From 3dbf370ac0a7cb0f10c56c37286adf971215dff1 Mon Sep 17 00:00:00 2001 From: Sarita Patra Date: Sun, 22 Jan 2023 21:10:45 -0800 Subject: pimd,pim6d: Modify pim_neighbor_find() API Modify pim_neighbor_find() API to find the neighbor in neighbor secondary list. Signed-off-by: Sarita Patra --- pimd/pim_cmd_common.c | 2 +- pimd/pim_hello.c | 2 +- pimd/pim_neighbor.c | 9 ++++++++- pimd/pim_neighbor.h | 2 +- pimd/pim_pim.c | 4 ++-- 5 files changed, 13 insertions(+), 6 deletions(-) (limited to 'pimd') diff --git a/pimd/pim_cmd_common.c b/pimd/pim_cmd_common.c index c7b501ee1..75df09ec3 100644 --- a/pimd/pim_cmd_common.c +++ b/pimd/pim_cmd_common.c @@ -1385,7 +1385,7 @@ void pim_show_upstream(struct pim_instance *pim, struct vty *vty, nbr = pim_neighbor_find( up->rpf.source_nexthop.interface, - up->rpf.rpf_addr); + up->rpf.rpf_addr, false); if (nbr) pim_time_timer_to_hhmmss(join_timer, sizeof(join_timer), diff --git a/pimd/pim_hello.c b/pimd/pim_hello.c index 8d1924741..978607d14 100644 --- a/pimd/pim_hello.c +++ b/pimd/pim_hello.c @@ -277,7 +277,7 @@ int pim_hello_recv(struct interface *ifp, pim_addr src_addr, uint8_t *tlv_buf, New neighbor? */ - neigh = pim_neighbor_find(ifp, src_addr); + neigh = pim_neighbor_find(ifp, src_addr, false); if (!neigh) { /* Add as new neighbor */ diff --git a/pimd/pim_neighbor.c b/pimd/pim_neighbor.c index 9edc3c1af..0b7ea0ad9 100644 --- a/pimd/pim_neighbor.c +++ b/pimd/pim_neighbor.c @@ -406,7 +406,7 @@ struct pim_neighbor *pim_neighbor_find_by_secondary(struct interface *ifp, } struct pim_neighbor *pim_neighbor_find(struct interface *ifp, - pim_addr source_addr) + pim_addr source_addr, bool secondary) { struct pim_interface *pim_ifp; struct listnode *node; @@ -425,6 +425,13 @@ struct pim_neighbor *pim_neighbor_find(struct interface *ifp, } } + if (secondary) { + struct prefix p; + + pim_addr_to_prefix(&p, source_addr); + return pim_neighbor_find_by_secondary(ifp, &p); + } + return NULL; } diff --git a/pimd/pim_neighbor.h b/pimd/pim_neighbor.h index e00f99fe2..f7375745a 100644 --- a/pimd/pim_neighbor.h +++ b/pimd/pim_neighbor.h @@ -38,7 +38,7 @@ struct pim_neighbor { 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, - pim_addr source_addr); + pim_addr source_addr, bool secondary); struct pim_neighbor *pim_neighbor_find_by_secondary(struct interface *ifp, struct prefix *src); struct pim_neighbor *pim_neighbor_find_if(struct interface *ifp); diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c index a7a8b0575..1248db3de 100644 --- a/pimd/pim_pim.c +++ b/pimd/pim_pim.c @@ -289,7 +289,7 @@ int pim_pim_packet(struct interface *ifp, uint8_t *buf, size_t len, pim_msg_len - PIM_MSG_HEADER_LEN); break; case PIM_MSG_TYPE_JOIN_PRUNE: - neigh = pim_neighbor_find(ifp, sg.src); + neigh = pim_neighbor_find(ifp, sg.src, false); if (!neigh) { if (PIM_DEBUG_PIM_PACKETS) zlog_debug( @@ -304,7 +304,7 @@ int pim_pim_packet(struct interface *ifp, uint8_t *buf, size_t len, pim_msg_len - PIM_MSG_HEADER_LEN); break; case PIM_MSG_TYPE_ASSERT: - neigh = pim_neighbor_find(ifp, sg.src); + neigh = pim_neighbor_find(ifp, sg.src, false); if (!neigh) { if (PIM_DEBUG_PIM_PACKETS) zlog_debug( -- cgit v1.2.3