[BusyBox-cvs] busybox/networking nameif.c,1.1,1.2

Glenn McGrath bug1 at busybox.net
Fri Dec 13 09:02:19 UTC 2002


Update of /var/cvs/busybox/networking
In directory winder:/tmp/cvs-serv24196/networking

Modified Files:
	nameif.c 
Log Message:
Fix bug when reading mac from command line, continue; if hwaddrr not found


Index: nameif.c
===================================================================
RCS file: /var/cvs/busybox/networking/nameif.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- nameif.c	13 Dec 2002 00:01:44 -0000	1.1
+++ nameif.c	13 Dec 2002 09:02:16 -0000	1.2
@@ -67,7 +67,7 @@
 	}
 
 	va_end(ap);
-
+	
 	exit(EXIT_FAILURE);
 }
 
@@ -121,7 +121,7 @@
 			ch = xcalloc(1, sizeof(mactable_t));
 			ch->ifname = strdup(argv[optind - 1]);
 			ch->mac = xcalloc(1, ETH_ALEN);
-			memcpy(ch->mac, &mac, ETH_ALEN);
+			memcpy(ch->mac, mac, ETH_ALEN);
 			optind++;
 			if (clist)
 				clist->pprev = &ch->next;
@@ -186,7 +186,8 @@
 		memset(&ifr, 0, sizeof(struct ifreq));
 		strncpy(ifr.ifr_name, line_ptr, iface_name_length);
 		if (ioctl(ctl_sk, SIOCGIFHWADDR, &ifr) < 0) {
-			serror_msg_and_die(use_syslog, "cannot change name of %s to %s: %s", ifr.ifr_name, ch->ifname, strerror(errno));
+//			serror_msg(use_syslog, "cannot read hardware address of %s: %s", ifr.ifr_name, strerror(errno));
+			continue;
 		}
 		for (ch = clist; ch; ch = ch->next)
 			if (!memcmp(ch->mac, ifr.ifr_hwaddr.sa_data, ETH_ALEN))
@@ -194,6 +195,7 @@
 		if (ch == NULL) {
 			continue;
 		}
+
 		strcpy(ifr.ifr_newname, ch->ifname);
 
 		if (ioctl(ctl_sk, SIOCSIFNAME, &ifr) < 0) {;




More information about the busybox-cvs mailing list