diff options
-rw-r--r-- | pimd/pim6_main.c | 2 | ||||
-rw-r--r-- | pimd/pim_iface.c | 37 | ||||
-rw-r--r-- | pimd/pim_mroute.c | 10 | ||||
-rw-r--r-- | pimd/pim_ssm.c | 2 | ||||
-rw-r--r-- | pimd/pim_zebra.c | 48 |
5 files changed, 71 insertions, 28 deletions
diff --git a/pimd/pim6_main.c b/pimd/pim6_main.c index 3d8ebd0d8..a6cfe7682 100644 --- a/pimd/pim6_main.c +++ b/pimd/pim6_main.c @@ -183,8 +183,8 @@ int main(int argc, char **argv, char **envp) /* TODO PIM6: next line is temporary since pim_cmd_init is disabled */ if_cmd_init(NULL); -#if 0 pim_zebra_init(); +#if 0 pim_bfd_init(); pim_mlag_init(); diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c index cf5037171..3e24e6963 100644 --- a/pimd/pim_iface.c +++ b/pimd/pim_iface.c @@ -85,6 +85,7 @@ static void pim_sec_addr_free(struct pim_secondary_addr *sec_addr) XFREE(MTYPE_PIM_SEC_ADDR, sec_addr); } +__attribute__((unused)) static int pim_sec_addr_comp(const void *p1, const void *p2) { const struct pim_secondary_addr *sec1 = p1; @@ -126,6 +127,7 @@ struct pim_interface *pim_if_new(struct interface *ifp, bool igmp, bool pim, pim_ifp->pim = ifp->vrf->info; pim_ifp->mroute_vif_index = -1; +#if PIM_IPV == 4 pim_ifp->igmp_version = IGMP_DEFAULT_VERSION; pim_ifp->gm_default_robustness_variable = IGMP_DEFAULT_ROBUSTNESS_VARIABLE; @@ -187,6 +189,7 @@ struct pim_interface *pim_if_new(struct interface *ifp, bool igmp, bool pim, pim_sock_reset(ifp); pim_if_add_vif(ifp, ispimreg, is_vxlan_term); +#endif pim_ifp->pim->mcast_if_count++; return pim_ifp; @@ -195,12 +198,15 @@ struct pim_interface *pim_if_new(struct interface *ifp, bool igmp, bool pim, void pim_if_delete(struct interface *ifp) { struct pim_interface *pim_ifp; - struct pim_ifchannel *ch; assert(ifp); pim_ifp = ifp->info; assert(pim_ifp); + pim_ifp->pim->mcast_if_count--; +#if PIM_IPV == 4 + struct pim_ifchannel *ch; + if (pim_ifp->gm_join_list) { pim_if_igmp_join_del_all(ifp); } @@ -211,7 +217,6 @@ void pim_if_delete(struct interface *ifp) pim_neighbor_delete_all(ifp, "Interface removed from configuration"); pim_if_del_vif(ifp); - pim_ifp->pim->mcast_if_count--; pim_igmp_if_fini(pim_ifp); @@ -228,6 +233,7 @@ void pim_if_delete(struct interface *ifp) } XFREE(MTYPE_PIM_INTERFACE, pim_ifp); +#endif ifp->info = NULL; } @@ -496,7 +502,6 @@ void pim_if_addr_add(struct connected *ifc) { struct pim_interface *pim_ifp; struct interface *ifp; - struct in_addr ifaddr; bool vxlan_term; assert(ifc); @@ -517,13 +522,14 @@ void pim_if_addr_add(struct connected *ifc) ? "secondary" : "primary"); - ifaddr = ifc->address->u.prefix4; - detect_address_change(ifp, 0, __func__); // if (ifc->address->family != AF_INET) // return; +#if PIM_IPV == 4 + struct in_addr ifaddr = ifc->address->u.prefix4; + if (PIM_IF_TEST_IGMP(pim_ifp->options)) { struct gm_sock *igmp; @@ -589,6 +595,7 @@ void pim_if_addr_add(struct connected *ifc) true); } } /* igmp mtrace only */ +#endif if (PIM_IF_TEST_PIM(pim_ifp->options)) { @@ -640,6 +647,7 @@ void pim_if_addr_add(struct connected *ifc) static void pim_if_addr_del_igmp(struct connected *ifc) { +#if PIM_IPV == 4 struct pim_interface *pim_ifp = ifc->ifp->info; struct gm_sock *igmp; struct in_addr ifaddr; @@ -662,6 +670,7 @@ static void pim_if_addr_del_igmp(struct connected *ifc) /* if addr found, del IGMP socket */ igmp_sock_delete(igmp); } +#endif } static void pim_if_addr_del_pim(struct connected *ifc) @@ -1341,6 +1350,7 @@ int pim_if_igmp_join_del(struct interface *ifp, struct in_addr group_addr, return 0; } +__attribute__((unused)) static void pim_if_igmp_join_del_all(struct interface *ifp) { struct pim_interface *pim_ifp; @@ -1548,6 +1558,7 @@ static int pim_ifp_create(struct interface *ifp) */ if (pim_ifp) pim_ifp->pim = pim; +#if PIM_IPV == 4 pim_if_addr_add_all(ifp); /* @@ -1559,8 +1570,10 @@ static int pim_ifp_create(struct interface *ifp) * this is a no-op if it's already been done. */ pim_if_create_pimreg(pim); +#endif } +#if PIM_IPV == 4 /* * If we are a vrf device that is up, open up the pim_socket for * listening @@ -1588,6 +1601,7 @@ static int pim_ifp_create(struct interface *ifp) "%s: Cannot enable pim on %s. MAXVIFS(%d) reached. Deleting and readding the vxlan termimation device after unconfiguring pim from other interfaces may succeed.", __func__, ifp->name, MAXVIFS); } +#endif return 0; } @@ -1596,7 +1610,6 @@ static int pim_ifp_up(struct interface *ifp) { struct pim_interface *pim_ifp; struct pim_instance *pim; - uint32_t table_id; if (PIM_DEBUG_ZEBRA) { zlog_debug( @@ -1617,6 +1630,9 @@ static int pim_ifp_up(struct interface *ifp) if (pim_ifp) pim_ifp->pim = pim; +#if PIM_IPV == 4 + uint32_t table_id; + /* pim_if_addr_add_all() suffices for bringing up both IGMP and PIM @@ -1645,6 +1661,7 @@ static int pim_ifp_up(struct interface *ifp) } } } +#endif return 0; } @@ -1658,6 +1675,7 @@ static int pim_ifp_down(struct interface *ifp) ifp->mtu, if_is_operative(ifp)); } +#if PIM_IPV == 4 if (!if_is_operative(ifp)) { pim_ifchannel_delete_all(ifp); /* @@ -1680,14 +1698,13 @@ static int pim_ifp_down(struct interface *ifp) pim_if_del_vif(ifp); pim_ifstat_reset(ifp); } +#endif return 0; } static int pim_ifp_destroy(struct interface *ifp) { - struct pim_instance *pim; - if (PIM_DEBUG_ZEBRA) { zlog_debug( "%s: %s index %d vrf %s(%u) flags %ld metric %d mtu %d operative %d", @@ -1696,12 +1713,16 @@ static int pim_ifp_destroy(struct interface *ifp) ifp->mtu, if_is_operative(ifp)); } +#if PIM_IPV == 4 + struct pim_instance *pim; + if (!if_is_operative(ifp)) pim_if_addr_del_all(ifp); pim = ifp->vrf->info; if (pim && pim->vxlan.term_if == ifp) pim_vxlan_del_term_dev(pim); +#endif return 0; } diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index 2fabd3d1b..26ca0e2ce 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -581,12 +581,8 @@ static int pim_mroute_msg(struct pim_instance *pim, const char *buf, int buf_size, ifindex_t ifindex) { struct interface *ifp; - struct pim_interface *pim_ifp; const struct ip *ip_hdr; const struct igmpmsg *msg; - struct in_addr ifaddr; - struct gm_sock *igmp; - const struct prefix *connected_src; if (buf_size < (int)sizeof(struct ip)) return 0; @@ -594,6 +590,11 @@ static int pim_mroute_msg(struct pim_instance *pim, const char *buf, ip_hdr = (const struct ip *)buf; if (ip_hdr->ip_p == IPPROTO_IGMP) { +#if PIM_IPV == 4 + struct pim_interface *pim_ifp; + struct in_addr ifaddr; + struct gm_sock *igmp; + const struct prefix *connected_src; /* We have the IP packet but we do not know which interface this * packet was @@ -633,6 +634,7 @@ static int pim_mroute_msg(struct pim_instance *pim, const char *buf, zlog_debug("No IGMP socket on interface: %s with connected source: %pFX", ifp->name, connected_src); } +#endif } else if (ip_hdr->ip_p) { if (PIM_DEBUG_MROUTE_DETAIL) { zlog_debug( diff --git a/pimd/pim_ssm.c b/pimd/pim_ssm.c index 45aac7756..688d38c84 100644 --- a/pimd/pim_ssm.c +++ b/pimd/pim_ssm.c @@ -32,6 +32,7 @@ static void pim_ssm_range_reevaluate(struct pim_instance *pim) { +#if PIM_IPV == 4 /* 1. Setup register state for (S,G) entries if G has changed from SSM * to * ASM. @@ -50,6 +51,7 @@ static void pim_ssm_range_reevaluate(struct pim_instance *pim) */ pim_upstream_register_reevaluate(pim); igmp_source_forward_reevaluate_all(pim); +#endif } void pim_ssm_prefix_list_update(struct pim_instance *pim, diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c index 422c61202..a0eb602f2 100644 --- a/pimd/pim_zebra.c +++ b/pimd/pim_zebra.c @@ -55,6 +55,7 @@ struct zclient *zclient; /* Router-id update message from zebra. */ +__attribute__((unused)) static int pim_router_id_update_zebra(ZAPI_CALLBACK_ARGS) { struct prefix router_id; @@ -64,6 +65,7 @@ static int pim_router_id_update_zebra(ZAPI_CALLBACK_ARGS) return 0; } +__attribute__((unused)) static int pim_zebra_interface_vrf_update(ZAPI_CALLBACK_ARGS) { struct interface *ifp; @@ -112,7 +114,6 @@ static int pim_zebra_if_address_add(ZAPI_CALLBACK_ARGS) struct connected *c; struct prefix *p; struct pim_interface *pim_ifp; - struct pim_instance *pim; /* zebra api notifies address adds/dels events by using the same call @@ -141,6 +142,7 @@ static int pim_zebra_if_address_add(ZAPI_CALLBACK_ARGS) #endif } +#if PIM_IPV == 4 if (p->family != PIM_AF) SET_FLAG(c->flags, ZEBRA_IFA_SECONDARY); else if (!CHECK_FLAG(c->flags, ZEBRA_IFA_SECONDARY)) { @@ -159,6 +161,8 @@ static int pim_zebra_if_address_add(ZAPI_CALLBACK_ARGS) pim_if_addr_add(c); if (pim_ifp) { + struct pim_instance *pim; + pim = pim_get_pim_instance(vrf_id); pim_ifp->pim = pim; @@ -174,7 +178,10 @@ static int pim_zebra_if_address_add(ZAPI_CALLBACK_ARGS) pim_if_addr_add_all(ifp); } } - +#else /* PIM_IPV != 4 */ + /* unused - for now */ + (void)pim_ifp; +#endif return 0; } @@ -183,11 +190,9 @@ static int pim_zebra_if_address_del(ZAPI_CALLBACK_ARGS) struct connected *c; struct prefix *p; struct vrf *vrf = vrf_lookup_by_id(vrf_id); - struct pim_instance *pim; if (!vrf) return 0; - pim = vrf->info; /* zebra api notifies address adds/dels events by using the same call @@ -202,24 +207,29 @@ static int pim_zebra_if_address_del(ZAPI_CALLBACK_ARGS) return 0; p = c->address; - if (p->family == AF_INET) { - if (PIM_DEBUG_ZEBRA) { - zlog_debug( - "%s: %s(%u) disconnected IP address %pFX flags %u %s", - __func__, c->ifp->name, vrf_id, p, c->flags, - CHECK_FLAG(c->flags, ZEBRA_IFA_SECONDARY) - ? "secondary" - : "primary"); + if (PIM_DEBUG_ZEBRA) { + zlog_debug( + "%s: %s(%u) disconnected IP address %pFX flags %u %s", + __func__, c->ifp->name, vrf_id, p, c->flags, + CHECK_FLAG(c->flags, ZEBRA_IFA_SECONDARY) + ? "secondary" + : "primary"); #ifdef PIM_DEBUG_IFADDR_DUMP - dump_if_address(c->ifp); + dump_if_address(c->ifp); #endif - } + } +#if PIM_IPV == 4 + if (p->family == AF_INET) { + struct pim_instance *pim; + + pim = vrf->info; pim_if_addr_del(c, 0); pim_rp_setup(pim); pim_i_am_rp_re_evaluate(pim); } +#endif connected_free(&c); return 0; @@ -325,6 +335,7 @@ void pim_zebra_upstream_rpf_changed(struct pim_instance *pim, pim_upstream_update_join_desired(pim, up); } +__attribute__((unused)) static int pim_zebra_vxlan_sg_proc(ZAPI_CALLBACK_ARGS) { struct stream *s; @@ -354,6 +365,7 @@ static int pim_zebra_vxlan_sg_proc(ZAPI_CALLBACK_ARGS) return 0; } +__attribute__((unused)) static void pim_zebra_vxlan_replay(void) { struct stream *s = NULL; @@ -422,13 +434,17 @@ void sched_rpf_cache_refresh(struct pim_instance *pim) static void pim_zebra_connected(struct zclient *zclient) { +#if PIM_IPV == 4 /* Send the client registration */ bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER, router->vrf_id); +#endif zclient_send_reg_requests(zclient, router->vrf_id); +#if PIM_IPV == 4 /* request for VxLAN BUM group addresses */ pim_zebra_vxlan_replay(); +#endif } static void pim_zebra_capabilities(struct zclient_capabilities *cap) @@ -437,9 +453,10 @@ static void pim_zebra_capabilities(struct zclient_capabilities *cap) } static zclient_handler *const pim_handlers[] = { - [ZEBRA_ROUTER_ID_UPDATE] = pim_router_id_update_zebra, [ZEBRA_INTERFACE_ADDRESS_ADD] = pim_zebra_if_address_add, [ZEBRA_INTERFACE_ADDRESS_DELETE] = pim_zebra_if_address_del, +#if PIM_IPV == 4 + [ZEBRA_ROUTER_ID_UPDATE] = pim_router_id_update_zebra, [ZEBRA_INTERFACE_VRF_UPDATE] = pim_zebra_interface_vrf_update, [ZEBRA_NEXTHOP_UPDATE] = pim_parse_nexthop_update, @@ -449,6 +466,7 @@ static zclient_handler *const pim_handlers[] = { [ZEBRA_MLAG_PROCESS_UP] = pim_zebra_mlag_process_up, [ZEBRA_MLAG_PROCESS_DOWN] = pim_zebra_mlag_process_down, [ZEBRA_MLAG_FORWARD_MSG] = pim_zebra_mlag_handle_msg, +#endif }; void pim_zebra_init(void) |