diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2004-11-11 16:59:48 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2004-11-11 16:59:48 +0000 |
commit | 1d2ec773c05052566732708f28c5955b64cbe561 (patch) | |
tree | d859f628ab5606335924953ee3b9df8f95414ffc /usr.sbin | |
parent | 7918d4577859b060d229622c9aff17cbf846f2fa (diff) |
Unbreak peer_localaddr() because Link Local Addresses reported by
getifaddrs() have the scope id added to the address and so fuck up in the
compare later. This part has bin stolen from ifconfig/ifconfig.c and shows
the beauty of IPv6. Thank you KAME.
disgusting but OK henning@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bgpd/Makefile | 5 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde.c | 11 |
2 files changed, 14 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/Makefile b/usr.sbin/bgpd/Makefile index d501c6313b3..83ddc5d5e63 100644 --- a/usr.sbin/bgpd/Makefile +++ b/usr.sbin/bgpd/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.19 2004/05/07 10:06:15 djm Exp $ +# $OpenBSD: Makefile,v 1.20 2004/11/11 16:59:47 claudio Exp $ .PATH: ${.CURDIR}/.. @@ -15,4 +15,7 @@ CFLAGS+= -Wsign-compare YFLAGS= MAN= bgpd.8 bgpd.conf.5 +# kame scopeid hack +CPPFLAGS+=-DKAME_SCOPEID + .include <bsd.prog.mk> diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index ff4366e8cf8..a537ba6f071 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.150 2004/11/11 16:50:33 claudio Exp $ */ +/* $OpenBSD: rde.c,v 1.151 2004/11/11 16:59:47 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -2167,6 +2167,15 @@ sa_cmp(struct bgpd_addr *a, struct sockaddr *b) break; case AF_INET6: in6_b = (struct sockaddr_in6 *)b; +#if defined(__KAME__) && defined(KAME_SCOPEID) + /* directly stolen from sbin/ifconfig/ifconfig.c */ + if (IN6_IS_ADDR_LINKLOCAL(&in6_b->sin6_addr)) { + in6_b->sin6_scope_id = + ntohs(*(u_int16_t *)&in6_b->sin6_addr.s6_addr[2]); + in6_b->sin6_addr.s6_addr[2] = + in6_b->sin6_addr.s6_addr[3] = 0; + } +#endif if (bcmp(&a->v6, &in6_b->sin6_addr, sizeof(struct in6_addr))) return (1); |