From 5a515ebed0af700d8ec6020961559270d6a37e8c Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 7 Dec 2016 11:01:57 -0500 Subject: [PATCH] pimd: Reset neighbor hold time when we receive packet When we receive a packet from a neighbor, reset the hold time as that we *know* that they are still alive. During heavy packet load, we were seeing cases where neighbors were being reset because we were timing out due to not processing the hello packet in time. Signed-off-by: Donald Sharp --- pimd/pim_neighbor.c | 19 ++----------------- pimd/pim_pim.c | 2 ++ 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/pimd/pim_neighbor.c b/pimd/pim_neighbor.c index 83d3851d9e..d253ef5412 100644 --- a/pimd/pim_neighbor.c +++ b/pimd/pim_neighbor.c @@ -240,26 +240,11 @@ static int on_neighbor_timer(struct thread *t) return 0; } -static void neighbor_timer_off(struct pim_neighbor *neigh) -{ - if (PIM_DEBUG_PIM_TRACE_DETAIL) { - if (neigh->t_expire_timer) { - char src_str[INET_ADDRSTRLEN]; - pim_inet4_dump("", neigh->source_addr, src_str, sizeof(src_str)); - zlog_debug("%s: cancelling timer for neighbor %s on %s", - __PRETTY_FUNCTION__, - src_str, neigh->interface->name); - } - } - THREAD_OFF(neigh->t_expire_timer); - zassert(!neigh->t_expire_timer); -} - void pim_neighbor_timer_reset(struct pim_neighbor *neigh, uint16_t holdtime) { neigh->holdtime = holdtime; - neighbor_timer_off(neigh); + THREAD_OFF(neigh->t_expire_timer); /* 0xFFFF is request for no holdtime @@ -571,7 +556,7 @@ void pim_neighbor_delete(struct interface *ifp, zlog_info("PIM NEIGHBOR DOWN: neighbor %s on interface %s: %s", src_str, ifp->name, delete_message); - neighbor_timer_off(neigh); + THREAD_OFF(neigh->t_expire_timer); pim_if_assert_on_neighbor_down(ifp, neigh->source_addr); diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c index b973adacc4..f9d74ff039 100644 --- a/pimd/pim_pim.c +++ b/pimd/pim_pim.c @@ -245,6 +245,7 @@ int pim_pim_packet(struct interface *ifp, uint8_t *buf, size_t len) pim_type, src_str, ifp->name); return -1; } + pim_neighbor_timer_reset(neigh, neigh->holdtime); return pim_joinprune_recv(ifp, neigh, ip_hdr->ip_src, pim_msg + PIM_MSG_HEADER_LEN, @@ -259,6 +260,7 @@ int pim_pim_packet(struct interface *ifp, uint8_t *buf, size_t len) pim_type, src_str, ifp->name); return -1; } + pim_neighbor_timer_reset(neigh, neigh->holdtime); return pim_assert_recv(ifp, neigh, ip_hdr->ip_src, pim_msg + PIM_MSG_HEADER_LEN, -- 2.39.5