* [PATCH] ip: xfrm if_id -ve value is error
@ 2019-12-19 14:18 Antony Antony
2019-12-25 20:38 ` Stephen Hemminger
0 siblings, 1 reply; 3+ messages in thread
From: Antony Antony @ 2019-12-19 14:18 UTC (permalink / raw)
To: netdev; +Cc: Antony Antony, Matt Ellison, Nicolas Dichtel
if_id is u32, error on -ve values instead of setting to 0
after :
ip link add ipsec1 type xfrm dev lo if_id -10
Error: argument "-10" is wrong: if_id value is invalid
before : note xfrm if_id 0
ip link add ipsec1 type xfrm dev lo if_id -10
ip -d link show dev ipsec1
9: ipsec1@lo: <NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/none 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 68 maxmtu 1500
xfrm if_id 0 addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
Fixes: 286446c1e8c ("ip: support for xfrm interfaces")
Signed-off-by: Antony Antony <antony@phenome.org>
---
ip/link_xfrm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/ip/link_xfrm.c b/ip/link_xfrm.c
index a28f308d..7dbfb13f 100644
--- a/ip/link_xfrm.c
+++ b/ip/link_xfrm.c
@@ -37,7 +37,9 @@ static int xfrm_parse_opt(struct link_util *lu, int argc, char **argv,
exit(nodev(*argv));
} else if (!matches(*argv, "if_id")) {
NEXT_ARG();
- if (!get_u32(&if_id, *argv, 0))
+ if (get_u32(&if_id, *argv, 0))
+ invarg("if_id value is invalid", *argv);
+ else
addattr32(n, 1024, IFLA_XFRM_IF_ID, if_id);
} else {
xfrm_print_help(lu, argc, argv, stderr);
--
2.21.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] ip: xfrm if_id -ve value is error
2019-12-19 14:18 [PATCH] ip: xfrm if_id -ve value is error Antony Antony
@ 2019-12-25 20:38 ` Stephen Hemminger
0 siblings, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2019-12-25 20:38 UTC (permalink / raw)
To: Antony Antony; +Cc: netdev, Matt Ellison, Nicolas Dichtel
On Thu, 19 Dec 2019 15:18:03 +0100
Antony Antony <antony@phenome.org> wrote:
> if_id is u32, error on -ve values instead of setting to 0
>
> after :
> ip link add ipsec1 type xfrm dev lo if_id -10
> Error: argument "-10" is wrong: if_id value is invalid
>
> before : note xfrm if_id 0
> ip link add ipsec1 type xfrm dev lo if_id -10
> ip -d link show dev ipsec1
> 9: ipsec1@lo: <NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
> link/none 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 68 maxmtu 1500
> xfrm if_id 0 addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
>
> Fixes: 286446c1e8c ("ip: support for xfrm interfaces")
>
> Signed-off-by: Antony Antony <antony@phenome.org>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] ip: xfrm if_id -ve value is error
@ 2019-04-09 19:44 Antony Antony
0 siblings, 0 replies; 3+ messages in thread
From: Antony Antony @ 2019-04-09 19:44 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger, Matt Ellison, Antony Antony
if_id is u32, error on -ve values instead of setting to 0
after :
ip link add ipsec0 type xfrm dev enp0s5 if_id -10
Error: argument "-10" is wrong: if_id value is invalid
before :
ip link add ipsec0 type xfrm dev enp0s5 if_id -10
ip -d link show dev ipsec0
67: ipsec0@enp0s5: <NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/none 00:1c:42:55:d6:ab brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 68 maxmtu 1500
xfrm if_id 0 addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
Fixes: 286446c1e8c error on -ve if_id
Signed-off-by: Antony Antony <antony@phenome.org>
---
ip/link_xfrm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/ip/link_xfrm.c b/ip/link_xfrm.c
index 79a902fd..7f66bad6 100644
--- a/ip/link_xfrm.c
+++ b/ip/link_xfrm.c
@@ -34,7 +34,9 @@ static int xfrm_parse_opt(struct link_util *lu, int argc, char **argv,
exit(nodev(*argv));
} else if (!matches(*argv, "if_id")) {
NEXT_ARG();
- if (!get_u32(&if_id, *argv, 0))
+ if (get_u32(&if_id, *argv, 0))
+ invarg("if_id value is invalid", *argv);
+ else
addattr32(n, 1024, IFLA_XFRM_IF_ID, if_id);
} else {
xfrm_print_help(lu, argc, argv, stderr);
--
2.17.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-12-25 20:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-19 14:18 [PATCH] ip: xfrm if_id -ve value is error Antony Antony
2019-12-25 20:38 ` Stephen Hemminger
-- strict thread matches above, loose matches on Subject: below --
2019-04-09 19:44 Antony Antony
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).