Re: [PATCH net-next] ipv4/fib: send RTM_DELROUTE notify when flush fib

David Ahern
2023-07-18T14:45:22Z

On 7/18/23 4:32 AM, Ido Schimmel wrote:
>>> @@ -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.
>

exactly.