Skip to content

Commit

Permalink
For IPv6 pass prefix not nexthop as network for connected nexthops ba…
Browse files Browse the repository at this point in the history
…ck to

the RDE so that the code actually works.
Problem found and reported by Pier Carlo Chiodi (pierky at pierky com)
OK deraadt@
  • Loading branch information
cjeker committed Mar 28, 2017
1 parent a568087 commit f1385c8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions usr.sbin/bgpd/kroute.c
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit f1385c8

Please sign in to comment.