Subject: Re: Netlink, route monitoring, RTM_DELROUTE not issued for ppp peer address. Bug or feature?

From: Stephen Hemminger <[email-masked]>
Date: Mon, 16 Apr 2012 08:19:54 -0700

On Mon, 16 Apr 2012 13:37:14 +0300
Denys Fedoryshchenko <[email-masked]> wrote:

> After digging the code, i came to conclusion:
> fib_del_ifaddr, will check if deleted address are exist as prefsrc or 
> interface are shut down, they will do fi->fib_flags |= RTNH_F_DEAD;
> Then fib_flush -> fib_table_flush -> trie_flush_leaf -> trie_flush_list 
> will delete such routes.
> But trie_flush_list won't notify over netlink that route are deleted.
> 
> So the only solution is to fetch first, then keep full routing table in 
> userspace also, and keep tracking if local addresses deleted, and do the 
> same in userspace and check for prefsrc...
> 
> Maybe it should be fixed? E.g. netlink message sent when any route are 
> deleted, even over the flush
> 
> On 2012-04-13 16:59, Stian Skjelstad wrote:
> > I've seen the same issue, and got no response so far to that very
> > same question. Have you tested this on older kernels? I have worked
> > around this issue by testing my local copy of routing entries that 
> > use
> > 'via'. If they are not routable when after the RTM_DELROUTE event, I
> > autoremove them from my local copy.
> >
> > Stian Skjelstad
> >

Looking at Quagga, it knows that deleting interface address
removes connected routes and silently cleans up.

You have to be really careful here making any changes to not break
applications that expect existing behavior.