summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_evpn_mh.c28
-rw-r--r--bgpd/bgp_fsm.c4
-rw-r--r--bgpd/bgp_rpki.c17
-rw-r--r--pimd/pim6_cmd.c113
-rw-r--r--pimd/pim_cmd.c93
-rw-r--r--pimd/pim_cmd_common.c91
-rw-r--r--pimd/pim_cmd_common.h17
-rw-r--r--pimd/pim_iface.c20
-rw-r--r--pimd/pim_iface.h28
-rw-r--r--pimd/pim_ifchannel.c4
-rw-r--r--pimd/pim_igmp.c19
-rw-r--r--pimd/pim_nb_config.c42
-rw-r--r--pimd/pim_nht.c55
-rw-r--r--pimd/pim_pim.c12
-rw-r--r--pimd/pim_vty.c4
-rw-r--r--pimd/pim_vxlan.c12
-rw-r--r--pimd/pim_zebra.c7
-rw-r--r--pimd/pim_zlookup.c6
-rw-r--r--zebra/rt_netlink.c2
-rw-r--r--zebra/zebra_evpn.c23
-rw-r--r--zebra/zebra_vxlan.c27
21 files changed, 382 insertions, 242 deletions
diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c
index ed3716f601..858fee50b3 100644
--- a/bgpd/bgp_evpn_mh.c
+++ b/bgpd/bgp_evpn_mh.c
@@ -1273,9 +1273,9 @@ void bgp_evpn_mh_config_ead_export_rt(struct bgp *bgp,
}
}
- if (node_to_del)
- list_delete_node(bgp_mh_info->ead_es_export_rtl,
- node_to_del);
+ assert(node_to_del);
+ list_delete_node(bgp_mh_info->ead_es_export_rtl,
+ node_to_del);
}
} else {
listnode_add_sort(bgp_mh_info->ead_es_export_rtl, ecomcfg);
@@ -1902,9 +1902,6 @@ static struct bgp_evpn_es *bgp_evpn_es_new(struct bgp *bgp, const esi_t *esi)
{
struct bgp_evpn_es *es;
- if (!bgp)
- return NULL;
-
es = XCALLOC(MTYPE_BGP_EVPN_ES, sizeof(struct bgp_evpn_es));
/* set the ESI */
@@ -2364,7 +2361,6 @@ int bgp_evpn_local_es_add(struct bgp *bgp, esi_t *esi,
struct in_addr originator_ip, bool oper_up,
uint16_t df_pref, bool bypass)
{
- char buf[ESI_STR_LEN];
struct bgp_evpn_es *es;
bool new_es = true;
bool regen_esr = false;
@@ -2374,15 +2370,8 @@ int bgp_evpn_local_es_add(struct bgp *bgp, esi_t *esi,
if (es) {
if (CHECK_FLAG(es->flags, BGP_EVPNES_LOCAL))
new_es = false;
- } else {
+ } else
es = bgp_evpn_es_new(bgp, esi);
- if (!es) {
- flog_err(EC_BGP_ES_CREATE,
- "%u: Failed to allocate ES entry for ESI %s - at Local ES Add",
- bgp->vrf_id, esi_to_str(esi, buf, sizeof(buf)));
- return -1;
- }
- }
if (BGP_DEBUG(evpn_mh, EVPN_MH_ES))
zlog_debug("add local es %s orig-ip %pI4 df_pref %u %s",
@@ -3821,15 +3810,8 @@ int bgp_evpn_remote_es_evi_add(struct bgp *bgp, struct bgpevpn *vpn,
&p->prefix.ead_addr.ip.ipaddr_v4);
es = bgp_evpn_es_find(esi);
- if (!es) {
+ if (!es)
es = bgp_evpn_es_new(bgp, esi);
- if (!es) {
- flog_err(EC_BGP_ES_CREATE,
- "%u: Failed to allocate ES entry for ESI %s - at remote ES Add",
- bgp->vrf_id, esi_to_str(esi, buf, sizeof(buf)));
- return -1;
- }
- }
es_evi = bgp_evpn_es_evi_find(es, vpn);
if (!es_evi)
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index 26aac6e6f7..6854a6501a 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -2755,10 +2755,10 @@ const char *print_peer_gr_cmd(enum peer_gr_command pr_gr_cmd)
peer_gr_cmd = "NO_PEER_GR_CMD";
break;
case PEER_DISABLE_CMD:
- peer_gr_cmd = "PEER_GR_CMD";
+ peer_gr_cmd = "PEER_DISABLE_GR_CMD";
break;
case NO_PEER_DISABLE_CMD:
- peer_gr_cmd = "NO_PEER_GR_CMD";
+ peer_gr_cmd = "NO_PEER_DISABLE_GR_CMD";
break;
case PEER_HELPER_CMD:
peer_gr_cmd = "PEER_HELPER_CMD";
diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c
index c724b938d1..a7bc89e648 100644
--- a/bgpd/bgp_rpki.c
+++ b/bgpd/bgp_rpki.c
@@ -67,6 +67,7 @@ static struct thread *t_rpki;
DEFINE_MTYPE_STATIC(BGPD, BGP_RPKI_CACHE, "BGP RPKI Cache server");
DEFINE_MTYPE_STATIC(BGPD, BGP_RPKI_CACHE_GROUP, "BGP RPKI Cache server group");
+DEFINE_MTYPE_STATIC(BGPD, BGP_RPKI_RTRLIB, "BGP RPKI RTRLib");
#define POLLING_PERIOD_DEFAULT 3600
#define EXPIRE_INTERVAL_DEFAULT 7200
@@ -156,17 +157,17 @@ static const struct route_map_rule_cmd route_match_rpki_cmd = {
static void *malloc_wrapper(size_t size)
{
- return XMALLOC(MTYPE_BGP_RPKI_CACHE, size);
+ return XMALLOC(MTYPE_BGP_RPKI_RTRLIB, size);
}
static void *realloc_wrapper(void *ptr, size_t size)
{
- return XREALLOC(MTYPE_BGP_RPKI_CACHE, ptr, size);
+ return XREALLOC(MTYPE_BGP_RPKI_RTRLIB, ptr, size);
}
static void free_wrapper(void *ptr)
{
- XFREE(MTYPE_BGP_RPKI_CACHE, ptr);
+ XFREE(MTYPE_BGP_RPKI_RTRLIB, ptr);
}
static void init_tr_socket(struct cache *cache)
@@ -902,9 +903,8 @@ static void free_cache(struct cache *cache)
if (cache->type == TCP) {
XFREE(MTYPE_BGP_RPKI_CACHE, cache->tr_config.tcp_config->host);
XFREE(MTYPE_BGP_RPKI_CACHE, cache->tr_config.tcp_config->port);
- if (cache->tr_config.tcp_config->bindaddr)
- XFREE(MTYPE_BGP_RPKI_CACHE,
- cache->tr_config.tcp_config->bindaddr);
+ XFREE(MTYPE_BGP_RPKI_CACHE,
+ cache->tr_config.tcp_config->bindaddr);
XFREE(MTYPE_BGP_RPKI_CACHE, cache->tr_config.tcp_config);
}
#if defined(FOUND_SSH)
@@ -916,9 +916,8 @@ static void free_cache(struct cache *cache)
cache->tr_config.ssh_config->client_privkey_path);
XFREE(MTYPE_BGP_RPKI_CACHE,
cache->tr_config.ssh_config->server_hostkey_path);
- if (cache->tr_config.ssh_config->bindaddr)
- XFREE(MTYPE_BGP_RPKI_CACHE,
- cache->tr_config.ssh_config->bindaddr);
+ XFREE(MTYPE_BGP_RPKI_CACHE,
+ cache->tr_config.ssh_config->bindaddr);
XFREE(MTYPE_BGP_RPKI_CACHE, cache->tr_config.ssh_config);
}
#endif
diff --git a/pimd/pim6_cmd.c b/pimd/pim6_cmd.c
index 6e12b7fd39..5d7a63372f 100644
--- a/pimd/pim6_cmd.c
+++ b/pimd/pim6_cmd.c
@@ -625,6 +625,102 @@ DEFPY (interface_no_ipv6_mld_query_interval,
"frr-routing:ipv6");
}
+DEFPY (mld_group_watermark,
+ mld_group_watermark_cmd,
+ "ipv6 mld watermark-warn (1-65535)$limit",
+ IPV6_STR
+ MLD_STR
+ "Configure group limit for watermark warning\n"
+ "Group count to generate watermark warning\n")
+{
+ PIM_DECLVAR_CONTEXT(vrf, pim);
+ /* TBD Depends on MLD data structure changes */
+ return CMD_SUCCESS;
+}
+
+DEFPY (no_mld_group_watermark,
+ no_mld_group_watermark_cmd,
+ "no ipv6 mld watermark-warn [(1-65535)$limit]",
+ NO_STR
+ IPV6_STR
+ MLD_STR
+ "Unconfigure group limit for watermark warning\n"
+ IGNORED_IN_NO_STR)
+{
+ PIM_DECLVAR_CONTEXT(vrf, pim);
+ /* TBD Depends on MLD data structure changes */
+ return CMD_SUCCESS;
+}
+
+DEFPY (interface_ipv6_mld_query_max_response_time,
+ interface_ipv6_mld_query_max_response_time_cmd,
+ "ipv6 mld query-max-response-time (1-65535)$qmrt",
+ IPV6_STR
+ IFACE_MLD_STR
+ IFACE_MLD_QUERY_MAX_RESPONSE_TIME_STR
+ "Query response value in deci-seconds\n")
+{
+ return gm_process_query_max_response_time_cmd(vty, qmrt_str);
+}
+
+DEFPY (interface_no_ipv6_mld_query_max_response_time,
+ interface_no_ipv6_mld_query_max_response_time_cmd,
+ "no ipv6 mld query-max-response-time [(1-65535)]",
+ NO_STR
+ IPV6_STR
+ IFACE_MLD_STR
+ IFACE_MLD_QUERY_MAX_RESPONSE_TIME_STR
+ IGNORED_IN_NO_STR)
+{
+ return gm_process_no_query_max_response_time_cmd(vty);
+}
+
+DEFPY (interface_ipv6_mld_last_member_query_count,
+ interface_ipv6_mld_last_member_query_count_cmd,
+ "ipv6 mld last-member-query-count (1-255)$lmqc",
+ IPV6_STR
+ IFACE_MLD_STR
+ IFACE_MLD_LAST_MEMBER_QUERY_COUNT_STR
+ "Last member query count\n")
+{
+ return gm_process_last_member_query_count_cmd(vty, lmqc_str);
+}
+
+DEFPY (interface_no_ipv6_mld_last_member_query_count,
+ interface_no_ipv6_mld_last_member_query_count_cmd,
+ "no ipv6 mld last-member-query-count [(1-255)]",
+ NO_STR
+ IPV6_STR
+ IFACE_MLD_STR
+ IFACE_MLD_LAST_MEMBER_QUERY_COUNT_STR
+ IGNORED_IN_NO_STR)
+{
+ return gm_process_no_last_member_query_count_cmd(vty);
+}
+
+DEFPY (interface_ipv6_mld_last_member_query_interval,
+ interface_ipv6_mld_last_member_query_interval_cmd,
+ "ipv6 mld last-member-query-interval (1-65535)$lmqi",
+ IPV6_STR
+ IFACE_MLD_STR
+ IFACE_MLD_LAST_MEMBER_QUERY_INTERVAL_STR
+ "Last member query interval in deciseconds\n")
+{
+ return gm_process_last_member_query_interval_cmd(vty, lmqi_str);
+}
+
+DEFPY (interface_no_ipv6_mld_last_member_query_interval,
+ interface_no_ipv6_mld_last_member_query_interval_cmd,
+ "no ipv6 mld last-member-query-interval [(1-65535)]",
+ NO_STR
+ IPV6_STR
+ IFACE_MLD_STR
+ IFACE_MLD_LAST_MEMBER_QUERY_INTERVAL_STR
+ IGNORED_IN_NO_STR)
+{
+ return gm_process_no_last_member_query_interval_cmd(vty);
+}
+
DEFPY (show_ipv6_pim_rp,
show_ipv6_pim_rp_cmd,
"show ipv6 pim [vrf NAME] rp-info [X:X::X:X/M$group] [json$json]",
@@ -1501,6 +1597,23 @@ void pim_cmd_init(void)
install_element(INTERFACE_NODE, &interface_ipv6_mld_query_interval_cmd);
install_element(INTERFACE_NODE,
&interface_no_ipv6_mld_query_interval_cmd);
+ install_element(CONFIG_NODE, &mld_group_watermark_cmd);
+ install_element(VRF_NODE, &mld_group_watermark_cmd);
+ install_element(CONFIG_NODE, &no_mld_group_watermark_cmd);
+ install_element(VRF_NODE, &no_mld_group_watermark_cmd);
+ install_element(INTERFACE_NODE,
+ &interface_ipv6_mld_query_max_response_time_cmd);
+ install_element(INTERFACE_NODE,
+ &interface_no_ipv6_mld_query_max_response_time_cmd);
+ install_element(INTERFACE_NODE,
+ &interface_ipv6_mld_last_member_query_count_cmd);
+ install_element(INTERFACE_NODE,
+ &interface_no_ipv6_mld_last_member_query_count_cmd);
+ install_element(INTERFACE_NODE,
+ &interface_ipv6_mld_last_member_query_interval_cmd);
+ install_element(INTERFACE_NODE,
+ &interface_no_ipv6_mld_last_member_query_interval_cmd);
+
install_element(VIEW_NODE, &show_ipv6_pim_rp_cmd);
install_element(VIEW_NODE, &show_ipv6_pim_rp_vrf_all_cmd);
install_element(VIEW_NODE, &show_ipv6_pim_rpf_cmd);
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 3f2e248481..78fc975787 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -5664,35 +5664,15 @@ DEFUN (interface_no_ip_igmp_version,
"frr-routing:ipv4");
}
-DEFUN (interface_ip_igmp_query_max_response_time,
+DEFPY (interface_ip_igmp_query_max_response_time,
interface_ip_igmp_query_max_response_time_cmd,
- "ip igmp query-max-response-time (1-65535)",
+ "ip igmp query-max-response-time (1-65535)$qmrt",
IP_STR
IFACE_IGMP_STR
IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
"Query response value in deci-seconds\n")
{
- const struct lyd_node *pim_enable_dnode;
-
- pim_enable_dnode =
- yang_dnode_getf(vty->candidate_config->dnode,
- FRR_PIM_ENABLE_XPATH, VTY_CURR_XPATH,
- "frr-routing:ipv4");
-
- if (!pim_enable_dnode) {
- nb_cli_enqueue_change(vty, "./enable", NB_OP_MODIFY,
- "true");
- } else {
- if (!yang_dnode_get_bool(pim_enable_dnode, "."))
- nb_cli_enqueue_change(vty, "./enable",
- NB_OP_MODIFY, "true");
- }
-
- nb_cli_enqueue_change(vty, "./query-max-response-time", NB_OP_MODIFY,
- argv[3]->arg);
-
- return nb_cli_apply_changes(vty, FRR_GMP_INTERFACE_XPATH,
- "frr-routing:ipv4");
+ return gm_process_query_max_response_time_cmd(vty, qmrt_str);
}
DEFUN (interface_no_ip_igmp_query_max_response_time,
@@ -5704,10 +5684,7 @@ DEFUN (interface_no_ip_igmp_query_max_response_time,
IFACE_IGMP_QUERY_MAX_RESPONSE_TIME_STR
IGNORED_IN_NO_STR)
{
- nb_cli_enqueue_change(vty, "./query-max-response-time", NB_OP_DESTROY,
- NULL);
- return nb_cli_apply_changes(vty, FRR_GMP_INTERFACE_XPATH,
- "frr-routing:ipv4");
+ return gm_process_no_query_max_response_time_cmd(vty);
}
DEFUN_HIDDEN (interface_ip_igmp_query_max_response_time_dsec,
@@ -5756,34 +5733,15 @@ DEFUN_HIDDEN (interface_no_ip_igmp_query_max_response_time_dsec,
"frr-routing:ipv4");
}
-DEFUN (interface_ip_igmp_last_member_query_count,
+DEFPY (interface_ip_igmp_last_member_query_count,
interface_ip_igmp_last_member_query_count_cmd,
- "ip igmp last-member-query-count (1-255)",
+ "ip igmp last-member-query-count (1-255)$lmqc",
IP_STR
IFACE_IGMP_STR
IFACE_IGMP_LAST_MEMBER_QUERY_COUNT_STR
"Last member query count\n")
{
- const struct lyd_node *pim_enable_dnode;
-
- pim_enable_dnode =
- yang_dnode_getf(vty->candidate_config->dnode,
- FRR_PIM_ENABLE_XPATH, VTY_CURR_XPATH,
- "frr-routing:ipv4");
- if (!pim_enable_dnode) {
- nb_cli_enqueue_change(vty, "./enable", NB_OP_MODIFY,
- "true");
- } else {
- if (!yang_dnode_get_bool(pim_enable_dnode, "."))
- nb_cli_enqueue_change(vty, "./enable",
- NB_OP_MODIFY, "true");
- }
-
- nb_cli_enqueue_change(vty, "./robustness-variable", NB_OP_MODIFY,
- argv[3]->arg);
-
- return nb_cli_apply_changes(vty, FRR_GMP_INTERFACE_XPATH,
- "frr-routing:ipv4");
+ return gm_process_last_member_query_count_cmd(vty, lmqc_str);
}
DEFUN (interface_no_ip_igmp_last_member_query_count,
@@ -5795,41 +5753,18 @@ DEFUN (interface_no_ip_igmp_last_member_query_count,
IFACE_IGMP_LAST_MEMBER_QUERY_COUNT_STR
IGNORED_IN_NO_STR)
{
- nb_cli_enqueue_change(vty, "./robustness-variable", NB_OP_DESTROY,
- NULL);
-
- return nb_cli_apply_changes(vty, FRR_GMP_INTERFACE_XPATH,
- "frr-routing:ipv4");
+ return gm_process_no_last_member_query_count_cmd(vty);
}
-DEFUN (interface_ip_igmp_last_member_query_interval,
+DEFPY (interface_ip_igmp_last_member_query_interval,
interface_ip_igmp_last_member_query_interval_cmd,
- "ip igmp last-member-query-interval (1-65535)",
+ "ip igmp last-member-query-interval (1-65535)$lmqi",
IP_STR
IFACE_IGMP_STR
IFACE_IGMP_LAST_MEMBER_QUERY_INTERVAL_STR
"Last member query interval in deciseconds\n")
{
- const struct lyd_node *pim_enable_dnode;
-
- pim_enable_dnode =
- yang_dnode_getf(vty->candidate_config->dnode,
- FRR_PIM_ENABLE_XPATH, VTY_CURR_XPATH,
- "frr-routing:ipv4");
- if (!pim_enable_dnode) {
- nb_cli_enqueue_change(vty, "./enable", NB_OP_MODIFY,
- "true");
- } else {
- if (!yang_dnode_get_bool(pim_enable_dnode, "."))
- nb_cli_enqueue_change(vty, "./enable",
- NB_OP_MODIFY, "true");
- }
-
- nb_cli_enqueue_change(vty, "./last-member-query-interval", NB_OP_MODIFY,
- argv[3]->arg);
-
- return nb_cli_apply_changes(vty, FRR_GMP_INTERFACE_XPATH,
- "frr-routing:ipv4");
+ return gm_process_last_member_query_interval_cmd(vty, lmqi_str);
}
DEFUN (interface_no_ip_igmp_last_member_query_interval,
@@ -5841,11 +5776,7 @@ DEFUN (interface_no_ip_igmp_last_member_query_interval,
IFACE_IGMP_LAST_MEMBER_QUERY_INTERVAL_STR
IGNORED_IN_NO_STR)
{
- nb_cli_enqueue_change(vty, "./last-member-query-interval",
- NB_OP_DESTROY, NULL);
-
- return nb_cli_apply_changes(vty, FRR_GMP_INTERFACE_XPATH,
- "frr-routing:ipv4");
+ return gm_process_no_last_member_query_interval_cmd(vty);
}
DEFUN (interface_ip_pim_drprio,
diff --git a/pimd/pim_cmd_common.c b/pimd/pim_cmd_common.c
index 0d575a1456..0992a60de9 100644
--- a/pimd/pim_cmd_common.c
+++ b/pimd/pim_cmd_common.c
@@ -2749,3 +2749,94 @@ void pim_show_neighbors(struct pim_instance *pim, struct vty *vty,
}
}
}
+
+int gm_process_query_max_response_time_cmd(struct vty *vty,
+ const char *qmrt_str)
+{
+ const struct lyd_node *pim_enable_dnode;
+
+ pim_enable_dnode = yang_dnode_getf(vty->candidate_config->dnode,
+ FRR_PIM_ENABLE_XPATH, VTY_CURR_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+
+ if (!pim_enable_dnode) {
+ nb_cli_enqueue_change(vty, "./enable", NB_OP_MODIFY, "true");
+ } else {
+ if (!yang_dnode_get_bool(pim_enable_dnode, "."))
+ nb_cli_enqueue_change(vty, "./enable", NB_OP_MODIFY,
+ "true");
+ }
+
+ nb_cli_enqueue_change(vty, "./query-max-response-time", NB_OP_MODIFY,
+ qmrt_str);
+ return nb_cli_apply_changes(vty, FRR_GMP_INTERFACE_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+}
+
+int gm_process_no_query_max_response_time_cmd(struct vty *vty)
+{
+ nb_cli_enqueue_change(vty, "./query-max-response-time", NB_OP_DESTROY,
+ NULL);
+ return nb_cli_apply_changes(vty, FRR_GMP_INTERFACE_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+}
+
+int gm_process_last_member_query_count_cmd(struct vty *vty,
+ const char *lmqc_str)
+{
+ const struct lyd_node *pim_enable_dnode;
+
+ pim_enable_dnode = yang_dnode_getf(vty->candidate_config->dnode,
+ FRR_PIM_ENABLE_XPATH, VTY_CURR_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+ if (!pim_enable_dnode) {
+ nb_cli_enqueue_change(vty, "./enable", NB_OP_MODIFY, "true");
+ } else {
+ if (!yang_dnode_get_bool(pim_enable_dnode, "."))
+ nb_cli_enqueue_change(vty, "./enable", NB_OP_MODIFY,
+ "true");
+ }
+
+ nb_cli_enqueue_change(vty, "./robustness-variable", NB_OP_MODIFY,
+ lmqc_str);
+ return nb_cli_apply_changes(vty, FRR_GMP_INTERFACE_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+}
+
+int gm_process_no_last_member_query_count_cmd(struct vty *vty)
+{
+ nb_cli_enqueue_change(vty, "./robustness-variable", NB_OP_DESTROY,
+ NULL);
+ return nb_cli_apply_changes(vty, FRR_GMP_INTERFACE_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+}
+
+int gm_process_last_member_query_interval_cmd(struct vty *vty,
+ const char *lmqi_str)
+{
+ const struct lyd_node *pim_enable_dnode;
+
+ pim_enable_dnode = yang_dnode_getf(vty->candidate_config->dnode,
+ FRR_PIM_ENABLE_XPATH, VTY_CURR_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+ if (!pim_enable_dnode) {
+ nb_cli_enqueue_change(vty, "./enable", NB_OP_MODIFY, "true");
+ } else {
+ if (!yang_dnode_get_bool(pim_enable_dnode, "."))
+ nb_cli_enqueue_change(vty, "./enable", NB_OP_MODIFY,
+ "true");
+ }
+
+ nb_cli_enqueue_change(vty, "./last-member-query-interval", NB_OP_MODIFY,
+ lmqi_str);
+ return nb_cli_apply_changes(vty, FRR_GMP_INTERFACE_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+}
+
+int gm_process_no_last_member_query_interval_cmd(struct vty *vty)
+{
+ nb_cli_enqueue_change(vty, "./last-member-query-interval",
+ NB_OP_DESTROY, NULL);
+ return nb_cli_apply_changes(vty, FRR_GMP_INTERFACE_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+}
diff --git a/pimd/pim_cmd_common.h b/pimd/pim_cmd_common.h
index 00a9a56738..3bcd0d5d6d 100644
--- a/pimd/pim_cmd_common.h
+++ b/pimd/pim_cmd_common.h
@@ -93,6 +93,15 @@ void pim_show_neighbors_single(struct pim_instance *pim, struct vty *vty,
const char *neighbor, json_object *json);
void pim_show_neighbors(struct pim_instance *pim, struct vty *vty,
json_object *json);
+int gm_process_query_max_response_time_cmd(struct vty *vty,
+ const char *qmrt_str);
+int gm_process_no_query_max_response_time_cmd(struct vty *vty);
+int gm_process_last_member_query_count_cmd(struct vty *vty,
+ const char *lmqc_str);
+int gm_process_no_last_member_query_count_cmd(struct vty *vty);
+int gm_process_last_member_query_interval_cmd(struct vty *vty,
+ const char *lmqi_str);
+int gm_process_no_last_member_query_interval_cmd(struct vty *vty);
/*
* Special Macro to allow us to get the correct pim_instance
*/
@@ -102,4 +111,12 @@ void pim_show_neighbors(struct pim_instance *pim, struct vty *vty,
(vrf) ? vrf->info : pim_get_pim_instance(VRF_DEFAULT); \
vrf = (vrf) ? vrf : pim->vrf
+/*
+ * Special Macro to allow us to get the correct pim_instance;
+ */
+#define PIM_DECLVAR_CONTEXT(A, B) \
+ struct vrf *A = VTY_GET_CONTEXT(vrf); \
+ struct pim_instance *B = \
+ (vrf) ? vrf->info : pim_get_pim_instance(VRF_DEFAULT); \
+ vrf = (vrf) ? vrf : pim->vrf
#endif /* PIM_CMD_COMMON_H */
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c
index 4470d05663..a644d9cfec 100644
--- a/pimd/pim_iface.c
+++ b/pimd/pim_iface.c
@@ -150,13 +150,9 @@ struct pim_interface *pim_if_new(struct interface *ifp, bool igmp, bool pim,
assert(pim_ifp->gm_query_max_response_time_dsec <
pim_ifp->gm_default_query_interval);
- if (pim)
- PIM_IF_DO_PIM(pim_ifp->options);
+ pim_ifp->pim_enable = pim;
#if PIM_IPV == 4
- if (igmp)
- PIM_IF_DO_IGMP(pim_ifp->options);
-
- PIM_IF_DO_IGMP_LISTEN_ALLROUTERS(pim_ifp->options);
+ pim_ifp->igmp_enable = igmp;
#endif
pim_ifp->gm_join_list = NULL;
@@ -317,7 +313,7 @@ static int detect_primary_address_change(struct interface *ifp,
if (changed) {
/* Before updating pim_ifp send Hello time with 0 hold time */
- if (PIM_IF_TEST_PIM(pim_ifp->options)) {
+ if (pim_ifp->pim_enable) {
pim_hello_send(ifp, 0 /* zero-sec holdtime */);
}
pim_ifp->primary_address = new_prim_addr;
@@ -462,7 +458,7 @@ static void detect_address_change(struct interface *ifp, int force_prim_as_any,
if (changed) {
- if (!PIM_IF_TEST_PIM(pim_ifp->options)) {
+ if (!pim_ifp->pim_enable) {
return;
}
@@ -543,7 +539,7 @@ void pim_if_addr_add(struct connected *ifc)
#if PIM_IPV == 4
struct in_addr ifaddr = ifc->address->u.prefix4;
- if (PIM_IF_TEST_IGMP(pim_ifp->options)) {
+ if (pim_ifp->igmp_enable) {
struct gm_sock *igmp;
/* lookup IGMP socket */
@@ -610,7 +606,7 @@ void pim_if_addr_add(struct connected *ifc)
} /* igmp mtrace only */
#endif
- if (PIM_IF_TEST_PIM(pim_ifp->options)) {
+ if (pim_ifp->pim_enable) {
if (!pim_addr_is_any(pim_ifp->primary_address)) {
@@ -802,7 +798,7 @@ void pim_if_addr_add_all(struct interface *ifp)
}
if (!v4_addrs && v6_addrs && !if_is_loopback(ifp)) {
- if (PIM_IF_TEST_PIM(pim_ifp->options)) {
+ if (pim_ifp->pim_enable) {
/* Interface has a valid primary address ? */
if (!pim_addr_is_any(pim_ifp->primary_address)) {
@@ -1211,7 +1207,7 @@ long pim_if_t_suppressed_msec(struct interface *ifp)
assert(pim_ifp);
/* join suppression disabled ? */
- if (PIM_IF_TEST_PIM_CAN_DISABLE_JOIN_SUPPRESSION(pim_ifp->options))
+ if (pim_ifp->pim_can_disable_join_suppression)
return 0;
/* t_suppressed = t_periodic * rand(1.1, 1.4) */
diff --git a/pimd/pim_iface.h b/pimd/pim_iface.h
index bab73eae86..b0f7e52ac2 100644
--- a/pimd/pim_iface.h
+++ b/pimd/pim_iface.h
@@ -34,31 +34,8 @@
#include "bfd.h"
#include "pim_str.h"
-#define PIM_IF_MASK_PIM (1 << 0)
-#define PIM_IF_MASK_IGMP (1 << 1)
-#define PIM_IF_MASK_IGMP_LISTEN_ALLROUTERS (1 << 2)
-#define PIM_IF_MASK_PIM_CAN_DISABLE_JOIN_SUPPRESSION (1 << 3)
-
#define PIM_IF_IS_DELETED(ifp) ((ifp)->ifindex == IFINDEX_INTERNAL)
-#define PIM_IF_TEST_PIM(options) (PIM_IF_MASK_PIM & (options))
-#define PIM_IF_TEST_IGMP(options) (PIM_IF_MASK_IGMP & (options))
-#define PIM_IF_TEST_IGMP_LISTEN_ALLROUTERS(options) (PIM_IF_MASK_IGMP_LISTEN_ALLROUTERS & (options))
-#define PIM_IF_TEST_PIM_CAN_DISABLE_JOIN_SUPPRESSION(options) \
- (PIM_IF_MASK_PIM_CAN_DISABLE_JOIN_SUPPRESSION & (options))
-
-#define PIM_IF_DO_PIM(options) ((options) |= PIM_IF_MASK_PIM)
-#define PIM_IF_DO_IGMP(options) ((options) |= PIM_IF_MASK_IGMP)
-#define PIM_IF_DO_IGMP_LISTEN_ALLROUTERS(options) ((options) |= PIM_IF_MASK_IGMP_LISTEN_ALLROUTERS)
-#define PIM_IF_DO_PIM_CAN_DISABLE_JOIN_SUPPRESSION(options) \
- ((options) |= PIM_IF_MASK_PIM_CAN_DISABLE_JOIN_SUPPRESSION)
-
-#define PIM_IF_DONT_PIM(options) ((options) &= ~PIM_IF_MASK_PIM)
-#define PIM_IF_DONT_IGMP(options) ((options) &= ~PIM_IF_MASK_IGMP)
-#define PIM_IF_DONT_IGMP_LISTEN_ALLROUTERS(options) ((options) &= ~PIM_IF_MASK_IGMP_LISTEN_ALLROUTERS)
-#define PIM_IF_DONT_PIM_CAN_DISABLE_JOIN_SUPPRESSION(options) \
- ((options) &= ~PIM_IF_MASK_PIM_CAN_DISABLE_JOIN_SUPPRESSION)
-
#define PIM_I_am_DR(pim_ifp) \
!pim_addr_cmp((pim_ifp)->pim_dr_addr, (pim_ifp)->primary_address)
#define PIM_I_am_DualActive(pim_ifp) (pim_ifp)->activeactive == true
@@ -93,6 +70,11 @@ struct pim_secondary_addr {
};
struct pim_interface {
+ bool pim_enable : 1;
+ bool pim_can_disable_join_suppression : 1;
+
+ bool igmp_enable : 1;
+
uint32_t options; /* bit vector */
ifindex_t mroute_vif_index;
struct pim_instance *pim;
diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c
index f9fb8cf094..54cd824f9e 100644
--- a/pimd/pim_ifchannel.c
+++ b/pimd/pim_ifchannel.c
@@ -1155,7 +1155,7 @@ int pim_ifchannel_local_membership_add(struct interface *ifp, pim_sgaddr *sg,
return 0;
}
- if (!PIM_IF_TEST_PIM(pim_ifp->options)) {
+ if (!pim_ifp->pim_enable) {
if (PIM_DEBUG_EVENTS)
zlog_debug("%s:%pSG PIM is not configured on this interface %s",
__func__, sg, ifp->name);
@@ -1249,7 +1249,7 @@ void pim_ifchannel_local_membership_del(struct interface *ifp, pim_sgaddr *sg)
pim_ifp = ifp->info;
if (!pim_ifp)
return;
- if (!PIM_IF_TEST_PIM(pim_ifp->options))
+ if (!pim_ifp->pim_enable)
return;
orig = ch = pim_ifchannel_find(ifp, sg);
diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c
index 3d716ccc1c..08cc0b8fc4 100644
--- a/pimd/pim_igmp.c
+++ b/pimd/pim_igmp.c
@@ -255,17 +255,14 @@ static int igmp_sock_open(struct in_addr ifaddr, struct interface *ifp,
if (fd < 0)
return -1;
- if (PIM_IF_TEST_IGMP_LISTEN_ALLROUTERS(pim_options)) {
- if (inet_aton(PIM_ALL_ROUTERS, &group)) {
- if (!pim_socket_join(fd, group, ifaddr, ifp->ifindex,
- pim_ifp))
- ++join;
- } else {
- zlog_warn(
- "%s %s: IGMP socket fd=%d interface %pI4: could not solve %s to group address: errno=%d: %s",
- __FILE__, __func__, fd, &ifaddr,
- PIM_ALL_ROUTERS, errno, safe_strerror(errno));
- }
+ if (inet_aton(PIM_ALL_ROUTERS, &group)) {
+ if (!pim_socket_join(fd, group, ifaddr, ifp->ifindex, pim_ifp))
+ ++join;
+ } else {
+ zlog_warn(
+ "%s %s: IGMP socket fd=%d interface %pI4: could not solve %s to group address: errno=%d: %s",
+ __FILE__, __func__, fd, &ifaddr, PIM_ALL_ROUTERS, errno,
+ safe_strerror(errno));
}
/*
diff --git a/pimd/pim_nb_config.c b/pimd/pim_nb_config.c
index 7fe7c0395f..d174b8a0af 100644
--- a/pimd/pim_nb_config.c
+++ b/pimd/pim_nb_config.c
@@ -63,8 +63,7 @@ static void pim_if_membership_clear(struct interface *ifp)
pim_ifp = ifp->info;
assert(pim_ifp);
- if (PIM_IF_TEST_PIM(pim_ifp->options)
- && PIM_IF_TEST_IGMP(pim_ifp->options)) {
+ if (pim_ifp->pim_enable && pim_ifp->igmp_enable) {
return;
}
@@ -90,9 +89,9 @@ static void pim_if_membership_refresh(struct interface *ifp)
pim_ifp = ifp->info;
assert(pim_ifp);
- if (!PIM_IF_TEST_PIM(pim_ifp->options))
+ if (!pim_ifp->pim_enable)
return;
- if (!PIM_IF_TEST_IGMP(pim_ifp->options))
+ if (!pim_ifp->igmp_enable)
return;
/*
@@ -143,7 +142,7 @@ static int pim_cmd_interface_add(struct interface *ifp)
if (!pim_ifp)
pim_ifp = pim_if_new(ifp, false, true, false, false);
else
- PIM_IF_DO_PIM(pim_ifp->options);
+ pim_ifp->pim_enable = true;
pim_if_addr_add_all(ifp);
pim_if_membership_refresh(ifp);
@@ -159,7 +158,7 @@ static int pim_cmd_interface_delete(struct interface *ifp)
if (!pim_ifp)
return 1;
- PIM_IF_DONT_PIM(pim_ifp->options);
+ pim_ifp->pim_enable = false;
pim_if_membership_clear(ifp);
@@ -169,7 +168,7 @@ static int pim_cmd_interface_delete(struct interface *ifp)
*/
pim_sock_delete(ifp, "pim unconfigured on interface");
- if (!PIM_IF_TEST_IGMP(pim_ifp->options)) {
+ if (!pim_ifp->igmp_enable) {
pim_if_addr_del_all(ifp);
pim_if_delete(ifp);
}
@@ -360,8 +359,8 @@ static int pim_cmd_igmp_start(struct interface *ifp)
pim_ifp = pim_if_new(ifp, true, false, false, false);
need_startup = 1;
} else {
- if (!PIM_IF_TEST_IGMP(pim_ifp->options)) {
- PIM_IF_DO_IGMP(pim_ifp->options);
+ if (!pim_ifp->igmp_enable) {
+ pim_ifp->igmp_enable = true;
need_startup = 1;
}
}
@@ -409,7 +408,6 @@ static void igmp_sock_query_interval_reconfig(struct gm_sock *igmp)
*/
igmp_startup_mode_on(igmp);
}
-#endif
static void igmp_sock_query_reschedule(struct gm_sock *igmp)
{
@@ -439,6 +437,7 @@ static void igmp_sock_query_reschedule(struct gm_sock *igmp)
assert(igmp->t_other_querier_timer);
}
}
+#endif /* PIM_IPV == 4 */
#if PIM_IPV == 4
static void change_query_interval(struct pim_interface *pim_ifp,
@@ -456,6 +455,7 @@ static void change_query_interval(struct pim_interface *pim_ifp,
}
#endif
+#if PIM_IPV == 4
static void change_query_max_response_time(struct pim_interface *pim_ifp,
int query_max_response_time_dsec)
{
@@ -503,6 +503,7 @@ static void change_query_max_response_time(struct pim_interface *pim_ifp,
}
}
}
+#endif
int routing_control_plane_protocols_name_validate(
struct nb_cb_create_args *args)
@@ -2537,13 +2538,13 @@ int lib_interface_gmp_address_family_destroy(struct nb_cb_destroy_args *args)
if (!pim_ifp)
return NB_OK;
- PIM_IF_DONT_IGMP(pim_ifp->options);
+ pim_ifp->igmp_enable = false;
pim_if_membership_clear(ifp);
pim_if_addr_del_all_igmp(ifp);
- if (!PIM_IF_TEST_PIM(pim_ifp->options))
+ if (!pim_ifp->pim_enable)
pim_if_delete(ifp);
}
@@ -2594,13 +2595,13 @@ int lib_interface_gmp_address_family_enable_modify(
if (!pim_ifp)
return NB_ERR_INCONSISTENCY;
- PIM_IF_DONT_IGMP(pim_ifp->options);
+ pim_ifp->igmp_enable = false;
pim_if_membership_clear(ifp);
pim_if_addr_del_all_igmp(ifp);
- if (!PIM_IF_TEST_PIM(pim_ifp->options))
+ if (!pim_ifp->pim_enable)
pim_if_delete(ifp);
}
}
@@ -2733,6 +2734,7 @@ int lib_interface_gmp_address_family_query_interval_modify(
int lib_interface_gmp_address_family_query_max_response_time_modify(
struct nb_cb_modify_args *args)
{
+#if PIM_IPV == 4
struct interface *ifp;
int query_max_response_time_dsec;
@@ -2748,6 +2750,10 @@ int lib_interface_gmp_address_family_query_max_response_time_modify(
change_query_max_response_time(ifp->info,
query_max_response_time_dsec);
}
+#else
+ /* TBD Depends on MLD data structure changes */
+#endif
+
return NB_OK;
}
@@ -2758,6 +2764,7 @@ int lib_interface_gmp_address_family_query_max_response_time_modify(
int lib_interface_gmp_address_family_last_member_query_interval_modify(
struct nb_cb_modify_args *args)
{
+#if PIM_IPV == 4
struct interface *ifp;
struct pim_interface *pim_ifp;
int last_member_query_interval;
@@ -2777,6 +2784,9 @@ int lib_interface_gmp_address_family_last_member_query_interval_modify(
break;
}
+#else
+ /* TBD Depends on MLD data structure changes */
+#endif
return NB_OK;
}
@@ -2787,6 +2797,7 @@ int lib_interface_gmp_address_family_last_member_query_interval_modify(
int lib_interface_gmp_address_family_robustness_variable_modify(
struct nb_cb_modify_args *args)
{
+#if PIM_IPV == 4
struct interface *ifp;
struct pim_interface *pim_ifp;
int last_member_query_count;
@@ -2805,6 +2816,9 @@ int lib_interface_gmp_address_family_robustness_variable_modify(
break;
}
+#else
+ /* TBD Depends on MLD data structure changes */
+#endif
return NB_OK;
}
diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c
index 94dcfb8265..106bce61db 100644
--- a/pimd/pim_nht.c
+++ b/pimd/pim_nht.c
@@ -696,9 +696,7 @@ int pim_parse_nexthop_update(ZAPI_CALLBACK_ARGS)
int i;
struct pim_rpf rpf;
struct pim_nexthop_cache *pnc = NULL;
- struct pim_neighbor *nbr = NULL;
struct interface *ifp = NULL;
- struct interface *ifp1 = NULL;
struct vrf *vrf = vrf_lookup_by_id(vrf_id);
struct pim_instance *pim;
struct zapi_route nhr;
@@ -739,11 +737,6 @@ int pim_parse_nexthop_update(ZAPI_CALLBACK_ARGS)
for (i = 0; i < nhr.nexthop_num; i++) {
nexthop = nexthop_from_zapi_nexthop(&nhr.nexthops[i]);
switch (nexthop->type) {
- case NEXTHOP_TYPE_IPV4:
- case NEXTHOP_TYPE_IPV4_IFINDEX:
- case NEXTHOP_TYPE_IPV6:
- case NEXTHOP_TYPE_BLACKHOLE:
- break;
case NEXTHOP_TYPE_IFINDEX:
/*
* Connected route (i.e. no nexthop), use
@@ -760,31 +753,44 @@ int pim_parse_nexthop_update(ZAPI_CALLBACK_ARGS)
pnc->rpf.rpf_addr.u.prefix6;
#endif
break;
- case NEXTHOP_TYPE_IPV6_IFINDEX:
+#if PIM_IPV == 4
+ /* RFC5549 IPv4-over-IPv6 nexthop handling:
+ * if we get an IPv6 nexthop in IPv4 PIM, hunt down a
+ * PIM neighbor and use that instead.
+ */
+ case NEXTHOP_TYPE_IPV6_IFINDEX: {
+ struct interface *ifp1 = NULL;
+ struct pim_neighbor *nbr = NULL;
+
ifp1 = if_lookup_by_index(nexthop->ifindex,
pim->vrf->vrf_id);
if (!ifp1)
nbr = NULL;
else
+ /* FIXME: should really use nbr's
+ * secondary address list here
+ */
nbr = pim_neighbor_find_if(ifp1);
+
/* Overwrite with Nbr address as NH addr */
if (nbr)
-#if PIM_IPV == 4
nexthop->gate.ipv4 = nbr->source_addr;
-#else
- nexthop->gate.ipv6 = nbr->source_addr;
-#endif
- else {
+ else
// Mark nexthop address to 0 until PIM
// Nbr is resolved.
-#if PIM_IPV == 4
nexthop->gate.ipv4 = PIMADDR_ANY;
+
+ break;
+ }
#else
- nexthop->gate.ipv6 = PIMADDR_ANY;
+ case NEXTHOP_TYPE_IPV6_IFINDEX:
#endif
- }
-
+ case NEXTHOP_TYPE_IPV6:
+ case NEXTHOP_TYPE_IPV4:
+ case NEXTHOP_TYPE_IPV4_IFINDEX:
+ case NEXTHOP_TYPE_BLACKHOLE:
+ /* nothing to do for the other nexthop types */
break;
}
@@ -804,13 +810,18 @@ int pim_parse_nexthop_update(ZAPI_CALLBACK_ARGS)
continue;
}
- if (PIM_DEBUG_PIM_NHT)
+ if (PIM_DEBUG_PIM_NHT) {
+#if PIM_IPV == 4
+ pim_addr nhaddr = nexthop->gate.ipv4;
+#else
+ pim_addr nhaddr = nexthop->gate.ipv6;
+#endif
zlog_debug(
- "%s: NHT addr %pFX(%s) %d-nhop via %pI4(%s) type %d distance:%u metric:%u ",
+ "%s: NHT addr %pFX(%s) %d-nhop via %pPA(%s) type %d distance:%u metric:%u ",
__func__, &match, pim->vrf->name, i + 1,
- &nexthop->gate.ipv4, ifp->name,
- nexthop->type, nhr.distance,
- nhr.metric);
+ &nhaddr, ifp->name, nexthop->type,
+ nhr.distance, nhr.metric);
+ }
if (!ifp->info) {
/*
diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c
index 50bbc0fe18..1baa5c38ca 100644
--- a/pimd/pim_pim.c
+++ b/pimd/pim_pim.c
@@ -526,11 +526,8 @@ void pim_sock_reset(struct interface *ifp)
PIM_DEFAULT_PROPAGATION_DELAY_MSEC;
pim_ifp->pim_override_interval_msec =
PIM_DEFAULT_OVERRIDE_INTERVAL_MSEC;
- if (PIM_DEFAULT_CAN_DISABLE_JOIN_SUPPRESSION) {
- PIM_IF_DO_PIM_CAN_DISABLE_JOIN_SUPPRESSION(pim_ifp->options);
- } else {
- PIM_IF_DONT_PIM_CAN_DISABLE_JOIN_SUPPRESSION(pim_ifp->options);
- }
+ pim_ifp->pim_can_disable_join_suppression =
+ PIM_DEFAULT_CAN_DISABLE_JOIN_SUPPRESSION;
/* neighbors without lan_delay */
pim_ifp->pim_number_of_nonlandelay_neighbors = 0;
@@ -702,8 +699,7 @@ static int hello_send(struct interface *ifp, uint16_t holdtime)
__func__, &qpim_all_pim_routers_addr, ifp->name,
holdtime, pim_ifp->pim_propagation_delay_msec,
pim_ifp->pim_override_interval_msec,
- PIM_IF_TEST_PIM_CAN_DISABLE_JOIN_SUPPRESSION(
- pim_ifp->options),
+ pim_ifp->pim_can_disable_join_suppression,
pim_ifp->pim_dr_priority, pim_ifp->pim_generation_id,
listcount(ifp->connected));
@@ -713,7 +709,7 @@ static int hello_send(struct interface *ifp, uint16_t holdtime)
pim_ifp->pim_dr_priority, pim_ifp->pim_generation_id,
pim_ifp->pim_propagation_delay_msec,
pim_ifp->pim_override_interval_msec,
- PIM_IF_TEST_PIM_CAN_DISABLE_JOIN_SUPPRESSION(pim_ifp->options));
+ pim_ifp->pim_can_disable_join_suppression);
if (pim_tlv_size < 0) {
return -1;
}
diff --git a/pimd/pim_vty.c b/pimd/pim_vty.c
index a0dea63b79..b360181f43 100644
--- a/pimd/pim_vty.c
+++ b/pimd/pim_vty.c
@@ -289,7 +289,7 @@ static int pim_igmp_config_write(struct vty *vty, int writes,
struct pim_interface *pim_ifp)
{
/* IF ip igmp */
- if (PIM_IF_TEST_IGMP(pim_ifp->options)) {
+ if (pim_ifp->igmp_enable) {
vty_out(vty, " ip igmp\n");
++writes;
}
@@ -361,7 +361,7 @@ int pim_config_write(struct vty *vty, int writes, struct interface *ifp,
{
struct pim_interface *pim_ifp = ifp->info;
- if (PIM_IF_TEST_PIM(pim_ifp->options)) {
+ if (pim_ifp->pim_enable) {
vty_out(vty, " " PIM_AF_NAME " pim\n");
++writes;
}
diff --git a/pimd/pim_vxlan.c b/pimd/pim_vxlan.c
index 5e55b9f9c8..120293dbfd 100644
--- a/pimd/pim_vxlan.c
+++ b/pimd/pim_vxlan.c
@@ -880,6 +880,12 @@ void pim_vxlan_mlag_update(bool enable, bool peer_state, uint32_t role,
*/
pim = pim_get_pim_instance(VRF_DEFAULT);
+ if (!pim) {
+ if (PIM_DEBUG_VXLAN)
+ zlog_debug("%s: Unable to find pim instance", __func__);
+ return;
+ }
+
if (enable)
vxlan_mlag.flags |= PIM_VXLAN_MLAGF_ENABLED;
else
@@ -1137,7 +1143,7 @@ void pim_vxlan_add_term_dev(struct pim_instance *pim,
/* enable pim on the term ifp */
pim_ifp = (struct pim_interface *)ifp->info;
if (pim_ifp) {
- PIM_IF_DO_PIM(pim_ifp->options);
+ pim_ifp->pim_enable = true;
/* ifp is already oper up; activate it as a term dev */
if (pim_ifp->mroute_vif_index >= 0)
pim_vxlan_term_oif_update(pim, ifp);
@@ -1165,8 +1171,8 @@ void pim_vxlan_del_term_dev(struct pim_instance *pim)
pim_ifp = (struct pim_interface *)ifp->info;
if (pim_ifp) {
- PIM_IF_DONT_PIM(pim_ifp->options);
- if (!PIM_IF_TEST_IGMP(pim_ifp->options))
+ pim_ifp->pim_enable = false;
+ if (!pim_ifp->igmp_enable)
pim_if_delete(ifp);
}
}
diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c
index 7f463715a5..4bed8d5b73 100644
--- a/pimd/pim_zebra.c
+++ b/pimd/pim_zebra.c
@@ -166,6 +166,13 @@ static int pim_zebra_if_address_add(ZAPI_CALLBACK_ARGS)
struct pim_instance *pim;
pim = pim_get_pim_instance(vrf_id);
+ if (!pim) {
+ if (PIM_DEBUG_ZEBRA)
+ zlog_debug("%s: Unable to find pim instance",
+ __func__);
+ return 0;
+ }
+
pim_ifp->pim = pim;
pim_rp_check_on_if_add(pim_ifp);
diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c
index c487f995e7..5d99f131a8 100644
--- a/pimd/pim_zlookup.c
+++ b/pimd/pim_zlookup.c
@@ -388,6 +388,12 @@ void zclient_lookup_read_pipe(struct thread *thread)
struct pim_zlookup_nexthop nexthop_tab[10];
struct in_addr l = {.s_addr = INADDR_ANY};
+ if (!pim) {
+ if (PIM_DEBUG_PIM_NHT_DETAIL)
+ zlog_debug("%s: Unable to find pim instance", __func__);
+ return;
+ }
+
zclient_lookup_nexthop_once(pim, nexthop_tab, 10, l);
thread_add_timer(router->master, zclient_lookup_read_pipe, zlookup, 60,
&zlookup_read);
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index f2cf9122fa..2ff083dec5 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -3273,7 +3273,7 @@ static int netlink_macfdb_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
memcpy(&mac, RTA_DATA(tb[NDA_LLADDR]), ETH_ALEN);
- if ((NDA_VLAN <= NDA_MAX) && tb[NDA_VLAN]) {
+ if (tb[NDA_VLAN]) {
vid_present = 1;
vid = *(uint16_t *)RTA_DATA(tb[NDA_VLAN]);
snprintf(vid_buf, sizeof(vid_buf), " VLAN %u", vid);
diff --git a/zebra/zebra_evpn.c b/zebra/zebra_evpn.c
index d9d21462fb..d223a21eda 100644
--- a/zebra/zebra_evpn.c
+++ b/zebra/zebra_evpn.c
@@ -649,10 +649,9 @@ static int zebra_evpn_map_vlan_ns(struct ns *ns,
struct zebra_l2info_vxlan *vxl = NULL;
struct zebra_from_svi_param *in_param =
(struct zebra_from_svi_param *)_in_param;
- int found = 0;
- if (!in_param)
- return NS_WALK_STOP;
+ assert(p_zevpn && in_param);
+
br_if = in_param->br_if;
zif = in_param->zif;
assert(zif);
@@ -676,17 +675,13 @@ static int zebra_evpn_map_vlan_ns(struct ns *ns,
if (!in_param->bridge_vlan_aware
|| vxl->access_vlan == in_param->vid) {
- found = 1;
- break;
+ zevpn = zebra_evpn_lookup(vxl->vni);
+ *p_zevpn = zevpn;
+ return NS_WALK_STOP;
}
}
- if (!found)
- return NS_WALK_CONTINUE;
- zevpn = zebra_evpn_lookup(vxl->vni);
- if (p_zevpn)
- *p_zevpn = zevpn;
- return NS_WALK_STOP;
+ return NS_WALK_CONTINUE;
}
/*
@@ -831,8 +826,7 @@ static int zvni_map_to_macvlan_ns(struct ns *ns,
struct interface *tmp_if = NULL;
struct zebra_if *zif;
- if (!in_param)
- return NS_WALK_STOP;
+ assert(in_param && p_ifp);
/* Identify corresponding VLAN interface. */
for (rn = route_top(zns->if_table); rn; rn = route_next(rn)) {
@@ -846,8 +840,7 @@ static int zvni_map_to_macvlan_ns(struct ns *ns,
continue;
if (zif->link == in_param->svi_if) {
- if (p_ifp)
- *p_ifp = tmp_if;
+ *p_ifp = tmp_if;
return NS_WALK_STOP;
}
}
diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c
index 13e1f63457..fc7eb8c87a 100644
--- a/zebra/zebra_vxlan.c
+++ b/zebra/zebra_vxlan.c
@@ -1754,6 +1754,8 @@ static int zl3vni_map_to_vxlan_if_ns(struct ns *ns,
if (!zvrf)
return NS_WALK_STOP;
+ assert(_pifp);
+
/* loop through all vxlan-interface */
for (rn = route_top(zns->if_table); rn; rn = route_next(rn)) {
@@ -1784,8 +1786,7 @@ static int zl3vni_map_to_vxlan_if_ns(struct ns *ns,
zl3vni->local_vtep_ip = vxl->vtep_ip;
- if (_pifp)
- *_pifp = (void *)ifp;
+ *_pifp = (void *)ifp;
return NS_WALK_STOP;
}
@@ -1856,7 +1857,6 @@ struct zebra_l3vni *zl3vni_from_vrf(vrf_id_t vrf_id)
static int zl3vni_from_svi_ns(struct ns *ns, void *_in_param, void **_p_zl3vni)
{
- int found = 0;
struct zebra_ns *zns = ns->info;
struct zebra_l3vni **p_zl3vni = (struct zebra_l3vni **)_p_zl3vni;
struct zebra_from_svi_param *in_param =
@@ -1866,8 +1866,7 @@ static int zl3vni_from_svi_ns(struct ns *ns, void *_in_param, void **_p_zl3vni)
struct zebra_if *zif = NULL;
struct zebra_l2info_vxlan *vxl = NULL;
- if (!in_param)
- return NS_WALK_STOP;
+ assert(in_param && p_zl3vni);
/* loop through all vxlan-interface */
for (rn = route_top(zns->if_table); rn; rn = route_next(rn)) {
@@ -1886,17 +1885,12 @@ static int zl3vni_from_svi_ns(struct ns *ns, void *_in_param, void **_p_zl3vni)
if (!in_param->bridge_vlan_aware
|| vxl->access_vlan == in_param->vid) {
- found = 1;
- break;
+ *p_zl3vni = zl3vni_lookup(vxl->vni);
+ return NS_WALK_STOP;
}
}
- if (!found)
- return NS_WALK_CONTINUE;
-
- if (p_zl3vni)
- *p_zl3vni = zl3vni_lookup(vxl->vni);
- return NS_WALK_STOP;
+ return NS_WALK_CONTINUE;
}
/*
@@ -5130,8 +5124,13 @@ int zebra_vxlan_if_update(struct interface *ifp, uint16_t chgflags)
zevpn_vxlan_if_set(zevpn, ifp, true /* set */);
vlan_if = zvni_map_to_svi(vxl->access_vlan,
zif->brslave_info.br_if);
- if (vlan_if)
+ if (vlan_if) {
zevpn->svi_if = vlan_if;
+ zevpn->vrf_id = vlan_if->vrf->vrf_id;
+ zl3vni = zl3vni_from_vrf(vlan_if->vrf->vrf_id);
+ if (zl3vni)
+ listnode_add_sort_nodup(zl3vni->l2vnis, zevpn);
+ }
/* Take further actions needed.
* Note that if we are here, there is a change of interest.