All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] ipv4/fib: send RTM_DELROUTE notify when flush fib
@ 2023-07-18  8:00 Hangbin Liu
  2023-07-18 10:19 ` Ido Schimmel
  2023-07-25 14:13 ` kernel test robot
  0 siblings, 2 replies; 45+ messages in thread
From: Hangbin Liu @ 2023-07-18  8:00 UTC (permalink / raw)
  To: netdev
  Cc: David S . Miller, David Ahern, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Hangbin Liu, Thomas Haller

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.

This lack of notification can make routing daemons like NetworkManager,
miss the routing changes. e.g.

+ ip link add dummy1 type dummy
+ ip link add dummy2 type dummy
+ ip link set dummy1 up
+ ip link set dummy2 up
+ ip addr add 192.168.5.5/24 dev dummy1
+ ip route add 7.7.7.0/24 dev dummy2 src 192.168.5.5
+ ip -4 route
7.7.7.0/24 dev dummy2 scope link src 192.168.5.5
192.168.5.0/24 dev dummy1 proto kernel scope link src 192.168.5.5
+ ip monitor route
+ ip addr del 192.168.5.5/24 dev dummy1
Deleted 192.168.5.0/24 dev dummy1 proto kernel scope link src 192.168.5.5
Deleted broadcast 192.168.5.255 dev dummy1 table local proto kernel scope link src 192.168.5.5
Deleted local 192.168.5.5 dev dummy1 table local proto kernel scope host src 192.168.5.5

After update:
+ ip monitor route
+ ip addr del 192.168.5.5/24 dev dummy1
Deleted 192.168.5.0/24 dev dummy1 proto kernel scope link src 192.168.5.5
Deleted broadcast 192.168.5.255 dev dummy1 table local proto kernel scope link src 192.168.5.5
Deleted local 192.168.5.5 dev dummy1 table local proto kernel scope host src 192.168.5.5
Deleted 7.7.7.0/24 dev dummy2 scope link src 192.168.5.5

Suggested-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
 net/ipv4/fib_trie.c | 3 +++
 1 file changed, 3 insertions(+)

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);
 			hlist_del_rcu(&fa->fa_list);
 			fib_release_info(fa->fa_info);
 			alias_free_mem_rcu(fa);
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2023-09-15 17:00 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-18  8:00 [PATCH net-next] ipv4/fib: send RTM_DELROUTE notify when flush fib Hangbin Liu
2023-07-18 10:19 ` Ido Schimmel
2023-07-18 10:32   ` Ido Schimmel
2023-07-18 14:45     ` David Ahern
2023-07-18 15:58   ` Stephen Hemminger
2023-07-20  7:51     ` Hangbin Liu
2023-07-20 14:29       ` Ido Schimmel
2023-07-21  1:34         ` Hangbin Liu
2023-07-21  4:01           ` David Ahern
2023-07-21  5:46             ` Hangbin Liu
2023-07-23  7:38               ` Ido Schimmel
2023-07-24  8:56                 ` Hangbin Liu
2023-07-24 15:48                   ` Stephen Hemminger
2023-07-25  8:20                     ` Hangbin Liu
2023-07-25 16:36                       ` Stephen Hemminger
2023-07-28 13:01                         ` Nicolas Dichtel
2023-07-28 15:42                           ` David Ahern
2023-08-02  9:10                             ` Thomas Haller
2023-08-08  1:44                               ` David Ahern
2023-08-08 18:59                                 ` Benjamin Poirier
2023-09-11  9:50                                   ` Thomas Haller
2023-09-13  7:58                                     ` Nicolas Dichtel
2023-09-13  9:54                                       ` Hangbin Liu
2023-09-13 14:11                                         ` Nicolas Dichtel
2023-09-13 14:43                                           ` David Ahern
2023-09-13 14:53                                             ` Nicolas Dichtel
2023-09-14 15:43                                               ` Nicolas Dichtel
2023-09-15  3:07                                                 ` David Ahern
2023-09-15 15:54                                                   ` Nicolas Dichtel
2023-09-13 14:41                                       ` David Ahern
2023-09-15 16:59                                         ` Stephen Hemminger
2023-07-26 10:17                     ` [Questions] Some issues about IPv4/IPv6 nexthop route (was Re: [PATCH net-next] ipv4/fib: send RTM_DELROUTE notify when flush fib) Hangbin Liu
2023-07-26 15:57                       ` David Ahern
2023-07-27  4:19                         ` [Questions] Some issues about IPv4/IPv6 nexthop route Hangbin Liu
2023-07-27 15:35                           ` David Ahern
2023-07-27 14:45                       ` [Questions] Some issues about IPv4/IPv6 nexthop route (was Re: [PATCH net-next] ipv4/fib: send RTM_DELROUTE notify when flush fib) Ido Schimmel
2023-08-28  7:53                         ` [Questions] Some issues about IPv4/IPv6 nexthop route Hangbin Liu
2023-08-28 15:06                           ` David Ahern
2023-08-29  1:07                             ` Hangbin Liu
2023-08-29  1:42                               ` David Ahern
2023-08-02  9:06                 ` [PATCH net-next] ipv4/fib: send RTM_DELROUTE notify when flush fib Thomas Haller
2023-08-04  8:09                 ` Hangbin Liu
2023-08-09  7:06                   ` Ido Schimmel
2023-08-09 10:02                     ` Hangbin Liu
2023-07-25 14:13 ` kernel test robot

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.