From f3b778a4dcfe49dbb294365e7f026674a91f9a32 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Fri, 16 May 2008 16:10:31 +0000 Subject: - fix bug where we incorrectly rejected ifconfig eth0 hw ether $whatever - add support for printing ipoib to ifconfig --- networking/ifconfig.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'networking/ifconfig.c') 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[] = { { "netmask", N_ARG, ARG_NETMASK, 0 }, { "broadcast", N_ARG | M_CLR, ARG_BROADCAST, IFF_BROADCAST }, #if ENABLE_FEATURE_IFCONFIG_HW - { "hw", N_ARG, ARG_HW, 0 }, + { "hw", N_ARG, ARG_HW, 0 }, #endif { "pointopoint", N_ARG | M_CLR, ARG_POINTOPOINT, IFF_POINTOPOINT }, #ifdef SIOCSKEEPALIVE @@ -255,6 +255,11 @@ static const struct options OptArray[] = { #if ENABLE_FEATURE_IFCONFIG_HW static int in_ether(const char *bufp, struct sockaddr *sap); +# if ENABLE_FEATURE_HWIB +extern int in_ib(const char *bufp, struct sockaddr *sap); +# else +# define in_ib(a, b) 1 /* fail */ +# endif #endif /* @@ -425,11 +430,14 @@ int ifconfig_main(int argc, char **argv) #if ENABLE_FEATURE_IFCONFIG_HW } else { /* A_CAST_HOST_COPY_IN_ETHER */ /* This is the "hw" arg case. */ - if (strcmp("ether", *argv) || !*++argv) + smalluint hw_class= index_in_substrings("ether\0" + USE_FEATURE_HWIB("infiniband\0"), *argv) + 1; + if (!hw_class || !*++argv) bb_show_usage(); /*safe_strncpy(host, *argv, sizeof(host));*/ host = *argv; - if (in_ether(host, &sa)) + if (hw_class == 1 ? in_ether(host, &sa) + : in_ib(host, &sa)) bb_error_msg_and_die("invalid hw-addr %s", host); p = (char *) &sa; } -- cgit v1.2.3