summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2007-10-10 14:06:04 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2007-10-10 14:06:04 +0000
commit00614674fd7c30c31cd6d99eee5ef9d519d5da32 (patch)
tree9b8699e066b10a1e3e701dec726957d5870c75c5
parentc833cb12132a3d88fa1f85477f01cee5cc15709c (diff)
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