Changeset 1d2dbec in rtems
- Timestamp:
- 08/06/03 14:39:16 (20 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- ce275cf
- Parents:
- d931f107
- Location:
- cpukit/libnetworking
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/libnetworking/ChangeLog
rd931f107 r1d2dbec 1 2003-08-06 Till Strauman <strauman@slac.stanford.edu> 2 3 PR 435/networking 4 * rtems/rtems_showifstat.c: rtems_showifstat misses printing 5 the netmask 6 1 7 2003-07-08 Ralf Corsepius <corsepiu@faw.uni-ulm.de> 2 8 -
cpukit/libnetworking/rtems/rtems_showifstat.c
rd931f107 r1d2dbec 12 12 #include <sys/ioctl.h> 13 13 #include <net/if.h> 14 #include <net/if_dl.h> 15 #include <net/if_types.h> 14 16 #include <netinet/in.h> 17 #include <arpa/inet.h> 15 18 16 19 /* … … 21 24 { 22 25 struct sockaddr_in *sa; 26 char buf[17]; 23 27 24 if (!a || (a->sa_family != AF_INET))28 if (!a) 25 29 return 0; 26 30 printf ("%s:", name); 27 31 sa = (struct sockaddr_in *)a; 28 printf ("%-16s", inet_nto a (sa->sin_addr));32 printf ("%-16s", inet_ntop (AF_INET, &sa->sin_addr, buf, sizeof(buf))); 29 33 return 1; 30 34 } … … 39 43 struct ifaddr *ifa; 40 44 unsigned short bit, flags; 41 int printed;42 45 43 46 printf ("************ INTERFACE STATISTICS ************\n"); … … 45 48 printf ("***** %s%d *****\n", ifp->if_name, ifp->if_unit); 46 49 for (ifa = ifp->if_addrlist ; ifa ; ifa = ifa->ifa_next) { 47 printed = showaddress ("Address", ifa->ifa_addr); 48 if (ifp->if_flags & IFF_BROADCAST) 49 printed |= showaddress ("Broadcast Address", ifa->ifa_broadaddr); 50 if (ifp->if_flags & IFF_POINTOPOINT) 51 printed |= showaddress ("Destination Address", ifa->ifa_dstaddr); 52 printed |= showaddress ("Net mask", ifa->ifa_netmask); 53 if (printed) 54 printf ("\n"); 50 51 if ( !ifa->ifa_addr ) 52 continue; 53 54 switch ( ifa->ifa_addr->sa_family ) { 55 case AF_LINK: 56 { 57 struct sockaddr_dl *sdl = (struct sockaddr_dl *)ifa->ifa_addr; 58 char *cp = LLADDR(sdl); 59 int i; 60 61 switch ( sdl->sdl_type ) { 62 case IFT_ETHER: 63 if ( (i=sdl->sdl_alen) > 0 ) { 64 printf("Ethernet Address: "); 65 do { 66 i--; 67 printf("%02X%c", *cp++, i ? ':' : '\n'); 68 } while ( i>0 ); 69 } 70 break; 71 72 default: 73 break; 74 } 75 } 76 break; 77 78 case AF_INET: 79 { 80 int printed; 81 printed = showaddress ("Address", ifa->ifa_addr); 82 if (ifp->if_flags & IFF_BROADCAST) 83 printed |= showaddress ("Broadcast Address", ifa->ifa_broadaddr); 84 if (ifp->if_flags & IFF_POINTOPOINT) 85 printed |= showaddress ("Destination Address", ifa->ifa_dstaddr); 86 printed |= showaddress ("Net mask", ifa->ifa_netmask); 87 if (printed) 88 printf ("\n"); 89 } 90 break; 91 92 default: 93 break; 94 } 55 95 } 56 96
Note: See TracChangeset
for help on using the changeset viewer.