=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/netstat/route.c,v retrieving revision 1.69 retrieving revision 1.70 diff -c -r1.69 -r1.70 *** src/usr.bin/netstat/route.c 2005/06/07 00:53:25 1.69 --- src/usr.bin/netstat/route.c 2005/06/08 04:47:04 1.70 *************** *** 1,4 **** ! /* $OpenBSD: route.c,v 1.69 2005/06/07 00:53:25 henning Exp $ */ /* $NetBSD: route.c,v 1.15 1996/05/07 02:55:06 thorpej Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: route.c,v 1.70 2005/06/08 04:47:04 henning Exp $ */ /* $NetBSD: route.c,v 1.15 1996/05/07 02:55:06 thorpej Exp $ */ /* *************** *** 34,40 **** #if 0 static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94"; #else ! static char *rcsid = "$OpenBSD: route.c,v 1.69 2005/06/07 00:53:25 henning Exp $"; #endif #endif /* not lint */ --- 34,40 ---- #if 0 static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94"; #else ! static char *rcsid = "$OpenBSD: route.c,v 1.70 2005/06/08 04:47:04 henning Exp $"; #endif #endif /* not lint */ *************** *** 52,59 **** #include #include - #include - #include #include --- 52,57 ---- *************** *** 196,204 **** afname = "Internet6"; break; #endif - case AF_NS: - afname = "XNS"; - break; case AF_IPX: afname = "IPX"; break; --- 194,199 ---- *************** *** 494,503 **** } #endif - case AF_NS: - cp = ns_print(sa); - break; - case AF_IPX: cp = ipx_print(sa); break; --- 489,494 ---- *************** *** 850,924 **** rtstat.rts_unreach, plural(rtstat.rts_unreach)); printf("\t%u use%s of a wildcard route\n", rtstat.rts_wildcard, plural(rtstat.rts_wildcard)); - } - - short ns_nullh[] = {0,0,0}; - short ns_bh[] = {-1,-1,-1}; - - char * - ns_print(struct sockaddr *sa) - { - struct sockaddr_ns *sns = (struct sockaddr_ns*)sa; - struct ns_addr work; - union { union ns_net net_e; u_long long_e; } net; - in_port_t port; - static char mybuf[50], cport[10], chost[25]; - char *host = ""; - char *p; - u_char *q; - - work = sns->sns_addr; - port = ntohs(work.x_port); - work.x_port = 0; - net.net_e = work.x_net; - if (ns_nullhost(work) && net.long_e == 0) { - if (port ) { - snprintf(mybuf, sizeof mybuf, "*.%xH", port); - upHex(mybuf); - } else - snprintf(mybuf, sizeof mybuf, "*.*"); - return (mybuf); - } - - if (bcmp(ns_bh, work.x_host.c_host, 6) == 0) { - host = "any"; - } else if (bcmp(ns_nullh, work.x_host.c_host, 6) == 0) { - host = "*"; - } else { - q = work.x_host.c_host; - 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++) - continue; - host = p; - } - if (port) - snprintf(cport, sizeof cport, ".%xH", htons(port)); - else - *cport = 0; - - snprintf(mybuf, sizeof mybuf, "%xH.%s%s", ntohl(net.long_e), - host, cport); - upHex(mybuf); - return(mybuf); - } - - char * - ns_phost(struct sockaddr *sa) - { - struct sockaddr_ns *sns = (struct sockaddr_ns *)sa; - struct sockaddr_ns work; - static union ns_net ns_zeronet; - char *p; - - work = *sns; - work.sns_addr.x_port = 0; - work.sns_addr.x_net = ns_zeronet; - - p = ns_print((struct sockaddr *)&work); - if (strncmp("0H.", p, 3) == 0) - p += 3; - return(p); } u_short ipx_nullh[] = {0,0,0}; --- 841,846 ----