* ip-nexthop does not support flush by id
@ 2021-03-30 12:44 xuchunmei
2021-03-30 13:05 ` Ido Schimmel
0 siblings, 1 reply; 3+ messages in thread
From: xuchunmei @ 2021-03-30 12:44 UTC (permalink / raw
To: netdev
Hi,
I use iproute-5.10 with kernel-5.10.6, I found that ip-nexthop does not support flush by id, is it by design?
Reproduce steps:
# ip netns add me
# ip -netns me addr add 127.0.0.1/8 dev lo
# ip -netns me link set lo up
# ip -netns me nexthop add id 105 blackhole proto 99
# ip -netns me nexthop flush id 105
id 105 blackhole proto 99
# ip -netns me nexthop ls
id 105 blackhole proto 99
while use flush without any args, flush will success.
# ip -netns me nexthop flush
Flushed 1 nexthops
I find the function ipnh_list_flush implemented in ipnexthop.c:
else if (!strcmp(*argv, "id")) {
__u32 id;
NEXT_ARG();
if (get_unsigned(&id, *argv, 0))
invarg("invalid id value", *argv);
return ipnh_get_id(id);
}
When args is “id”, just return the related info of “id”, so I want to known is it by design ?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ip-nexthop does not support flush by id
2021-03-30 12:44 ip-nexthop does not support flush by id xuchunmei
@ 2021-03-30 13:05 ` Ido Schimmel
2021-03-30 15:04 ` David Ahern
0 siblings, 1 reply; 3+ messages in thread
From: Ido Schimmel @ 2021-03-30 13:05 UTC (permalink / raw
To: xuchunmei; +Cc: netdev, dsahern
On Tue, Mar 30, 2021 at 08:44:30PM +0800, xuchunmei wrote:
> Hi,
>
> I use iproute-5.10 with kernel-5.10.6, I found that ip-nexthop does not support flush by id, is it by design?
>
> Reproduce steps:
> # ip netns add me
> # ip -netns me addr add 127.0.0.1/8 dev lo
> # ip -netns me link set lo up
> # ip -netns me nexthop add id 105 blackhole proto 99
> # ip -netns me nexthop flush id 105
> id 105 blackhole proto 99
> # ip -netns me nexthop ls
> id 105 blackhole proto 99
>
> while use flush without any args, flush will success.
> # ip -netns me nexthop flush
> Flushed 1 nexthops
>
> I find the function ipnh_list_flush implemented in ipnexthop.c:
>
> else if (!strcmp(*argv, "id")) {
> __u32 id;
>
> NEXT_ARG();
> if (get_unsigned(&id, *argv, 0))
> invarg("invalid id value", *argv);
> return ipnh_get_id(id);
> }
>
> When args is “id”, just return the related info of “id”, so I want to known is it by design ?
Looks like a bug. 'flush' does not really make sense with 'id', but
'list id' works, so I think 'flush id' should also work.
Can you send a patch?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ip-nexthop does not support flush by id
2021-03-30 13:05 ` Ido Schimmel
@ 2021-03-30 15:04 ` David Ahern
0 siblings, 0 replies; 3+ messages in thread
From: David Ahern @ 2021-03-30 15:04 UTC (permalink / raw
To: Ido Schimmel, xuchunmei; +Cc: netdev
On 3/30/21 7:05 AM, Ido Schimmel wrote:
> Looks like a bug. 'flush' does not really make sense with 'id', but
> 'list id' works, so I think 'flush id' should also work.
right, neither were intended. If you know the id, you don't need the
generic list / flush option.
>
> Can you send a patch?
Agreed. At this point consistency is best.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-30 15:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-30 12:44 ip-nexthop does not support flush by id xuchunmei
2021-03-30 13:05 ` Ido Schimmel
2021-03-30 15:04 ` David Ahern
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.