On Mon, 10 Sep 2001, kuznet@xxxxxxxxxxxxx wrote:
> (BTW Matthias, while applying it to my tree, I noticed that
> it does not check for SIOGGIFNETMASK. It would be better to do this only
> when it is meaningful: I see only SIOGGIFNETMASK and SIOGGIFBROADCAST).
Thanks for reviewing it again.
However, I think it should not be complicated. It's clear, simple and
can easily be understood.
1/ It's not worth it.
a/ If someone configures two IP addresses for a P2P-interface,
something is wrong in a different part of the kernel, so
SIOCGIFDSTADDR need not be exempt.
b/ Treating SIOCGIFADDR the same way as SIOCGIFNETMASK has the
advantage that kernels with 4.3BSD ioctl interface (Linux up to 2.2.19
and 2.4.9) will return the first address of the interface rather than
the alias address passed in. This way, an application can check if the
kernel's ioctl interface is really IP alias aware, by just matching
the ifr it passed in against the one it got back after SIOCGIFADDR.
I have actually sent a patch to Wietse Venema which lets Postfix warn
about alias interface addresses that it cannot obtain the netmasks for
and just skip them, so it does not treat something it does not know
how to handle.
2/ The search-for-ifa code is unconditionally called upon entry to that
function. If it depends on the ioctl, it will confuse all people that
expect all SIOCGIF* ioctls to have the same search properties and
hinder debugging of applications.
Let's keep this as simple as possible. Performance is not an issue,
ioctl is not read, you don't call it from tight inner loops. Let's not
make it more error prone than it needs to be.
Outlook (Express) users: press Ctrl+F3 for the full source code of this post.