From fd3af22930861c8a05431215f06bda9bab1a8c36 Mon Sep 17 00:00:00 2001 From: sarita patra Date: Wed, 23 Feb 2022 05:58:23 -0800 Subject: [PATCH] pim6d: Handling IPV6 in pim_upstream Signed-off-by: sarita patra --- pimd/pim_ifchannel.c | 3 +-- pimd/pim_upstream.c | 29 ++++++++++++++--------------- pimd/pim_upstream.h | 4 ++-- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c index 76d7341a33..956ab0d67c 100644 --- a/pimd/pim_ifchannel.c +++ b/pimd/pim_ifchannel.c @@ -764,8 +764,7 @@ static void check_recv_upstream(int is_join, struct interface *recv_ifp, if (is_join) { /* Join(S,G) to RPF'(S,G) */ - pim_upstream_join_suppress(up, up->rpf.rpf_addr.u.prefix4, - holdtime); + pim_upstream_join_suppress(up, up->rpf.rpf_addr, holdtime); return; } diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index 7d835996f0..24833f5a63 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -422,8 +422,8 @@ void pim_update_suppress_timers(uint32_t suppress_time) } } -void pim_upstream_join_suppress(struct pim_upstream *up, - struct in_addr rpf_addr, int holdtime) +void pim_upstream_join_suppress(struct pim_upstream *up, struct prefix rpf, + int holdtime) { long t_joinsuppress_msec; long join_timer_remain_msec = 0; @@ -455,7 +455,8 @@ void pim_upstream_join_suppress(struct pim_upstream *up, if (PIM_DEBUG_PIM_TRACE) { char rpf_str[INET_ADDRSTRLEN]; - pim_inet4_dump("", rpf_addr, rpf_str, sizeof(rpf_str)); + + pim_addr_dump("", &rpf, rpf_str, sizeof(rpf_str)); zlog_debug( "%s %s: detected Join%s to RPF'(S,G)=%s: join_timer=%ld msec t_joinsuppress=%ld msec", __FILE__, __func__, up->sg_str, rpf_str, @@ -512,8 +513,10 @@ void pim_upstream_join_timer_decrease_to_t_override(const char *debug_label, if (PIM_DEBUG_PIM_TRACE) { char rpf_str[INET_ADDRSTRLEN]; - pim_inet4_dump("", up->rpf.rpf_addr.u.prefix4, rpf_str, - sizeof(rpf_str)); + + pim_addr_dump("", &up->rpf.rpf_addr, rpf_str, + sizeof(rpf_str)); + zlog_debug( "%s: to RPF'%s=%s: join_timer=%ld msec t_override=%d msec", debug_label, up->sg_str, rpf_str, @@ -829,9 +832,8 @@ void pim_upstream_fill_static_iif(struct pim_upstream *up, up->rpf.source_nexthop.interface = incoming; /* reset other parameters to matched a connected incoming interface */ - up->rpf.source_nexthop.mrib_nexthop_addr.family = AF_INET; - up->rpf.source_nexthop.mrib_nexthop_addr.u.prefix4.s_addr = - PIM_NET_INADDR_ANY; + pim_addr_to_prefix(&up->rpf.source_nexthop.mrib_nexthop_addr, + PIMADDR_ANY); up->rpf.source_nexthop.mrib_metric_preference = ZEBRA_CONNECT_DISTANCE_DEFAULT; up->rpf.source_nexthop.mrib_route_metric = 0; @@ -891,16 +893,13 @@ static struct pim_upstream *pim_upstream_new(struct pim_instance *pim, up->sptbit = PIM_UPSTREAM_SPTBIT_FALSE; up->rpf.source_nexthop.interface = NULL; - up->rpf.source_nexthop.mrib_nexthop_addr.family = AF_INET; - up->rpf.source_nexthop.mrib_nexthop_addr.u.prefix4.s_addr = - PIM_NET_INADDR_ANY; + pim_addr_to_prefix(&up->rpf.source_nexthop.mrib_nexthop_addr, + PIMADDR_ANY); up->rpf.source_nexthop.mrib_metric_preference = router->infinite_assert_metric.metric_preference; up->rpf.source_nexthop.mrib_route_metric = router->infinite_assert_metric.route_metric; - up->rpf.rpf_addr.family = AF_INET; - up->rpf.rpf_addr.u.prefix4.s_addr = PIM_NET_INADDR_ANY; - + pim_addr_to_prefix(&up->rpf.rpf_addr, PIMADDR_ANY); up->ifchannels = list_new(); up->ifchannels->cmp = (int (*)(void *, void *))pim_ifchannel_compare; @@ -960,7 +959,7 @@ static struct pim_upstream *pim_upstream_new(struct pim_instance *pim, if (PIM_DEBUG_PIM_TRACE) { zlog_debug( - "%s: Created Upstream %s upstream_addr %pI4 ref count %d increment", + "%s: Created Upstream %s upstream_addr %pPAs ref count %d increment", __func__, up->sg_str, &up->upstream_addr, up->ref_count); } diff --git a/pimd/pim_upstream.h b/pimd/pim_upstream.h index ad936a2839..8feffb8fdb 100644 --- a/pimd/pim_upstream.h +++ b/pimd/pim_upstream.h @@ -317,8 +317,8 @@ void pim_upstream_update_join_desired(struct pim_instance *pim, struct pim_upstream *up); void pim_update_suppress_timers(uint32_t suppress_time); -void pim_upstream_join_suppress(struct pim_upstream *up, - struct in_addr rpf_addr, int holdtime); +void pim_upstream_join_suppress(struct pim_upstream *up, struct prefix rpf, + int holdtime); void pim_upstream_join_timer_decrease_to_t_override(const char *debug_label, struct pim_upstream *up); -- 2.39.5