From 1148de0adbb606c64ffabdb7cb70030365d51c65 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sat, 6 Aug 2016 06:26:05 -0400 Subject: [PATCH] pimd: Send hello immediately with receive of new genid When we receive a new genid from a neighbor, we need to form the neigbhor relationship before the join/prune messages are sent to the neighbor. Additionally we were calling the pim_upstream_rpf_genid_changed function 2 times in a row. This function just spun throught the upstream list and marked all relevant upstreams to be sent immediately Ticket:CM-11979 Signed-off-by: Donald Sharp --- pimd/pim_hello.c | 11 ++++------- pimd/pim_neighbor.c | 13 +++++++++++-- pimd/pim_neighbor.h | 7 ++++++- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/pimd/pim_hello.c b/pimd/pim_hello.c index 3502f4e962..434a0e66c4 100644 --- a/pimd/pim_hello.c +++ b/pimd/pim_hello.c @@ -350,7 +350,8 @@ int pim_hello_recv(struct interface *ifp, hello_option_override_interval, hello_option_dr_priority, hello_option_generation_id, - hello_option_addr_list); + hello_option_addr_list, + PIM_NEIGHBOR_SEND_DELAY); if (!neigh) { if (PIM_DEBUG_PIM_HELLO) { char src_str[100]; @@ -374,11 +375,6 @@ int pim_hello_recv(struct interface *ifp, /* GenID mismatch ? */ if (!PIM_OPTION_IS_SET(neigh->hello_options, PIM_OPTION_MASK_GENERATION_ID) || (hello_option_generation_id != neigh->generation_id)) { - - /* GenID changed */ - - pim_upstream_rpf_genid_changed(neigh->source_addr); - /* GenID mismatch, then replace neighbor */ if (PIM_DEBUG_PIM_HELLO) { @@ -401,7 +397,8 @@ int pim_hello_recv(struct interface *ifp, hello_option_override_interval, hello_option_dr_priority, hello_option_generation_id, - hello_option_addr_list); + hello_option_addr_list, + PIM_NEIGHBOR_SEND_NOW); if (!neigh) { if (PIM_DEBUG_PIM_HELLO) { char src_str[100]; diff --git a/pimd/pim_neighbor.c b/pimd/pim_neighbor.c index 2703b8fcf5..4d79388092 100644 --- a/pimd/pim_neighbor.c +++ b/pimd/pim_neighbor.c @@ -411,7 +411,8 @@ struct pim_neighbor *pim_neighbor_add(struct interface *ifp, uint16_t override_interval, uint32_t dr_priority, uint32_t generation_id, - struct list *addr_list) + struct list *addr_list, + int send_hello_now) { struct pim_interface *pim_ifp; struct pim_neighbor *neigh; @@ -450,8 +451,16 @@ struct pim_neighbor *pim_neighbor_add(struct interface *ifp, message with a new GenID is received from an existing neighbor, a new Hello message should be sent on this interface after a randomized delay between 0 and Triggered_Hello_Delay. + + This is a bit silly to do it that way. If I get a new + genid we need to send the hello *now* because we've + lined up a bunch of join/prune messages to go out the + interface. */ - pim_hello_restart_triggered(neigh->interface); + if (send_hello_now) + pim_hello_restart_now (ifp); + else + pim_hello_restart_triggered(neigh->interface); return neigh; } diff --git a/pimd/pim_neighbor.h b/pimd/pim_neighbor.h index 10d0cf3a68..4bf78d063e 100644 --- a/pimd/pim_neighbor.h +++ b/pimd/pim_neighbor.h @@ -47,6 +47,10 @@ void pim_neighbor_timer_reset(struct pim_neighbor *neigh, uint16_t holdtime); void pim_neighbor_free(struct pim_neighbor *neigh); struct pim_neighbor *pim_neighbor_find(struct interface *ifp, struct in_addr source_addr); + + +#define PIM_NEIGHBOR_SEND_DELAY 0 +#define PIM_NEIGHBOR_SEND_NOW 1 struct pim_neighbor *pim_neighbor_add(struct interface *ifp, struct in_addr source_addr, pim_hello_options hello_options, @@ -55,7 +59,8 @@ struct pim_neighbor *pim_neighbor_add(struct interface *ifp, uint16_t override_interval, uint32_t dr_priority, uint32_t generation_id, - struct list *addr_list); + struct list *addr_list, + int send_hello_now); void pim_neighbor_delete(struct interface *ifp, struct pim_neighbor *neigh, const char *delete_message); -- 2.39.5