aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntony Antony <antony.antony@secunet.com>2022-03-14 09:52:26 +0100
committerStephen Hemminger <stephen@networkplumber.org>2022-03-15 11:35:03 -0700
commit7846496bf721293fd72836a3677a109530858d0e (patch)
tree73e938b7e9e6bce8fba0494b7fcecaa6958642d7
parenteed4bb1ae6e5cd8e17f927551782c5b0aa9a7259 (diff)
downloadiproute2-7846496bf721293fd72836a3677a109530858d0e.tar.gz
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@secunet.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
-rw-r--r--ip/link_xfrm.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ip/link_xfrm.c b/ip/link_xfrm.c
index 7dbfb13f8..f6c961e6e 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);