=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/netstat/show.c,v retrieving revision 1.5 retrieving revision 1.6 diff -c -r1.5 -r1.6 *** src/usr.bin/netstat/show.c 2007/03/23 10:59:38 1.5 --- src/usr.bin/netstat/show.c 2007/06/04 12:20:24 1.6 *************** *** 1,4 **** ! /* $OpenBSD: show.c,v 1.5 2007/03/23 10:59:38 pyr Exp $ */ /* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: show.c,v 1.6 2007/06/04 12:20:24 henning Exp $ */ /* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */ /* *************** *** 42,48 **** #include #include #include - #include #include #include #include --- 42,47 ---- *************** *** 338,346 **** case AF_INET6: afname = "Internet6"; break; - case AF_IPX: - afname = "IPX"; - break; case PF_KEY: afname = "Encap"; break; --- 337,342 ---- *************** *** 568,576 **** return (routename6(&sin6)); } - case AF_IPX: - return (ipx_print(sa)); - case AF_LINK: return (link_print(sa)); --- 564,569 ---- *************** *** 778,785 **** case AF_INET6: return netname6((struct sockaddr_in6 *)sa, (struct sockaddr_in6 *)mask); - case AF_IPX: - return (ipx_print(sa)); case AF_LINK: return (link_print(sa)); default: --- 771,776 ---- *************** *** 808,864 **** } while (--len > 0 && (out + 3) < &obuf[sizeof(obuf) - 1]); out[-1] = '\0'; 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 * --- 799,804 ----