diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-05-16 16:10:31 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-05-16 16:10:31 +0000 |
commit | f3b778a4dcfe49dbb294365e7f026674a91f9a32 (patch) | |
tree | d68b08af40a70399b5027949541d1f08696d4925 /networking/ifconfig.c | |
parent | 825968f92c603357e2e1e1d73c3ec26d89004381 (diff) | |
download | busybox-w32-f3b778a4dcfe49dbb294365e7f026674a91f9a32.tar.gz busybox-w32-f3b778a4dcfe49dbb294365e7f026674a91f9a32.tar.bz2 busybox-w32-f3b778a4dcfe49dbb294365e7f026674a91f9a32.zip |
- fix bug where we incorrectly rejected ifconfig eth0 hw ether $whatever
- add support for printing ipoib to ifconfig
Diffstat (limited to 'networking/ifconfig.c')
-rw-r--r-- | networking/ifconfig.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/networking/ifconfig.c b/networking/ifconfig.c index 9e95533cc..d02175783 100644 --- a/networking/ifconfig.c +++ b/networking/ifconfig.c | |||
@@ -220,7 +220,7 @@ static const struct options OptArray[] = { | |||
220 | { "netmask", N_ARG, ARG_NETMASK, 0 }, | 220 | { "netmask", N_ARG, ARG_NETMASK, 0 }, |
221 | { "broadcast", N_ARG | M_CLR, ARG_BROADCAST, IFF_BROADCAST }, | 221 | { "broadcast", N_ARG | M_CLR, ARG_BROADCAST, IFF_BROADCAST }, |
222 | #if ENABLE_FEATURE_IFCONFIG_HW | 222 | #if ENABLE_FEATURE_IFCONFIG_HW |
223 | { "hw", N_ARG, ARG_HW, 0 }, | 223 | { "hw", N_ARG, ARG_HW, 0 }, |
224 | #endif | 224 | #endif |
225 | { "pointopoint", N_ARG | M_CLR, ARG_POINTOPOINT, IFF_POINTOPOINT }, | 225 | { "pointopoint", N_ARG | M_CLR, ARG_POINTOPOINT, IFF_POINTOPOINT }, |
226 | #ifdef SIOCSKEEPALIVE | 226 | #ifdef SIOCSKEEPALIVE |
@@ -255,6 +255,11 @@ static const struct options OptArray[] = { | |||
255 | 255 | ||
256 | #if ENABLE_FEATURE_IFCONFIG_HW | 256 | #if ENABLE_FEATURE_IFCONFIG_HW |
257 | static int in_ether(const char *bufp, struct sockaddr *sap); | 257 | static int in_ether(const char *bufp, struct sockaddr *sap); |
258 | # if ENABLE_FEATURE_HWIB | ||
259 | extern int in_ib(const char *bufp, struct sockaddr *sap); | ||
260 | # else | ||
261 | # define in_ib(a, b) 1 /* fail */ | ||
262 | # endif | ||
258 | #endif | 263 | #endif |
259 | 264 | ||
260 | /* | 265 | /* |
@@ -425,11 +430,14 @@ int ifconfig_main(int argc, char **argv) | |||
425 | #if ENABLE_FEATURE_IFCONFIG_HW | 430 | #if ENABLE_FEATURE_IFCONFIG_HW |
426 | } else { /* A_CAST_HOST_COPY_IN_ETHER */ | 431 | } else { /* A_CAST_HOST_COPY_IN_ETHER */ |
427 | /* This is the "hw" arg case. */ | 432 | /* This is the "hw" arg case. */ |
428 | if (strcmp("ether", *argv) || !*++argv) | 433 | smalluint hw_class= index_in_substrings("ether\0" |
434 | USE_FEATURE_HWIB("infiniband\0"), *argv) + 1; | ||
435 | if (!hw_class || !*++argv) | ||
429 | bb_show_usage(); | 436 | bb_show_usage(); |
430 | /*safe_strncpy(host, *argv, sizeof(host));*/ | 437 | /*safe_strncpy(host, *argv, sizeof(host));*/ |
431 | host = *argv; | 438 | host = *argv; |
432 | if (in_ether(host, &sa)) | 439 | if (hw_class == 1 ? in_ether(host, &sa) |
440 | : in_ib(host, &sa)) | ||
433 | bb_error_msg_and_die("invalid hw-addr %s", host); | 441 | bb_error_msg_and_die("invalid hw-addr %s", host); |
434 | p = (char *) &sa; | 442 | p = (char *) &sa; |
435 | } | 443 | } |