lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Mon, 11 Jul 2022 16:38:51 +0300 From: <ehakim@...dia.com> To: <dsahern@...nel.org>, <netdev@...r.kernel.org> CC: <raeds@...dia.com>, <tariqt@...dia.com>, Emeel Hakim <ehakim@...dia.com> Subject: [PATCH v1 1/3] macsec: add option to pass flag list to ip link add command From: Emeel Hakim <ehakim@...dia.com> This patch introduces a new flag list option to ip link add command using type macsec, the patch prepares a framework for passing and parsing flag list for future features like macsec extended packet number (XPN) to use. Signed-off-by: Emeel Hakim <ehakim@...dia.com> --- ip/ipmacsec.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/ip/ipmacsec.c b/ip/ipmacsec.c index bf48e8b5..9aeaafcc 100644 --- a/ip/ipmacsec.c +++ b/ip/ipmacsec.c @@ -1256,9 +1256,28 @@ static void usage(FILE *f) " [ validate { strict | check | disabled } ]\n" " [ encodingsa { 0..3 } ]\n" " [ offload { mac | phy | off } ]\n" + " [ flag FLAG-LIST ]\n" + "FLAG-LIST := [ FLAG-LIST ] FLAG\n" + "FLAG :=\n" ); } +static int macsec_flag_parse(__u8 *flags, int *argcp, char ***argvp) +{ + int argc = *argcp; + char **argv = *argvp; + + while (1) { + /* parse flag list */ + break; + } + + *argcp = argc; + *argvp = argv; + + return 0; +} + static int macsec_parse_opt(struct link_util *lu, int argc, char **argv, struct nlmsghdr *n) { @@ -1271,6 +1290,7 @@ static int macsec_parse_opt(struct link_util *lu, int argc, char **argv, bool es = false, scb = false, send_sci = false; int replay_protect = -1; struct sci sci = { 0 }; + __u8 flags = 0; ret = get_sci_portaddr(&sci, &argc, &argv, true, true); if (ret < 0) { @@ -1388,6 +1408,9 @@ static int macsec_parse_opt(struct link_util *lu, int argc, char **argv, return ret; addattr8(n, MACSEC_BUFLEN, IFLA_MACSEC_OFFLOAD, offload); + } else if (strcmp(*argv, "flag") == 0) { + NEXT_ARG(); + macsec_flag_parse(&flags, &argc, &argv); } else { fprintf(stderr, "macsec: unknown command \"%s\"?\n", *argv); -- 2.26.3
Powered by blists - more mailing lists