Re: SIOCGIFADDR broken on 9.0-RC1?

From: GR <freebsd_at_gomor.org>
Date: Tue, 15 Nov 2011 23:35:37 +0100 (CET)
>From "Kristof Provost" <kristof_at_sigsegv.be>:
[..]
> The 'ia' pointer is later used to return the IP address.
> 
> In other words: it returns the first address on the interface
> of type IF_INET (which isn't assigned to a jail).
> 
> I think the order of the addresses is not fixed, or rather it depends
> on
> the order in which you assign addresses. In the handling of
> SIOCSIFADDR
> new addresses are just appended:
> 
> TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link);
> 
> I don't believe this has changed since 8.0. Is it possible something
> changed in the network initialisation, leading to the addresses being
> assigned in a different order?
> 
> Eagerly awaiting to be told I'm wrong,
> Kristof

Thanks Kristof. It appears you are right, the order of assignement is important.
I configured my interface using DHCP, and added aliases (all in /etc/rc.conf).
But on the 8.2-RELEASE, I used static configuration.

So, I switched to static assignement and it changes the behaviour (and "fixes" the "bug").
My guess is that during the time waiting for the DHCP offer, all aliases are already configured on the network interface, and the IP address given by DHCP is added at the end of the tail.

Is that a wanted behaviour? I find it dangerous (i.e. not exactly what a user is expecting).

Note: my aliases are attributed to jails.

Regards,

-- 
  ^  ___  ___             http://www.GomoR.org/          <-+
  | / __ |__/            Senior Security Engineer          |
  | \__/ |  \     ---[ zsh$ alias psed='perl -pe ' ]---    |
  +-->  Net::Frame <=> http://search.cpan.org/~gomor/  <---+
Received on Tue Nov 15 2011 - 21:46:48 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:20 UTC