[BACK]Return to show.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / netstat

Diff for /src/usr.bin/netstat/show.c between version 1.5 and 1.6

version 1.5, 2007/03/23 10:59:38 version 1.6, 2007/06/04 12:20:24
Line 42 
Line 42 
 #include <net/pfkeyv2.h>  #include <net/pfkeyv2.h>
 #include <net/route.h>  #include <net/route.h>
 #include <netinet/in.h>  #include <netinet/in.h>
 #include <netipx/ipx.h>  
 #include <netinet/if_ether.h>  #include <netinet/if_ether.h>
 #include <netinet/ip_ipsp.h>  #include <netinet/ip_ipsp.h>
 #include <arpa/inet.h>  #include <arpa/inet.h>
Line 338 
Line 337 
         case AF_INET6:          case AF_INET6:
                 afname = "Internet6";                  afname = "Internet6";
                 break;                  break;
         case AF_IPX:  
                 afname = "IPX";  
                 break;  
         case PF_KEY:          case PF_KEY:
                 afname = "Encap";                  afname = "Encap";
                 break;                  break;
Line 568 
Line 564 
                 return (routename6(&sin6));                  return (routename6(&sin6));
             }              }
   
         case AF_IPX:  
                 return (ipx_print(sa));  
   
         case AF_LINK:          case AF_LINK:
                 return (link_print(sa));                  return (link_print(sa));
   
Line 778 
Line 771 
         case AF_INET6:          case AF_INET6:
                 return netname6((struct sockaddr_in6 *)sa,                  return netname6((struct sockaddr_in6 *)sa,
                     (struct sockaddr_in6 *)mask);                      (struct sockaddr_in6 *)mask);
         case AF_IPX:  
                 return (ipx_print(sa));  
         case AF_LINK:          case AF_LINK:
                 return (link_print(sa));                  return (link_print(sa));
         default:          default:
Line 808 
Line 799 
         } while (--len > 0 && (out + 3) < &obuf[sizeof(obuf) - 1]);          } while (--len > 0 && (out + 3) < &obuf[sizeof(obuf) - 1]);
         out[-1] = '\0';          out[-1] = '\0';
         return (obuf);          return (obuf);
 }  
   
 short ipx_nullh[] = {0,0,0};  
 short ipx_bh[] = {-1,-1,-1};  
   
 char *  
 ipx_print(struct sockaddr *sa)  
 {  
         struct sockaddr_ipx *sipx = (struct sockaddr_ipx *)sa;  
         struct ipx_addr work;  
         union {  
                 union ipx_net   net_e;  
                 u_int32_t       long_e;  
         } net;  
         u_short port;  
         static char mybuf[50+MAXHOSTNAMELEN], cport[10], chost[25];  
         char *host = "";  
         char *p;  
         u_char *q;  
   
         work = sipx->sipx_addr;  
         port = ntohs(work.ipx_port);  
         work.ipx_port = 0;  
         net.net_e = work.ipx_net;  
         if (ipx_nullhost(work) && net.long_e == 0) {  
                 if (!port)  
                         return ("*.*");  
                 (void)snprintf(mybuf, sizeof(mybuf), "*.0x%XH", port);  
                 return (mybuf);  
         }  
   
         if (memcmp(ipx_bh, work.ipx_host.c_host, 6) == 0)  
                 host = "any";  
         else if (memcmp(ipx_nullh, work.ipx_host.c_host, 6) == 0)  
                 host = "*";  
         else {  
                 q = work.ipx_host.c_host;  
                 (void)snprintf(chost, sizeof(chost), "%02X%02X%02X%02X%02X%02XH",  
                         q[0], q[1], q[2], q[3], q[4], q[5]);  
                 for (p = chost; *p == '0' && p < chost + 12; p++)  
                         /* void */;  
                 host = p;  
         }  
         if (port)  
                 (void)snprintf(cport, sizeof(cport), ".%XH", htons(port));  
         else  
                 *cport = '\0';  
   
         (void)snprintf(mybuf, sizeof(mybuf), "%XH.%s%s",  
             ntohl(net.long_e), host, cport);  
         return (mybuf);  
 }  }
   
 char *  char *

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6