[PATCH] fix ifenslave to not fail on lack of IP information

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
 ***************************************************/

Attachment: pgpNoeyOwoIvU.pgp
Description: PGP signature


[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux