summaryrefslogtreecommitdiff
path: root/usr.sbin/ldpd/hello.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/hello.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/hello.c')
-rw-r--r--usr.sbin/ldpd/hello.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.sbin/ldpd/hello.c b/usr.sbin/ldpd/hello.c
index e921c364079..3a3c3bf8923 100644
--- a/usr.sbin/ldpd/hello.c
+++ b/usr.sbin/ldpd/hello.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hello.c,v 1.11 2011/01/10 12:28:25 claudio Exp $ */
+/* $OpenBSD: hello.c,v 1.12 2011/03/12 01:57:13 claudio Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -124,14 +124,16 @@ recv_hello(struct iface *iface, struct in_addr src, char *buf, u_int16_t len)
nbr = nbr_find_ldpid(ldp.lsr_id, ldp.lspace_id);
if (!nbr) {
- nbr = nbr_new(ldp.lsr_id, ldp.lspace_id, iface);
+ struct in_addr a;
- /* set neighbor parameters */
if (address.s_addr == INADDR_ANY)
- nbr->addr.s_addr = src.s_addr;
+ a = src;
else
- nbr->addr.s_addr = address.s_addr;
+ a = address;
+
+ nbr = nbr_new(ldp.lsr_id, ldp.lspace_id, iface, a);
+ /* set neighbor parameters */
nbr->hello_type = flags;
if (holdtime == 0) {