summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/kroute.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2017-03-28 05:04:10 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2017-03-28 05:04:10 +0000
commitc5af497f0e317feb29de2b88e0833e688bea9811 (patch)
tree32e948f2d069745532b15cba71545167c2cadded /usr.sbin/bgpd/kroute.c
parent79e7760e1a6b76d3ff041d9591e549f74579eeed (diff)
For IPv6 pass prefix not nexthop as network for connected nexthops back to
the RDE so that the code actually works. Problem found and reported by Pier Carlo Chiodi (pierky at pierky com) OK deraadt@
Diffstat (limited to 'usr.sbin/bgpd/kroute.c')
-rw-r--r--usr.sbin/bgpd/kroute.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c
index b4edd7ffe24..36926dd2fd5 100644
--- a/usr.sbin/bgpd/kroute.c
+++ b/usr.sbin/bgpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.211 2017/01/24 04:22:42 benno Exp $ */
+/* $OpenBSD: kroute.c,v 1.212 2017/03/28 05:04:09 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -2200,9 +2200,10 @@ knexthop_send_update(struct knexthop_node *kn)
kr = kn->kroute;
n.valid = kroute_validate(&kr->r);
n.connected = kr->r.flags & F_CONNECTED;
- if ((n.gateway.v4.s_addr =
- kr->r.nexthop.s_addr) != 0)
+ if (kr->r.nexthop.s_addr != 0) {
n.gateway.aid = AID_INET;
+ n.gateway.v4.s_addr = kr->r.nexthop.s_addr;
+ }
if (n.connected) {
n.net.aid = AID_INET;
n.net.v4.s_addr = kr->r.prefix.s_addr;
@@ -2221,7 +2222,7 @@ knexthop_send_update(struct knexthop_node *kn)
}
if (n.connected) {
n.net.aid = AID_INET6;
- memcpy(&n.net.v6, &kr6->r.nexthop,
+ memcpy(&n.net.v6, &kr6->r.prefix,
sizeof(struct in6_addr));
n.netlen = kr6->r.prefixlen;
}