Route flush on linkdown: physical vs virtual/stacked interfaces

From: Christian Benvenuti (benve) <hidden>
Date: 2012-04-17 17:43:19

When we assign an IP address to an interface, the kernel
configures a number of routes:
- /32 for the configured IP address
- /32 for the broadcast/s (two of them)
- /netmask for the network
The /32 generated routes go to the LOCAL table, and
the /netmask route goes to the MAIN table.
OK.

When you ifconfig down an interface, the kernel removes
the /netmask route from the MAIN table but keeps the /32
routes in the LOCAL table.
The same happens when there is a link down event on the same
interface.
And this is fine.

However, software/stacked devices (like vlan and bridges) behave
differently with regards to linkdown events:

- let's assume we assigned an IP address to a vlan interface
  # vconfig add eth0 100
  # ifconfig eth0.100 10.0.1.1 netmask 255.255.255.0

- when you ifconfig down the (physical) interface sitting
  below the vlan interface (eth0 in the above example), the
  kernel removes all the routes previously generated by
  the above vlan interface IP address configuration (ie, both
  the /32 routes and the /netmask route).

- However, when there is a linkdown event for the lower
  interface (again eth0 in the above example), the kernel
  does not remove any of the routes associated with the vlan
  interface. 

The same happens for example with a bridge if I enslave only
one NIC and I ifconfig down the latter.

The result is that the /netmask route derived from the vlan
interface ip config remains in the routing table and becomes
a black hole.
Applications will (hopelessly) use it instead of, for
example, receiving a "network is unreachable" kind of error
message or using an alternate route.

Since latest net-next still behaves this way, is this behavior
wanted or is this a bug?

/Chris
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help