Subject: alias addresses vs routing
To: None <tech-net@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-net
Date: 02/09/2006 16:25:43
I'm seeing something peculiar-looking, and I'm wondering whether this
is the bug it looks like to me, or a misunderstanding in my
expectations somewhere, or what.

On NetBSD/i386 3.0:

# ifconfig ex0
ex0: flags=8a63<UP,BROADCAST,NOTRAILERS,RUNNING,ALLMULTI,SIMPLEX,MULTICAST> mtu 1500
        address: 00:10:4b:63:01:94
        media: Ethernet autoselect (100baseTX full-duplex)
        status: active
        inet6 fe80::210:4bff:fe63:194%ex0 prefixlen 64 scopeid 0x3
# ifconfig ex0 10.100.0.1/30
# ifconfig ex0 10.100.0.100/24 alias
# netstat -rn -f inet
Routing tables

Internet:
Destination        Gateway            Flags     Refs     Use    Mtu  Interface
10.10.10/23        link#1             UC          2        0      -  fxp0
10.10.10.10        00:02:b3:1a:9e:91  UHLc        0        4      -  fxp0
10.10.10.20        08:00:20:1f:7c:95  UHLc        2     2094      -  fxp0
10.100/30          link#3             UC          0        0      -  ex0
127/8              127.0.0.1          UGRS        0        0  33192  lo0
127.0.0.1          127.0.0.1          UH          1        0  33192  lo0
# 

Note in particular the lack of a route to 10.100/24 corresponding to
the "alias" address.  But if the /30 is a different one (but still
within the /24), it all works as expected:

# ifconfig ex0 10.100.0.5/30
# ifconfig ex0 10.100.0.100/24 alias
# netstat -rn -f inet
Routing tables

Internet:
Destination        Gateway            Flags     Refs     Use    Mtu  Interface
10.10.10/23        link#1             UC          2        0      -  fxp0
10.10.10.10        00:02:b3:1a:9e:91  UHLc        0        4      -  fxp0
10.10.10.20        08:00:20:1f:7c:95  UHLc        2     2235      -  fxp0
10.100/24          link#3             UC          0        0      -  ex0
10.100.0.4/30      link#3             UC          0        0      -  ex0
127/8              127.0.0.1          UGRS        0        0  33192  lo0
127.0.0.1          127.0.0.1          UH          1        0  33192  lo0
# 

This looks like a bug to me; I see no reason why 10.100.0.0/30 and
10.100.0.0/24 deserve to be any more incompatible than 10.100.0.4/30
and 10.100.0.0/24.  (I can in a sense understand how such an
incompatibility could arise - by tracking route destinations without
correctly taking netmasks into account - but, as I say, that strikes me
as a bug.)

Or is there something I'm missing, and this is really a feature?

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B