mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-26 09:46:09 +00:00
- Fix a bug in embedded scope id handling in LLA which prevented it from
working on 10.x. - Add LICENSE.
This commit is contained in:
parent
3eb0319a7b
commit
0c2d600ee5
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=354184
@ -2,6 +2,7 @@
|
||||
|
||||
PORTNAME= openbgpd
|
||||
PORTVERSION= 5.2.20121209
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= net
|
||||
MASTER_SITES= ${MASTER_SITE_OPENBSD}
|
||||
MASTER_SITE_SUBDIR= OpenBGPD
|
||||
@ -12,9 +13,13 @@ DIST_SUBDIR= ${PORTNAME}
|
||||
MAINTAINER= hrs@FreeBSD.org
|
||||
COMMENT= Free implementation of the Border Gateway Protocol, Version 4
|
||||
|
||||
LICENSE= ISCL
|
||||
LICENSE_FILE= ${FILESDIR}/COPYING
|
||||
|
||||
CONFLICTS= zebra-[0-9]* quagga-[0-9]*
|
||||
|
||||
WRKSRC= ${WRKDIR}
|
||||
MAKE_ARGS= -DFREEBSDPORTS
|
||||
USE_RC_SUBR= ${PORTNAME}
|
||||
PLIST_FILES= sbin/bgpctl sbin/bgpd man/man5/bgpd.conf.5.gz \
|
||||
man/man8/bgpctl.8.gz man/man8/bgpd.8.gz
|
||||
@ -29,7 +34,7 @@ IPV6LLPEER_DESC=Support nexthop using IPv6 link-local address
|
||||
.include <bsd.port.options.mk>
|
||||
|
||||
.if ${PORT_OPTIONS:MIPV6LLPEER}
|
||||
MAKE_ARGS= -DIPV6_LINKLOCAL_PEER
|
||||
MAKE_ARGS+= -DIPV6_LINKLOCAL_PEER
|
||||
.endif
|
||||
|
||||
post-patch:
|
||||
|
21
net/openbgpd/files/COPYING
Normal file
21
net/openbgpd/files/COPYING
Normal file
@ -0,0 +1,21 @@
|
||||
$FreeBSD$
|
||||
|
||||
Copyright (c) 2003-2007 Henning Brauer <henning@openbsd.org>
|
||||
Copyright (c) 2002 Daniel Hartmeier <dhartmei@openbsd.org>
|
||||
Copyright (c) 2003, 2004, 2006 Claudio Jeker <claudio@openbsd.org>
|
||||
Copyright (c) 2003, 2004 Markus Friedl <markus@openbsd.org>
|
||||
Copyright (c) 2004 Damien Miller <djm@openbsd.org>
|
||||
Copyright (c) 2006, 2007, 2008 Reyk Floeter <reyk@openbsd.org>
|
||||
Copyright (c) 2006, 2007 Pierre-Yves Ritschard <pyr@openbsd.org>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
|
||||
AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
@ -3,10 +3,13 @@ Index: Makefile.inc
|
||||
RCS file: Makefile.inc
|
||||
diff -N Makefile.inc
|
||||
--- /dev/null 1 Jan 1970 00:00:00 -0000
|
||||
+++ Makefile.inc 30 Jun 2009 07:19:13 -0000 1.2
|
||||
@@ -0,0 +1,5 @@
|
||||
+# $hrs: openbgpd/Makefile.inc,v 1.2 2009/06/30 07:19:13 hrs Exp $
|
||||
+++ Makefile.inc 16 May 2014 01:06:14 -0000 1.5
|
||||
@@ -0,0 +1,8 @@
|
||||
+# $hrs: openbgpd/Makefile.inc,v 1.5 2014/05/16 01:06:14 hrs Exp $
|
||||
+
|
||||
+PREFIX?= /usr/local
|
||||
+BINDIR?= ${PREFIX}/sbin
|
||||
+MANDIR?= ${PREFIX}/man/man
|
||||
+.if defined(FREEBSDPORTS)
|
||||
+WITH_INSTALL_AS_USER= yes
|
||||
+.endif
|
||||
|
@ -2,10 +2,9 @@ Index: bgpd/Makefile
|
||||
===================================================================
|
||||
RCS file: /home/cvs/private/hrs/openbgpd/bgpd/Makefile,v
|
||||
retrieving revision 1.1.1.2
|
||||
retrieving revision 1.9
|
||||
diff -u -p -r1.1.1.2 -r1.9
|
||||
diff -u -p -r1.1.1.2 Makefile
|
||||
--- bgpd/Makefile 9 Jul 2009 16:49:54 -0000 1.1.1.2
|
||||
+++ bgpd/Makefile 13 Oct 2012 18:36:00 -0000 1.9
|
||||
+++ bgpd/Makefile 16 May 2014 00:42:48 -0000
|
||||
@@ -1,15 +1,25 @@
|
||||
# $OpenBSD: Makefile,v 1.28 2009/06/25 14:14:54 deraadt Exp $
|
||||
|
||||
|
@ -2,10 +2,10 @@ Index: bgpd/bgpd.h
|
||||
===================================================================
|
||||
RCS file: /home/cvs/private/hrs/openbgpd/bgpd/bgpd.h,v
|
||||
retrieving revision 1.1.1.8
|
||||
retrieving revision 1.14
|
||||
diff -u -p -r1.1.1.8 -r1.14
|
||||
retrieving revision 1.15
|
||||
diff -u -p -r1.1.1.8 -r1.15
|
||||
--- bgpd/bgpd.h 14 Feb 2010 20:19:57 -0000 1.1.1.8
|
||||
+++ bgpd/bgpd.h 8 Dec 2012 20:17:59 -0000 1.14
|
||||
+++ bgpd/bgpd.h 16 May 2014 00:36:26 -0000 1.15
|
||||
@@ -1,4 +1,4 @@
|
||||
-/* $OpenBSD: bgpd.h,v 1.241 2009/06/12 16:42:53 claudio Exp $ */
|
||||
+/* $OpenBSD: bgpd.h,v 1.273 2012/09/18 10:10:00 claudio Exp $ */
|
||||
@ -661,7 +661,7 @@ diff -u -p -r1.1.1.8 -r1.14
|
||||
- u_int16_t id;
|
||||
- u_int16_t flags;
|
||||
+/* macros for IPv6 link-local address */
|
||||
+#if defined(__KAME__) && defined(IPV6_LINKLOCAL_PEER)
|
||||
+#ifdef __KAME__
|
||||
+#define IN6_LINKLOCAL_IFINDEX(addr) \
|
||||
+ ((addr).s6_addr[2] << 8 | (addr).s6_addr[3])
|
||||
+
|
||||
|
@ -2,10 +2,10 @@ Index: bgpd/kroute.c
|
||||
===================================================================
|
||||
RCS file: /home/cvs/private/hrs/openbgpd/bgpd/kroute.c,v
|
||||
retrieving revision 1.1.1.7
|
||||
retrieving revision 1.14
|
||||
diff -u -p -r1.1.1.7 -r1.14
|
||||
retrieving revision 1.15
|
||||
diff -u -p -r1.1.1.7 -r1.15
|
||||
--- bgpd/kroute.c 14 Feb 2010 20:19:57 -0000 1.1.1.7
|
||||
+++ bgpd/kroute.c 8 Dec 2012 20:17:59 -0000 1.14
|
||||
+++ bgpd/kroute.c 16 May 2014 00:36:26 -0000 1.15
|
||||
@@ -1,4 +1,4 @@
|
||||
-/* $OpenBSD: kroute.c,v 1.169 2009/06/25 15:54:22 claudio Exp $ */
|
||||
+/* $OpenBSD: kroute.c,v 1.190 2012/07/13 16:57:35 claudio Exp $ */
|
||||
@ -400,10 +400,9 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
+ else if (kt->state == RECONF_REINIT)
|
||||
+ kt->fib_sync = kt->fib_conf;
|
||||
+ }
|
||||
}
|
||||
|
||||
int
|
||||
-kr_change(struct kroute_label *kl)
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+ktable_exists(u_int rtableid, u_int *rdomid)
|
||||
+{
|
||||
+#if !defined(__FreeBSD__) /* FreeBSD does not have NET_RT_TABLE. */
|
||||
@ -433,9 +432,10 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
+ *rdomid = 0;
|
||||
+#endif
|
||||
+ return (1);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
}
|
||||
|
||||
int
|
||||
-kr_change(struct kroute_label *kl)
|
||||
+kr_change(u_int rtableid, struct kroute_full *kl)
|
||||
+{
|
||||
+ struct ktable *kt;
|
||||
@ -565,7 +565,8 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
+ /* for blackhole and reject routes nexthop needs to be ::1 */
|
||||
+ if (kl->flags & (F_BLACKHOLE|F_REJECT))
|
||||
+ bcopy(&lo6, &kl->nexthop.v6, sizeof(kl->nexthop.v6));
|
||||
+
|
||||
|
||||
- rtlabel_unref(kl->kr.labelid);
|
||||
+ if (action == RTM_ADD) {
|
||||
+ if ((kr6 = calloc(1, sizeof(struct kroute6_node))) == NULL) {
|
||||
+ log_warn("kr_change");
|
||||
@ -579,7 +580,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
+ kr6->r.priority = RTP_BGP;
|
||||
+ kr6->r.labelid = labelid;
|
||||
|
||||
- rtlabel_unref(kl->kr.labelid);
|
||||
- if (kroute_remove(kr) == -1)
|
||||
+ if (kroute6_insert(kt, kr6) == -1)
|
||||
+ free(kr6);
|
||||
+ } else {
|
||||
@ -596,8 +597,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
+ else
|
||||
+ kr6->r.flags &= ~F_REJECT;
|
||||
+ }
|
||||
|
||||
- if (kroute_remove(kr) == -1)
|
||||
+
|
||||
+ if (send_rt6msg(kr_state.fd, action, kt, &kr6->r) == -1)
|
||||
return (-1);
|
||||
|
||||
@ -706,10 +706,11 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
+ if (send_rtmsg(kr_state.fd, action, kt, &kr->r) == -1)
|
||||
+ return (-1);
|
||||
+
|
||||
+ return (0);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
-kr6_delete(struct kroute6_label *kl)
|
||||
+kr_delete(u_int rtableid, struct kroute_full *kl)
|
||||
+{
|
||||
+ struct ktable *kt;
|
||||
@ -750,11 +751,10 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
+ if (kroute_remove(kt, kr) == -1)
|
||||
+ return (-1);
|
||||
+
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
-kr6_delete(struct kroute6_label *kl)
|
||||
+ return (0);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+kr6_delete(struct ktable *kt, struct kroute_full *kl)
|
||||
{
|
||||
struct kroute6_node *kr6;
|
||||
@ -835,10 +835,10 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
- kr_state.fib_sync = 1;
|
||||
+ if (kt->fib_sync) /* already coupled */
|
||||
+ return;
|
||||
+
|
||||
+ kt->fib_sync = 1;
|
||||
|
||||
- RB_FOREACH(kr, kroute_tree, &krt)
|
||||
+ kt->fib_sync = 1;
|
||||
+
|
||||
+ RB_FOREACH(kr, kroute_tree, &kt->krt)
|
||||
if ((kr->r.flags & F_BGPD_INSERTED))
|
||||
- send_rtmsg(kr_state.fd, RTM_ADD, &kr->r);
|
||||
@ -1117,7 +1117,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
ifindex = kr6->r.ifindex;
|
||||
break;
|
||||
}
|
||||
@@ -608,6 +994,24 @@ kr_show_route(struct imsg *imsg)
|
||||
@@ -608,41 +994,190 @@ kr_show_route(struct imsg *imsg)
|
||||
send_imsg_session(IMSG_CTL_SHOW_INTERFACE,
|
||||
imsg->hdr.pid, &kif->k, sizeof(kif->k));
|
||||
break;
|
||||
@ -1142,15 +1142,25 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
default: /* nada */
|
||||
break;
|
||||
}
|
||||
@@ -628,21 +1032,152 @@ kr_ifinfo(char *ifname)
|
||||
}
|
||||
}
|
||||
|
||||
-struct redist_node {
|
||||
- LIST_ENTRY(redist_node) entry;
|
||||
- struct kroute *kr;
|
||||
- struct kroute6 *kr6;
|
||||
-};
|
||||
-
|
||||
- send_imsg_session(IMSG_CTL_END, imsg->hdr.pid, NULL, 0);
|
||||
+
|
||||
+ send_imsg_session(IMSG_CTL_END, imsg->hdr.pid, NULL, 0);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+kr_ifinfo(char *ifname)
|
||||
+{
|
||||
+ struct kif_node *kif;
|
||||
+
|
||||
+ RB_FOREACH(kif, kif_tree, &kit)
|
||||
+ if (!strcmp(ifname, kif->k.ifname)) {
|
||||
+ send_imsg_session(IMSG_IFINFO, 0,
|
||||
+ &kif->k, sizeof(kif->k));
|
||||
+ return;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+kr_net_delete(struct network *n)
|
||||
+{
|
||||
@ -1187,13 +1197,21 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
+ }
|
||||
+ }
|
||||
+ return (NULL);
|
||||
+}
|
||||
+
|
||||
}
|
||||
|
||||
-void
|
||||
-kr_ifinfo(char *ifname)
|
||||
+struct network *
|
||||
+kr_net_match6(struct ktable *kt, struct kroute6 *kr6)
|
||||
+{
|
||||
{
|
||||
- struct kif_node *kif;
|
||||
+ struct network *xn;
|
||||
|
||||
- RB_FOREACH(kif, kif_tree, &kit)
|
||||
- if (!strcmp(ifname, kif->k.ifname)) {
|
||||
- send_imsg_session(IMSG_IFINFO, 0,
|
||||
- &kif->k, sizeof(kif->k));
|
||||
- return;
|
||||
+ TAILQ_FOREACH(xn, &kt->krn, entry) {
|
||||
+ if (xn->net.prefix.aid != AID_INET6)
|
||||
+ continue;
|
||||
@ -1216,12 +1234,16 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
+ case NETWORK_MRTCLONE:
|
||||
+ /* can not happen */
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
+ }
|
||||
+ return (NULL);
|
||||
+}
|
||||
}
|
||||
|
||||
-LIST_HEAD(, redist_node) redistlist;
|
||||
-struct redist_node {
|
||||
- LIST_ENTRY(redist_node) entry;
|
||||
- struct kroute *kr;
|
||||
- struct kroute6 *kr6;
|
||||
-};
|
||||
+struct network *
|
||||
+kr_net_find(struct ktable *kt, struct network *n)
|
||||
+{
|
||||
@ -1238,12 +1260,10 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
+ }
|
||||
+ return (NULL);
|
||||
+}
|
||||
|
||||
int
|
||||
-kr_redistribute(int type, struct kroute *kr)
|
||||
+
|
||||
+int
|
||||
+kr_net_reload(u_int rtableid, struct network_head *nh)
|
||||
{
|
||||
- struct redist_node *rn;
|
||||
+{
|
||||
+ struct network *n, *xn;
|
||||
+ struct ktable *kt;
|
||||
+
|
||||
@ -1268,7 +1288,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
+ } else
|
||||
+ TAILQ_INSERT_TAIL(&kt->krn, n, entry);
|
||||
+ }
|
||||
+
|
||||
|
||||
+ for (n = TAILQ_FIRST(&kt->krn); n != NULL; n = xn) {
|
||||
+ xn = TAILQ_NEXT(n, entry);
|
||||
+ if (n->net.old) {
|
||||
@ -1280,13 +1300,16 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
+ kr_net_delete(n);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
||||
-LIST_HEAD(, redist_node) redistlist;
|
||||
+ return (0);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
|
||||
int
|
||||
-kr_redistribute(int type, struct kroute *kr)
|
||||
+kr_redistribute(int type, struct ktable *kt, struct kroute *kr)
|
||||
+{
|
||||
{
|
||||
- struct redist_node *rn;
|
||||
+ struct network *match;
|
||||
+ struct network_config net;
|
||||
u_int32_t a;
|
||||
@ -1732,16 +1755,41 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
}
|
||||
}
|
||||
return (kn6);
|
||||
@@ -1065,7 +1652,7 @@ kroute6_matchgw(struct kroute6_node *kr,
|
||||
memcpy(&nexthop, &sa_in6->sin6_addr, sizeof(nexthop));
|
||||
@@ -1056,17 +1643,29 @@ kroute6_find(const struct in6_addr *pref
|
||||
struct kroute6_node *
|
||||
kroute6_matchgw(struct kroute6_node *kr, struct sockaddr_in6 *sa_in6)
|
||||
{
|
||||
- struct in6_addr nexthop;
|
||||
+ struct sockaddr_in6 nexthop;
|
||||
|
||||
if (sa_in6 == NULL) {
|
||||
log_warnx("kroute6_matchgw: no nexthop defined");
|
||||
return (NULL);
|
||||
}
|
||||
- memcpy(&nexthop, &sa_in6->sin6_addr, sizeof(nexthop));
|
||||
+ memcpy(&nexthop, sa_in6, sizeof(nexthop));
|
||||
+#if defined(__KAME__) && defined(IPV6_LINKLOCAL_PEER)
|
||||
+ if (IN6_IS_ADDR_LINKLOCAL(&nexthop.sin6_addr)) {
|
||||
+ /* Embed scope id and set sin6_scope_id. */
|
||||
+ if (nexthop.sin6_scope_id == 0)
|
||||
+ nexthop.sin6_scope_id =
|
||||
+ IN6_LINKLOCAL_IFINDEX(nexthop.sin6_addr);
|
||||
+ else
|
||||
+ SET_IN6_LINKLOCAL_IFINDEX(nexthop.sin6_addr,
|
||||
+ nexthop.sin6_scope_id);
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
while (kr) {
|
||||
- if (memcmp(&kr->r.nexthop, &nexthop, sizeof(nexthop)) == NULL)
|
||||
+ if (memcmp(&kr->r.nexthop, &nexthop, sizeof(nexthop)) == 0)
|
||||
return (kr);
|
||||
- return (kr);
|
||||
+ if (memcmp(&kr->r.nexthop, &nexthop.sin6_addr,
|
||||
+ sizeof(nexthop.sin6_addr)) == 0)
|
||||
+ return (kr);
|
||||
kr = kr->next;
|
||||
}
|
||||
@@ -1074,13 +1661,13 @@ kroute6_matchgw(struct kroute6_node *kr,
|
||||
|
||||
@@ -1074,13 +1673,13 @@ kroute6_matchgw(struct kroute6_node *kr,
|
||||
}
|
||||
|
||||
int
|
||||
@ -1757,7 +1805,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
/* multipath route, add at end of list */
|
||||
while (krm->next != NULL)
|
||||
krm = krm->next;
|
||||
@@ -1088,14 +1675,15 @@ kroute6_insert(struct kroute6_node *kr)
|
||||
@@ -1088,14 +1687,15 @@ kroute6_insert(struct kroute6_node *kr)
|
||||
kr->next = NULL; /* to be sure */
|
||||
}
|
||||
|
||||
@ -1776,7 +1824,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
}
|
||||
|
||||
if (kr->r.flags & F_CONNECTED)
|
||||
@@ -1104,19 +1692,19 @@ kroute6_insert(struct kroute6_node *kr)
|
||||
@@ -1104,19 +1704,19 @@ kroute6_insert(struct kroute6_node *kr)
|
||||
|
||||
if (krm == NULL)
|
||||
/* redistribute multipath routes only once */
|
||||
@ -1799,7 +1847,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
log_warnx("kroute6_remove failed for %s/%u",
|
||||
log_in6addr(&kr->r.prefix), kr->r.prefixlen);
|
||||
return (-1);
|
||||
@@ -1124,13 +1712,14 @@ kroute6_remove(struct kroute6_node *kr)
|
||||
@@ -1124,13 +1724,14 @@ kroute6_remove(struct kroute6_node *kr)
|
||||
|
||||
if (krm == kr) {
|
||||
/* head element */
|
||||
@ -1816,7 +1864,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
log_warnx("kroute6_remove failed to add %s/%u",
|
||||
log_in6addr(&kr->r.prefix),
|
||||
kr->r.prefixlen);
|
||||
@@ -1151,14 +1740,14 @@ kroute6_remove(struct kroute6_node *kr)
|
||||
@@ -1151,14 +1752,14 @@ kroute6_remove(struct kroute6_node *kr)
|
||||
}
|
||||
|
||||
/* check whether a nexthop depends on this kroute */
|
||||
@ -1835,7 +1883,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
|
||||
if (kr->r.flags & F_CONNECTED)
|
||||
if (kif_kr6_remove(kr) == -1) {
|
||||
@@ -1171,45 +1760,46 @@ kroute6_remove(struct kroute6_node *kr)
|
||||
@@ -1171,45 +1772,46 @@ kroute6_remove(struct kroute6_node *kr)
|
||||
}
|
||||
|
||||
void
|
||||
@ -1893,7 +1941,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
log_warnx("knexthop_remove failed for %s",
|
||||
log_addr(&kn->nexthop));
|
||||
return (-1);
|
||||
@@ -1220,12 +1810,12 @@ knexthop_remove(struct knexthop_node *kn
|
||||
@@ -1220,12 +1822,12 @@ knexthop_remove(struct knexthop_node *kn
|
||||
}
|
||||
|
||||
void
|
||||
@ -1909,7 +1957,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
}
|
||||
|
||||
struct kif_node *
|
||||
@@ -1257,6 +1847,7 @@ kif_insert(struct kif_node *kif)
|
||||
@@ -1257,6 +1859,7 @@ kif_insert(struct kif_node *kif)
|
||||
int
|
||||
kif_remove(struct kif_node *kif)
|
||||
{
|
||||
@ -1917,7 +1965,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
struct kif_kr *kkr;
|
||||
struct kif_kr6 *kkr6;
|
||||
|
||||
@@ -1265,20 +1856,23 @@ kif_remove(struct kif_node *kif)
|
||||
@@ -1265,20 +1868,23 @@ kif_remove(struct kif_node *kif)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
@ -1944,7 +1992,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
free(kif);
|
||||
return (0);
|
||||
}
|
||||
@@ -1473,113 +2067,109 @@ kroute6_validate(struct kroute6 *kr)
|
||||
@@ -1473,113 +2079,109 @@ kroute6_validate(struct kroute6 *kr)
|
||||
}
|
||||
|
||||
void
|
||||
@ -2103,7 +2151,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
+ n.net.aid = AID_INET;
|
||||
+ n.net.v4.s_addr = kr->r.prefix.s_addr;
|
||||
+ n.netlen = kr->r.prefixlen;
|
||||
+ }
|
||||
}
|
||||
+ break;
|
||||
+ case AID_INET6:
|
||||
+ kr6 = kn->kroute;
|
||||
@ -2114,7 +2162,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
+ n.gateway.aid = AID_INET6;
|
||||
+ memcpy(&n.gateway.v6, &kr6->r.nexthop,
|
||||
+ sizeof(struct in6_addr));
|
||||
}
|
||||
+ }
|
||||
+ if (n.connected) {
|
||||
+ n.net.aid = AID_INET6;
|
||||
+ memcpy(&n.net.v6, &kr6->r.nexthop,
|
||||
@ -2132,7 +2180,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
{
|
||||
int i;
|
||||
struct kroute_node *kr;
|
||||
@@ -1589,13 +2179,13 @@ kroute_match(in_addr_t key, int matchall
|
||||
@@ -1589,13 +2191,13 @@ kroute_match(in_addr_t key, int matchall
|
||||
|
||||
/* we will never match the default route */
|
||||
for (i = 32; i > 0; i--)
|
||||
@ -2148,7 +2196,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
if (matchall || bgpd_filternexthop(&kr->r, NULL) == 0)
|
||||
return (kr);
|
||||
|
||||
@@ -1603,7 +2193,7 @@ kroute_match(in_addr_t key, int matchall
|
||||
@@ -1603,7 +2205,7 @@ kroute_match(in_addr_t key, int matchall
|
||||
}
|
||||
|
||||
struct kroute6_node *
|
||||
@ -2157,7 +2205,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
{
|
||||
int i;
|
||||
struct kroute6_node *kr6;
|
||||
@@ -1612,13 +2202,13 @@ kroute6_match(struct in6_addr *key, int
|
||||
@@ -1612,13 +2214,13 @@ kroute6_match(struct in6_addr *key, int
|
||||
/* we will never match the default route */
|
||||
for (i = 128; i > 0; i--) {
|
||||
inet6applymask(&ina, key, i);
|
||||
@ -2173,7 +2221,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
if (matchall || bgpd_filternexthop(NULL, &kr6->r) == 0)
|
||||
return (kr6);
|
||||
|
||||
@@ -1626,31 +2216,30 @@ kroute6_match(struct in6_addr *key, int
|
||||
@@ -1626,31 +2228,30 @@ kroute6_match(struct in6_addr *key, int
|
||||
}
|
||||
|
||||
void
|
||||
@ -2215,7 +2263,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
k6 = kn->kroute;
|
||||
k6->r.flags &= ~F_NEXTHOP;
|
||||
break;
|
||||
@@ -1665,7 +2254,7 @@ kroute_detach_nexthop(struct knexthop_no
|
||||
@@ -1665,7 +2266,7 @@ kroute_detach_nexthop(struct knexthop_no
|
||||
*/
|
||||
|
||||
int
|
||||
@ -2224,7 +2272,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
{
|
||||
struct kroute_node *kr;
|
||||
struct kroute6_node *kr6;
|
||||
@@ -1675,11 +2264,11 @@ protect_lo(void)
|
||||
@@ -1675,11 +2276,11 @@ protect_lo(void)
|
||||
log_warn("protect_lo");
|
||||
return (-1);
|
||||
}
|
||||
@ -2238,7 +2286,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
free(kr); /* kernel route already there, no problem */
|
||||
|
||||
/* special protection for loopback */
|
||||
@@ -1689,9 +2278,9 @@ protect_lo(void)
|
||||
@@ -1689,9 +2290,9 @@ protect_lo(void)
|
||||
}
|
||||
memcpy(&kr6->r.prefix, &in6addr_loopback, sizeof(kr6->r.prefix));
|
||||
kr6->r.prefixlen = 128;
|
||||
@ -2250,7 +2298,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
free(kr6); /* kernel route already there, no problem */
|
||||
|
||||
return (0);
|
||||
@@ -1726,17 +2315,17 @@ mask2prefixlen(in_addr_t ina)
|
||||
@@ -1726,17 +2327,17 @@ mask2prefixlen(in_addr_t ina)
|
||||
u_int8_t
|
||||
mask2prefixlen6(struct sockaddr_in6 *sa_in6)
|
||||
{
|
||||
@ -2273,7 +2321,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
case 0xff:
|
||||
l += 8;
|
||||
break;
|
||||
@@ -1764,7 +2353,7 @@ mask2prefixlen6(struct sockaddr_in6 *sa_
|
||||
@@ -1764,7 +2365,7 @@ mask2prefixlen6(struct sockaddr_in6 *sa_
|
||||
case 0x00:
|
||||
return (l);
|
||||
default:
|
||||
@ -2282,7 +2330,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1788,7 +2377,7 @@ prefixlen2mask6(u_int8_t prefixlen)
|
||||
@@ -1788,7 +2389,7 @@ prefixlen2mask6(u_int8_t prefixlen)
|
||||
}
|
||||
|
||||
#define ROUNDUP(a) \
|
||||
@ -2291,7 +2339,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
|
||||
void
|
||||
get_rtaddrs(int addrs, struct sockaddr *sa, struct sockaddr **rti_info)
|
||||
@@ -1808,11 +2397,10 @@ get_rtaddrs(int addrs, struct sockaddr *
|
||||
@@ -1808,11 +2409,10 @@ get_rtaddrs(int addrs, struct sockaddr *
|
||||
void
|
||||
if_change(u_short ifindex, int flags, struct if_data *ifd)
|
||||
{
|
||||
@ -2304,7 +2352,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
u_int8_t reachable;
|
||||
|
||||
if ((kif = kif_find(ifindex)) == NULL) {
|
||||
@@ -1833,28 +2421,18 @@ if_change(u_short ifindex, int flags, st
|
||||
@@ -1833,28 +2433,18 @@ if_change(u_short ifindex, int flags, st
|
||||
|
||||
kif->k.nh_reachable = reachable;
|
||||
|
||||
@ -2339,7 +2387,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
}
|
||||
LIST_FOREACH(kkr6, &kif->kroute6_l, entry) {
|
||||
if (reachable)
|
||||
@@ -1862,27 +2440,10 @@ if_change(u_short ifindex, int flags, st
|
||||
@@ -1862,27 +2452,10 @@ if_change(u_short ifindex, int flags, st
|
||||
else
|
||||
kkr6->kr->r.flags |= F_DOWN;
|
||||
|
||||
@ -2371,7 +2419,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1917,25 +2478,38 @@ if_announce(void *msg)
|
||||
@@ -1917,25 +2490,38 @@ if_announce(void *msg)
|
||||
*/
|
||||
|
||||
int
|
||||
@ -2414,7 +2462,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
if (kroute->flags & F_BLACKHOLE)
|
||||
hdr.rtm_flags |= RTF_BLACKHOLE;
|
||||
if (kroute->flags & F_REJECT)
|
||||
@@ -1984,6 +2558,37 @@ send_rtmsg(int fd, int action, struct kr
|
||||
@@ -1984,6 +2570,37 @@ send_rtmsg(int fd, int action, struct kr
|
||||
iov[iovcnt].iov_base = &mask;
|
||||
iov[iovcnt++].iov_len = sizeof(mask);
|
||||
|
||||
@ -2452,7 +2500,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
if (kroute->labelid) {
|
||||
bzero(&label, sizeof(label));
|
||||
label.sr_len = sizeof(label);
|
||||
@@ -1996,11 +2601,11 @@ send_rtmsg(int fd, int action, struct kr
|
||||
@@ -1996,11 +2613,11 @@ send_rtmsg(int fd, int action, struct kr
|
||||
iov[iovcnt].iov_base = &label;
|
||||
iov[iovcnt++].iov_len = sizeof(label);
|
||||
}
|
||||
@ -2466,7 +2514,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
if (hdr.rtm_type == RTM_CHANGE) {
|
||||
hdr.rtm_type = RTM_ADD;
|
||||
goto retry;
|
||||
@@ -2009,27 +2614,18 @@ retry:
|
||||
@@ -2009,27 +2626,18 @@ retry:
|
||||
inet_ntoa(kroute->prefix),
|
||||
kroute->prefixlen);
|
||||
return (0);
|
||||
@ -2498,7 +2546,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
{
|
||||
struct iovec iov[5];
|
||||
struct rt_msghdr hdr;
|
||||
@@ -2037,17 +2633,23 @@ send_rt6msg(int fd, int action, struct k
|
||||
@@ -2037,17 +2645,23 @@ send_rt6msg(int fd, int action, struct k
|
||||
struct sockaddr_in6 addr;
|
||||
char pad[sizeof(long)];
|
||||
} prefix, nexthop, mask;
|
||||
@ -2523,7 +2571,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
if (kroute->flags & F_BLACKHOLE)
|
||||
hdr.rtm_flags |= RTF_BLACKHOLE;
|
||||
if (kroute->flags & F_REJECT)
|
||||
@@ -2100,6 +2702,7 @@ send_rt6msg(int fd, int action, struct k
|
||||
@@ -2100,6 +2714,7 @@ send_rt6msg(int fd, int action, struct k
|
||||
iov[iovcnt].iov_base = &mask;
|
||||
iov[iovcnt++].iov_len = ROUNDUP(sizeof(struct sockaddr_in6));
|
||||
|
||||
@ -2531,7 +2579,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
if (kroute->labelid) {
|
||||
bzero(&label, sizeof(label));
|
||||
label.sr_len = sizeof(label);
|
||||
@@ -2112,11 +2715,11 @@ send_rt6msg(int fd, int action, struct k
|
||||
@@ -2112,11 +2727,11 @@ send_rt6msg(int fd, int action, struct k
|
||||
iov[iovcnt].iov_base = &label;
|
||||
iov[iovcnt++].iov_len = sizeof(label);
|
||||
}
|
||||
@ -2545,7 +2593,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
if (hdr.rtm_type == RTM_CHANGE) {
|
||||
hdr.rtm_type = RTM_ADD;
|
||||
goto retry;
|
||||
@@ -2125,31 +2728,26 @@ retry:
|
||||
@@ -2125,31 +2740,26 @@ retry:
|
||||
log_in6addr(&kroute->prefix),
|
||||
kroute->prefixlen);
|
||||
return (0);
|
||||
@ -2586,7 +2634,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
struct rt_msghdr *rtm;
|
||||
struct sockaddr *sa, *gw, *rti_info[RTAX_MAX];
|
||||
struct sockaddr_in *sa_in;
|
||||
@@ -2163,22 +2761,35 @@ fetchtable(u_int rtableid, int connected
|
||||
@@ -2163,22 +2773,35 @@ fetchtable(u_int rtableid, int connected
|
||||
mib[3] = 0;
|
||||
mib[4] = NET_RT_DUMP;
|
||||
mib[5] = 0;
|
||||
@ -2632,7 +2680,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
}
|
||||
|
||||
lim = buf + len;
|
||||
@@ -2186,7 +2797,11 @@ fetchtable(u_int rtableid, int connected
|
||||
@@ -2186,7 +2809,11 @@ fetchtable(u_int rtableid, int connected
|
||||
rtm = (struct rt_msghdr *)next;
|
||||
if (rtm->rtm_version != RTM_VERSION)
|
||||
continue;
|
||||
@ -2644,7 +2692,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
get_rtaddrs(rtm->rtm_addrs, sa, rti_info);
|
||||
|
||||
if ((sa = rti_info[RTAX_DST]) == NULL)
|
||||
@@ -2205,7 +2820,11 @@ fetchtable(u_int rtableid, int connected
|
||||
@@ -2205,7 +2832,11 @@ fetchtable(u_int rtableid, int connected
|
||||
}
|
||||
|
||||
kr->r.flags = F_KERNEL;
|
||||
@ -2656,7 +2704,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
kr->r.ifindex = rtm->rtm_index;
|
||||
kr->r.prefix.s_addr =
|
||||
((struct sockaddr_in *)sa)->sin_addr.s_addr;
|
||||
@@ -2223,8 +2842,12 @@ fetchtable(u_int rtableid, int connected
|
||||
@@ -2223,8 +2854,12 @@ fetchtable(u_int rtableid, int connected
|
||||
break;
|
||||
kr->r.prefixlen =
|
||||
mask2prefixlen(sa_in->sin_addr.s_addr);
|
||||
@ -2670,7 +2718,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
else
|
||||
kr->r.prefixlen =
|
||||
prefixlen_classful(kr->r.prefix.s_addr);
|
||||
@@ -2238,7 +2861,11 @@ fetchtable(u_int rtableid, int connected
|
||||
@@ -2238,11 +2873,25 @@ fetchtable(u_int rtableid, int connected
|
||||
}
|
||||
|
||||
kr6->r.flags = F_KERNEL;
|
||||
@ -2682,7 +2730,21 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
kr6->r.ifindex = rtm->rtm_index;
|
||||
memcpy(&kr6->r.prefix,
|
||||
&((struct sockaddr_in6 *)sa)->sin6_addr,
|
||||
@@ -2257,8 +2884,12 @@ fetchtable(u_int rtableid, int connected
|
||||
sizeof(kr6->r.prefix));
|
||||
+#if defined(__KAME__) && defined(IPV6_LINKLOCAL_PEER)
|
||||
+ if (IN6_IS_ADDR_LINKLOCAL(&kr6->r.prefix)) {
|
||||
+ if (((struct sockaddr_in6 *)sa)->sin6_scope_id !=0)
|
||||
+ SET_IN6_LINKLOCAL_IFINDEX(kr6->r.prefix,
|
||||
+ ((struct sockaddr_in6 *)sa)->sin6_scope_id);
|
||||
+ else
|
||||
+ SET_IN6_LINKLOCAL_IFINDEX(kr6->r.prefix,
|
||||
+ rtm->rtm_index);
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
sa_in6 = (struct sockaddr_in6 *)rti_info[RTAX_NETMASK];
|
||||
if (rtm->rtm_flags & RTF_STATIC)
|
||||
@@ -2257,8 +2906,12 @@ fetchtable(u_int rtableid, int connected
|
||||
if (sa_in6->sin6_len == 0)
|
||||
break;
|
||||
kr6->r.prefixlen = mask2prefixlen6(sa_in6);
|
||||
@ -2696,7 +2758,21 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
else
|
||||
fatalx("INET6 route without netmask");
|
||||
break;
|
||||
@@ -2290,23 +2921,28 @@ fetchtable(u_int rtableid, int connected
|
||||
@@ -2280,6 +2933,13 @@ fetchtable(u_int rtableid, int connected
|
||||
memcpy(&kr6->r.nexthop,
|
||||
&((struct sockaddr_in6 *)gw)->sin6_addr,
|
||||
sizeof(kr6->r.nexthop));
|
||||
+#if defined(__KAME__) && defined(IPV6_LINKLOCAL_PEER)
|
||||
+ if (IN6_IS_ADDR_LINKLOCAL(&kr6->r.nexthop) &&
|
||||
+ ((struct sockaddr_in6 *)gw)->sin6_scope_id != 0) {
|
||||
+ SET_IN6_LINKLOCAL_IFINDEX(kr6->r.nexthop,
|
||||
+ ((struct sockaddr_in6 *)gw)->sin6_scope_id);
|
||||
+ }
|
||||
+#endif
|
||||
break;
|
||||
case AF_LINK:
|
||||
if (sa->sa_family == AF_INET)
|
||||
@@ -2290,23 +2950,28 @@ fetchtable(u_int rtableid, int connected
|
||||
}
|
||||
|
||||
if (sa->sa_family == AF_INET) {
|
||||
@ -2737,7 +2813,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
}
|
||||
}
|
||||
free(buf);
|
||||
@@ -2327,7 +2963,7 @@ fetchifs(int ifindex)
|
||||
@@ -2327,7 +2992,7 @@ fetchifs(int ifindex)
|
||||
mib[0] = CTL_NET;
|
||||
mib[1] = AF_ROUTE;
|
||||
mib[2] = 0;
|
||||
@ -2746,7 +2822,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
mib[4] = NET_RT_IFLIST;
|
||||
mib[5] = ifindex;
|
||||
|
||||
@@ -2396,7 +3032,7 @@ dispatch_rtmsg(void)
|
||||
@@ -2396,7 +3061,7 @@ dispatch_rtmsg(void)
|
||||
struct rt_msghdr *rtm;
|
||||
struct if_msghdr ifm;
|
||||
struct sockaddr *sa, *rti_info[RTAX_MAX];
|
||||
@ -2755,7 +2831,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
|
||||
if ((n = read(kr_state.fd, &buf, sizeof(buf))) == -1) {
|
||||
log_warn("dispatch_rtmsg: read error");
|
||||
@@ -2418,7 +3054,11 @@ dispatch_rtmsg(void)
|
||||
@@ -2418,7 +3083,11 @@ dispatch_rtmsg(void)
|
||||
case RTM_ADD:
|
||||
case RTM_CHANGE:
|
||||
case RTM_DELETE:
|
||||
@ -2767,7 +2843,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
get_rtaddrs(rtm->rtm_addrs, sa, rti_info);
|
||||
|
||||
if (rtm->rtm_pid == kr_state.pid) /* cause by us */
|
||||
@@ -2430,16 +3070,14 @@ dispatch_rtmsg(void)
|
||||
@@ -2430,16 +3099,14 @@ dispatch_rtmsg(void)
|
||||
if (rtm->rtm_flags & RTF_LLINFO) /* arp cache */
|
||||
continue;
|
||||
|
||||
@ -2791,7 +2867,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
return (-1);
|
||||
break;
|
||||
case RTM_IFINFO:
|
||||
@@ -2460,7 +3098,7 @@ dispatch_rtmsg(void)
|
||||
@@ -2460,7 +3127,7 @@ dispatch_rtmsg(void)
|
||||
|
||||
int
|
||||
dispatch_rtmsg_addr(struct rt_msghdr *rtm, struct sockaddr *rti_info[RTAX_MAX],
|
||||
@ -2800,7 +2876,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
{
|
||||
struct sockaddr *sa;
|
||||
struct sockaddr_in *sa_in;
|
||||
@@ -2468,7 +3106,7 @@ dispatch_rtmsg_addr(struct rt_msghdr *rt
|
||||
@@ -2468,7 +3135,7 @@ dispatch_rtmsg_addr(struct rt_msghdr *rt
|
||||
struct kroute_node *kr;
|
||||
struct kroute6_node *kr6;
|
||||
struct bgpd_addr prefix;
|
||||
@ -2809,7 +2885,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
u_int16_t ifindex;
|
||||
u_int8_t prefixlen;
|
||||
u_int8_t prio;
|
||||
@@ -2494,31 +3132,44 @@ dispatch_rtmsg_addr(struct rt_msghdr *rt
|
||||
@@ -2494,31 +3161,54 @@ dispatch_rtmsg_addr(struct rt_msghdr *rt
|
||||
mpath = 1;
|
||||
#endif
|
||||
|
||||
@ -2844,6 +2920,16 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
+ prefix.aid = AID_INET6;
|
||||
memcpy(&prefix.v6, &((struct sockaddr_in6 *)sa)->sin6_addr,
|
||||
sizeof(struct in6_addr));
|
||||
+#if defined(__KAME__) && defined(IPV6_LINKLOCAL_PEER)
|
||||
+ if (IN6_IS_ADDR_LINKLOCAL(&prefix.v6) != 0) {
|
||||
+ if (((struct sockaddr_in6 *)sa)->sin6_scope_id !=0)
|
||||
+ SET_IN6_LINKLOCAL_IFINDEX(prefix.v6,
|
||||
+ ((struct sockaddr_in6 *)sa)->sin6_scope_id);
|
||||
+ else
|
||||
+ SET_IN6_LINKLOCAL_IFINDEX(prefix.v6,
|
||||
+ rtm->rtm_index);
|
||||
+ }
|
||||
+#endif
|
||||
sa_in6 = (struct sockaddr_in6 *)rti_info[RTAX_NETMASK];
|
||||
if (sa_in6 != NULL) {
|
||||
if (sa_in6->sin6_len != 0)
|
||||
@ -2858,7 +2944,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
else
|
||||
fatalx("in6 net addr without netmask");
|
||||
break;
|
||||
@@ -2537,10 +3188,10 @@ dispatch_rtmsg_addr(struct rt_msghdr *rt
|
||||
@@ -2537,10 +3227,10 @@ dispatch_rtmsg_addr(struct rt_msghdr *rt
|
||||
}
|
||||
|
||||
if (rtm->rtm_type == RTM_DELETE) {
|
||||
@ -2872,7 +2958,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
prefixlen, prio)) == NULL)
|
||||
return (0);
|
||||
if (!(kr->r.flags & F_KERNEL))
|
||||
@@ -2554,12 +3205,12 @@ dispatch_rtmsg_addr(struct rt_msghdr *rt
|
||||
@@ -2554,12 +3244,12 @@ dispatch_rtmsg_addr(struct rt_msghdr *rt
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -2888,7 +2974,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
prio)) == NULL)
|
||||
return (0);
|
||||
if (!(kr6->r.flags & F_KERNEL))
|
||||
@@ -2574,26 +3225,23 @@ dispatch_rtmsg_addr(struct rt_msghdr *rt
|
||||
@@ -2574,26 +3264,23 @@ dispatch_rtmsg_addr(struct rt_msghdr *rt
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -2919,7 +3005,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
prio)) != NULL) {
|
||||
if (kr->r.flags & F_KERNEL) {
|
||||
/* get the correct route */
|
||||
@@ -2605,30 +3253,38 @@ dispatch_rtmsg_addr(struct rt_msghdr *rt
|
||||
@@ -2605,30 +3292,38 @@ dispatch_rtmsg_addr(struct rt_msghdr *rt
|
||||
} else if (mpath && rtm->rtm_type == RTM_ADD)
|
||||
goto add4;
|
||||
|
||||
@ -2964,7 +3050,7 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
}
|
||||
} else if (rtm->rtm_type == RTM_CHANGE) {
|
||||
log_warnx("change req for %s/%u: not in table",
|
||||
@@ -2651,50 +3307,62 @@ add4:
|
||||
@@ -2651,50 +3346,62 @@ add4:
|
||||
kr->r.ifindex = ifindex;
|
||||
kr->r.priority = prio;
|
||||
|
||||
@ -3037,11 +3123,17 @@ diff -u -p -r1.1.1.7 -r1.14
|
||||
}
|
||||
} else if (rtm->rtm_type == RTM_CHANGE) {
|
||||
log_warnx("change req for %s/%u: not in table",
|
||||
@@ -2720,7 +3388,7 @@ add6:
|
||||
@@ -2719,8 +3426,12 @@ add6:
|
||||
kr6->r.flags = flags;
|
||||
kr6->r.ifindex = ifindex;
|
||||
kr6->r.priority = prio;
|
||||
|
||||
-
|
||||
- kroute6_insert(kr6);
|
||||
+#if defined(__KAME__) && defined(IPV6_LINKLOCAL_PEER)
|
||||
+ if (IN6_IS_ADDR_LINKLOCAL(&kr6->r.nexthop))
|
||||
+ SET_IN6_LINKLOCAL_IFINDEX(kr6->r.nexthop,
|
||||
+ ifindex);
|
||||
+#endif
|
||||
+ kroute6_insert(kt, kr6);
|
||||
}
|
||||
break;
|
||||
|
@ -2,10 +2,10 @@ Index: bgpd/printconf.c
|
||||
===================================================================
|
||||
RCS file: /home/cvs/private/hrs/openbgpd/bgpd/printconf.c,v
|
||||
retrieving revision 1.1.1.7
|
||||
retrieving revision 1.10
|
||||
diff -u -p -r1.1.1.7 -r1.10
|
||||
retrieving revision 1.11
|
||||
diff -u -p -r1.1.1.7 -r1.11
|
||||
--- bgpd/printconf.c 14 Feb 2010 20:19:57 -0000 1.1.1.7
|
||||
+++ bgpd/printconf.c 8 Dec 2012 20:17:59 -0000 1.10
|
||||
+++ bgpd/printconf.c 16 May 2014 00:36:26 -0000 1.11
|
||||
@@ -1,4 +1,4 @@
|
||||
-/* $OpenBSD: printconf.c,v 1.70 2009/06/06 01:10:29 claudio Exp $ */
|
||||
+/* $OpenBSD: printconf.c,v 1.88 2012/09/23 09:39:18 claudio Exp $ */
|
||||
@ -379,7 +379,7 @@ diff -u -p -r1.1.1.7 -r1.10
|
||||
case MRT_ALL_IN:
|
||||
return "all in";
|
||||
case MRT_ALL_OUT:
|
||||
@@ -541,13 +648,12 @@ print_mrt(u_int32_t pid, u_int32_t gid,
|
||||
@@ -541,12 +648,12 @@ print_mrt(u_int32_t pid, u_int32_t gid,
|
||||
printf("%s%sdump ", prep, prep2);
|
||||
if (m->rib[0])
|
||||
printf("rib %s ", m->rib);
|
||||
@ -392,12 +392,11 @@ diff -u -p -r1.1.1.7 -r1.10
|
||||
else
|
||||
- printf("%s %s %d\n", mrt_type(m->type),
|
||||
- MRT2MC(m)->name,
|
||||
- MRT2MC(m)->ReopenTimerInterval);
|
||||
+ printf(" %d\n", MRT2MC(m)->ReopenTimerInterval);
|
||||
+ printf(" %ld\n",
|
||||
MRT2MC(m)->ReopenTimerInterval);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -612,26 +718,34 @@ peer_compare(const void *aa, const void
|
||||
@@ -612,26 +719,34 @@ peer_compare(const void *aa, const void
|
||||
void
|
||||
print_config(struct bgpd_config *conf, struct rib_names *rib_l,
|
||||
struct network_head *net_l, struct peer *peer_l,
|
||||
|
@ -2,10 +2,10 @@ Index: bgpd/rde.c
|
||||
===================================================================
|
||||
RCS file: /home/cvs/private/hrs/openbgpd/bgpd/rde.c,v
|
||||
retrieving revision 1.1.1.8
|
||||
retrieving revision 1.11
|
||||
diff -u -p -r1.1.1.8 -r1.11
|
||||
retrieving revision 1.12
|
||||
diff -u -p -r1.1.1.8 -r1.12
|
||||
--- bgpd/rde.c 14 Feb 2010 20:19:57 -0000 1.1.1.8
|
||||
+++ bgpd/rde.c 13 Oct 2012 18:36:00 -0000 1.11
|
||||
+++ bgpd/rde.c 16 May 2014 00:36:26 -0000 1.12
|
||||
@@ -1,4 +1,4 @@
|
||||
-/* $OpenBSD: rde.c,v 1.264 2009/06/29 12:22:16 claudio Exp $ */
|
||||
+/* $OpenBSD: rde.c,v 1.320 2012/09/18 09:45:51 claudio Exp $ */
|
||||
@ -671,7 +671,9 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
+ peer->reconf_out = 1;
|
||||
+ reconf_out = 1;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
- /* XXX this needs rework anyway */
|
||||
- /* sync local-RIB first */
|
||||
+ /* bring ribs in sync before softreconfig dance */
|
||||
+ for (rid = 0; rid < rib_size; rid++) {
|
||||
+ if (ribs[rid].state == RECONF_DELETE)
|
||||
@ -680,9 +682,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
+ rib_dump(&ribs[0],
|
||||
+ rde_softreconfig_load, &ribs[rid],
|
||||
+ AID_UNSPEC);
|
||||
}
|
||||
- /* XXX this needs rework anyway */
|
||||
- /* sync local-RIB first */
|
||||
+ }
|
||||
+ /* sync local-RIBs first */
|
||||
if (reconf_in)
|
||||
rib_dump(&ribs[0], rde_softreconfig_in, NULL,
|
||||
@ -1201,7 +1201,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
if (!CHECK_FLAGS(flags, ATTR_OPTIONAL|ATTR_TRANSITIVE,
|
||||
ATTR_PARTIAL))
|
||||
goto bad_flags;
|
||||
@@ -1381,19 +1729,30 @@ bad_flags:
|
||||
@@ -1381,20 +1729,31 @@ bad_flags:
|
||||
if (!CHECK_FLAGS(flags, ATTR_OPTIONAL|ATTR_TRANSITIVE,
|
||||
ATTR_PARTIAL))
|
||||
goto bad_flags;
|
||||
@ -1226,6 +1226,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
- goto optattr;
|
||||
- }
|
||||
- a->flags |= F_ATTR_AS4BYTE_NEW;
|
||||
- goto optattr;
|
||||
+ if (flags & ATTR_PARTIAL || err == AS_ERR_SOFT) {
|
||||
+ a->flags |= F_ATTR_PARSE_ERR;
|
||||
+ log_peer_warnx(&peer->conf, "bad AS4_PATH, "
|
||||
@ -1238,9 +1239,10 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
+ }
|
||||
+ }
|
||||
+ a->flags |= F_ATTR_AS4BYTE_NEW;
|
||||
goto optattr;
|
||||
+ goto optattr;
|
||||
default:
|
||||
if ((flags & ATTR_OPTIONAL) == 0) {
|
||||
rde_update_err(peer, ERR_UPDATE, ERR_UPD_UNKNWN_WK_ATTR,
|
||||
@@ -1415,6 +1774,42 @@ bad_list:
|
||||
|
||||
return (plen);
|
||||
@ -1307,7 +1309,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
/*
|
||||
* RFC2545 describes that there may be a link-local
|
||||
* address carried in nexthop. Yikes!
|
||||
@@ -1471,72 +1867,143 @@ rde_get_mp_nexthop(u_char *data, u_int16
|
||||
@@ -1471,72 +1867,144 @@ rde_get_mp_nexthop(u_char *data, u_int16
|
||||
log_warnx("bad multiprotocol nexthop, bad size");
|
||||
return (-1);
|
||||
}
|
||||
@ -1320,9 +1322,10 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
+ int ifindex;
|
||||
+
|
||||
+ ifindex = if_nametoindex(peer->conf.lliface);
|
||||
+ if (ifindex != 0)
|
||||
+ if (ifindex != 0) {
|
||||
+ SET_IN6_LINKLOCAL_IFINDEX(nexthop.v6, ifindex);
|
||||
+ else
|
||||
+ nexthop.scope_id = ifindex;
|
||||
+ } else
|
||||
+ log_warnx("bad interface: %s", peer->conf.lliface);
|
||||
+ }
|
||||
+#endif
|
||||
@ -1490,7 +1493,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
|
||||
if (len < 1)
|
||||
return (-1);
|
||||
@@ -1546,25 +2013,50 @@ rde_update_get_prefix6(u_char *p, u_int1
|
||||
@@ -1546,25 +2014,50 @@ rde_update_get_prefix6(u_char *p, u_int1
|
||||
plen = 1;
|
||||
|
||||
bzero(prefix, sizeof(struct bgpd_addr));
|
||||
@ -1552,7 +1555,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
|
||||
if ((wbuf = imsg_create(ibuf_se, IMSG_UPDATE_ERR, peer->conf.id, 0,
|
||||
size + sizeof(error) + sizeof(suberr))) == NULL)
|
||||
@@ -1616,16 +2108,30 @@ rde_as4byte_fixup(struct rde_peer *peer,
|
||||
@@ -1616,16 +2109,30 @@ rde_as4byte_fixup(struct rde_peer *peer,
|
||||
struct attr *nasp, *naggr, *oaggr;
|
||||
u_int32_t as;
|
||||
|
||||
@ -1585,7 +1588,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
return;
|
||||
}
|
||||
/* OLD session using 2-byte ASNs */
|
||||
@@ -1669,6 +2175,10 @@ rde_reflector(struct rde_peer *peer, str
|
||||
@@ -1669,6 +2176,10 @@ rde_reflector(struct rde_peer *peer, str
|
||||
u_int16_t len;
|
||||
u_int32_t id;
|
||||
|
||||
@ -1596,7 +1599,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
/* check for originator id if eq router_id drop */
|
||||
if ((a = attr_optget(asp, ATTR_ORIGINATOR_ID)) != NULL) {
|
||||
if (memcmp(&conf->bgpid, a->data, sizeof(conf->bgpid)) == 0) {
|
||||
@@ -1677,10 +2187,10 @@ rde_reflector(struct rde_peer *peer, str
|
||||
@@ -1677,10 +2188,10 @@ rde_reflector(struct rde_peer *peer, str
|
||||
return;
|
||||
}
|
||||
} else if (conf->flags & BGPD_FLAG_REFLECTOR) {
|
||||
@ -1610,7 +1613,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
if (attr_optadd(asp, ATTR_OPTIONAL, ATTR_ORIGINATOR_ID,
|
||||
&id, sizeof(u_int32_t)) == -1)
|
||||
fatalx("attr_optadd failed but impossible");
|
||||
@@ -1724,17 +2234,17 @@ void
|
||||
@@ -1724,17 +2235,17 @@ void
|
||||
rde_dump_rib_as(struct prefix *p, struct rde_aspath *asp, pid_t pid, int flags)
|
||||
{
|
||||
struct ctl_show_rib rib;
|
||||
@ -1631,7 +1634,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
strlcpy(rib.descr, asp->peer->conf.descr, sizeof(rib.descr));
|
||||
memcpy(&rib.remote_addr, &asp->peer->remote_addr,
|
||||
sizeof(rib.remote_addr));
|
||||
@@ -1748,23 +2258,26 @@ rde_dump_rib_as(struct prefix *p, struct
|
||||
@@ -1748,23 +2259,26 @@ rde_dump_rib_as(struct prefix *p, struct
|
||||
/* announced network may have a NULL nexthop */
|
||||
bzero(&rib.true_nexthop, sizeof(rib.true_nexthop));
|
||||
bzero(&rib.exit_nexthop, sizeof(rib.exit_nexthop));
|
||||
@ -1666,7 +1669,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
rib.aspath_len = aspath_length(asp->aspath);
|
||||
|
||||
if ((wbuf = imsg_create(ibuf_se_ctl, IMSG_CTL_SHOW_RIB, 0, pid,
|
||||
@@ -1784,13 +2297,13 @@ rde_dump_rib_as(struct prefix *p, struct
|
||||
@@ -1784,13 +2298,13 @@ rde_dump_rib_as(struct prefix *p, struct
|
||||
IMSG_CTL_SHOW_RIB_ATTR, 0, pid,
|
||||
attr_optlen(a))) == NULL)
|
||||
return;
|
||||
@ -1683,7 +1686,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
return;
|
||||
}
|
||||
imsg_close(ibuf_se_ctl, wbuf);
|
||||
@@ -1828,17 +2341,20 @@ rde_dump_filter(struct prefix *p, struct
|
||||
@@ -1828,17 +2342,20 @@ rde_dump_filter(struct prefix *p, struct
|
||||
{
|
||||
struct rde_peer *peer;
|
||||
|
||||
@ -1708,7 +1711,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
rde_dump_rib_as(p, p->aspath, req->pid, req->flags);
|
||||
} else if (req->flags & F_CTL_ADJ_OUT) {
|
||||
if (p->rib->active != p)
|
||||
@@ -1872,7 +2388,7 @@ rde_dump_prefix_upcall(struct rib_entry
|
||||
@@ -1872,7 +2389,7 @@ rde_dump_prefix_upcall(struct rib_entry
|
||||
|
||||
pt = re->prefix;
|
||||
pt_getaddr(pt, &addr);
|
||||
@ -1717,7 +1720,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
return;
|
||||
if (ctx->req.prefixlen > pt->prefixlen)
|
||||
return;
|
||||
@@ -1889,6 +2405,7 @@ rde_dump_ctx_new(struct ctl_show_rib_req
|
||||
@@ -1889,6 +2406,7 @@ rde_dump_ctx_new(struct ctl_show_rib_req
|
||||
struct rib_entry *re;
|
||||
u_int error;
|
||||
u_int16_t id;
|
||||
@ -1725,7 +1728,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
|
||||
if ((ctx = calloc(1, sizeof(*ctx))) == NULL) {
|
||||
log_warn("rde_dump_ctx_new");
|
||||
@@ -1902,6 +2419,7 @@ rde_dump_ctx_new(struct ctl_show_rib_req
|
||||
@@ -1902,6 +2420,7 @@ rde_dump_ctx_new(struct ctl_show_rib_req
|
||||
error = CTL_RES_NOSUCHPEER;
|
||||
imsg_compose(ibuf_se_ctl, IMSG_CTL_RESULT, 0, pid, -1, &error,
|
||||
sizeof(error));
|
||||
@ -1733,7 +1736,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1924,7 +2442,18 @@ rde_dump_ctx_new(struct ctl_show_rib_req
|
||||
@@ -1924,7 +2443,18 @@ rde_dump_ctx_new(struct ctl_show_rib_req
|
||||
ctx->ribctx.ctx_upcall = rde_dump_prefix_upcall;
|
||||
break;
|
||||
}
|
||||
@ -1753,7 +1756,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
re = rib_lookup(&ribs[id], &req->prefix);
|
||||
else
|
||||
re = rib_get(&ribs[id], &req->prefix, req->prefixlen);
|
||||
@@ -1937,7 +2466,7 @@ rde_dump_ctx_new(struct ctl_show_rib_req
|
||||
@@ -1937,7 +2467,7 @@ rde_dump_ctx_new(struct ctl_show_rib_req
|
||||
}
|
||||
ctx->ribctx.ctx_done = rde_dump_done;
|
||||
ctx->ribctx.ctx_arg = ctx;
|
||||
@ -1762,7 +1765,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
rib_dump_r(&ctx->ribctx);
|
||||
}
|
||||
|
||||
@@ -1971,13 +2500,17 @@ rde_dump_mrt_new(struct mrt *mrt, pid_t
|
||||
@@ -1971,13 +2501,17 @@ rde_dump_mrt_new(struct mrt *mrt, pid_t
|
||||
free(ctx);
|
||||
return;
|
||||
}
|
||||
@ -1783,7 +1786,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
rde_mrt_cnt++;
|
||||
rib_dump_r(&ctx->ribctx);
|
||||
}
|
||||
@@ -1985,13 +2518,25 @@ rde_dump_mrt_new(struct mrt *mrt, pid_t
|
||||
@@ -1985,13 +2519,25 @@ rde_dump_mrt_new(struct mrt *mrt, pid_t
|
||||
/*
|
||||
* kroute specific functions
|
||||
*/
|
||||
@ -1812,7 +1815,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
enum imsg_type type;
|
||||
|
||||
/*
|
||||
@@ -2011,43 +2556,43 @@ rde_send_kroute(struct prefix *new, stru
|
||||
@@ -2011,43 +2557,43 @@ rde_send_kroute(struct prefix *new, stru
|
||||
}
|
||||
|
||||
pt_getaddr(p->prefix, &addr);
|
||||
@ -1892,7 +1895,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
fatal("imsg_compose error");
|
||||
break;
|
||||
}
|
||||
@@ -2098,7 +2643,6 @@ rde_send_pftable_commit(void)
|
||||
@@ -2098,7 +2644,6 @@ rde_send_pftable_commit(void)
|
||||
void
|
||||
rde_send_nexthop(struct bgpd_addr *next, int valid)
|
||||
{
|
||||
@ -1900,7 +1903,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
int type;
|
||||
|
||||
if (valid)
|
||||
@@ -2106,8 +2650,6 @@ rde_send_nexthop(struct bgpd_addr *next,
|
||||
@@ -2106,8 +2651,6 @@ rde_send_nexthop(struct bgpd_addr *next,
|
||||
else
|
||||
type = IMSG_NEXTHOP_REMOVE;
|
||||
|
||||
@ -1909,7 +1912,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
if (imsg_compose(ibuf_main, type, 0, 0, -1, next,
|
||||
sizeof(struct bgpd_addr)) == -1)
|
||||
fatal("imsg_compose error");
|
||||
@@ -2201,6 +2743,10 @@ rde_softreconfig_in(struct rib_entry *re
|
||||
@@ -2201,6 +2744,10 @@ rde_softreconfig_in(struct rib_entry *re
|
||||
continue;
|
||||
|
||||
for (i = 1; i < rib_size; i++) {
|
||||
@ -1920,7 +1923,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
/* check if prefix changed */
|
||||
oa = rde_filter(i, &oasp, rules_l, peer, asp, &addr,
|
||||
pt->prefixlen, peer, DIR_IN);
|
||||
@@ -2228,7 +2774,7 @@ rde_softreconfig_in(struct rib_entry *re
|
||||
@@ -2228,7 +2775,7 @@ rde_softreconfig_in(struct rib_entry *re
|
||||
if (path_compare(nasp, oasp) == 0)
|
||||
goto done;
|
||||
/* send update */
|
||||
@ -1929,7 +1932,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
pt->prefixlen);
|
||||
}
|
||||
|
||||
@@ -2241,6 +2787,104 @@ done:
|
||||
@@ -2241,6 +2788,104 @@ done:
|
||||
}
|
||||
}
|
||||
|
||||
@ -2034,7 +2037,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
/*
|
||||
* update specific functions
|
||||
*/
|
||||
@@ -2252,7 +2896,7 @@ rde_up_dump_upcall(struct rib_entry *re,
|
||||
@@ -2252,7 +2897,7 @@ rde_up_dump_upcall(struct rib_entry *re,
|
||||
struct rde_peer *peer = ptr;
|
||||
|
||||
if (re->ribid != peer->ribid)
|
||||
@ -2043,7 +2046,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
if (re->active == NULL)
|
||||
return;
|
||||
up_generate_updates(rules_l, peer, re->active, NULL);
|
||||
@@ -2265,7 +2909,7 @@ rde_generate_updates(u_int16_t ribid, st
|
||||
@@ -2265,7 +2910,7 @@ rde_generate_updates(u_int16_t ribid, st
|
||||
|
||||
/*
|
||||
* If old is != NULL we know it was active and should be removed.
|
||||
@ -2052,7 +2055,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
* generate an update.
|
||||
*/
|
||||
if (old == NULL && new == NULL)
|
||||
@@ -2286,7 +2930,7 @@ void
|
||||
@@ -2286,7 +2931,7 @@ void
|
||||
rde_update_queue_runner(void)
|
||||
{
|
||||
struct rde_peer *peer;
|
||||
@ -2061,7 +2064,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
u_int16_t len, wd_len, wpos;
|
||||
|
||||
len = sizeof(queue_buf) - MSGSIZE_HEADER;
|
||||
@@ -2300,7 +2944,7 @@ rde_update_queue_runner(void)
|
||||
@@ -2300,7 +2945,7 @@ rde_update_queue_runner(void)
|
||||
/* first withdraws */
|
||||
wpos = 2; /* reserve space for the length field */
|
||||
r = up_dump_prefix(queue_buf + wpos, len - wpos - 2,
|
||||
@ -2070,7 +2073,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
wd_len = r;
|
||||
/* write withdraws length filed */
|
||||
wd_len = htons(wd_len);
|
||||
@@ -2310,31 +2954,49 @@ rde_update_queue_runner(void)
|
||||
@@ -2310,31 +2955,49 @@ rde_update_queue_runner(void)
|
||||
/* now bgp path attributes */
|
||||
r = up_dump_attrnlri(queue_buf + wpos, len - wpos,
|
||||
peer);
|
||||
@ -2130,7 +2133,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
u_int16_t len;
|
||||
|
||||
/* first withdraws ... */
|
||||
@@ -2346,7 +3008,7 @@ rde_update6_queue_runner(void)
|
||||
@@ -2346,7 +3009,7 @@ rde_update6_queue_runner(void)
|
||||
if (peer->state != PEER_UP)
|
||||
continue;
|
||||
len = sizeof(queue_buf) - MSGSIZE_HEADER;
|
||||
@ -2139,7 +2142,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
|
||||
if (b == NULL)
|
||||
continue;
|
||||
@@ -2369,10 +3031,18 @@ rde_update6_queue_runner(void)
|
||||
@@ -2369,10 +3032,18 @@ rde_update6_queue_runner(void)
|
||||
if (peer->state != PEER_UP)
|
||||
continue;
|
||||
len = sizeof(queue_buf) - MSGSIZE_HEADER;
|
||||
@ -2149,10 +2152,10 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
+ r = up_dump_mp_reach(queue_buf, &len, peer, aid);
|
||||
+ switch (r) {
|
||||
+ case -2:
|
||||
continue;
|
||||
+ continue;
|
||||
+ case -1:
|
||||
+ peer_send_eor(peer, aid);
|
||||
+ continue;
|
||||
continue;
|
||||
+ default:
|
||||
+ b = queue_buf + r;
|
||||
+ break;
|
||||
@ -2161,7 +2164,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
/* finally send message to SE */
|
||||
if (imsg_compose(ibuf_se, IMSG_UPDATE, peer->conf.id,
|
||||
0, -1, b, len) == -1)
|
||||
@@ -2411,7 +3081,7 @@ rde_decisionflags(void)
|
||||
@@ -2411,7 +3082,7 @@ rde_decisionflags(void)
|
||||
int
|
||||
rde_as4byte(struct rde_peer *peer)
|
||||
{
|
||||
@ -2170,7 +2173,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2429,7 +3099,6 @@ void
|
||||
@@ -2429,7 +3100,6 @@ void
|
||||
peer_init(u_int32_t hashsize)
|
||||
{
|
||||
struct peer_config pc;
|
||||
@ -2178,7 +2181,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
u_int32_t hs, i;
|
||||
|
||||
for (hs = 1; hs < hashsize; hs <<= 1)
|
||||
@@ -2445,17 +3114,13 @@ peer_init(u_int32_t hashsize)
|
||||
@@ -2445,17 +3115,13 @@ peer_init(u_int32_t hashsize)
|
||||
peertable.peer_hashmask = hs - 1;
|
||||
|
||||
bzero(&pc, sizeof(pc));
|
||||
@ -2197,7 +2200,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2534,14 +3199,10 @@ peer_localaddrs(struct rde_peer *peer, s
|
||||
@@ -2534,14 +3200,10 @@ peer_localaddrs(struct rde_peer *peer, s
|
||||
if (ifa->ifa_addr->sa_family ==
|
||||
match->ifa_addr->sa_family)
|
||||
ifa = match;
|
||||
@ -2213,7 +2216,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) {
|
||||
if (ifa->ifa_addr->sa_family == AF_INET6 &&
|
||||
strcmp(ifa->ifa_name, match->ifa_name) == 0) {
|
||||
@@ -2559,13 +3220,7 @@ peer_localaddrs(struct rde_peer *peer, s
|
||||
@@ -2559,13 +3221,7 @@ peer_localaddrs(struct rde_peer *peer, s
|
||||
&((struct sockaddr_in6 *)ifa->
|
||||
ifa_addr)->sin6_addr))
|
||||
continue;
|
||||
@ -2228,7 +2231,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2577,23 +3232,22 @@ void
|
||||
@@ -2577,23 +3233,22 @@ void
|
||||
peer_up(u_int32_t id, struct session_up *sup)
|
||||
{
|
||||
struct rde_peer *peer;
|
||||
@ -2257,7 +2260,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
|
||||
peer_localaddrs(peer, &sup->local_addr);
|
||||
|
||||
@@ -2607,7 +3261,10 @@ peer_up(u_int32_t id, struct session_up
|
||||
@@ -2607,7 +3262,10 @@ peer_up(u_int32_t id, struct session_up
|
||||
*/
|
||||
return;
|
||||
|
||||
@ -2269,7 +2272,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2641,43 +3298,90 @@ peer_down(u_int32_t id)
|
||||
@@ -2641,43 +3299,90 @@ peer_down(u_int32_t id)
|
||||
free(peer);
|
||||
}
|
||||
|
||||
@ -2383,7 +2386,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
u_char null[4];
|
||||
|
||||
bzero(&null, 4);
|
||||
@@ -2688,6 +3392,9 @@ peer_send_eor(struct rde_peer *peer, u_i
|
||||
@@ -2688,6 +3393,9 @@ peer_send_eor(struct rde_peer *peer, u_i
|
||||
u_int16_t i;
|
||||
u_char buf[10];
|
||||
|
||||
@ -2393,7 +2396,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
i = 0; /* v4 withdrawn len */
|
||||
bcopy(&i, &buf[0], sizeof(i));
|
||||
i = htons(6); /* path attr len */
|
||||
@@ -2709,39 +3416,61 @@ peer_send_eor(struct rde_peer *peer, u_i
|
||||
@@ -2709,39 +3417,61 @@ peer_send_eor(struct rde_peer *peer, u_i
|
||||
* network announcement stuff
|
||||
*/
|
||||
void
|
||||
@ -2478,7 +2481,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
path_put(asp);
|
||||
filterset_free(&nc->attrset);
|
||||
}
|
||||
@@ -2749,12 +3478,41 @@ network_add(struct network_config *nc, i
|
||||
@@ -2749,12 +3479,41 @@ network_add(struct network_config *nc, i
|
||||
void
|
||||
network_delete(struct network_config *nc, int flagstatic)
|
||||
{
|
||||
@ -2522,7 +2525,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
for (i = rib_size - 1; i > 0; i--)
|
||||
prefix_remove(&ribs[i], peerself, &nc->prefix, nc->prefixlen,
|
||||
flags);
|
||||
@@ -2764,38 +3522,31 @@ void
|
||||
@@ -2764,38 +3523,31 @@ void
|
||||
network_dump_upcall(struct rib_entry *re, void *ptr)
|
||||
{
|
||||
struct prefix *p;
|
||||
@ -2580,7 +2583,7 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2841,10 +3592,10 @@ sa_cmp(struct bgpd_addr *a, struct socka
|
||||
@@ -2841,10 +3593,10 @@ sa_cmp(struct bgpd_addr *a, struct socka
|
||||
struct sockaddr_in *in_b;
|
||||
struct sockaddr_in6 *in6_b;
|
||||
|
||||
@ -2593,3 +2596,19 @@ diff -u -p -r1.1.1.8 -r1.11
|
||||
case AF_INET:
|
||||
in_b = (struct sockaddr_in *)b;
|
||||
if (a->v4.s_addr != in_b->sin_addr.s_addr)
|
||||
@@ -2855,10 +3607,11 @@ sa_cmp(struct bgpd_addr *a, struct socka
|
||||
#ifdef __KAME__
|
||||
/* 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;
|
||||
+ if (in6_b->sin6_scope_id == 0) {
|
||||
+ in6_b->sin6_scope_id =
|
||||
+ IN6_LINKLOCAL_IFINDEX(in6_b->sin6_addr);
|
||||
+ }
|
||||
+ SET_IN6_LINKLOCAL_IFINDEX(in6_b->sin6_addr, 0);
|
||||
}
|
||||
#endif
|
||||
if (bcmp(&a->v6, &in6_b->sin6_addr,
|
||||
|
Loading…
Reference in New Issue
Block a user