[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZLngmOaz24y5yLz8@Laptop-X1>
Date: Fri, 21 Jul 2023 09:34:16 +0800
From: Hangbin Liu <liuhangbin@...il.com>
To: Ido Schimmel <idosch@...sch.org>
Cc: Stephen Hemminger <stephen@...workplumber.org>, netdev@...r.kernel.org,
"David S . Miller" <davem@...emloft.net>,
David Ahern <dsahern@...nel.org>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Thomas Haller <thaller@...hat.com>
Subject: Re: [PATCH net-next] ipv4/fib: send RTM_DELROUTE notify when flush
fib
On Thu, Jul 20, 2023 at 05:29:58PM +0300, Ido Schimmel wrote:
> > > > IMO, the number of routes being flushed because a preferred source
> > > > address is deleted is significantly lower compared to interface down /
> > > > deletion, so generating notifications in this case is probably OK. It
> >
> > How about ignore route deletion for link down? e.g.
> >
> > diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
> > index 74d403dbd2b4..11c0f325e887 100644
> > --- a/net/ipv4/fib_trie.c
> > +++ b/net/ipv4/fib_trie.c
> > @@ -2026,6 +2026,7 @@ void fib_table_flush_external(struct fib_table *tb)
> > int fib_table_flush(struct net *net, struct fib_table *tb, bool flush_all)
> > {
> > struct trie *t = (struct trie *)tb->tb_data;
> > + struct nl_info info = { .nl_net = net };
> > struct key_vector *pn = t->kv;
> > unsigned long cindex = 1;
> > struct hlist_node *tmp;
> > @@ -2088,6 +2089,11 @@ int fib_table_flush(struct net *net, struct fib_table *tb, bool flush_all)
> >
> > fib_notify_alias_delete(net, n->key, &n->leaf, fa,
> > NULL);
> > + if (!(fi->fib_flags & RTNH_F_LINKDOWN)) {
> > + rtmsg_fib(RTM_DELROUTE, htonl(n->key), fa,
> > + KEYLENGTH - fa->fa_slen, tb->tb_id, &info, 0);
> > + }
>
> Will you get a notification in this case for 198.51.100.0/24?
No. Do you think it is expected with this patch or not?
>
> # ip link add name dummy1 up type dummy
> # ip link add name dummy2 up type dummy
> # ip address add 192.0.2.1/24 dev dummy1
> # ip route add 198.51.100.0/24 dev dummy2 src 192.0.2.1
> # ip link set dev dummy2 carrier off
> # ip -4 r s
> 192.0.2.0/24 dev dummy1 proto kernel scope link src 192.0.2.1
> 198.51.100.0/24 dev dummy2 scope link src 192.0.2.1 linkdown
> # ip address del 192.0.2.1/24 dev dummy1
> # ip -4 r s
+ ip link set dev dummy2 carrier off
+ sleep 1
+ ip -4 r s
default via 10.73.131.254 dev eth0 proto dhcp src 10.73.131.181 metric 100
10.73.130.0/23 dev eth0 proto kernel scope link src 10.73.131.181 metric 100
192.0.2.0/24 dev dummy1 proto kernel scope link src 192.0.2.1
198.51.100.0/24 dev dummy2 scope link src 192.0.2.1 linkdown
+ sleep 1
+ ip address del 192.0.2.1/24 dev dummy1
Deleted 192.0.2.0/24 dev dummy1 proto kernel scope link src 192.0.2.1
Deleted broadcast 192.0.2.255 dev dummy1 table local proto kernel scope link src 192.0.2.1
Deleted local 192.0.2.1 dev dummy1 table local proto kernel scope host src 192.0.2.1
+ sleep 1
+ ip -4 r s
default via 10.73.131.254 dev eth0 proto dhcp src 10.73.131.181 metric 100
10.73.130.0/23 dev eth0 proto kernel scope link src 10.73.131.181 metric 100
Thanks
Hangbin
Powered by blists - more mailing lists