diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2010-05-28 12:27:18 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2010-05-28 12:27:18 +0000 |
commit | b4bfd6975f736adcfdb884dfc58ee20bb1f56810 (patch) | |
tree | e571e101e8e14e15b71b5dac340684740ea42e26 /usr.sbin/ldpd | |
parent | c26a59411bdc7a9adc0dbcf456b21b8ababb8643 (diff) |
Send the IMSG_NEIGHBOR_UP msg when the neighbor is going into operational
status instead upon creation (when the first HELLO is received). The LDE
needs only to know about operational neighbors or it may happen that the
LDE is sending messages to neighbors that have no session open resulting
in a crash because of unitialized structures.
OK michele@
Diffstat (limited to 'usr.sbin/ldpd')
-rw-r--r-- | usr.sbin/ldpd/neighbor.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/usr.sbin/ldpd/neighbor.c b/usr.sbin/ldpd/neighbor.c index db1e1f9dc86..c48749ea846 100644 --- a/usr.sbin/ldpd/neighbor.c +++ b/usr.sbin/ldpd/neighbor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: neighbor.c,v 1.15 2010/05/26 13:56:08 nicm Exp $ */ +/* $OpenBSD: neighbor.c,v 1.16 2010/05/28 12:27:17 claudio Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -42,6 +42,7 @@ int nbr_establish_connection(struct nbr *); void nbr_send_labelmappings(struct nbr *); +int nbr_act_session_operational(struct nbr *); LIST_HEAD(nbr_head, nbr); @@ -148,6 +149,7 @@ nbr_fsm(struct nbr *nbr, enum nbr_event event) nbr_reset_ktimer(nbr); break; case NBR_ACT_STRT_KTIMER: + nbr_act_session_operational(nbr); nbr_start_ktimer(nbr); nbr_start_ktimeout(nbr); send_address(nbr, NULL); @@ -161,6 +163,7 @@ nbr_fsm(struct nbr *nbr, enum nbr_event event) send_keepalive(nbr); break; case NBR_ACT_KEEPALIVE_SEND: + nbr_act_session_operational(nbr); nbr_start_ktimer(nbr); nbr_start_ktimeout(nbr); send_keepalive(nbr); @@ -225,7 +228,6 @@ nbr_new(u_int32_t nbr_id, u_int16_t lspace, struct iface *iface) { struct nbr_head *head; struct nbr *nbr; - struct lde_nbr rn; if ((nbr = calloc(1, sizeof(*nbr))) == NULL) fatal("nbr_new"); @@ -259,13 +261,6 @@ nbr_new(u_int32_t nbr_id, u_int16_t lspace, struct iface *iface) evtimer_set(&nbr->keepalive_timer, nbr_ktimer, nbr); evtimer_set(&nbr->initdelay_timer, nbr_idtimer, nbr); - bzero(&rn, sizeof(rn)); - rn.id.s_addr = nbr->id.s_addr; - rn.lspace = nbr->lspace; - rn.ifindex = nbr->iface->ifindex; - ldpe_imsg_compose_lde(IMSG_NEIGHBOR_UP, nbr->peerid, 0, &rn, - sizeof(rn)); - return (nbr); } @@ -582,6 +577,19 @@ nbr_act_session_establish(struct nbr *nbr, int active) return (0); } +int +nbr_act_session_operational(struct nbr *nbr) +{ + struct lde_nbr rn; + + bzero(&rn, sizeof(rn)); + rn.id.s_addr = nbr->id.s_addr; + rn.lspace = nbr->lspace; + + return (ldpe_imsg_compose_lde(IMSG_NEIGHBOR_UP, nbr->peerid, 0, &rn, + sizeof(rn))); +} + void nbr_send_labelmappings(struct nbr *nbr) { |