Hi,

When using CONFIG_FEATURE_IFUPDOWN_IP, mac addresses from
/etc/network/interfaces aren't being set correctly.  This is because
of argument differences between ifconfig and 'ip'.

It is passed as:

ip link set address ether xx:xx:xx:xx:xx:xx eth0 up

when it should be:

ip link set address xx:xx:xx:xx:xx:xx eth0 up

Note: this is accordance to debian's interfaces format described here:
http://www.annodex.net/cgi-bin/man/man2html?interfaces

The attached patch skips the 'ether' (or any other class) keyword so
the arguments are correct.

Does it look ok?

Wade
Index: busybox/networking/ifupdown.c
===================================================================
--- busybox/networking/ifupdown.c	(revision 23068)
+++ busybox/networking/ifupdown.c	(working copy)
@@ -249,6 +249,19 @@
 				varvalue = get_var(command, nextpercent - command, ifd);
 
 				if (varvalue) {
+#if ENABLE_FEATURE_IFUPDOWN_IP
+					/* 'ip' doesn't want the 'ether' keyword in hwaddress 
+					 * like 'ifconfig' does.  Skip the keyword after hwaddress. */
+					if (strncmp(command, "hwaddress", 9) == 0) {
+						char *skip_hw;
+						skip_hw = strchr(varvalue, ' ');
+						if (skip_hw != NULL) {
+							while (*skip_hw == ' ' && *skip_hw != '\0')
+								skip_hw++;
+							varvalue = skip_hw;
+						}
+					}
+#endif
 					addstr(&result, varvalue, strlen(varvalue));
 				} else {
 #if ENABLE_FEATURE_IFUPDOWN_IP
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to