Hi,

According to: http://www.annodex.net/cgi-bin/man/man2html?interfaces

it is possible to set a custom mac address when using dhcp.

The attached patch allows this for both 'ifconfig' and 'ip'.

Wade
Index: busybox/networking/ifupdown.c
===================================================================
--- busybox/networking/ifupdown.c	(revision 23068)
+++ busybox/networking/ifupdown.c	(working copy)
@@ -489,8 +489,12 @@
 	unsigned i;
 #if ENABLE_FEATURE_IFUPDOWN_IP
 	/* ip doesn't up iface when it configures it (unlike ifconfig) */
-	if (!execute("ip link set %iface% up", ifd, exec))
+	if (!execute("ip link set[[ address %hwaddress%]] %iface% up", ifd, exec))
 		return 0;
+#else
+	/* also call ifconfig so we can set the hw addr even when using dhcp */
+	if (!execute("ifconfig %iface%[[ hw %hwaddress%]] up", ifd, exec))
+		return 0;
 #endif
 	for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) {
 		if (exists_execable(ext_dhcp_clients[i].name))
@@ -504,8 +508,12 @@
 {
 #if ENABLE_FEATURE_IFUPDOWN_IP
 	/* ip doesn't up iface when it configures it (unlike ifconfig) */
-	if (!execute("ip link set %iface% up", ifd, exec))
+	if (!execute("ip link set[[ address %hwaddress%]] %iface% up", ifd, exec))
 		return 0;
+#else
+	/* also call ifconfig so we can set the hw addr even when using dhcp */
+	if (!execute("ifconfig %iface%[[ hw %hwaddress%]] up", ifd, exec))
+		return 0;
 #endif
 	return execute("udhcpc -R -n -p /var/run/udhcpc.%iface%.pid "
 			"-i %iface%[[ -H %hostname%]][[ -c %clientid%]][[ -s %script%]][[ %udhcpc_opts%]]",
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to