All of lore.kernel.org
 help / color / mirror / Atom feed
* BUG - routes not correctly deleted when address is deleted
@ 2010-12-01  0:55 Stephen Hemminger
  2010-12-01 10:08 ` Julian Anastasov
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2010-12-01  0:55 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

If multiple addresses are assigned to an interface, and
a route is created that uses that address.  The route is not
deleted when the address is deleted.  Linux does cleanup properly
when the last address is deleted; it seems the FIB lacks the callback
to cleanup routes referencing an address.

Simple example:

# modprobe dummy
# ip li set dev dummy0 up
# ip addr add 192.168.74.160/24 dev dummy0
# ip addr add 192.168.18.11/24 dev dummy0
# ip ro add 74.11.49.0/24 via 192.168.74.160

# ip addr del 192.168.74.160/24 dev dummy0
# ip ro show dev dummy0
74.11.49.0/24 via 192.168.74.160 
192.168.18.0/24  proto kernel  scope link  src 192.168.18.11 

Before I go off and either brute force it (add another call back
into fib_hash and fib_trie), is there a better way?


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

* Re: BUG - routes not correctly deleted when address is deleted
  2010-12-01  0:55 BUG - routes not correctly deleted when address is deleted Stephen Hemminger
@ 2010-12-01 10:08 ` Julian Anastasov
  2010-12-01 20:34   ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: Julian Anastasov @ 2010-12-01 10:08 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, netdev


 	Hello,

On Tue, 30 Nov 2010, Stephen Hemminger wrote:

> If multiple addresses are assigned to an interface, and
> a route is created that uses that address.  The route is not
> deleted when the address is deleted.  Linux does cleanup properly
> when the last address is deleted; it seems the FIB lacks the callback
> to cleanup routes referencing an address.
>
> Simple example:
>
> # modprobe dummy
> # ip li set dev dummy0 up
> # ip addr add 192.168.74.160/24 dev dummy0
> # ip addr add 192.168.18.11/24 dev dummy0
> # ip ro add 74.11.49.0/24 via 192.168.74.160

 	Such routes look as old way to create direct
routes over some device, used by "route" tool.
Device is inherited from the local IP used as gateway.
Such local gateways IPs are not used, see rt_set_nexthop()
where nh_scope is checked. FIB removes routes only when
the deleted IP is a prefsrc for this route, so may be
it is a good idea to use prefsrc.

> # ip addr del 192.168.74.160/24 dev dummy0
> # ip ro show dev dummy0
> 74.11.49.0/24 via 192.168.74.160
> 192.168.18.0/24  proto kernel  scope link  src 192.168.18.11
>
> Before I go off and either brute force it (add another call back
> into fib_hash and fib_trie), is there a better way?

 	Adding prefsrc is recommended. For me, it is not fatal
such routes to stay because nh_gw is not used. It is a
way to say at configuration time:

ip ro add 74.11.49.0/24 dev eth0

 	If you need such route to depend on the lifetime
of some local IP then you need to specify prefsrc.

 	If you go ahead with changes may be you should call 
fib_sync_down_dev from fib_del_ifaddr by providing the IP
as new argument. While fib_sync_down_addr is called when this
IP is removed from the last device where it was configured,
now for nh_gw fib_sync_down_dev should be called for every
fib_del_ifaddr call. For me, it is a complication, not sure
what others think.

Regards

--
Julian Anastasov <ja@ssi.bg>

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

* Re: BUG - routes not correctly deleted when address is deleted
  2010-12-01 10:08 ` Julian Anastasov
@ 2010-12-01 20:34   ` Stephen Hemminger
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2010-12-01 20:34 UTC (permalink / raw)
  To: Julian Anastasov; +Cc: David Miller, netdev

On Wed, 1 Dec 2010 12:08:42 +0200 (EET)
Julian Anastasov <ja@ssi.bg> wrote:

> 
>  	Hello,
> 
> On Tue, 30 Nov 2010, Stephen Hemminger wrote:
> 
> > If multiple addresses are assigned to an interface, and
> > a route is created that uses that address.  The route is not
> > deleted when the address is deleted.  Linux does cleanup properly
> > when the last address is deleted; it seems the FIB lacks the callback
> > to cleanup routes referencing an address.
> >
> > Simple example:
> >
> > # modprobe dummy
> > # ip li set dev dummy0 up
> > # ip addr add 192.168.74.160/24 dev dummy0
> > # ip addr add 192.168.18.11/24 dev dummy0
> > # ip ro add 74.11.49.0/24 via 192.168.74.160
> 
>  	Such routes look as old way to create direct
> routes over some device, used by "route" tool.
> Device is inherited from the local IP used as gateway.
> Such local gateways IPs are not used, see rt_set_nexthop()
> where nh_scope is checked. FIB removes routes only when
> the deleted IP is a prefsrc for this route, so may be
> it is a good idea to use prefsrc.

These are the kind of routes routing daemons like Quagga
create.

> > # ip addr del 192.168.74.160/24 dev dummy0
> > # ip ro show dev dummy0
> > 74.11.49.0/24 via 192.168.74.160
> > 192.168.18.0/24  proto kernel  scope link  src 192.168.18.11
> >
> > Before I go off and either brute force it (add another call back
> > into fib_hash and fib_trie), is there a better way?
> 
>  	Adding prefsrc is recommended. For me, it is not fatal
> such routes to stay because nh_gw is not used. It is a
> way to say at configuration time:

This isn't done by routing daemons.


> ip ro add 74.11.49.0/24 dev eth0
> 
>  	If you need such route to depend on the lifetime
> of some local IP then you need to specify prefsrc.
> 
>  	If you go ahead with changes may be you should call 
> fib_sync_down_dev from fib_del_ifaddr by providing the IP
> as new argument. While fib_sync_down_addr is called when this
> IP is removed from the last device where it was configured,
> now for nh_gw fib_sync_down_dev should be called for every
> fib_del_ifaddr call. For me, it is a complication, not sure
> what others think.

Probably just going to make the existing fib_sync_down_dev
take an optional address.

-- 

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

end of thread, other threads:[~2010-12-01 20:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-01  0:55 BUG - routes not correctly deleted when address is deleted Stephen Hemminger
2010-12-01 10:08 ` Julian Anastasov
2010-12-01 20:34   ` Stephen Hemminger

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.