summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/ldpd/hello.c12
-rw-r--r--usr.sbin/ldpd/ldpe.h4
-rw-r--r--usr.sbin/ldpd/neighbor.c6
3 files changed, 13 insertions, 9 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) {
diff --git a/usr.sbin/ldpd/ldpe.h b/usr.sbin/ldpd/ldpe.h
index 394ce3b297a..46fd0496ee2 100644
--- a/usr.sbin/ldpd/ldpe.h
+++ b/usr.sbin/ldpd/ldpe.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldpe.h,v 1.14 2011/01/10 12:28:25 claudio Exp $ */
+/* $OpenBSD: ldpe.h,v 1.15 2011/03/12 01:57:13 claudio Exp $ */
/*
* Copyright (c) 2004, 2005, 2008 Esben Norby <norby@openbsd.org>
@@ -143,7 +143,7 @@ int if_set_tos(int, int);
int if_set_reuse(int, int);
/* neighbor.c */
-struct nbr *nbr_new(u_int32_t, u_int16_t, struct iface *);
+struct nbr *nbr_new(u_int32_t, u_int16_t, struct iface *, struct in_addr);
void nbr_del(struct nbr *);
struct nbr *nbr_find_ip(u_int32_t);
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))