[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZLZqMw/wOjwtQg+K@shredder>
Date: Tue, 18 Jul 2023 13:32:19 +0300
From: Ido Schimmel <idosch@...sch.org>
To: Hangbin Liu <liuhangbin@...il.com>
Cc: 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 Tue, Jul 18, 2023 at 01:19:13PM +0300, Ido Schimmel wrote:
> On Tue, Jul 18, 2023 at 04:00:44PM +0800, Hangbin Liu wrote:
> > After deleting an interface address in fib_del_ifaddr(), the function
> > scans the fib_info list for stray entries and calls fib_flush.
> > Then the stray entries will be deleted silently and no RTM_DELROUTE
> > notification will be sent.
>
> [...]
>
> > diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
> > index 74d403dbd2b4..1a88013f6a5b 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,8 @@ 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);
> > + rtmsg_fib(RTM_DELROUTE, htonl(n->key), fa,
> > + KEYLENGTH - fa->fa_slen, tb->tb_id, &info, 0);
>
> fib_table_flush() isn't only called when an address is deleted, but also
> when an interface is deleted or put down. The lack of notification in
> these cases is deliberate. Commit 7c6bb7d2faaf ("net/ipv6: Add knob to
> skip DELROUTE message on device down") introduced a sysctl to make IPv6
> behave like IPv4 in this regard, but this patch breaks it.
>
> 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
> also seems to be consistent with IPv6 given that rt6_remove_prefsrc()
> calls fib6_clean_all() and not fib6_clean_all_skip_notify().
Actually, looking closer at IPv6, it seems that routes are not deleted,
but instead the preferred source address is simply removed from them
(w/o a notification).
Anyway, my point is that a RTM_DELROUTE notification should not be
emitted for routes that are deleted because of interface down /
deletion.
>
> > hlist_del_rcu(&fa->fa_list);
> > fib_release_info(fa->fa_info);
> > alias_free_mem_rcu(fa);
> > --
> > 2.38.1
> >
> >
Powered by blists - more mailing lists