Changeset e8f49680 in rtems


Ignore:
Timestamp:
08/06/03 14:44:28 (21 years ago)
Author:
Jennifer Averett <Jennifer.Averett@…>
Children:
a97ee41
Parents:
ca15cda0
Message:

2003-08-06 Till Strauman <strauman@…>

PR 435/networking

  • rtems/rtems_showifstat.c: rtems_showifstat misses printing the netmask
Location:
cpukit/libnetworking
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libnetworking/ChangeLog

    rca15cda0 re8f49680  
     12003-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
    172003-05-29      Joel Sherrill <joel@OARcorp.com>
    28
  • cpukit/libnetworking/rtems/rtems_showifstat.c

    rca15cda0 re8f49680  
    1212#include <sys/ioctl.h>
    1313#include <net/if.h>
     14#include <net/if_dl.h>
     15#include <net/if_types.h>
    1416#include <netinet/in.h>
     17#include <arpa/inet.h>
    1518
    1619/*
     
    2124{
    2225        struct sockaddr_in *sa;
     26        char    buf[17];
    2327
    24         if (!a || (a->sa_family != AF_INET))
     28        if (!a)
    2529                return 0;
    2630        printf ("%s:", name);
    2731        sa = (struct sockaddr_in *)a;
    28         printf ("%-16s", inet_ntoa (sa->sin_addr));
     32        printf ("%-16s", inet_ntop (AF_INET, &sa->sin_addr, buf, sizeof(buf)));
    2933        return 1;
    3034}
     
    3943        struct ifaddr *ifa;
    4044        unsigned short bit, flags;
    41         int printed;
    4245
    4346        printf ("************ INTERFACE STATISTICS ************\n");
     
    4548                printf ("***** %s%d *****\n", ifp->if_name, ifp->if_unit);
    4649                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                        }
    5595                }
    5696
Note: See TracChangeset for help on using the changeset viewer.