2005-11-04 16:55:46

by Neil Horman

[permalink] [raw]
Subject: [PATCH] fix ifenslave to not fail on lack of IP information

The current version of ifenslave fails to attach slave interfaces to a bond if
the masters doesn't have appropriate IP information. While its common for
bonded interface to have IP information its not required (bond as part of a
bridge for instance). This patch modifies ifenslave to not fail if IP
information is not available in the master at the time of enslaving.

Regards
Neil

Signed-off-by: Neil Horman <[email protected]>


ifenslave.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)


diff --git a/Documentation/networking/ifenslave.c b/Documentation/networking/ifenslave.c
--- a/Documentation/networking/ifenslave.c
+++ b/Documentation/networking/ifenslave.c
@@ -517,11 +517,10 @@ static int if_getconfig(char *ifname)
ifname, ifr.ifr_flags);

strcpy(ifr.ifr_name, ifname);
- if (ioctl(skfd, SIOCGIFADDR, &ifr) < 0)
- return -1;
- printf("The result of SIOCGIFADDR is %2.2x.%2.2x.%2.2x.%2.2x.\n",
- ifr.ifr_addr.sa_data[0], ifr.ifr_addr.sa_data[1],
- ifr.ifr_addr.sa_data[2], ifr.ifr_addr.sa_data[3]);
+ if (ioctl(skfd, SIOCGIFADDR, &ifr) >= 0)
+ printf("The result of SIOCGIFADDR is %2.2x.%2.2x.%2.2x.%2.2x.\n",
+ ifr.ifr_addr.sa_data[0], ifr.ifr_addr.sa_data[1],
+ ifr.ifr_addr.sa_data[2], ifr.ifr_addr.sa_data[3]);

strcpy(ifr.ifr_name, ifname);
if (ioctl(skfd, SIOCGIFHWADDR, &ifr) < 0)
@@ -1085,7 +1084,6 @@ static int set_if_addr(char *master_ifna
slave_ifname, ifra[i].req_name,
strerror(saved_errno));

- return res;
}

ipaddr = ifr.ifr_addr.sa_data;
--
/***************************************************
*Neil Horman
*Software Engineer
*gpg keyid: 1024D / 0x92A74FA1 - http://pgp.mit.edu
***************************************************/


Attachments:
(No filename) (1.72 kB)
(No filename) (189.00 B)
Download all attachments

2005-11-07 06:37:44

by Willy Tarreau

[permalink] [raw]
Subject: Re: [PATCH] fix ifenslave to not fail on lack of IP information

Hi,

On Fri, Nov 04, 2005 at 11:54:34AM -0500, Neil Horman wrote:
> The current version of ifenslave fails to attach slave interfaces to a bond if
> the masters doesn't have appropriate IP information. While its common for
> bonded interface to have IP information its not required (bond as part of a
> bridge for instance). This patch modifies ifenslave to not fail if IP
> information is not available in the master at the time of enslaving.
>
> Regards
> Neil
>
> Signed-off-by: Neil Horman <[email protected]>
>
>
> ifenslave.c | 10 ++++------
> 1 files changed, 4 insertions(+), 6 deletions(-)
>
>
> diff --git a/Documentation/networking/ifenslave.c b/Documentation/networking/ifenslave.c
> --- a/Documentation/networking/ifenslave.c
> +++ b/Documentation/networking/ifenslave.c
(...)

I find it annoying that ifenslave is still hosted by the kernel. I made
this mistake years ago because it was not hosted anywhere and I needed
to make changes available somewhere, but it should move to somewhere
else, either as a standalone package on sf.net, or added to an existing
package such as ifconfig, or better merged with it. I even think that
if ifconfig included all ifenslave, vconfig, ethtool and brctl functions,
it wouldn't be abandonned as it is now, but this is another problem.

Regards,
Willy

2005-11-11 04:21:55

by Rob Landley

[permalink] [raw]
Subject: Re: [PATCH] fix ifenslave to not fail on lack of IP information

On Monday 07 November 2005 00:23, Willy Tarreau wrote:
> I find it annoying that ifenslave is still hosted by the kernel. I made
> this mistake years ago because it was not hosted anywhere and I needed
> to make changes available somewhere, but it should move to somewhere
> else, either as a standalone package on sf.net, or added to an existing
> package such as ifconfig, or better merged with it. I even think that
> if ifconfig included all ifenslave, vconfig, ethtool and brctl functions,
> it wouldn't be abandonned as it is now, but this is another problem.

We're adding it to busybox in the not-to-distant future. (Possibly even Next
Sunday, A.D.)

> Regards,
> Willy

Rob