diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 1996-08-16 09:26:12 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 1996-08-16 09:26:12 +0000 |
commit | 9e1e83a0e7fb47df10ae0985cabf2316562d900d (patch) | |
tree | 278ead732d26ba4d1134ffe59feeeb23670a0c6f | |
parent | cd1cc82135488823648bce9f5b8567132b5b8898 (diff) |
ipx.
-rw-r--r-- | sbin/route/keywords | 3 | ||||
-rw-r--r-- | sbin/route/route.8 | 3 | ||||
-rw-r--r-- | sbin/route/route.c | 87 |
3 files changed, 89 insertions, 4 deletions
diff --git a/sbin/route/keywords b/sbin/route/keywords index 23990a1a7a8..5122d760a0d 100644 --- a/sbin/route/keywords +++ b/sbin/route/keywords @@ -1,4 +1,4 @@ -# $OpenBSD: keywords,v 1.2 1996/06/23 14:32:22 deraadt Exp $ +# $OpenBSD: keywords,v 1.3 1996/08/16 09:26:10 mickey Exp $ # $NetBSD: keywords,v 1.6 1995/04/20 17:39:17 mycroft Exp $ # @(#)keywords 8.2 (Berkeley) 3/19/94 @@ -20,6 +20,7 @@ interface ifa ifp inet +ipx iso link llinfo diff --git a/sbin/route/route.8 b/sbin/route/route.8 index 0e406a471de..4d78598f60a 100644 --- a/sbin/route/route.8 +++ b/sbin/route/route.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: route.8,v 1.2 1996/06/23 14:32:22 deraadt Exp $ +.\" $OpenBSD: route.8,v 1.3 1996/08/16 09:26:10 mickey Exp $ .\" $NetBSD: route.8,v 1.6 1995/03/18 15:00:13 cgd Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 @@ -316,6 +316,7 @@ to create the new entry. .Xr esis 4 , .Xr routed 8 , .Xr XNSrouted 8 +.Xr IPXrouted 8 .Sh HISTORY The .Nm diff --git a/sbin/route/route.c b/sbin/route/route.c index 359f52f5db3..b3372235c23 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.7 1996/08/15 19:06:09 deraadt Exp $ */ +/* $OpenBSD: route.c,v 1.8 1996/08/16 09:26:11 mickey Exp $ */ /* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)route.c 8.3 (Berkeley) 3/19/94"; #else -static char rcsid[] = "$OpenBSD: route.c,v 1.7 1996/08/15 19:06:09 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: route.c,v 1.8 1996/08/16 09:26:11 mickey Exp $"; #endif #endif /* not lint */ @@ -60,6 +60,7 @@ static char rcsid[] = "$OpenBSD: route.c,v 1.7 1996/08/15 19:06:09 deraadt Exp $ #include <net/if_dl.h> #include <netinet/in.h> #include <netns/ns.h> +#include <netipx/ipx.h> #include <netiso/iso.h> #include <netccitt/x25.h> #include <arpa/inet.h> @@ -86,6 +87,7 @@ union sockunion { struct sockaddr sa; struct sockaddr_in sin; struct sockaddr_ns sns; + struct sockaddr_ipx sipx; struct sockaddr_iso siso; struct sockaddr_dl sdl; struct sockaddr_x25 sx25; @@ -233,6 +235,9 @@ flushroutes(argc, argv) case K_XNS: af = AF_NS; break; + case K_IPX: + af = AF_IPX; + break; case K_LINK: af = AF_LINK; break; @@ -313,6 +318,7 @@ routename(sa) static char domain[MAXHOSTNAMELEN + 1]; static int first = 1; char *ns_print(); + char *ipx_print(); if (first) { first = 0; @@ -358,6 +364,9 @@ routename(sa) case AF_NS: return (ns_print((struct sockaddr_ns *)sa)); + case AF_IPX: + return (ipx_print((struct sockaddr_ipx *)sa)); + case AF_LINK: return (link_ntoa((struct sockaddr_dl *)sa)); @@ -394,6 +403,7 @@ netname(sa) register u_long i; int subnetshift; char *ns_print(); + char *ipx_print(); switch (sa->sa_family) { @@ -450,6 +460,9 @@ netname(sa) case AF_NS: return (ns_print((struct sockaddr_ns *)sa)); + case AF_IPX: + return (ipx_print((struct sockaddr_ipx *)sa)); + case AF_LINK: return (link_ntoa((struct sockaddr_dl *)sa)); @@ -543,6 +556,10 @@ newroute(argc, argv) af = AF_NS; aflen = sizeof(struct sockaddr_ns); break; + case K_IPX: + af = AF_IPX; + aflen = sizeof(struct sockaddr_ipx); + break; case K_IFACE: case K_INTERFACE: iflag++; @@ -773,6 +790,7 @@ getaddr(which, s, hpp) { register sup su; struct ns_addr ns_addr(); + struct ipx_addr ipx_addr(); struct iso_addr *iso_addr(); struct hostent *hp; struct netent *np; @@ -837,6 +855,19 @@ getaddr(which, s, hpp) su->sns.sns_addr = ns_addr(s); return (!ns_nullhost(su->sns.sns_addr)); + case AF_IPX: + if (which == RTA_DST) { + extern short ipx_bh[3]; + struct sockaddr_ipx *sms = &(so_mask.sipx); + memset(sms, 0, sizeof(*sms)); + sms->sipx_family = 0; + sms->sipx_len = 6; + sms->sipx_addr.ipx_net = *(union ipx_net *)ipx_bh; + rtm_addrs |= RTA_NETMASK; + } + su->sipx.sipx_addr = ipx_addr(s); + return (!ipx_nullhost(su->sipx.sipx_addr)); + case AF_OSI: su->siso.siso_addr = *iso_addr(s); if (which == RTA_NETMASK || which == RTA_GENMASK) { @@ -958,6 +989,53 @@ ns_print(sns) return (mybuf); } +short ipx_nullh[] = {0,0,0}; +short ipx_bh[] = {-1,-1,-1}; + +char * +ipx_print(sipx) + struct sockaddr_ipx *sipx; +{ + struct ipx_addr work; + union { union ipx_net net_e; u_long long_e; } net; + u_short port; + static char mybuf[50], cport[10], chost[25]; + char *host = ""; + register char *p; + register 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) sprintf(mybuf, "*.%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) sprintf(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) sprintf(cport, ".%XH", htons(port)); + else + *cport = 0; + + (void) sprintf(mybuf,"%XH.%s%s", ntohl(net.long_e), host, cport); + return (mybuf); +} + void interfaces() { @@ -1094,6 +1172,7 @@ mask_addr() return; switch (so_dst.sa.sa_family) { case AF_NS: + case AF_IPX: case AF_INET: case AF_CCITT: case 0: @@ -1377,6 +1456,10 @@ sodump(su, which) (void) printf("%s: xns %s; ", which, ns_ntoa(su->sns.sns_addr)); break; + case AF_IPX: + (void) printf("%s: ipx %s; ", + which, ipx_ntoa(su->sipx.sipx_addr)); + break; } (void) fflush(stdout); } |