diff options
author | julian <julian@FreeBSD.org> | 1996-07-09 19:02:28 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 1996-07-09 19:02:28 +0000 |
commit | ba8d9388bd19ffc402d860c2376f96c7e618e193 (patch) | |
tree | 24f83308465f14033b3f5c7b106426f5cf349dbb /sbin | |
parent | 09d5c22b13fb2393e602fe00723c07a75fdf32dd (diff) | |
download | FreeBSD-src-ba8d9388bd19ffc402d860c2376f96c7e618e193.zip FreeBSD-src-ba8d9388bd19ffc402d860c2376f96c7e618e193.tar.gz |
changes to allow route to manipulate appletalk routes.
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/route/keywords | 1 | ||||
-rw-r--r-- | sbin/route/route.8 | 8 | ||||
-rw-r--r-- | sbin/route/route.c | 55 |
3 files changed, 61 insertions, 3 deletions
diff --git a/sbin/route/keywords b/sbin/route/keywords index e486042..b031a9e 100644 --- a/sbin/route/keywords +++ b/sbin/route/keywords @@ -1,6 +1,7 @@ # @(#)keywords 8.2 (Berkeley) 3/19/94 add +atalk blackhole change cloning diff --git a/sbin/route/route.8 b/sbin/route/route.8 index 53ed6e6..42b2678 100644 --- a/sbin/route/route.8 +++ b/sbin/route/route.8 @@ -117,6 +117,7 @@ will ``flush'' the routing tables of all gateway entries. When the address family may is specified by any of the .Fl osi , .Fl xns , +.Fl atalk , or .Fl inet modifiers, only routes having destinations with addresses in the @@ -180,11 +181,14 @@ indicating the interface to be used for transmission. The optional modifiers .Fl xns , .Fl osi , +.Fl atalk , and .Fl link specify that all subsequent addresses are in the -.Tn XNS -.Tn OSI +.Tn XNS , +.Tn OSI , +or +.Tn AppleTalk address families, or are specified as link-level addresses, and the names must be numeric specifications rather than diff --git a/sbin/route/route.c b/sbin/route/route.c index 5d9c54e..a0239b7 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -43,7 +43,7 @@ static const char copyright[] = static char sccsid[] = "@(#)route.c 8.3 (Berkeley) 3/19/94"; */ static const char rcsid[] = - "$Id: route.c,v 1.7 1996/02/17 21:13:32 mpp Exp $"; + "$Id: route.c,v 1.8 1996/05/08 20:48:59 wollman Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -57,6 +57,7 @@ static const char rcsid[] = #include <net/route.h> #include <net/if_dl.h> #include <netinet/in.h> +#include <netatalk/at.h> #ifdef NS #include <netns/ns.h> #endif @@ -91,6 +92,7 @@ struct ortentry route; union sockunion { struct sockaddr sa; struct sockaddr_in sin; + struct sockaddr_at sat; #ifdef NS struct sockaddr_ns sns; #endif @@ -112,6 +114,8 @@ int locking, lockrest, debugonly; struct rt_metrics rt_metrics; u_long rtm_inits; struct in_addr inet_makeaddr(); +int atalk_aton __P((const char *, struct at_addr *)); +char *atalk_ntoa __P((struct at_addr)); char *routename(), *netname(); void flushroutes(), newroute(), monitor(), sockaddr(), sodump(), bprintf(); void print_getmsg(), print_rtmsg(), pmsg_common(), pmsg_addrs(), mask_addr(); @@ -233,6 +237,9 @@ flushroutes(argc, argv) case K_INET: af = AF_INET; break; + case K_ATALK: + af = AF_APPLETALK; + break; #ifdef NS case K_XNS: af = AF_NS; @@ -365,6 +372,11 @@ routename(sa) break; } + case AF_APPLETALK: + (void) snprintf(line, sizeof(line), "atalk %s", + atalk_ntoa(((struct sockaddr_at *)sa)->sat_addr)); + break; + #ifdef NS case AF_NS: return (ns_print((struct sockaddr_ns *)sa)); @@ -462,6 +474,11 @@ netname(sa) break; } + case AF_APPLETALK: + (void) snprintf(line, sizeof(line), "atalk %s", + atalk_ntoa(((struct sockaddr_at *)sa)->sat_addr)); + break; + #ifdef NS case AF_NS: return (ns_print((struct sockaddr_ns *)sa)); @@ -552,6 +569,10 @@ newroute(argc, argv) af = AF_INET; aflen = sizeof(struct sockaddr_in); break; + case K_ATALK: + af = AF_APPLETALK; + aflen = sizeof(struct sockaddr_at); + break; #ifdef CCITT case K_X25: af = AF_CCITT; @@ -867,6 +888,11 @@ getaddr(which, s, hpp) return (1); #endif + case AF_APPLETALK: + if (!atalk_aton(s, &su->sat.sat_addr)) + errx(EX_NOHOST, "bad address: %s", s); + return(su->sat.sat_addr.s_node != 0); + case AF_LINK: link_addr(s, &su->sdl); return (1); @@ -1121,6 +1147,7 @@ mask_addr() case AF_NS: #endif case AF_INET: + case AF_APPLETALK: #ifdef CCITT case AF_CCITT: #endif @@ -1411,6 +1438,10 @@ sodump(su, which) (void) printf("%s: inet %s; ", which, inet_ntoa(su->sin.sin_addr)); break; + case AF_APPLETALK: + (void) printf("%s: atalk %s; ", + which, atalk_ntoa(su->sat.sat_addr)); + break; #ifdef NS case AF_NS: (void) printf("%s: xns %s; ", @@ -1473,3 +1504,25 @@ sockaddr(addr, sa) } while (cp < cplim); sa->sa_len = cp - (char *)sa; } + +int +atalk_aton(const char *text, struct at_addr *addr) +{ + u_int net, node; + + if (sscanf(text, "%u.%u", &net, &node) != 2 + || net > 0xffff || node > 0xff) + return(0); + addr->s_net = net; + addr->s_node = node; + return(1); +} + +char * +atalk_ntoa(struct at_addr at) +{ + static char buf[20]; + + (void) snprintf(buf, sizeof(buf), "%u.%u", at.s_net, at.s_node); + return(buf); +} |