From 230ad00030d6be174f1b4c6a6b4395f6f77f053c Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Wed, 9 Jun 2010 17:46:43 +0000 Subject: =?UTF-8?q?Only=20embed=20the=20interface=20scope=20for=20link=20l?= =?UTF-8?q?ocal=20nexthops.=20AS-ext=20LSA=20have=20an=20optional=20non=20?= =?UTF-8?q?link=20local=20forwarding=20address=20so=20we=20need=20to=20be?= =?UTF-8?q?=20a=20bit=20more=20careful=20here.=20Problem=20found=20and=20a?= =?UTF-8?q?nalyzed=20by=20Martin=20Pelik=C3=A1n.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- usr.sbin/ospf6d/kroute.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'usr.sbin') 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 @@ -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; -- cgit v1.2.3