summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2010-06-09 17:46:43 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2010-06-09 17:46:43 +0000
commit230ad00030d6be174f1b4c6a6b4395f6f77f053c (patch)
tree064fa01468761ac22080bef75397d4b29ea1839f /usr.sbin
parentc230e118543f45ee1e633a734ace7db754b4b3b4 (diff)
Only embed the interface scope for link local nexthops. AS-ext LSA have
an optional non link local forwarding address so we need to be a bit more careful here. Problem found and analyzed by Martin Pelikán.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ospf6d/kroute.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/ospf6d/kroute.c b/usr.sbin/ospf6d/kroute.c
index d1aea1f860b..5944bcf8119 100644
--- a/usr.sbin/ospf6d/kroute.c
+++ b/usr.sbin/ospf6d/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.19 2010/02/23 16:22:57 claudio Exp $ */
+/* $OpenBSD: kroute.c,v 1.20 2010/06/09 17:46:42 claudio Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -981,9 +981,13 @@ send_rtmsg(int fd, int action, struct kroute *kroute)
* XXX into the sin6_addr. Welcome to the typical
* XXX IPv6 insanity and all without wine bottles.
*/
- /* nexthop.addr.sin6_scope_id = kroute->scope; */
- nexthop.addr.sin6_addr.s6_addr[2] = (kroute->scope >> 8) & 0xff;
- nexthop.addr.sin6_addr.s6_addr[3] = kroute->scope & 0xff;
+ if (IN6_IS_ADDR_LINKLOCAL(&nexthop.addr.sin6_addr)) {
+ /* nexthop.addr.sin6_scope_id = kroute->scope; */
+ nexthop.addr.sin6_addr.s6_addr[2] =
+ (kroute->scope >> 8) & 0xff;
+ nexthop.addr.sin6_addr.s6_addr[3] =
+ kroute->scope & 0xff;
+ }
/* adjust header */
hdr.rtm_flags |= RTF_GATEWAY;
hdr.rtm_addrs |= RTA_GATEWAY;