summaryrefslogtreecommitdiff
path: root/ldpd/adjacency.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-04-26 14:21:40 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-04-26 14:21:40 -0400
commit99180b6290e40026bb269d12445d755c6e83824c (patch)
tree2edd3748089054abd9bf75dd9ab1465ec5974e90 /ldpd/adjacency.c
parent6aa210418ec5f573bc393a170b283e899a27b8e8 (diff)
parente24287f11c8a0f84523cde9533340d78749aed3d (diff)
Merge remote-tracking branch 'origin/master' into EIGRP
Diffstat (limited to 'ldpd/adjacency.c')
-rw-r--r--ldpd/adjacency.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/ldpd/adjacency.c b/ldpd/adjacency.c
index 8659202ee4..3ec57f1589 100644
--- a/ldpd/adjacency.c
+++ b/ldpd/adjacency.c
@@ -29,6 +29,8 @@ static __inline int adj_compare(struct adj *, struct adj *);
static int adj_itimer(struct thread *);
static __inline int tnbr_compare(struct tnbr *, struct tnbr *);
static void tnbr_del(struct ldpd_conf *, struct tnbr *);
+static void tnbr_start(struct tnbr *);
+static void tnbr_stop(struct tnbr *);
static int tnbr_hello_timer(struct thread *);
static void tnbr_start_hello_timer(struct tnbr *);
static void tnbr_stop_hello_timer(struct tnbr *);
@@ -245,9 +247,7 @@ tnbr_new(int af, union ldpd_addr *addr)
static void
tnbr_del(struct ldpd_conf *xconf, struct tnbr *tnbr)
{
- tnbr_stop_hello_timer(tnbr);
- if (tnbr->adj)
- adj_del(tnbr->adj, S_SHUTDOWN);
+ tnbr_stop(tnbr);
RB_REMOVE(tnbr_head, &xconf->tnbr_tree, tnbr);
free(tnbr);
}
@@ -273,6 +273,23 @@ tnbr_check(struct ldpd_conf *xconf, struct tnbr *tnbr)
return (tnbr);
}
+static void
+tnbr_start(struct tnbr *tnbr)
+{
+ send_hello(HELLO_TARGETED, NULL, tnbr);
+ tnbr_start_hello_timer(tnbr);
+ tnbr->state = TNBR_STA_ACTIVE;
+}
+
+static void
+tnbr_stop(struct tnbr *tnbr)
+{
+ tnbr_stop_hello_timer(tnbr);
+ if (tnbr->adj)
+ adj_del(tnbr->adj, S_SHUTDOWN);
+ tnbr->state = TNBR_STA_DOWN;
+}
+
void
tnbr_update(struct tnbr *tnbr)
{
@@ -292,16 +309,12 @@ tnbr_update(struct tnbr *tnbr)
if (!socket_ok || !rtr_id_ok)
return;
- tnbr->state = TNBR_STA_ACTIVE;
- send_hello(HELLO_TARGETED, NULL, tnbr);
-
- tnbr_start_hello_timer(tnbr);
+ tnbr_start(tnbr);
} else if (tnbr->state == TNBR_STA_ACTIVE) {
if (socket_ok && rtr_id_ok)
return;
- tnbr->state = TNBR_STA_DOWN;
- tnbr_stop_hello_timer(tnbr);
+ tnbr_stop(tnbr);
}
}