diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-08-12 01:35:34 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-08-12 01:35:34 +0000 |
commit | ee777c4e5f7335296afe2e32d91e0afd46fbe957 (patch) | |
tree | 5c692c6c8fb10511dad95537395525a4c639687e | |
parent | 8d07560eef94262d0e156e48ea8ecf17db20e794 (diff) | |
download | busybox-w32-ee777c4e5f7335296afe2e32d91e0afd46fbe957.tar.gz busybox-w32-ee777c4e5f7335296afe2e32d91e0afd46fbe957.tar.bz2 busybox-w32-ee777c4e5f7335296afe2e32d91e0afd46fbe957.zip |
ifupdown: fixes for custom MAC address, by Wade Berrier <wberrier AT gmail.com>
-rw-r--r-- | networking/ifupdown.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/networking/ifupdown.c b/networking/ifupdown.c index c0e9e812e..0f90102f0 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c | |||
@@ -249,6 +249,14 @@ static char *parse(const char *command, struct interface_defn_t *ifd) | |||
249 | varvalue = get_var(command, nextpercent - command, ifd); | 249 | varvalue = get_var(command, nextpercent - command, ifd); |
250 | 250 | ||
251 | if (varvalue) { | 251 | if (varvalue) { |
252 | #if ENABLE_FEATURE_IFUPDOWN_IP | ||
253 | /* "hwaddress <class> <address>": | ||
254 | * unlike ifconfig, ip doesnt want <class> | ||
255 | * (usually "ether" keyword). Skip it. */ | ||
256 | if (strncmp(command, "hwaddress", 9) == 0) { | ||
257 | varvalue = skip_whitespace(skip_non_whitespace(varvalue)); | ||
258 | } | ||
259 | #endif | ||
252 | addstr(&result, varvalue, strlen(varvalue)); | 260 | addstr(&result, varvalue, strlen(varvalue)); |
253 | } else { | 261 | } else { |
254 | #if ENABLE_FEATURE_IFUPDOWN_IP | 262 | #if ENABLE_FEATURE_IFUPDOWN_IP |
@@ -489,7 +497,11 @@ static int dhcp_up(struct interface_defn_t *ifd, execfn *exec) | |||
489 | unsigned i; | 497 | unsigned i; |
490 | #if ENABLE_FEATURE_IFUPDOWN_IP | 498 | #if ENABLE_FEATURE_IFUPDOWN_IP |
491 | /* ip doesn't up iface when it configures it (unlike ifconfig) */ | 499 | /* ip doesn't up iface when it configures it (unlike ifconfig) */ |
492 | if (!execute("ip link set %iface% up", ifd, exec)) | 500 | if (!execute("ip link set[[ address %hwaddress%]] %iface% up", ifd, exec)) |
501 | return 0; | ||
502 | #else | ||
503 | /* needed if we have hwaddress on dhcp iface */ | ||
504 | if (!execute("ifconfig %iface%[[ hw %hwaddress%]] up", ifd, exec)) | ||
493 | return 0; | 505 | return 0; |
494 | #endif | 506 | #endif |
495 | for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) { | 507 | for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) { |
@@ -504,7 +516,11 @@ static int dhcp_up(struct interface_defn_t *ifd, execfn *exec) | |||
504 | { | 516 | { |
505 | #if ENABLE_FEATURE_IFUPDOWN_IP | 517 | #if ENABLE_FEATURE_IFUPDOWN_IP |
506 | /* ip doesn't up iface when it configures it (unlike ifconfig) */ | 518 | /* ip doesn't up iface when it configures it (unlike ifconfig) */ |
507 | if (!execute("ip link set %iface% up", ifd, exec)) | 519 | if (!execute("ip link set[[ address %hwaddress%]] %iface% up", ifd, exec)) |
520 | return 0; | ||
521 | #else | ||
522 | /* needed if we have hwaddress on dhcp iface */ | ||
523 | if (!execute("ifconfig %iface%[[ hw %hwaddress%]] up", ifd, exec)) | ||
508 | return 0; | 524 | return 0; |
509 | #endif | 525 | #endif |
510 | return execute("udhcpc -R -n -p /var/run/udhcpc.%iface%.pid " | 526 | return execute("udhcpc -R -n -p /var/run/udhcpc.%iface%.pid " |