All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH main v2 1/3] macsec: add option to pass flag list to ip link add command
@ 2022-08-02  6:18 ehakim
  2022-08-02  6:18 ` [PATCH main v2 2/3] macsec: add Extended Packet Number support ehakim
  2022-08-02  6:18 ` [PATCH main v2 3/3] macsec: add user manual description for extended packet number feature ehakim
  0 siblings, 2 replies; 7+ messages in thread
From: ehakim @ 2022-08-02  6:18 UTC (permalink / raw)
  To: dsahern, netdev; +Cc: raeds, tariqt, sd, Emeel Hakim

From: Emeel Hakim <ehakim@nvidia.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@nvidia.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.21.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-08-07  8:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-02  6:18 [PATCH main v2 1/3] macsec: add option to pass flag list to ip link add command ehakim
2022-08-02  6:18 ` [PATCH main v2 2/3] macsec: add Extended Packet Number support ehakim
2022-08-04 16:48   ` Sabrina Dubroca
2022-08-04 18:36     ` David Ahern
2022-08-07  7:01       ` Emeel Hakim
2022-08-07  8:13         ` Tariq Toukan
2022-08-02  6:18 ` [PATCH main v2 3/3] macsec: add user manual description for extended packet number feature ehakim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.