request: have ifconfig purge routes that are being added via ifconfig

Rudy crapsh at monkeybrains.net
Wed May 18 08:00:09 UTC 2011


Summary:
  * ifconfig FAILs if route exists when adding an alias
  * ifconfig SILENTLY adds the IP even when route exists when creating
virtual interaces
  * DESIRED functionality: purge routes to make way for IPs with ifconfig
  * Less desired: stop the SILENT adding of IPs as that makes for a
bogus network

Background:
OSPF adds route, eg 1.2.3.0/24, into the kernel

If I try to add 1.2.3.4/24 to my router, it fails as that route already
exists.
Workaround: route del 1.2.3.0/14 && ifconfig igb0 alias 1.2.3.4/24

However, if I can create a vlan with an IP that conflicts with an
existing route.
Add this to rc.conf:

ifconfig_vlan2="1.2.3.4/24 vlan 2 vlandev igb0

then
ifconfig vlan2 create

Voila: you get a static route to 1.2.3.0/24 to your other router AND the
local IP.  Makes for a very messed up routing siltation.
Workaround: route del 1.2.3.0/14 && ifconfig vlan2 create

Proposal:  Change the way ifconfig works.
[1] Optimally, automatically do the 'route del' first
[2] Otherwise, bring these two methods of adding IPs into sync and have
the 'ifconfig vlan2 create' NOT add the IP when an existing route exists.


Rudy
 





More information about the freebsd-net mailing list