Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/networking/interface.c
- Timestamp:
- Feb 25, 2011, 9:26:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi-busybox/networking/interface.c
r1765 r2725 20 20 * and others. Copyright 1993 MicroWalt Corporation 21 21 * 22 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.22 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 23 23 * 24 24 * Patched to support 'add' and 'del' keywords for INET(4) addresses … … 31 31 * (default AF was wrong) 32 32 */ 33 34 33 #include <net/if.h> 35 34 #include <net/if_arp.h> 35 #if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION) 36 # include <net/ethernet.h> 37 #else 38 # include <linux/if_ether.h> 39 #endif 40 #include "libbb.h" 36 41 #include "inet_common.h" 37 #include "libbb.h" 42 43 #if ENABLE_FEATURE_HWIB 44 /* #include <linux/if_infiniband.h> */ 45 # undef INFINIBAND_ALEN 46 # define INFINIBAND_ALEN 20 47 #endif 38 48 39 49 #if ENABLE_FEATURE_IPV6 … … 47 57 48 58 #ifdef HAVE_AFINET6 49 50 #ifndef _LINUX_IN6_H 59 # ifndef _LINUX_IN6_H 51 60 /* 52 * This is in linux/include/net/ipv6.h.61 * This is from linux/include/net/ipv6.h 53 62 */ 54 55 63 struct in6_ifreq { 56 64 struct in6_addr ifr6_addr; … … 58 66 unsigned int ifr6_ifindex; 59 67 }; 60 61 #endif 62 68 # endif 63 69 #endif /* HAVE_AFINET6 */ 64 70 65 71 /* Defines for glibc2.0 users. */ 66 72 #ifndef SIOCSIFTXQLEN 67 # define SIOCSIFTXQLEN 0x894368 # define SIOCGIFTXQLEN 0x894273 # define SIOCSIFTXQLEN 0x8943 74 # define SIOCGIFTXQLEN 0x8942 69 75 #endif 70 76 71 77 /* ifr_qlen is ifru_ivalue, but it isn't present in 2.0 kernel headers */ 72 78 #ifndef ifr_qlen 73 # define ifr_qlen ifr_ifru.ifru_mtu79 # define ifr_qlen ifr_ifru.ifru_mtu 74 80 #endif 75 81 76 82 #ifndef HAVE_TXQUEUELEN 77 # define HAVE_TXQUEUELEN 183 # define HAVE_TXQUEUELEN 1 78 84 #endif 79 85 80 86 #ifndef IFF_DYNAMIC 81 # define IFF_DYNAMIC 0x8000/* dialup device with changing addresses */87 # define IFF_DYNAMIC 0x8000 /* dialup device with changing addresses */ 82 88 #endif 83 89 84 90 /* Display an Internet socket address. */ 85 static const char *INET_sprint(struct sockaddr *sap, int numeric)86 { 87 static char *buff; 91 static const char* FAST_FUNC INET_sprint(struct sockaddr *sap, int numeric) 92 { 93 static char *buff; /* defaults to NULL */ 88 94 89 95 free(buff); … … 137 143 #endif 138 144 139 static int INET_input(/*int type,*/ const char *bufp, struct sockaddr *sap)145 static int FAST_FUNC INET_input(/*int type,*/ const char *bufp, struct sockaddr *sap) 140 146 { 141 147 return INET_resolve(bufp, (struct sockaddr_in *) sap, 0); … … 153 159 154 160 static const struct aftype inet_aftype = { 155 .name ="inet",156 .title ="DARPA Internet",157 .af =AF_INET,158 .alen =4,159 .sprint = 160 .input =INET_input,161 .name = "inet", 162 .title = "DARPA Internet", 163 .af = AF_INET, 164 .alen = 4, 165 .sprint = INET_sprint, 166 .input = INET_input, 161 167 }; 162 168 … … 165 171 /* Display an Internet socket address. */ 166 172 /* dirty! struct sockaddr usually doesn't suffer for inet6 addresses, fst. */ 167 static const char *INET6_sprint(struct sockaddr *sap, int numeric)173 static const char* FAST_FUNC INET6_sprint(struct sockaddr *sap, int numeric) 168 174 { 169 175 static char *buff; … … 192 198 #endif 193 199 194 static int INET6_input(/*int type,*/ const char *bufp, struct sockaddr *sap)200 static int FAST_FUNC INET6_input(/*int type,*/ const char *bufp, struct sockaddr *sap) 195 201 { 196 202 return INET6_resolve(bufp, (struct sockaddr_in6 *) sap); … … 206 212 207 213 static const struct aftype inet6_aftype = { 208 .name ="inet6",209 .title ="IPv6",210 .af =AF_INET6,211 .alen =sizeof(struct in6_addr),212 .sprint = 213 .input =INET6_input,214 .name = "inet6", 215 .title = "IPv6", 216 .af = AF_INET6, 217 .alen = sizeof(struct in6_addr), 218 .sprint = INET6_sprint, 219 .input = INET6_input, 214 220 }; 215 221 … … 217 223 218 224 /* Display an UNSPEC address. */ 219 static char *UNSPEC_print(unsigned char *ptr)225 static char* FAST_FUNC UNSPEC_print(unsigned char *ptr) 220 226 { 221 227 static char *buff; … … 224 230 unsigned int i; 225 231 226 if (!buff) ;232 if (!buff) 227 233 buff = xmalloc(sizeof(struct sockaddr) * 3 + 1); 228 234 pos = buff; … … 238 244 239 245 /* Display an UNSPEC socket address. */ 240 static const char *UNSPEC_sprint(struct sockaddr *sap, int numeric)246 static const char* FAST_FUNC UNSPEC_sprint(struct sockaddr *sap, int numeric UNUSED_PARAM) 241 247 { 242 248 if (sap->sa_family == 0xFFFF || sap->sa_family == 0) … … 249 255 .title = "UNSPEC", 250 256 .af = AF_UNSPEC, 251 .alen 257 .alen = 0, 252 258 .print = UNSPEC_print, 253 259 .sprint = UNSPEC_sprint, … … 264 270 265 271 /* Check our protocol family table for this family. */ 266 const struct aftype *get_aftype(const char *name)272 const struct aftype* FAST_FUNC get_aftype(const char *name) 267 273 { 268 274 const struct aftype *const *afp; … … 322 328 struct interface { 323 329 struct interface *next, *prev; 324 char name[IFNAMSIZ]; 325 short type; 326 short flags; 327 int metric; 328 int mtu; 329 int tx_queue_len; 330 struct ifmap map; 331 struct sockaddr addr; 332 struct sockaddr dstaddr; 333 struct sockaddr broadaddr; 334 struct sockaddr netmask; 330 char name[IFNAMSIZ]; /* interface name */ 331 short type; /* if type */ 332 short flags; /* various flags */ 333 int metric; /* routing metric */ 334 int mtu; /* MTU value */ 335 int tx_queue_len; /* transmit queue length */ 336 struct ifmap map; /* hardware setup */ 337 struct sockaddr addr; /* IP address */ 338 struct sockaddr dstaddr; /* P-P IP address */ 339 struct sockaddr broadaddr; /* IP broadcast address */ 340 struct sockaddr netmask; /* IP network mask */ 335 341 int has_ip; 336 char hwaddr[32]; 342 char hwaddr[32]; /* HW address */ 337 343 int statistics_valid; 338 struct user_net_device_stats stats; 339 int keepalive; 340 int outfill; 344 struct user_net_device_stats stats; /* statistics */ 345 int keepalive; /* keepalive value for SLIP */ 346 int outfill; /* outfill value for SLIP */ 341 347 }; 342 348 … … 389 395 390 396 new = xzalloc(sizeof(*new)); 391 s afe_strncpy(new->name, name, IFNAMSIZ);397 strncpy_IFNAMSIZ(new->name, name); 392 398 nextp = ife ? &ife->next : &int_list; 393 399 new->prev = ife; … … 404 410 { 405 411 /* Extract <name> from nul-terminated p where p matches 406 <name>: after leading whitespace. 407 If match is not made, set name empty and return unchanged p */ 408 int namestart=0, nameend=0; 409 while (isspace(p[namestart])) 410 namestart++; 411 nameend=namestart; 412 while (p[nameend] && p[nameend]!=':' && !isspace(p[nameend])) 412 * <name>: after leading whitespace. 413 * If match is not made, set name empty and return unchanged p 414 */ 415 char *nameend; 416 char *namestart = skip_whitespace(p); 417 418 nameend = namestart; 419 while (*nameend && *nameend != ':' && !isspace(*nameend)) 413 420 nameend++; 414 if ( p[nameend]==':') {415 if ((nameend -namestart)<IFNAMSIZ) {416 memcpy(name, &p[namestart],nameend-namestart);417 name[nameend -namestart]='\0';418 p =&p[nameend];421 if (*nameend == ':') { 422 if ((nameend - namestart) < IFNAMSIZ) { 423 memcpy(name, namestart, nameend - namestart); 424 name[nameend - namestart] = '\0'; 425 p = nameend; 419 426 } else { 420 427 /* Interface name too large */ 421 name[0] ='\0';428 name[0] = '\0'; 422 429 } 423 430 } else { 424 431 /* trailing ':' not found - return empty */ 425 name[0] ='\0';432 name[0] = '\0'; 426 433 } 427 434 return p + 1; … … 491 498 } 492 499 493 static in line int procnetdev_version(char *buf)500 static int procnetdev_version(char *buf) 494 501 { 495 502 if (strstr(buf, "compressed")) … … 525 532 goto out; 526 533 } 527 if (ifc.ifc_len == sizeof(struct ifreq) * numreqs) {534 if (ifc.ifc_len == (int)(sizeof(struct ifreq) * numreqs)) { 528 535 /* assume it overflowed and try again */ 529 536 numreqs += 10; … … 560 567 proc_read = 1; 561 568 562 fh = fopen (_PATH_PROCNET_DEV, "r");569 fh = fopen_or_warn(_PATH_PROCNET_DEV, "r"); 563 570 if (!fh) { 564 bb_perror_msg("warning: cannot open %s, limiting output", _PATH_PROCNET_DEV);565 571 return if_readconf(); 566 572 } … … 608 614 skfd = xsocket(AF_INET, SOCK_DGRAM, 0); 609 615 610 strncpy (ifr.ifr_name, ifname, sizeof(ifr.ifr_name));616 strncpy_IFNAMSIZ(ifr.ifr_name, ifname); 611 617 if (ioctl(skfd, SIOCGIFFLAGS, &ifr) < 0) { 612 618 close(skfd); … … 615 621 ife->flags = ifr.ifr_flags; 616 622 617 strncpy (ifr.ifr_name, ifname, sizeof(ifr.ifr_name));623 strncpy_IFNAMSIZ(ifr.ifr_name, ifname); 618 624 memset(ife->hwaddr, 0, 32); 619 625 if (ioctl(skfd, SIOCGIFHWADDR, &ifr) >= 0) … … 622 628 ife->type = ifr.ifr_hwaddr.sa_family; 623 629 624 strncpy (ifr.ifr_name, ifname, sizeof(ifr.ifr_name));630 strncpy_IFNAMSIZ(ifr.ifr_name, ifname); 625 631 ife->metric = 0; 626 632 if (ioctl(skfd, SIOCGIFMETRIC, &ifr) >= 0) 627 633 ife->metric = ifr.ifr_metric; 628 634 629 strncpy (ifr.ifr_name, ifname, sizeof(ifr.ifr_name));635 strncpy_IFNAMSIZ(ifr.ifr_name, ifname); 630 636 ife->mtu = 0; 631 637 if (ioctl(skfd, SIOCGIFMTU, &ifr) >= 0) … … 634 640 memset(&ife->map, 0, sizeof(struct ifmap)); 635 641 #ifdef SIOCGIFMAP 636 strncpy (ifr.ifr_name, ifname, sizeof(ifr.ifr_name));642 strncpy_IFNAMSIZ(ifr.ifr_name, ifname); 637 643 if (ioctl(skfd, SIOCGIFMAP, &ifr) == 0) 638 644 ife->map = ifr.ifr_map; … … 640 646 641 647 #ifdef HAVE_TXQUEUELEN 642 strncpy (ifr.ifr_name, ifname, sizeof(ifr.ifr_name));648 strncpy_IFNAMSIZ(ifr.ifr_name, ifname); 643 649 ife->tx_queue_len = -1; /* unknown value */ 644 650 if (ioctl(skfd, SIOCGIFTXQLEN, &ifr) >= 0) … … 648 654 #endif 649 655 650 strncpy (ifr.ifr_name, ifname, sizeof(ifr.ifr_name));656 strncpy_IFNAMSIZ(ifr.ifr_name, ifname); 651 657 ifr.ifr_addr.sa_family = AF_INET; 652 658 memset(&ife->addr, 0, sizeof(struct sockaddr)); … … 654 660 ife->has_ip = 1; 655 661 ife->addr = ifr.ifr_addr; 656 strncpy (ifr.ifr_name, ifname, sizeof(ifr.ifr_name));662 strncpy_IFNAMSIZ(ifr.ifr_name, ifname); 657 663 memset(&ife->dstaddr, 0, sizeof(struct sockaddr)); 658 664 if (ioctl(skfd, SIOCGIFDSTADDR, &ifr) >= 0) 659 665 ife->dstaddr = ifr.ifr_dstaddr; 660 666 661 strncpy (ifr.ifr_name, ifname, sizeof(ifr.ifr_name));667 strncpy_IFNAMSIZ(ifr.ifr_name, ifname); 662 668 memset(&ife->broadaddr, 0, sizeof(struct sockaddr)); 663 669 if (ioctl(skfd, SIOCGIFBRDADDR, &ifr) >= 0) 664 670 ife->broadaddr = ifr.ifr_broadaddr; 665 671 666 strncpy (ifr.ifr_name, ifname, sizeof(ifr.ifr_name));672 strncpy_IFNAMSIZ(ifr.ifr_name, ifname); 667 673 memset(&ife->netmask, 0, sizeof(struct sockaddr)); 668 674 if (ioctl(skfd, SIOCGIFNETMASK, &ifr) >= 0) … … 673 679 return 0; 674 680 } 675 676 681 677 682 static int do_if_fetch(struct interface *ife) … … 706 711 }; 707 712 708 #include <net/if_arp.h>709 710 #if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION)711 #include <net/ethernet.h>712 #else713 #include <linux/if_ether.h>714 #endif715 716 713 /* Display an Ethernet address in readable format. */ 717 static char *pr_ether(unsigned char *ptr)714 static char* FAST_FUNC ether_print(unsigned char *ptr) 718 715 { 719 716 static char *buff; … … 727 724 } 728 725 729 static int in_ether(const char *bufp, struct sockaddr *sap);726 static int FAST_FUNC ether_input(const char *bufp, struct sockaddr *sap); 730 727 731 728 static const struct hwtype ether_hwtype = { 732 .name ="ether",733 .title = 734 .type =ARPHRD_ETHER,735 .alen =ETH_ALEN,736 .print = pr_ether,737 .input = in_ether729 .name = "ether", 730 .title = "Ethernet", 731 .type = ARPHRD_ETHER, 732 .alen = ETH_ALEN, 733 .print = ether_print, 734 .input = ether_input 738 735 }; 739 736 … … 749 746 750 747 /* Input an Ethernet address and convert to binary. */ 751 static int in_ether(const char *bufp, struct sockaddr *sap)748 static int FAST_FUNC ether_input(const char *bufp, struct sockaddr *sap) 752 749 { 753 750 unsigned char *ptr; … … 789 786 } 790 787 791 #include <net/if_arp.h>792 793 788 static const struct hwtype ppp_hwtype = { 794 789 .name = "ppp", … … 806 801 }; 807 802 #endif 803 #if ENABLE_FEATURE_HWIB 804 static const struct hwtype ib_hwtype = { 805 .name = "infiniband", 806 .title = "InfiniBand", 807 .type = ARPHRD_INFINIBAND, 808 .alen = INFINIBAND_ALEN, 809 .print = UNSPEC_print, 810 .input = in_ib, 811 }; 812 #endif 813 808 814 809 815 static const struct hwtype *const hwtypes[] = { … … 814 820 #if ENABLE_FEATURE_IPV6 815 821 &sit_hwtype, 822 #endif 823 #if ENABLE_FEATURE_HWIB 824 &ib_hwtype, 816 825 #endif 817 826 NULL … … 833 842 834 843 /* Check our hardware type table for this type. */ 835 const struct hwtype *get_hwtype(const char *name)844 const struct hwtype* FAST_FUNC get_hwtype(const char *name) 836 845 { 837 846 const struct hwtype *const *hwp; … … 847 856 848 857 /* Check our hardware type table for this type. */ 849 const struct hwtype *get_hwntype(int type)858 const struct hwtype* FAST_FUNC get_hwntype(int type) 850 859 { 851 860 const struct hwtype *const *hwp; … … 863 872 static int hw_null_address(const struct hwtype *hw, void *ap) 864 873 { 865 unsignedint i;874 int i; 866 875 unsigned char *address = (unsigned char *) ap; 867 876 … … 897 906 } 898 907 899 static void ife_print(struct interface *ptr)900 {901 const struct aftype *ap;902 const struct hwtype *hw;903 int hf;904 int can_compress = 0;905 908 906 909 #ifdef HAVE_AFINET6 910 #define IPV6_ADDR_ANY 0x0000U 911 912 #define IPV6_ADDR_UNICAST 0x0001U 913 #define IPV6_ADDR_MULTICAST 0x0002U 914 #define IPV6_ADDR_ANYCAST 0x0004U 915 916 #define IPV6_ADDR_LOOPBACK 0x0010U 917 #define IPV6_ADDR_LINKLOCAL 0x0020U 918 #define IPV6_ADDR_SITELOCAL 0x0040U 919 920 #define IPV6_ADDR_COMPATv4 0x0080U 921 922 #define IPV6_ADDR_SCOPE_MASK 0x00f0U 923 924 #define IPV6_ADDR_MAPPED 0x1000U 925 #define IPV6_ADDR_RESERVED 0x2000U /* reserved address space */ 926 927 928 static void ife_print6(struct interface *ptr) 929 { 907 930 FILE *f; 908 931 char addr6[40], devname[20]; … … 910 933 int plen, scope, dad_status, if_idx; 911 934 char addr6p[8][5]; 912 #endif 935 936 f = fopen_for_read(_PATH_PROCNET_IFINET6); 937 if (f == NULL) 938 return; 939 940 while (fscanf 941 (f, "%4s%4s%4s%4s%4s%4s%4s%4s %08x %02x %02x %02x %20s\n", 942 addr6p[0], addr6p[1], addr6p[2], addr6p[3], addr6p[4], 943 addr6p[5], addr6p[6], addr6p[7], &if_idx, &plen, &scope, 944 &dad_status, devname) != EOF 945 ) { 946 if (!strcmp(devname, ptr->name)) { 947 sprintf(addr6, "%s:%s:%s:%s:%s:%s:%s:%s", 948 addr6p[0], addr6p[1], addr6p[2], addr6p[3], 949 addr6p[4], addr6p[5], addr6p[6], addr6p[7]); 950 inet_pton(AF_INET6, addr6, 951 (struct sockaddr *) &sap.sin6_addr); 952 sap.sin6_family = AF_INET6; 953 printf(" inet6 addr: %s/%d", 954 INET6_sprint((struct sockaddr *) &sap, 1), 955 plen); 956 printf(" Scope:"); 957 switch (scope & IPV6_ADDR_SCOPE_MASK) { 958 case 0: 959 puts("Global"); 960 break; 961 case IPV6_ADDR_LINKLOCAL: 962 puts("Link"); 963 break; 964 case IPV6_ADDR_SITELOCAL: 965 puts("Site"); 966 break; 967 case IPV6_ADDR_COMPATv4: 968 puts("Compat"); 969 break; 970 case IPV6_ADDR_LOOPBACK: 971 puts("Host"); 972 break; 973 default: 974 puts("Unknown"); 975 } 976 } 977 } 978 fclose(f); 979 } 980 #else 981 #define ife_print6(a) ((void)0) 982 #endif 983 984 static void ife_print(struct interface *ptr) 985 { 986 const struct aftype *ap; 987 const struct hwtype *hw; 988 int hf; 989 int can_compress = 0; 913 990 914 991 ap = get_afntype(ptr->addr.sa_family); … … 925 1002 hw = get_hwntype(-1); 926 1003 927 printf("%-9 .9s Link encap:%s ", ptr->name, hw->title);1004 printf("%-9s Link encap:%s ", ptr->name, hw->title); 928 1005 /* For some hardware types (eg Ash, ATM) we don't print the 929 1006 hardware address if it's null. */ 930 if (hw->print != NULL && (!(hw_null_address(hw, ptr->hwaddr) && 931 hw->suppress_null_addr))) 1007 if (hw->print != NULL 1008 && !(hw_null_address(hw, ptr->hwaddr) && hw->suppress_null_addr) 1009 ) { 932 1010 printf("HWaddr %s ", hw->print((unsigned char *)ptr->hwaddr)); 1011 } 933 1012 #ifdef IFF_PORTSEL 934 1013 if (ptr->flags & IFF_PORTSEL) { … … 938 1017 } 939 1018 #endif 940 puts("");1019 bb_putchar('\n'); 941 1020 942 1021 if (ptr->has_ip) { … … 952 1031 } 953 1032 954 #ifdef HAVE_AFINET6 955 956 #define IPV6_ADDR_ANY 0x0000U 957 958 #define IPV6_ADDR_UNICAST 0x0001U 959 #define IPV6_ADDR_MULTICAST 0x0002U 960 #define IPV6_ADDR_ANYCAST 0x0004U 961 962 #define IPV6_ADDR_LOOPBACK 0x0010U 963 #define IPV6_ADDR_LINKLOCAL 0x0020U 964 #define IPV6_ADDR_SITELOCAL 0x0040U 965 966 #define IPV6_ADDR_COMPATv4 0x0080U 967 968 #define IPV6_ADDR_SCOPE_MASK 0x00f0U 969 970 #define IPV6_ADDR_MAPPED 0x1000U 971 #define IPV6_ADDR_RESERVED 0x2000U /* reserved address space */ 972 973 f = fopen(_PATH_PROCNET_IFINET6, "r"); 974 if (f != NULL) { 975 while (fscanf 976 (f, "%4s%4s%4s%4s%4s%4s%4s%4s %08x %02x %02x %02x %20s\n", 977 addr6p[0], addr6p[1], addr6p[2], addr6p[3], addr6p[4], 978 addr6p[5], addr6p[6], addr6p[7], &if_idx, &plen, &scope, 979 &dad_status, devname) != EOF 980 ) { 981 if (!strcmp(devname, ptr->name)) { 982 sprintf(addr6, "%s:%s:%s:%s:%s:%s:%s:%s", 983 addr6p[0], addr6p[1], addr6p[2], addr6p[3], 984 addr6p[4], addr6p[5], addr6p[6], addr6p[7]); 985 inet_pton(AF_INET6, addr6, 986 (struct sockaddr *) &sap.sin6_addr); 987 sap.sin6_family = AF_INET6; 988 printf(" inet6 addr: %s/%d", 989 INET6_sprint((struct sockaddr *) &sap, 1), 990 plen); 991 printf(" Scope:"); 992 switch (scope & IPV6_ADDR_SCOPE_MASK) { 993 case 0: 994 puts("Global"); 995 break; 996 case IPV6_ADDR_LINKLOCAL: 997 puts("Link"); 998 break; 999 case IPV6_ADDR_SITELOCAL: 1000 puts("Site"); 1001 break; 1002 case IPV6_ADDR_COMPATv4: 1003 puts("Compat"); 1004 break; 1005 case IPV6_ADDR_LOOPBACK: 1006 puts("Host"); 1007 break; 1008 default: 1009 puts("Unknown"); 1010 } 1011 } 1012 } 1013 fclose(f); 1014 } 1015 #endif 1033 ife_print6(ptr); 1016 1034 1017 1035 printf(" "); … … 1074 1092 printf(" Outfill:%d Keepalive:%d", ptr->outfill, ptr->keepalive); 1075 1093 #endif 1076 puts("");1094 bb_putchar('\n'); 1077 1095 1078 1096 /* If needed, display the interface statistics. */ … … 1105 1123 print_bytes_scaled(ptr->stats.rx_bytes, " T"); 1106 1124 print_bytes_scaled(ptr->stats.tx_bytes, "\n"); 1107 1108 } 1109 1110 if ((ptr->map.irq || ptr->map.mem_start || ptr->map.dma ||1111 ptr->map.base_addr)) {1125 } 1126 1127 if (ptr->map.irq || ptr->map.mem_start 1128 || ptr->map.dma || ptr->map.base_addr 1129 ) { 1112 1130 printf(" "); 1113 1131 if (ptr->map.irq) … … 1123 1141 if (ptr->map.dma) 1124 1142 printf("DMA chan:%x ", ptr->map.dma); 1125 puts(""); 1126 } 1127 puts(""); 1128 } 1129 1143 bb_putchar('\n'); 1144 } 1145 bb_putchar('\n'); 1146 } 1130 1147 1131 1148 static int do_if_print(struct interface *ife) /*, int *opt_a)*/ … … 1161 1178 for (ife = int_list; ife; ife = ife->next) { 1162 1179 int err = doit(ife, cookie); 1163 1164 1180 if (err) 1165 1181 return err; … … 1193 1209 } 1194 1210 1195 int display_interfaces(char *ifname) 1211 #if ENABLE_FEATURE_HWIB 1212 /* Input an Infiniband address and convert to binary. */ 1213 int FAST_FUNC in_ib(const char *bufp, struct sockaddr *sap) 1214 { 1215 sap->sa_family = ib_hwtype.type; 1216 //TODO: error check? 1217 hex2bin((char*)sap->sa_data, bufp, INFINIBAND_ALEN); 1218 # ifdef HWIB_DEBUG 1219 fprintf(stderr, "in_ib(%s): %s\n", bufp, UNSPEC_print(sap->sa_data)); 1220 # endif 1221 return 0; 1222 } 1223 #endif 1224 1225 int FAST_FUNC display_interfaces(char *ifname) 1196 1226 { 1197 1227 int status;
Note:
See TracChangeset
for help on using the changeset viewer.