kernel - Deal with inconsistencies between IP aliases and primary IPs
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 17 Jun 2011 06:03:27 +0000 (23:03 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 17 Jun 2011 06:03:27 +0000 (23:03 -0700)
commit30220c1741421db53104720a307357a1f7ff0f00
treee57c3aa53e9577ca5762ae753e4247b2b8b77390
parentf2dba7003b2add226b3999a41a99fd278cc5a26f
kernel - Deal with inconsistencies between IP aliases and primary IPs

These changes allow normal IP aliases with proper network masks to be
ifconfig'd instead of forcing people to use non-obvious /32's for their
IP aliases.  It may also be possible to use overlapping subnets with
this change but this is not tested.

* When ifconfig'ing an interface with aliases using the correct netmask
  instead of a /32, the network route will point to only one of the
  addresses.

  Trying to connect to a local IP alias wound up failing due to the
  mismatch between the network route's interface address (ifaddr)
  entry and the actual ifaddr being requested.  The target was not
  being considered a local address when it was.

* Fix in_addroute()'s detection of local host routes when cloning a
  route to check against all aliases instead of the one the gateway
  network route happens to be pointed to, and adjust the route entry
  appropriately.

  This fix also properly sets RTF_LOCAL for all such cloned routes
  whereas before RTF_LOCAL was only being set for the interface's
  primary IP.

* Minor syntax adjustments and documentation changes.

Reported-by: Peter Avalos <peter@theshell.com>
sys/netinet/if_ether.c
sys/netinet/in_rmx.c