Re: [PATCH] ioctl SIOCGIFNETMASK: ip alias bug 2.4.9 and 2.2.19

Matthias Andree (matthias.andree@gmx.de)
Mon, 10 Sep 2001 17:18:36 +0200


On Mon, 10 Sep 2001, David Weinehall wrote:

> "[snip] old and the new stuff, please name precisely the objections
> against portability and compatibility with FreeBSD 4.x aliasing."
> ^^^^^^^^^^^^^^^^^^^^
> This is what lead me to my conclusion. Care to clarify? If you simply
> meant SIOCGIFNETMASK, why not write that instead instead of involving
> FreeBSD 4.x?!

Dave, I came up with that because the same piece of code I looked at
choked on Linux 2.4, but not on FreeBSD 4.4-RC. I tracked this down,
fixed it and sent the patch. This can all be read from my posts to the
thread.

The issue here is:

1/ Linux returns ALL addresses to SIOCGIFCONF, no matter if these are visible
to SIOCGIFNETMASK or not. Invisible addresses are the second and
subsequent addresses added with ip addr add without using a distinct
label. This means the innocent application that just feeds the
SIOCGIFCONF results into SIOCGIFNETMASK will get the netmask for the
first address. Of course, you can "filter" the addresses through
SIOCGIFADDR and drop the duplicates after that, but why not fix it for
the better?

2/ FreeBSD also uses IP aliases without "logical" interface names such
as eth0:0

3/ FreeBSD returns the netmask for the requested address, Linux returns
the netmask for the first address of the interface.

4/ I sent a patch to enhance the compatibility with "nameless" IP
aliases.

If you talk about NOT fixing the SIOCG* ioctl API, then fix SIOCGIFCONF
to just return one address per interface regardless how many IPs it
listens to.

But this has all been through. Reread my mails, please.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/