[<prev] [next>] [day] [month] [year] [list]
Message-ID: <3510490c98d5d9245c172648806af31a2be97aad.1647247604.git.antony.antony@secunet.com>
Date: Mon, 14 Mar 2022 09:52:26 +0100
From: Antony Antony <antony.antony@...unet.com>
To: Stephen Hemminger <stephen@...workplumber.org>
CC: David Ahern <dsahern@...il.com>, Matt Ellison <matt@...oyo.io>,
<netdev@...r.kernel.org>, Eyal Birger <eyal.birger@...il.com>,
"Steffen Klassert" <steffen.klassert@...unet.com>,
Antony Antony <antony.antony@...unet.com>
Subject: [PATCH iproute2-next] link_xfrm: if_id must be non zero
Since kernel upstream commit
8dce43919566 ("xfrm: interface with if_id 0 should return error")
if_id must be non zero.
Fix the usage and return error for if_id 0.
Signed-off-by: Antony Antony <antony.antony@...unet.com>
---
ip/link_xfrm.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/ip/link_xfrm.c b/ip/link_xfrm.c
index 7dbfb13f..f6c961e6 100644
--- a/ip/link_xfrm.c
+++ b/ip/link_xfrm.c
@@ -19,7 +19,7 @@ static void xfrm_print_help(struct link_util *lu, int argc, char **argv,
fprintf(f,
"Usage: ... %-4s dev [ PHYS_DEV ] [ if_id IF-ID ]\n"
"\n"
- "Where: IF-ID := { 0x0..0xffffffff }\n",
+ "Where: IF-ID := { 0x1..0xffffffff }\n",
lu->id);
}
@@ -39,6 +39,8 @@ static int xfrm_parse_opt(struct link_util *lu, int argc, char **argv,
NEXT_ARG();
if (get_u32(&if_id, *argv, 0))
invarg("if_id value is invalid", *argv);
+ else if (!if_id)
+ invarg("if_id value is invalid", *argv);
else
addattr32(n, 1024, IFLA_XFRM_IF_ID, if_id);
} else {
@@ -48,6 +50,9 @@ static int xfrm_parse_opt(struct link_util *lu, int argc, char **argv,
argc--; argv++;
}
+ if (!if_id)
+ missarg("IF_ID");
+
if (link)
addattr32(n, 1024, IFLA_XFRM_LINK, link);
--
2.30.2
Powered by blists - more mailing lists