summaryrefslogtreecommitdiff
path: root/usr.sbin/ldpd/neighbor.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2011-03-12 01:57:14 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2011-03-12 01:57:14 +0000
commitcd06312d1f6bdbfe322dd8bf9ada43332f0d48e3 (patch)
tree4e749a5baf77ae8c4b7f3ccfd7cb93f933fe5eb1 /usr.sbin/ldpd/neighbor.c
parent052a85efe8d2f0b86634f2783879f2d87b5054c3 (diff)
Bad bad Claudio. Fix an evil bug that caused nbr addr_tree corruption.
Do not insert neighbors first to the address tree and then assign the address to the struct. Instead pass the address to nbr_new() so all keys for the various RB trees are available when setting the neighbor up.
Diffstat (limited to 'usr.sbin/ldpd/neighbor.c')
-rw-r--r--usr.sbin/ldpd/neighbor.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/ldpd/neighbor.c b/usr.sbin/ldpd/neighbor.c
index a446cd2ebb5..4331c97c9b7 100644
--- a/usr.sbin/ldpd/neighbor.c
+++ b/usr.sbin/ldpd/neighbor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: neighbor.c,v 1.23 2011/01/10 12:28:25 claudio Exp $ */
+/* $OpenBSD: neighbor.c,v 1.24 2011/03/12 01:57:13 claudio Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -236,7 +236,8 @@ nbr_fsm(struct nbr *nbr, enum nbr_event event)
}
struct nbr *
-nbr_new(u_int32_t nbr_id, u_int16_t lspace, struct iface *iface)
+nbr_new(u_int32_t nbr_id, u_int16_t lspace, struct iface *iface,
+ struct in_addr a)
{
struct nbr *nbr;
@@ -249,6 +250,7 @@ nbr_new(u_int32_t nbr_id, u_int16_t lspace, struct iface *iface)
nbr->id.s_addr = nbr_id;
nbr->lspace = lspace;
nbr->iface = iface;
+ nbr->addr = a;
/* get next unused peerid */
while (nbr_find_peerid(++peercnt))