From e97c9788a63c93668ccdbdc9ea7aa429f4997a56 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 24 Jan 2021 08:58:50 +0000 Subject: [PATCH] Add missing __KAME__ markers. OK claudio --- sbin/route/route.c | 4 +++- sbin/route/show.c | 6 +++++- usr.bin/netstat/show.c | 6 +++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/sbin/route/route.c b/sbin/route/route.c index 9130b9ff692..ed70dbd427b 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.251 2020/12/29 19:50:51 benno Exp $ */ +/* $OpenBSD: route.c,v 1.252 2021/01/24 08:58:50 florian Exp $ */ /* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */ /* @@ -974,6 +974,7 @@ getaddr(int which, int af, 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) || IN6_IS_ADDR_MC_INTFACELOCAL(&su->sin6.sin6_addr)) && @@ -982,6 +983,7 @@ getaddr(int which, int af, 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) { if (sep == NULL && su->sin6.sin6_scope_id == 0 && diff --git a/sbin/route/show.c b/sbin/route/show.c index 15b9a12503a..ff794e0a273 100644 --- a/sbin/route/show.c +++ b/sbin/route/show.c @@ -1,4 +1,4 @@ -/* $OpenBSD: show.c,v 1.117 2021/01/16 17:41:20 claudio Exp $ */ +/* $OpenBSD: show.c,v 1.118 2021/01/24 08:58:50 florian Exp $ */ /* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */ /* @@ -386,6 +386,7 @@ p_sockaddr(struct sockaddr *sa, struct sockaddr *mask, int flags, int width) case AF_INET6: { struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)sa; +#ifdef __KAME__ struct in6_addr *in6 = &sa6->sin6_addr; /* @@ -401,6 +402,7 @@ 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 @@ -493,6 +495,7 @@ 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) || @@ -503,6 +506,7 @@ routename(struct sockaddr *sa) sin6.sin6_addr.s6_addr[2] = 0; sin6.sin6_addr.s6_addr[3] = 0; } +#endif return (routename6(&sin6)); } diff --git a/usr.bin/netstat/show.c b/usr.bin/netstat/show.c index 8949c00deec..968428d29a3 100644 --- a/usr.bin/netstat/show.c +++ b/usr.bin/netstat/show.c @@ -1,4 +1,4 @@ -/* $OpenBSD: show.c,v 1.57 2021/01/16 17:42:52 claudio Exp $ */ +/* $OpenBSD: show.c,v 1.58 2021/01/24 08:58:50 florian Exp $ */ /* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */ /* @@ -335,6 +335,7 @@ p_sockaddr(struct sockaddr *sa, struct sockaddr *mask, int flags, int width) case AF_INET6: { struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)sa; +#ifdef __KAME__ struct in6_addr *in6 = &sa6->sin6_addr; /* @@ -350,6 +351,7 @@ 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 @@ -441,6 +443,7 @@ routename(struct sockaddr *sa) memset(&sin6, 0, sizeof(sin6)); memcpy(&sin6, sa, sa->sa_len); 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) || @@ -451,6 +454,7 @@ routename(struct sockaddr *sa) sin6.sin6_addr.s6_addr[2] = 0; sin6.sin6_addr.s6_addr[3] = 0; } +#endif return (routename6(&sin6)); } -- 2.20.1