X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=pimd%2Fpim_upstream.c;h=54a7f59ca44074d6b75fa7d15bafb8481a846c9f;hb=4fecac21cbaa5049c7fd8c5019fa6766ffd0fc9b;hp=a410a1c2cece59fdaffdc2a31b0110709c0ec407;hpb=b5bf67e90572121ae5769c6996b95f81f0dc2f04;p=mirror_frr.git diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index a410a1c2c..54a7f59ca 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -178,6 +178,14 @@ static void upstream_channel_oil_detach(struct pim_upstream *up) } +static void pim_upstream_timers_stop(struct pim_upstream *up) +{ + THREAD_OFF(up->t_ka_timer); + THREAD_OFF(up->t_rs_timer); + THREAD_OFF(up->t_msdp_reg_timer); + THREAD_OFF(up->t_join_timer); +} + struct pim_upstream *pim_upstream_del(struct pim_instance *pim, struct pim_upstream *up, const char *name) { @@ -207,9 +215,7 @@ struct pim_upstream *pim_upstream_del(struct pim_instance *pim, if (pim_up_mlag_is_local(up)) pim_mlag_up_local_del(pim, up); - THREAD_OFF(up->t_ka_timer); - THREAD_OFF(up->t_rs_timer); - THREAD_OFF(up->t_msdp_reg_timer); + pim_upstream_timers_stop(up); if (up->join_state == PIM_UPSTREAM_JOINED) { pim_jp_agg_single_upstream_send(&up->rpf, up, 0); @@ -302,7 +308,7 @@ void pim_upstream_send_join(struct pim_upstream *up) pim_jp_agg_single_upstream_send(&up->rpf, up, 1 /* join */); } -static int on_join_timer(struct thread *t) +static void on_join_timer(struct thread *t) { struct pim_upstream *up; @@ -312,14 +318,14 @@ static int on_join_timer(struct thread *t) if (PIM_DEBUG_PIM_TRACE) zlog_debug("%s: up %s RPF is not present", __func__, up->sg_str); - return 0; + return; } /* * In the case of a HFR we will not ahve anyone to send this to. */ if (PIM_UPSTREAM_FLAG_TEST_FHR(up->flags)) - return 0; + return; /* * Don't send the join if the outgoing interface is a loopback @@ -330,8 +336,6 @@ static int on_join_timer(struct thread *t) pim_upstream_send_join(up); join_timer_start(up); - - return 0; } static void join_timer_stop(struct pim_upstream *up) @@ -424,8 +428,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; @@ -457,7 +461,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, @@ -514,8 +519,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, @@ -640,7 +647,7 @@ void pim_upstream_register_reevaluate(struct pim_instance *pim) * 2. and along the RPT if SPTbit is not set * If forwarding is hw accelerated i.e. control and dataplane components * are separate you may not be able to reliably set SPT bit on intermediate - * routers while still fowarding on the (S,G,rpt). + * routers while still forwarding on the (S,G,rpt). * * This macro is a slight deviation on the RFC and uses "traffic-agnostic" * criteria to decide between using the RPT vs. SPT for forwarding. @@ -831,9 +838,7 @@ 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; + 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; @@ -893,16 +898,12 @@ 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; + 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; @@ -962,7 +963,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); } @@ -1263,7 +1264,7 @@ void pim_upstream_update_join_desired(struct pim_instance *pim, it so that it expires after t_override seconds. */ void pim_upstream_rpf_genid_changed(struct pim_instance *pim, - struct in_addr neigh_addr) + pim_addr neigh_addr) { struct pim_upstream *up; @@ -1271,24 +1272,24 @@ void pim_upstream_rpf_genid_changed(struct pim_instance *pim, * Scan all (S,G) upstreams searching for RPF'(S,G)=neigh_addr */ frr_each (rb_pim_upstream, &pim->upstream_head, up) { - if (PIM_DEBUG_PIM_TRACE) { - char rpf_addr_str[PREFIX_STRLEN]; - pim_addr_dump("", &up->rpf.rpf_addr, rpf_addr_str, - sizeof(rpf_addr_str)); + pim_addr rpf_addr; + + rpf_addr = pim_addr_from_prefix(&up->rpf.rpf_addr); + + if (PIM_DEBUG_PIM_TRACE) zlog_debug( - "%s: matching neigh=%pI4 against upstream (S,G)=%s[%s] joined=%d rpf_addr=%s", + "%s: matching neigh=%pPA against upstream (S,G)=%s[%s] joined=%d rpf_addr=%pPA", __func__, &neigh_addr, up->sg_str, pim->vrf->name, up->join_state == PIM_UPSTREAM_JOINED, - rpf_addr_str); - } + &rpf_addr); /* consider only (S,G) upstream in Joined state */ if (up->join_state != PIM_UPSTREAM_JOINED) continue; /* match RPF'(S,G)=neigh_addr */ - if (up->rpf.rpf_addr.u.prefix4.s_addr != neigh_addr.s_addr) + if (pim_addr_cmp(rpf_addr, neigh_addr)) continue; pim_upstream_join_timer_decrease_to_t_override( @@ -1482,7 +1483,7 @@ struct pim_upstream *pim_upstream_keep_alive_timer_proc( return up; } -static int pim_upstream_keep_alive_timer(struct thread *t) +static void pim_upstream_keep_alive_timer(struct thread *t) { struct pim_upstream *up; @@ -1491,10 +1492,9 @@ static int pim_upstream_keep_alive_timer(struct thread *t) /* pull the stats and re-check */ if (pim_upstream_sg_running_proc(up)) /* kat was restarted because of new activity */ - return 0; + return; pim_upstream_keep_alive_timer_proc(up); - return 0; } void pim_upstream_keep_alive_timer_start(struct pim_upstream *up, uint32_t time) @@ -1516,15 +1516,15 @@ void pim_upstream_keep_alive_timer_start(struct pim_upstream *up, uint32_t time) } /* MSDP on RP needs to know if a source is registerable to this RP */ -static int pim_upstream_msdp_reg_timer(struct thread *t) +static void pim_upstream_msdp_reg_timer(struct thread *t) { struct pim_upstream *up = THREAD_ARG(t); struct pim_instance *pim = up->channel_oil->pim; /* source is no longer active - pull the SA from MSDP's cache */ pim_msdp_sa_local_del(pim, &up->sg); - return 1; } + void pim_upstream_msdp_reg_timer_start(struct pim_upstream *up) { THREAD_OFF(up->t_msdp_reg_timer); @@ -1702,7 +1702,7 @@ const char *pim_reg_state2str(enum pim_reg_state reg_state, char *state_str, return state_str; } -static int pim_upstream_register_stop_timer(struct thread *t) +static void pim_upstream_register_stop_timer(struct thread *t) { struct pim_interface *pim_ifp; struct pim_instance *pim; @@ -1735,7 +1735,7 @@ static int pim_upstream_register_stop_timer(struct thread *t) zlog_debug("%s: up %s RPF is not present", __func__, up->sg_str); up->reg_state = PIM_REG_NOINFO; - return 0; + return; } pim_ifp = up->rpf.source_nexthop.interface->info; @@ -1745,7 +1745,7 @@ static int pim_upstream_register_stop_timer(struct thread *t) "%s: Interface: %s is not configured for pim", __func__, up->rpf.source_nexthop.interface->name); - return 0; + return; } up->reg_state = PIM_REG_JOIN_PENDING; pim_upstream_start_register_stop_timer(up, 1); @@ -1757,15 +1757,13 @@ static int pim_upstream_register_stop_timer(struct thread *t) zlog_debug( "%s: Stop sending the register, because I am the RP and we haven't seen a packet in a while", __func__); - return 0; + return; } pim_null_register_send(up); break; case PIM_REG_NOINFO: break; } - - return 0; } void pim_upstream_start_register_stop_timer(struct pim_upstream *up, @@ -1838,7 +1836,7 @@ int pim_upstream_inherited_olist_decide(struct pim_instance *pim, flag = PIM_OIF_FLAG_PROTO_STAR; else { if (PIM_IF_FLAG_TEST_PROTO_IGMP(ch->flags)) - flag = PIM_OIF_FLAG_PROTO_IGMP; + flag = PIM_OIF_FLAG_PROTO_GM; if (PIM_IF_FLAG_TEST_PROTO_PIM(ch->flags)) flag |= PIM_OIF_FLAG_PROTO_PIM; if (starch) @@ -1950,7 +1948,8 @@ void pim_upstream_terminate(struct pim_instance *pim) struct pim_upstream *up; while ((up = rb_pim_upstream_first(&pim->upstream_head))) { - pim_upstream_del(pim, up, __func__); + if (pim_upstream_del(pim, up, __func__)) + pim_upstream_timers_stop(up); } rb_pim_upstream_fini(&pim->upstream_head); @@ -1997,7 +1996,7 @@ static bool pim_upstream_kat_start_ok(struct pim_upstream *up) return false; pim_ifp = ifp->info; - if (pim_ifp->mroute_vif_index != c_oil->oil.mfcc_parent) + if (pim_ifp->mroute_vif_index != *oil_parent(c_oil)) return false; if (pim_if_connected_to_source(up->rpf.source_nexthop.interface, @@ -2061,6 +2060,7 @@ static bool pim_upstream_sg_running_proc(struct pim_upstream *up) if ((up->sptbit != PIM_UPSTREAM_SPTBIT_TRUE) && (up->rpf.source_nexthop.interface)) { pim_upstream_set_sptbit(up, up->rpf.source_nexthop.interface); + pim_upstream_update_could_assert(up); } return rv; @@ -2115,7 +2115,7 @@ void pim_upstream_add_lhr_star_pimreg(struct pim_instance *pim) continue; pim_channel_add_oif(up->channel_oil, pim->regiface, - PIM_OIF_FLAG_PROTO_IGMP, __func__); + PIM_OIF_FLAG_PROTO_GM, __func__); } } @@ -2160,18 +2160,17 @@ void pim_upstream_remove_lhr_star_pimreg(struct pim_instance *pim, if (!nlist) { pim_channel_del_oif(up->channel_oil, pim->regiface, - PIM_OIF_FLAG_PROTO_IGMP, __func__); + PIM_OIF_FLAG_PROTO_GM, __func__); continue; } pim_addr_to_prefix(&g, up->sg.grp); apply_new = prefix_list_apply(np, &g); if (apply_new == PREFIX_DENY) pim_channel_add_oif(up->channel_oil, pim->regiface, - PIM_OIF_FLAG_PROTO_IGMP, - __func__); + PIM_OIF_FLAG_PROTO_GM, __func__); else pim_channel_del_oif(up->channel_oil, pim->regiface, - PIM_OIF_FLAG_PROTO_IGMP, __func__); + PIM_OIF_FLAG_PROTO_GM, __func__); } }