diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2005-03-30 05:34:31 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2005-03-30 05:34:31 +0000 |
commit | bac6b16560c1f4c1ca212b3196c052e320d8fd0b (patch) | |
tree | 69770125235e8393e464875741539c6fb6fa106d /sbin | |
parent | ed92c4bf5049f6cc21e82afd7f383f9ca46dcaff (diff) |
unconditionalize INET6 support, no binary change
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/route/Makefile | 4 | ||||
-rw-r--r-- | sbin/route/route.c | 28 | ||||
-rw-r--r-- | sbin/route/show.c | 42 |
3 files changed, 11 insertions, 63 deletions
diff --git a/sbin/route/Makefile b/sbin/route/Makefile index a7d6db455f8..afd02ebdbc7 100644 --- a/sbin/route/Makefile +++ b/sbin/route/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.7 2005/03/30 05:20:18 henning Exp $ +# $OpenBSD: Makefile,v 1.8 2005/03/30 05:34:30 henning Exp $ PROG= route MAN= route.8 @@ -6,8 +6,6 @@ SRCS= route.c show.c keywords.c BINOWN= root BINMODE=555 -CPPFLAGS+= -DINET6 - route.o .depend lint tags: keywords.h .include <bsd.prog.mk> diff --git a/sbin/route/route.c b/sbin/route/route.c index 443e2fd3911..a4c2e208f3a 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.85 2005/03/30 05:29:04 henning Exp $ */ +/* $OpenBSD: route.c,v 1.86 2005/03/30 05:34:30 henning Exp $ */ /* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */ /* @@ -62,9 +62,7 @@ union sockunion { struct sockaddr sa; struct sockaddr_in sin; -#ifdef INET6 struct sockaddr_in6 sin6; -#endif struct sockaddr_ipx sipx; struct sockaddr_dl sdl; struct sockaddr_rtin rtin; @@ -96,9 +94,7 @@ void pmsg_common(struct rt_msghdr *); void pmsg_addrs(char *, int); void bprintf(FILE *, int, char *); void mask_addr(union sockunion *, union sockunion *, int); -#ifdef INET6 -int inet6_makenetandmask(struct sockaddr_in6 *); -#endif +int inet6_makenetandmask(struct sockaddr_in6 *); int getaddr(int, char *, struct hostent **); int rtmsg(int, int); __dead void usage(char *); @@ -218,11 +214,9 @@ flushroutes(int argc, char **argv) case K_INET: af = AF_INET; break; -#ifdef INET6 case K_INET6: af = AF_INET6; break; -#endif case K_IPX: af = AF_IPX; break; @@ -372,12 +366,10 @@ newroute(int argc, char **argv) af = AF_INET; aflen = sizeof(struct sockaddr_in); break; -#ifdef INET6 case K_INET6: af = AF_INET6; aflen = sizeof(struct sockaddr_in6); break; -#endif case K_SA: af = PF_ROUTE; aflen = sizeof(union sockunion); @@ -590,11 +582,9 @@ show(int argc, char *argv[]) case K_INET: af = AF_INET; break; -#ifdef INET6 case K_INET6: af = AF_INET6; break; -#endif case K_IPX: af = AF_IPX; break; @@ -656,7 +646,6 @@ inet_makenetandmask(u_int32_t net, struct sockaddr_in *sin, int bits) sin->sin_len = 1 + cp - (char *)sin; } -#ifdef INET6 /* * XXX the function may need more improvement... */ @@ -684,7 +673,6 @@ inet6_makenetandmask(struct sockaddr_in6 *sin6) return (0); } } -#endif /* * Interpret an argument as a network address of some kind, @@ -746,7 +734,6 @@ getaddr(int which, char *s, struct hostent **hpp) } switch (afamily) { -#ifdef INET6 case AF_INET6: { struct addrinfo hints, *res; @@ -766,7 +753,6 @@ getaddr(int which, char *s, struct hostent **hpp) errx(1, "%s: resolved to multiple values", s); memcpy(&su->sin6, res->ai_addr, sizeof(su->sin6)); freeaddrinfo(res); -#ifdef __KAME__ if ((IN6_IS_ADDR_LINKLOCAL(&su->sin6.sin6_addr) || IN6_IS_ADDR_MC_LINKLOCAL(&su->sin6.sin6_addr)) && su->sin6.sin6_scope_id) { @@ -774,7 +760,6 @@ getaddr(int which, char *s, struct hostent **hpp) htons(su->sin6.sin6_scope_id); su->sin6.sin6_scope_id = 0; } -#endif if (hints.ai_flags == AI_NUMERICHOST) { if (which == RTA_DST) return (inet6_makenetandmask(&su->sin6)); @@ -782,7 +767,6 @@ getaddr(int which, char *s, struct hostent **hpp) } else return (1); } -#endif case AF_IPX: if (which == RTA_DST) { @@ -856,11 +840,9 @@ prefixlen(char *s) case AF_INET: max = sizeof(struct in_addr) * 8; break; -#ifdef INET6 case AF_INET6: max = sizeof(struct in6_addr) * 8; break; -#endif default: errx(1, "prefixlen is not supported with af %d", af); /* NOTREACHED */ @@ -879,7 +861,6 @@ prefixlen(char *s) so_mask.sin.sin_len = sizeof(struct sockaddr_in); so_mask.sin.sin_addr.s_addr = htonl(0xffffffff << (32 - len)); break; -#ifdef INET6 case AF_INET6: so_mask.sin6.sin6_family = AF_INET6; so_mask.sin6.sin6_len = sizeof(struct sockaddr_in6); @@ -891,7 +872,6 @@ prefixlen(char *s) *((u_char *)&so_mask.sin6.sin6_addr + q) = (0xff00 >> r) & 0xff; break; -#endif } return (len == max); } @@ -1043,9 +1023,7 @@ mask_addr(union sockunion *addr, union sockunion *mask, int which) switch (addr->sa.sa_family) { case AF_IPX: case AF_INET: -#ifdef INET6 case AF_INET6: -#endif case 0: return; } @@ -1333,7 +1311,6 @@ sodump(sup su, char *which) case AF_INET: printf("%s: inet %s; ", which, inet_ntoa(su->sin.sin_addr)); break; -#ifdef INET6 case AF_INET6: { char ntop_buf[NI_MAXHOST]; @@ -1343,7 +1320,6 @@ sodump(sup su, char *which) ntop_buf, sizeof(ntop_buf))); break; } -#endif case AF_IPX: printf("%s: ipx %s; ", which, ipx_ntoa(su->sipx.sipx_addr)); break; diff --git a/sbin/route/show.c b/sbin/route/show.c index 27b5c339016..6dfc05b8c32 100644 --- a/sbin/route/show.c +++ b/sbin/route/show.c @@ -1,4 +1,4 @@ -/* $OpenBSD: show.c,v 1.40 2005/02/18 04:00:21 jaredy Exp $ */ +/* $OpenBSD: show.c,v 1.41 2005/03/30 05:34:30 henning 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.40 2005/02/18 04:00:21 jaredy Exp $"; +static const char rcsid[] = "$OpenBSD: show.c,v 1.41 2005/03/30 05:34:30 henning Exp $"; #endif #endif /* not lint */ @@ -104,9 +104,7 @@ void pr_family(int); void p_sockaddr(struct sockaddr *, struct sockaddr *, int, int); void p_flags(int, char *); char *routename4(in_addr_t); -#ifdef INET6 char *routename6(struct sockaddr_in6 *); -#endif char *any_ntoa(const struct sockaddr *); /* @@ -151,22 +149,13 @@ p_rttables(int af, int Aflag) } } -/* column widths; each followed by one space */ -#ifndef INET6 -#define WID_DST(af) 18 /* width of destination column */ -#define WID_GW(af) 18 /* width of gateway column */ -#else -/* width of destination/gateway column */ -#if 1 -/* strlen("fe80::aaaa:bbbb:cccc:dddd@gif0") == 30, strlen("/128") == 4 */ +/* + * column widths; each followed by one space + * width of destination/gateway column + * strlen("fe80::aaaa:bbbb:cccc:dddd@gif0") == 30, strlen("/128") == 4 + */ #define WID_DST(af) ((af) == AF_INET6 ? (nflag ? 34 : 18) : 18) #define WID_GW(af) ((af) == AF_INET6 ? (nflag ? 30 : 18) : 18) -#else -/* strlen("fe80::aaaa:bbbb:cccc:dddd") == 25, strlen("/128") == 4 */ -#define WID_DST(af) ((af) == AF_INET6 ? (nflag ? 29 : 18) : 18) -#define WID_GW(af) ((af) == AF_INET6 ? (nflag ? 25 : 18) : 18) -#endif -#endif /* INET6 */ /* * Print header for routing table columns. @@ -250,11 +239,9 @@ pr_family(int af) case AF_INET: afname = "Internet"; break; -#ifdef INET6 case AF_INET6: afname = "Internet6"; break; -#endif /* INET6 */ case AF_NS: afname = "XNS"; break; @@ -286,11 +273,9 @@ p_sockaddr(struct sockaddr *sa, struct sockaddr *mask, int flags, int width) char *cp; switch (sa->sa_family) { -#ifdef INET6 case AF_INET6: { struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)sa; -#ifdef __KAME__ struct in6_addr *in6 = &sa6->sin6_addr; /* @@ -304,14 +289,12 @@ p_sockaddr(struct sockaddr *sa, struct sockaddr *mask, int flags, int width) &in6->s6_addr[2]); *(u_short *)&in6->s6_addr[2] = 0; } -#endif if (flags & RTF_HOST) cp = routename((struct sockaddr *)sa6); else cp = netname((struct sockaddr *)sa6, mask); break; } -#endif default: if ((flags & RTF_HOST) || mask == NULL) cp = routename(sa); @@ -371,7 +354,6 @@ routename(struct sockaddr *sa) return (routename4(((struct sockaddr_in *)sa)->sin_addr.s_addr)); -#ifdef INET6 case AF_INET6: { struct sockaddr_in6 sin6; @@ -380,7 +362,6 @@ routename(struct sockaddr *sa) memcpy(&sin6, sa, sa->sa_len); sin6.sin6_len = sizeof(struct sockaddr_in6); sin6.sin6_family = AF_INET6; -#ifdef __KAME__ if (sa->sa_len == sizeof(struct sockaddr_in6) && (IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr) || IN6_IS_ADDR_MC_LINKLOCAL(&sin6.sin6_addr)) && @@ -390,10 +371,8 @@ routename(struct sockaddr *sa) sin6.sin6_addr.s6_addr[2] = 0; sin6.sin6_addr.s6_addr[3] = 0; } -#endif return (routename6(&sin6)); } -#endif case AF_IPX: return (ipx_print(sa)); @@ -443,7 +422,6 @@ routename4(in_addr_t in) return (line); } -#ifdef INET6 char * routename6(struct sockaddr_in6 *sin6) { @@ -461,7 +439,6 @@ routename6(struct sockaddr_in6 *sin6) return (line); } -#endif /* * Return the name of the network whose address is given. @@ -502,7 +479,6 @@ netname4(in_addr_t in, struct sockaddr_in *maskp) return (line); } -#ifdef INET6 char * netname6(struct sockaddr_in6 *sa6, struct sockaddr_in6 *mask) { @@ -595,7 +571,6 @@ netname6(struct sockaddr_in6 *sa6, struct sockaddr_in6 *mask) snprintf(line, sizeof(line), "%s/%d", hbuf, masklen); return (line); } -#endif /* * Return the name of the network whose address is given. @@ -609,11 +584,10 @@ netname(struct sockaddr *sa, struct sockaddr *mask) case AF_INET: return netname4(((struct sockaddr_in *)sa)->sin_addr.s_addr, (struct sockaddr_in *)mask); -#ifdef INET6 + case AF_INET6: return netname6((struct sockaddr_in6 *)sa, (struct sockaddr_in6 *)mask); -#endif case AF_IPX: return (ipx_print(sa)); |