summaryrefslogtreecommitdiff
path: root/pimd/pim_iface.c
diff options
context:
space:
mode:
Diffstat (limited to 'pimd/pim_iface.c')
-rw-r--r--pimd/pim_iface.c50
1 files changed, 43 insertions, 7 deletions
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c
index 57fe97816e..5425aec233 100644
--- a/pimd/pim_iface.c
+++ b/pimd/pim_iface.c
@@ -50,10 +50,12 @@
#include "pim_igmp_join.h"
#include "pim_vxlan.h"
+#if PIM_IPV == 4
static void pim_if_igmp_join_del_all(struct interface *ifp);
static int igmp_join_sock(const char *ifname, ifindex_t ifindex,
struct in_addr group_addr,
struct in_addr source_addr);
+#endif
void pim_if_init(struct pim_instance *pim)
{
@@ -83,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;
@@ -124,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;
@@ -185,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;
@@ -198,6 +203,8 @@ void pim_if_delete(struct interface *ifp)
pim_ifp = ifp->info;
assert(pim_ifp);
+ pim_ifp->pim->mcast_if_count--;
+#if PIM_IPV == 4
if (pim_ifp->gm_join_list) {
pim_if_igmp_join_del_all(ifp);
}
@@ -208,7 +215,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);
@@ -218,6 +224,7 @@ void pim_if_delete(struct interface *ifp)
XFREE(MTYPE_PIM_INTERFACE, pim_ifp->boundary_oil_plist);
XFREE(MTYPE_PIM_INTERFACE, pim_ifp);
+#endif
ifp->info = NULL;
}
@@ -486,7 +493,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);
@@ -507,13 +513,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;
@@ -579,6 +586,7 @@ void pim_if_addr_add(struct connected *ifc)
true);
}
} /* igmp mtrace only */
+#endif
if (PIM_IF_TEST_PIM(pim_ifp->options)) {
@@ -630,6 +638,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;
@@ -652,6 +661,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)
@@ -1140,6 +1150,7 @@ long pim_if_t_suppressed_msec(struct interface *ifp)
return t_suppressed_msec;
}
+#if PIM_IPV == 4
static void igmp_join_free(struct gm_join *ij)
{
XFREE(MTYPE_PIM_IGMP_JOIN, ij);
@@ -1330,6 +1341,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;
@@ -1350,6 +1362,19 @@ static void pim_if_igmp_join_del_all(struct interface *ifp)
for (ALL_LIST_ELEMENTS(pim_ifp->gm_join_list, node, nextnode, ij))
pim_if_igmp_join_del(ifp, ij->group_addr, ij->source_addr);
}
+#else /* PIM_IPV != 4 */
+ferr_r pim_if_igmp_join_add(struct interface *ifp, struct in_addr group_addr,
+ struct in_addr source_addr)
+{
+ return ferr_ok();
+}
+
+int pim_if_igmp_join_del(struct interface *ifp, struct in_addr group_addr,
+ struct in_addr source_addr)
+{
+ return 0;
+}
+#endif /* PIM_IPV != 4 */
/*
RFC 4601
@@ -1524,6 +1549,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);
/*
@@ -1535,8 +1561,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
@@ -1564,6 +1592,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;
}
@@ -1572,7 +1601,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(
@@ -1593,6 +1621,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
@@ -1621,6 +1652,7 @@ static int pim_ifp_up(struct interface *ifp)
}
}
}
+#endif
return 0;
}
@@ -1634,6 +1666,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);
/*
@@ -1656,14 +1689,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",
@@ -1672,12 +1704,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;
}