summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-07-09 11:49:03 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-07-09 11:49:03 +0000
commit9fb2be44da1186332cab222f76bf09c57898e288 (patch)
tree3b950cca56a2c20b9bfdce5498ff2bf19d7dee38 /sbin
parentc3944c12b2895e27f88009946d490d79fdb8fb73 (diff)
getifaddrs(3) grabs link-local addrs in kernel internal form, convert them
into proper sockaddr_in6.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/pfctl/parse.y14
1 files changed, 13 insertions, 1 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index 421d9d1495d..9d71cf4d506 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.114 2002/07/09 10:39:08 henning Exp $ */
+/* $OpenBSD: parse.y,v 1.115 2002/07/09 11:49:02 itojun Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -2553,6 +2553,18 @@ ifa_load(void)
ifalist[ifalistlen++] = ifa;
qsort(ifalist, ifalistlen, sizeof(void *), ifa_comp);
}
+#ifdef __KAME__
+ if (ifa->ifa_addr->sa_family == AF_INET6 &&
+ IN6_IS_ADDR_LINKLOCAL(&((struct sockaddr_in6 *)ifa->ifa_addr)->sin6_addr)) {
+ struct sockaddr_in6 *sin6;
+
+ sin6 = (struct sockaddr_in6 *)ifa->ifa_addr;
+ sin6->sin6_scope_id = sin6->sin6_addr.s6_addr[2] << 8 |
+ sin6->sin6_addr.s6_addr[3];
+ sin6->sin6_addr.s6_addr[2] = 0;
+ sin6->sin6_addr.s6_addr[3] = 0;
+ }
+#endif
if (ifa->ifa_addr->sa_family == AF_INET ||
ifa->ifa_addr->sa_family == AF_INET6) {
ifatab[ifatablen++] = ifa;