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/route/show.c | |
parent | ed92c4bf5049f6cc21e82afd7f383f9ca46dcaff (diff) |
unconditionalize INET6 support, no binary change
Diffstat (limited to 'sbin/route/show.c')
-rw-r--r-- | sbin/route/show.c | 42 |
1 files changed, 8 insertions, 34 deletions
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)); |