pim_zlookup_show_ip_multicast (vty);
vty_out(vty, "%s", VTY_NEWLINE);
- vty_out(vty, "Current highest VifIndex: %d%s",
- qpim_mroute_oif_highest_vif_index,
- VTY_NEWLINE);
vty_out(vty, "Maximum highest VifIndex: %d%s",
PIM_MAX_USABLE_VIFS,
VTY_NEWLINE);
struct interface *pim_regiface = NULL;
struct list *pim_ifchannel_list = NULL;
+static int pim_iface_vif_index[MAXVIFS];
static void pim_if_igmp_join_del_all(struct interface *ifp);
void
pim_if_init (void)
{
+ int i;
+
+ for (i = 0; i < MAXVIFS; i++)
+ pim_iface_vif_index[i] = 0;
+
vrf_iflist_create(VRF_DEFAULT);
pim_ifchannel_list = list_new();
pim_ifchannel_list->cmp = (int (*)(void *, void *))pim_ifchannel_compare;
return addr;
}
-static int pim_iface_vif_index = 0;
-
static int
pim_iface_next_vif_index (struct interface *ifp)
{
+ int i;
/*
* The pimreg vif is always going to be in index 0
* of the table.
if (ifp->ifindex == PIM_OIF_PIM_REGISTER_VIF)
return 0;
- pim_iface_vif_index++;
- return pim_iface_vif_index;
+ for (i = 1 ; i < MAXVIFS; i++)
+ {
+ if (pim_iface_vif_index[i] == 0)
+ return i;
+ }
+ return MAXVIFS;
}
/*
return -5;
}
- /*
- Update highest vif_index
- */
- if (pim_ifp->mroute_vif_index != PIM_OIF_PIM_REGISTER_VIF &&
- pim_ifp->mroute_vif_index > qpim_mroute_oif_highest_vif_index) {
- qpim_mroute_oif_highest_vif_index = pim_ifp->mroute_vif_index;
- }
-
+ pim_iface_vif_index[pim_ifp->mroute_vif_index] = 1;
return 0;
}
-static int iflist_find_highest_vif_index()
-{
- struct listnode *ifnode;
- struct interface *ifp;
- struct pim_interface *pim_ifp;
- int highest_vif_index = -1;
-
- for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), ifnode, ifp)) {
- pim_ifp = ifp->info;
- if (!pim_ifp)
- continue;
-
- if (pim_ifp->mroute_vif_index > highest_vif_index) {
- highest_vif_index = pim_ifp->mroute_vif_index;
- }
- }
-
- return highest_vif_index;
-}
-
int pim_if_del_vif(struct interface *ifp)
{
struct pim_interface *pim_ifp = ifp->info;
- int old_vif_index;
if (pim_ifp->mroute_vif_index < 1) {
zlog_warn("%s: vif_index=%d < 1 on interface %s ifindex=%d",
}
/*
- Update highest vif_index
+ Update vif_index
*/
-
- /* save old vif_index in order to compare with highest below */
- old_vif_index = pim_ifp->mroute_vif_index;
+ pim_iface_vif_index[pim_ifp->mroute_vif_index] = 0;
pim_ifp->mroute_vif_index = -1;
- if (old_vif_index == qpim_mroute_oif_highest_vif_index) {
- qpim_mroute_oif_highest_vif_index = iflist_find_highest_vif_index();
- }
-
return 0;
}
uint32_t qpim_debugs = 0;
int qpim_mroute_socket_fd = -1;
int64_t qpim_mroute_socket_creation = 0; /* timestamp of creation */
-int qpim_mroute_oif_highest_vif_index = -1;
int qpim_t_periodic = PIM_DEFAULT_T_PERIODIC; /* Period between Join/Prune Messages */
struct pim_assert_metric qpim_infinite_assert_metric;
long qpim_rpf_cache_refresh_delay_msec = 50;
qpim_static_route_list->del = (void (*)(void *)) pim_static_route_free;
qpim_mroute_socket_fd = -1; /* mark mroute as disabled */
- qpim_mroute_oif_highest_vif_index = -1;
qpim_inaddr_any.s_addr = PIM_NET_INADDR_ANY;