summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2007-10-10 14:06:03 +0000
committerclaudio <claudio@openbsd.org>2007-10-10 14:06:03 +0000
commitf52b4fa0c1cf67f8be4122694034edab403b10e6 (patch)
treefd3d02cd58bb429278793e1c59f2b5bca9cee580
parentTurn on the V6 and E bits in hello messages. This makes other OSPFv3 routers (diff)
downloadwireguard-openbsd-f52b4fa0c1cf67f8be4122694034edab403b10e6.tar.xz
wireguard-openbsd-f52b4fa0c1cf67f8be4122694034edab403b10e6.zip
Address scope was probably the most stupid idea comming out of IPv6.
Abusing the 3rd and 4th byte of a ff02::/32 address to store the scope is wrong wrong wrong. Depending on the calls it is not possible to compare addresses with IN6_ARE_ADDR_EQUAL(). Remove the scope hack when fetching interface addresses so that we never rely on that inside ospf6d. OK norby@
-rw-r--r--usr.sbin/ospf6d/kroute.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.sbin/ospf6d/kroute.c b/usr.sbin/ospf6d/kroute.c
index fd0d99ec4a4..fe917a6cc2e 100644
--- a/usr.sbin/ospf6d/kroute.c
+++ b/usr.sbin/ospf6d/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.1 2007/10/08 10:44:50 norby Exp $ */
+/* $OpenBSD: kroute.c,v 1.2 2007/10/10 14:06:03 claudio Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -914,6 +914,14 @@ if_newaddr(u_short ifindex, struct sockaddr_in6 *ifa, struct sockaddr_in6 *mask,
if ((ka = calloc(1, sizeof(struct kif_addr))) == NULL)
fatal("if_newaddr");
ka->addr = ifa->sin6_addr;
+
+ /* XXX thanks, KAME, for this ugliness... adopted from route/show.c */
+ if (IN6_IS_ADDR_LINKLOCAL(&ka->addr) ||
+ IN6_IS_ADDR_MC_LINKLOCAL(&ka->addr)) {
+ ka->addr.s6_addr[2] = 0;
+ ka->addr.s6_addr[3] = 0;
+ }
+
if (mask)
ka->mask = mask->sin6_addr;
else