From: <ehakim@nvidia.com>
To: <dsahern@kernel.org>, <netdev@vger.kernel.org>
Cc: <raeds@nvidia.com>, <tariqt@nvidia.com>, <sd@queasysnail.net>,
Emeel Hakim <ehakim@nvidia.com>
Subject: [PATCH main v2 1/3] macsec: add option to pass flag list to ip link add command
Date: Tue, 2 Aug 2022 09:18:11 +0300 [thread overview]
Message-ID: <20220802061813.24082-1-ehakim@nvidia.com> (raw)
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
next reply other threads:[~2022-08-02 6:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-02 6:18 ehakim [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220802061813.24082-1-ehakim@nvidia.com \
--to=ehakim@nvidia.com \
--cc=dsahern@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=raeds@nvidia.com \
--cc=sd@queasysnail.net \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).