netdev
[Top] [All Lists]

Re: ioctl SIOCGIFNETMASK: ip alias bug 2.4.9 and 2.2.19

To: jamal <hadi@xxxxxxxxxx>
Subject: Re: ioctl SIOCGIFNETMASK: ip alias bug 2.4.9 and 2.2.19
From: Matthias Andree <matthias.andree@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 6 Sep 2001 22:22:28 +0200
Cc: linux-kernel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxx, Andi Kleen <ak@xxxxxx>, kuznet@xxxxxxxxxxxxx
In-reply-to: <Pine.GSO.4.30.0109051803500.11700-100000@shell.cyberus.ca>
Mail-followup-to: jamal <hadi@xxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxx, Andi Kleen <ak@xxxxxx>, kuznet@xxxxxxxxxxxxx
References: <Pine.GSO.4.30.0109051803500.11700-100000@shell.cyberus.ca>
Sender: owner-netdev@xxxxxxxxxxx
User-agent: Mutt/1.3.22.1i
On Wed, 05 Sep 2001, jamal wrote:

> --- devinet.c   2001/09/04 19:18:51     1.1
> +++ devinet.c   2001/09/04 19:31:13
> @@ -530,7 +530,7 @@
> 
>         if ((in_dev=__in_dev_get(dev)) != NULL) {
>                 for (ifap=&in_dev->ifa_list; (ifa=*ifap) != NULL;
> ifap=&ifa->ifa_next)
> -                       if (strcmp(ifr.ifr_name, ifa->ifa_label) == 0)
> +                       if ((strcmp(ifr.ifr_name, ifa->ifa_label) == 0) ||
> (sin->sin_addr.s_addr == ifa->ifa_address))
>                                 break;
>         }

Thanks for trying to help, however, that's not going to work this way, sorry.

1. "sin" is cleared a few lines above, so you end up comparing 0.0.0.0
   against "ifa->ifa_address".

2. two interfaces can have the same configured address, your patch might
   end up returning the wrong address. You'd need to write && where you
   wrote ||, and you'd need to save the old address.

See the patch that I sent.

-- 
Matthias Andree

<Prev in Thread] Current Thread [Next in Thread>