version 1.69, 2005/06/07 00:53:25 |
version 1.70, 2005/06/08 04:47:04 |
|
|
#include <netinet/in.h> |
#include <netinet/in.h> |
#include <arpa/inet.h> |
#include <arpa/inet.h> |
|
|
#include <netns/ns.h> |
|
|
|
#include <netipx/ipx.h> |
#include <netipx/ipx.h> |
|
|
#include <netatalk/at.h> |
#include <netatalk/at.h> |
|
|
afname = "Internet6"; |
afname = "Internet6"; |
break; |
break; |
#endif |
#endif |
case AF_NS: |
|
afname = "XNS"; |
|
break; |
|
case AF_IPX: |
case AF_IPX: |
afname = "IPX"; |
afname = "IPX"; |
break; |
break; |
|
|
} |
} |
#endif |
#endif |
|
|
case AF_NS: |
|
cp = ns_print(sa); |
|
break; |
|
|
|
case AF_IPX: |
case AF_IPX: |
cp = ipx_print(sa); |
cp = ipx_print(sa); |
break; |
break; |
|
|
rtstat.rts_unreach, plural(rtstat.rts_unreach)); |
rtstat.rts_unreach, plural(rtstat.rts_unreach)); |
printf("\t%u use%s of a wildcard route\n", |
printf("\t%u use%s of a wildcard route\n", |
rtstat.rts_wildcard, plural(rtstat.rts_wildcard)); |
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}; |
u_short ipx_nullh[] = {0,0,0}; |