diff options
author | Jared Yanovich <jaredy@cvs.openbsd.org> | 2004-09-22 01:07:11 +0000 |
---|---|---|
committer | Jared Yanovich <jaredy@cvs.openbsd.org> | 2004-09-22 01:07:11 +0000 |
commit | 11972f0b2d3e009ccce100e7a0991b23f6673c0b (patch) | |
tree | 03ce8ca6f8ff180238fa91a449d0db2999df7b4d | |
parent | ed7dec2ffeafbe66f75b1e4ad5e236abb63b5aa2 (diff) |
remove -S, -src, -srcmask, and other source routing stuff. ok henning
-rw-r--r-- | sbin/route/keywords.c | 4 | ||||
-rw-r--r-- | sbin/route/keywords.h | 12 | ||||
-rw-r--r-- | sbin/route/keywords.sh | 4 | ||||
-rw-r--r-- | sbin/route/route.c | 91 | ||||
-rw-r--r-- | sbin/route/show.c | 47 | ||||
-rw-r--r-- | sbin/route/show.h | 4 |
6 files changed, 44 insertions, 118 deletions
diff --git a/sbin/route/keywords.c b/sbin/route/keywords.c index f229e7dad5f..be9ad7e7fb1 100644 --- a/sbin/route/keywords.c +++ b/sbin/route/keywords.c @@ -1,4 +1,4 @@ -/* $OpenBSD: keywords.c,v 1.10 2004/08/03 11:23:11 henning Exp $ */ +/* $OpenBSD: keywords.c,v 1.11 2004/09/22 01:07:10 jaredy Exp $ */ /* WARNING! This file was generated by keywords.sh */ @@ -49,8 +49,6 @@ struct keytab keywords[] = { {"sa", K_SA}, {"sendpipe", K_SENDPIPE}, {"show", K_SHOW}, - {"src", K_SRC}, - {"srcmask", K_SRCMASK}, {"ssthresh", K_SSTHRESH}, {"static", K_STATIC}, {"x25", K_X25}, diff --git a/sbin/route/keywords.h b/sbin/route/keywords.h index 6863b02ca9c..1c1841d5996 100644 --- a/sbin/route/keywords.h +++ b/sbin/route/keywords.h @@ -1,4 +1,4 @@ -/* $OpenBSD: keywords.h,v 1.10 2004/08/03 11:23:11 henning Exp $ */ +/* $OpenBSD: keywords.h,v 1.11 2004/09/22 01:07:10 jaredy Exp $ */ /* WARNING! This file was generated by keywords.sh */ @@ -51,9 +51,7 @@ extern struct keytab { #define K_SA 41 #define K_SENDPIPE 42 #define K_SHOW 43 -#define K_SRC 44 -#define K_SRCMASK 45 -#define K_SSTHRESH 46 -#define K_STATIC 47 -#define K_X25 48 -#define K_XRESOLVE 49 +#define K_SSTHRESH 44 +#define K_STATIC 45 +#define K_X25 46 +#define K_XRESOLVE 47 diff --git a/sbin/route/keywords.sh b/sbin/route/keywords.sh index aaa2a4c3260..87bea06afbe 100644 --- a/sbin/route/keywords.sh +++ b/sbin/route/keywords.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: keywords.sh,v 1.9 2004/08/03 11:23:11 henning Exp $ +# $OpenBSD: keywords.sh,v 1.10 2004/09/22 01:07:10 jaredy Exp $ # $NetBSD: keywords.sh,v 1.2 1996/11/15 18:57:21 gwr Exp $ # @(#)keywords 8.2 (Berkeley) 3/19/94 # @@ -52,8 +52,6 @@ rttvar sa sendpipe show -src -srcmask ssthresh static x25 diff --git a/sbin/route/route.c b/sbin/route/route.c index b21e13ecbea..43c997dece3 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.74 2004/09/15 23:40:29 deraadt Exp $ */ +/* $OpenBSD: route.c,v 1.75 2004/09/22 01:07:10 jaredy Exp $ */ /* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */ /* @@ -40,7 +40,7 @@ static const char copyright[] = #if 0 static const char sccsid[] = "@(#)route.c 8.3 (Berkeley) 3/19/94"; #else -static const char rcsid[] = "$OpenBSD: route.c,v 1.74 2004/09/15 23:40:29 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: route.c,v 1.75 2004/09/22 01:07:10 jaredy Exp $"; #endif #endif /* not lint */ @@ -85,13 +85,13 @@ union sockunion { struct sockaddr_x25 sx25; struct sockaddr_rtin rtin; struct sockaddr_rtlabel rtlabel; -} so_dst, so_gate, so_mask, so_genmask, so_ifa, so_ifp, so_src, so_srcmask, so_label; +} so_dst, so_gate, so_mask, so_genmask, so_ifa, so_ifp, so_label; typedef union sockunion *sup; pid_t pid; int rtm_addrs, s; int forcehost, forcenet, nflag, af, qflag, tflag, keyword(char *); -int Sflag, iflag, verbose, aflen = sizeof (struct sockaddr_in); +int iflag, verbose, aflen = sizeof (struct sockaddr_in); int locking, lockrest, debugonly; struct rt_metrics rt_metrics; u_long rtm_inits; @@ -119,7 +119,7 @@ int x25_makemask(void); __dead void usage(char *); void quit(char *); void set_metric(char *, int); -void inet_makenetandmask(u_int32_t, struct sockaddr_in *, int, int); +void inet_makenetandmask(u_int32_t, struct sockaddr_in *, int); void interfaces(void); void getlabel(char *); @@ -162,7 +162,7 @@ main(int argc, char **argv) if (argc < 2) usage(NULL); - while ((ch = getopt(argc, argv, "nqdtvS")) != -1) + while ((ch = getopt(argc, argv, "dnqtv")) != -1) switch(ch) { case 'n': nflag = 1; @@ -179,9 +179,6 @@ main(int argc, char **argv) case 'd': debugonly = 1; break; - case 'S': - Sflag = 1; - break; default: usage(NULL); } @@ -363,7 +360,7 @@ set_metric(char *value, int key) int newroute(int argc, char **argv) { - char *cmd, *dest = "", *source = "", *gateway = "", *err; + char *cmd, *dest = "", *gateway = "", *err; int ishost = 0, ret = 0, attempts, oerrno, flags = RTF_STATIC; int key, mpath = 0; struct hostent *hp = 0; @@ -471,17 +468,6 @@ newroute(int argc, char **argv) ishost = getaddr(RTA_DST, *++argv, &hp); dest = *argv; break; - case K_SRC: - if (!--argc) - usage(1+*argv); - (void) getaddr(RTA_SRC, *++argv, 0); - source = *argv; - break; - case K_SRCMASK: - if (!--argc) - usage(1+*argv); - (void) getaddr(RTA_SRCMASK, *++argv, 0); - break; case K_LABEL: if (!--argc) usage(1+*argv); @@ -519,7 +505,7 @@ newroute(int argc, char **argv) usage(1+*argv); } } else { - if ((rtm_addrs & (RTA_DST|RTA_SRC)) == 0) { + if ((rtm_addrs & RTA_DST) == 0) { dest = *argv; ishost = getaddr(RTA_DST, *argv, &hp); } else if ((rtm_addrs & RTA_GATEWAY) == 0) { @@ -562,11 +548,6 @@ newroute(int argc, char **argv) flags |= RTF_HOST; if (iflag == 0) flags |= RTF_GATEWAY; - if (rtm_addrs & (RTA_SRC|RTA_SRCMASK)) { - if (!(rtm_addrs & RTA_DST)) - getaddr(RTA_DST, "default", &hp); - flags |= RTF_SOURCE; - } for (attempts = 1; ; attempts++) { errno = 0; if ((ret = rtmsg(*cmd, flags)) == 0) @@ -585,8 +566,6 @@ newroute(int argc, char **argv) oerrno = errno; if (!qflag) { (void) printf("%s %s %s", cmd, ishost? "host" : "net", dest); - if (*source) - (void) printf(": source %s", source); if (*gateway) { (void) printf(": gateway %s", gateway); if (attempts > 1 && ret == 0 && af == AF_INET) @@ -648,16 +627,16 @@ show(int argc, char *argv[]) bad: usage(*argv); } - p_rttables(af, 0, Sflag); + p_rttables(af, 0); } void -inet_makenetandmask(u_int32_t net, struct sockaddr_in *sin, int bits, int which) +inet_makenetandmask(u_int32_t net, struct sockaddr_in *sin, int bits) { u_int32_t addr, mask = 0; char *cp; - rtm_addrs |= (which == RTA_DST) ? RTA_NETMASK : RTA_SRCMASK; + rtm_addrs |= RTA_NETMASK; if (net == 0) mask = addr = 0; else if (bits) { @@ -685,7 +664,7 @@ inet_makenetandmask(u_int32_t net, struct sockaddr_in *sin, int bits, int which) } addr &= mask; sin->sin_addr.s_addr = htonl(addr); - sin = (which == RTA_DST) ? &so_mask.sin : &so_srcmask.sin; + sin = &so_mask.sin; sin->sin_addr.s_addr = htonl(mask); sin->sin_len = 0; sin->sin_family = 0; @@ -765,12 +744,6 @@ getaddr(int which, char *s, struct hostent **hpp) case RTA_IFA: su = &so_ifa; break; - case RTA_SRC: - su = &so_src; - break; - case RTA_SRCMASK: - su = &so_srcmask; - break; default: errx(1, "internal error"); } @@ -865,7 +838,7 @@ getaddr(int which, char *s, struct hostent **hpp) case AF_INET: if (hpp != NULL) *hpp = NULL; - if ((which == RTA_DST || which == RTA_SRC) && !forcehost) { + if (which == RTA_DST && !forcehost) { bits = inet_net_pton(AF_INET, s, &su->sin.sin_addr, sizeof(su->sin.sin_addr)); if (bits == 32) @@ -873,13 +846,12 @@ getaddr(int which, char *s, struct hostent **hpp) if (bits >= 0) { inet_makenetandmask(ntohl( su->sin.sin_addr.s_addr), - &su->sin, bits, which); + &su->sin, bits); return (0); } np = getnetbyname(s); if (np != NULL && np->n_net != 0) { - inet_makenetandmask(np->n_net, &su->sin, 0, - which); + inet_makenetandmask(np->n_net, &su->sin, 0); return (0); } if (forcenet) @@ -1063,16 +1035,12 @@ rtmsg(int cmd, int flags) if (rtm_addrs & RTA_NETMASK) mask_addr(&so_dst, &so_mask, RTA_DST); - if (rtm_addrs & RTA_SRCMASK) - mask_addr(&so_src, &so_srcmask, RTA_SRC); NEXTADDR(RTA_DST, so_dst); NEXTADDR(RTA_GATEWAY, so_gate); NEXTADDR(RTA_NETMASK, so_mask); NEXTADDR(RTA_GENMASK, so_genmask); NEXTADDR(RTA_IFP, so_ifp); NEXTADDR(RTA_IFA, so_ifa); - NEXTADDR(RTA_SRC, so_src); - NEXTADDR(RTA_SRCMASK, so_srcmask); NEXTADDR(RTA_LABEL, so_label); rtm.rtm_msglen = l = cp - (char *)&m_rtmsg; if (verbose) @@ -1154,11 +1122,13 @@ char *msgtypes[] = { char metricnames[] = "\011pksent\010rttvar\7rtt\6ssthresh\5sendpipe\4recvpipe\3expire\2hopcount\1mtu"; char routeflags[] = -"\1UP\2GATEWAY\3HOST\4REJECT\5DYNAMIC\6MODIFIED\7DONE\010MASK_PRESENT\011CLONING\012XRESOLVE\013LLINFO\014STATIC\015BLACKHOLE\016PROTO3\017PROTO2\020PROTO1\021CLONED\022SOURCE"; +"\1UP\2GATEWAY\3HOST\4REJECT\5DYNAMIC\6MODIFIED\7DONE\010MASK_PRESENT\011CLONING" +"\012XRESOLVE\013LLINFO\014STATIC\015BLACKHOLE\016PROTO3\017PROTO2\020PROTO1\021CLONED"; char ifnetflags[] = -"\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5PTP\6NOTRAILERS\7RUNNING\010NOARP\011PPROMISC\012ALLMULTI\013OACTIVE\014SIMPLEX\015LINK0\016LINK1\017LINK2\020MULTICAST"; +"\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5PTP\6NOTRAILERS\7RUNNING\010NOARP\011PPROMISC" +"\012ALLMULTI\013OACTIVE\014SIMPLEX\015LINK0\016LINK1\017LINK2\020MULTICAST"; char addrnames[] = -"\1DST\2GATEWAY\3NETMASK\4GENMASK\5IFP\6IFA\7AUTHOR\010BRD\011SRC\012SRCMASK\13LABEL"; +"\1DST\2GATEWAY\3NETMASK\4GENMASK\5IFP\6IFA\7AUTHOR\010BRD\13LABEL"; void print_rtmsg(struct rt_msghdr *rtm, int msglen) @@ -1228,7 +1198,6 @@ void print_getmsg(struct rt_msghdr *rtm, int msglen) { struct sockaddr *dst = NULL, *gate = NULL, *mask = NULL; - struct sockaddr *src = NULL, *srcmask = NULL; struct sockaddr_dl *ifp = NULL; struct sockaddr_rtlabel *sa_rl = NULL; struct sockaddr *sa; @@ -1267,12 +1236,6 @@ print_getmsg(struct rt_msghdr *rtm, int msglen) case RTA_NETMASK: mask = sa; break; - case RTA_SRC: - src = sa; - break; - case RTA_SRCMASK: - srcmask = sa; - break; case RTA_IFP: if (sa->sa_family == AF_LINK && ((struct sockaddr_dl *)sa)->sdl_nlen) @@ -1295,17 +1258,6 @@ print_getmsg(struct rt_msghdr *rtm, int msglen) (void)printf(" mask: %s\n", routename(mask)); nflag = savenflag; } - if (src && srcmask) - srcmask->sa_family = src->sa_family; /* XXX */ - if (src) - (void)printf(" source: %s\n", routename(src)); - if (srcmask) { - int savenflag = nflag; - - nflag = 1; - (void)printf(" mask: %s\n", routename(mask)); - nflag = savenflag; - } if (gate && rtm->rtm_flags & RTF_GATEWAY) (void)printf(" gateway: %s\n", routename(gate)); if (ifp) @@ -1334,8 +1286,7 @@ print_getmsg(struct rt_msghdr *rtm, int msglen) printf("%8d%c\n", (int)rtm->rtm_rmx.rmx_expire, lock(EXPIRE)); #undef lock #undef msec -#define RTA_IGN (RTA_DST|RTA_GATEWAY|RTA_NETMASK|RTA_SRC|RTA_SRCMASK| \ - RTA_IFP|RTA_IFA|RTA_BRD) +#define RTA_IGN (RTA_DST|RTA_GATEWAY|RTA_NETMASK|RTA_IFP|RTA_IFA|RTA_BRD) if (verbose) pmsg_common(rtm); else if (rtm->rtm_addrs &~ RTA_IGN) { diff --git a/sbin/route/show.c b/sbin/route/show.c index cc110a8da4f..a853938239c 100644 --- a/sbin/route/show.c +++ b/sbin/route/show.c @@ -1,4 +1,4 @@ -/* $OpenBSD: show.c,v 1.35 2004/09/21 02:45:52 jaredy Exp $ */ +/* $OpenBSD: show.c,v 1.36 2004/09/22 01:07:10 jaredy Exp $ */ /* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94"; #else -static const char rcsid[] = "$OpenBSD: show.c,v 1.35 2004/09/21 02:45:52 jaredy Exp $"; +static const char rcsid[] = "$OpenBSD: show.c,v 1.36 2004/09/22 01:07:10 jaredy Exp $"; #endif #endif /* not lint */ @@ -95,12 +95,11 @@ static const struct bits bits[] = { { RTF_PROTO2, '2' }, { RTF_PROTO3, '3' }, { RTF_CLONED, 'c' }, - { RTF_SOURCE, 's' }, { 0 } }; -void pr_rthdr(int, int, int); -void p_rtentry(struct rt_msghdr *, int, int); +void pr_rthdr(int, int); +void p_rtentry(struct rt_msghdr *, int); void pr_family(int); void p_sockaddr(struct sockaddr *, struct sockaddr *, int, int); void p_flags(int, char *); @@ -114,7 +113,7 @@ char *any_ntoa(const struct sockaddr *); * Print routing tables. */ void -p_rttables(int af, int Aflag, int Sflag) +p_rttables(int af, int Aflag) { struct rt_msghdr *rtm; char *buf = NULL, *next, *lim = NULL; @@ -152,7 +151,7 @@ p_rttables(int af, int Aflag, int Sflag) sa = (struct sockaddr *)(rtm + 1); if (af != AF_UNSPEC && sa->sa_family != af) continue; - p_rtentry(rtm, Aflag, Sflag); + p_rtentry(rtm, Aflag); } free(buf); } @@ -179,23 +178,15 @@ p_rttables(int af, int Aflag, int Sflag) * Print header for routing table columns. */ void -pr_rthdr(int af, int Aflag, int Sflag) +pr_rthdr(int af, int Aflag) { if (Aflag) printf("%-*.*s ", PLEN, PLEN, "Address"); if (af != PF_KEY) - if (af == AF_INET && Sflag) - printf("%-*.*s %-*.*s %-*.*s %-6.6s " - "%6.6s %8.8s %6.6s %s\n", - WID_DST(af), WID_DST(af), "Source", - WID_DST(af), WID_DST(af), "Destination", - WID_GW(af), WID_GW(af), "Gateway", - "Flags", "Refs", "Use", "Mtu", "Interface"); - else - printf("%-*.*s %-*.*s %-6.6s %6.6s %8.8s %6.6s %s\n", - WID_DST(af), WID_DST(af), "Destination", - WID_GW(af), WID_GW(af), "Gateway", - "Flags", "Refs", "Use", "Mtu", "Interface"); + printf("%-*.*s %-*.*s %-6.6s %6.6s %8.8s %6.6s %s\n", + WID_DST(af), WID_DST(af), "Destination", + WID_GW(af), WID_GW(af), "Gateway", + "Flags", "Refs", "Use", "Mtu", "Interface"); else printf("%-18s %-5s %-18s %-5s %-5s %-22s\n", "Source", "Port", "Destination", @@ -221,9 +212,9 @@ get_rtaddrs(int addrs, struct sockaddr *sa, struct sockaddr **rti_info) * Print a routing table entry. */ void -p_rtentry(rtm, Aflag, Sflag) +p_rtentry(rtm, Aflag) struct rt_msghdr *rtm; - int Aflag, Sflag; + int Aflag; { static int old_af = -1; struct sockaddr *sa = (struct sockaddr *)(rtm + 1); @@ -234,7 +225,7 @@ p_rtentry(rtm, Aflag, Sflag) if (old_af != sa->sa_family) { old_af = sa->sa_family; pr_family(sa->sa_family); - pr_rthdr(sa->sa_family, Aflag, Sflag); + pr_rthdr(sa->sa_family, Aflag); } get_rtaddrs(rtm->rtm_addrs, sa, rti_info); @@ -242,16 +233,6 @@ p_rtentry(rtm, Aflag, Sflag) if ((sa = rti_info[RTAX_DST]) == NULL) return; - if (old_af == AF_INET && Sflag) { - if (rti_info[RTAX_SRC] != NULL) - p_sockaddr(rti_info[RTAX_SRC], - rti_info[RTAX_SRCMASK], - rti_info[RTAX_SRCMASK] ? 0 : RTF_HOST, - WID_DST(sa->sa_family)); - else - printf("%-*s ", WID_DST(AF_INET), "default"); - } - p_sockaddr(sa, mask, rtm->rtm_flags, WID_DST(sa->sa_family)); p_sockaddr(rti_info[RTAX_GATEWAY], 0, RTF_HOST, WID_GW(sa->sa_family)); p_flags(rtm->rtm_flags, "%-6.6s "); diff --git a/sbin/route/show.h b/sbin/route/show.h index 88f2f53eadd..73c7cc8b75a 100644 --- a/sbin/route/show.h +++ b/sbin/route/show.h @@ -1,4 +1,4 @@ -/* $OpenBSD: show.h,v 1.1 2004/06/12 09:40:49 claudio Exp $ */ +/* $OpenBSD: show.h,v 1.2 2004/09/22 01:07:10 jaredy Exp $ */ /* * Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org> @@ -19,7 +19,7 @@ #ifndef __UTILS_H__ #define __UTILS_H__ -void p_rttables(int, int, int); +void p_rttables(int, int); char *routename(struct sockaddr *); char *netname(struct sockaddr *, struct sockaddr *); char *any_ntoa(const struct sockaddr *); |