/ 2006-08-15 18:28:03 +0100
\ David Lee:
> > So, with IPaddr, if you do ifconfig afterwards, the interface for the IP
> > address shows up.  With IPaddr2, ifconfig will claim that no such
> > address is managed.
> 
> Many thanks, Alan.  Appreciated.
> 
> Was this difference (visibility of resulting IP/interfaces) a deliberate
> design choice?  Or was it a side-effect?
> 
> My instant, gut reaction (admittedly never having used the "...2" variant)
> is that this hiding of the IP/interface from the system's "ifconfig"
> command feels unclean.

some thoughts...

it is not exactly "hidden", it is just "unlabeled" by default,
resulting in the label being the same as the base interface name.

side-effect is that users which use ioctl(SIOCGIFCONF) to get the
interface list _might_ get confused about the duplicate entry for eth0,
and skip it.

ifconfig is one such user, and does skip it.

to illustrate:
  # ip -o -f inet a s
        1: lo    inet 127.0.0.1/8 scope host lo
        2: eth0    inet 10.9.9.55/24 brd 10.9.9.255 scope global eth0
  # ip a add 10.11.12.13 dev eth0
  # ip -o -f inet a s
        1: lo    inet 127.0.0.1/8 scope host lo
        2: eth0    inet 10.9.9.55/24 brd 10.9.9.255 scope global eth0
        2: eth0    inet 10.11.12.13/32 scope global eth0
  # strace -e ioctl -o /dev/stdout ifconfig | head
        ioctl(4, SIOCGIFCONF, {96, {{"lo", {AF_INET, inet_addr("127.0.0.1")}},
                {"eth0", {AF_INET, inet_addr("10.9.9.55")}},
                {"eth0", {AF_INET, inet_addr("10.11.12.13")}}}}) = 0

so, it does see it there. but it had already seen something named eth0,
so it skips the second entry. that could even be "fixed" in ifconfig...

if you add the alias ip with ifconfig, it labels it like "eth:x"
(x smal decimal number).
using ip, you could do the same, or label it "phony".
for compatibility with linux 2.0 net aliases,
the label has to start with the interface name, though.

  # ip a add 10.11.12.14 dev eth0 label eth0:ha_web
  # ip -o -f inet a s
        1: lo    inet 127.0.0.1/8 scope host lo
        2: eth0    inet 10.9.9.55/24 brd 10.9.9.255 scope global eth0
        2: eth0    inet 10.11.12.13/32 scope global eth0
        2: eth0    inet 10.11.12.14/32 scope global eth0:ha_web
  # strace -e ioctl -o /dev/stdout ifconfig | head
        ioctl(4, SIOCGIFCONF, {128, {{"lo", {AF_INET, inet_addr("127.0.0.1")}},
                {"eth0",        {AF_INET, inet_addr("10.9.9.55")}},
                {"eth0",        {AF_INET, inet_addr("10.11.12.13")}},
                {"eth0:ha_web", {AF_INET, inet_addr("10.11.12.14")}}}}) = 0

now this second alias has a different label than the base interface,
so ifconfig does not get confused, and at least displays this second
alias.

compatibility note: there are "old" users that do get confused about
the new-style "unlabeled" aliases. there are other users that do get
confused when the network aliases are labeled the "oldfashioned" way.
both users should be fixed.
if some cannot be fixed (closed source),
define an explicit label the style you need.

-- 
: Lars Ellenberg                                  Tel +43-1-8178292-55 :
: LINBIT Information Technologies GmbH            Fax +43-1-8178292-82 :
: Schoenbrunner Str. 244, A-1120 Vienna/Europe   http://www.linbit.com :
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to