]> git.proxmox.com Git - mirror_frr.git/blobdiff - pimd/pim_cmd.c
lib: enforce vrf_name_to_id by returning default_vrf when name is null
[mirror_frr.git] / pimd / pim_cmd.c
index 5dc86417cfe2a30a8781cea5454c6fb62acd7d2a..26932eea203e6e4f0e53d888d6938420a3452de2 100644 (file)
@@ -1187,8 +1187,9 @@ static void pim_show_interfaces_single(struct pim_instance *pim,
                        vty_out(vty, "Designated Router\n");
                        vty_out(vty, "-----------------\n");
                        vty_out(vty, "Address   : %s\n", dr_str);
-                       vty_out(vty, "Priority  : %d\n",
-                               pim_ifp->pim_dr_priority);
+                       vty_out(vty, "Priority  : %d(%d)\n",
+                               pim_ifp->pim_dr_priority,
+                               pim_ifp->pim_dr_num_nondrpri_neighbors);
                        vty_out(vty, "Uptime    : %s\n", dr_uptime);
                        vty_out(vty, "Elections : %d\n",
                                pim_ifp->pim_dr_election_count);
@@ -5640,27 +5641,6 @@ DEFUN (show_ip_pim_group_type,
        return CMD_SUCCESS;
 }
 
-DEFUN_HIDDEN (ip_multicast_routing,
-              ip_multicast_routing_cmd,
-              "ip multicast-routing",
-              IP_STR
-              "Enable IP multicast forwarding\n")
-{
-       return CMD_SUCCESS;
-}
-
-DEFUN_HIDDEN (no_ip_multicast_routing,
-              no_ip_multicast_routing_cmd,
-              "no ip multicast-routing",
-              NO_STR
-              IP_STR
-              "Enable IP multicast forwarding\n")
-{
-       vty_out(vty,
-               "Command is Disabled and will be removed in a future version\n");
-       return CMD_SUCCESS;
-}
-
 DEFUN (ip_ssmpingd,
        ip_ssmpingd_cmd,
        "ip ssmpingd [A.B.C.D]",
@@ -5787,7 +5767,7 @@ static int pim_cmd_igmp_start(struct vty *vty, struct interface *ifp)
        pim_ifp = ifp->info;
 
        if (!pim_ifp) {
-               pim_ifp = pim_if_new(ifp, 1 /* igmp=true */, 0 /* pim=false */);
+               pim_ifp = pim_if_new(ifp, true, false, false);
                if (!pim_ifp) {
                        vty_out(vty, "Could not enable IGMP on interface %s\n",
                                ifp->name);
@@ -6398,7 +6378,7 @@ static int pim_cmd_interface_add(struct interface *ifp)
        struct pim_interface *pim_ifp = ifp->info;
 
        if (!pim_ifp) {
-               pim_ifp = pim_if_new(ifp, 0 /* igmp=false */, 1 /* pim=true */);
+               pim_ifp = pim_if_new(ifp, false, true, false);
                if (!pim_ifp) {
                        return 0;
                }
@@ -6431,16 +6411,12 @@ DEFUN_HIDDEN (interface_ip_pim_ssm,
        return CMD_SUCCESS;
 }
 
-DEFUN (interface_ip_pim_sm,
-       interface_ip_pim_sm_cmd,
-       "ip pim sm",
-       IP_STR
-       PIM_STR
-       IFACE_PIM_SM_STR)
+static int interface_ip_pim_helper(struct vty *vty)
 {
        struct pim_interface *pim_ifp;
 
        VTY_DECLVAR_CONTEXT(interface, ifp);
+
        if (!pim_cmd_interface_add(ifp)) {
                vty_out(vty, "Could not enable PIM SM on interface\n");
                return CMD_WARNING_CONFIG_FAILED;
@@ -6453,6 +6429,25 @@ DEFUN (interface_ip_pim_sm,
        return CMD_SUCCESS;
 }
 
+DEFUN_HIDDEN (interface_ip_pim_sm,
+       interface_ip_pim_sm_cmd,
+       "ip pim sm",
+       IP_STR
+       PIM_STR
+       IFACE_PIM_SM_STR)
+{
+       return interface_ip_pim_helper(vty);
+}
+
+DEFUN (interface_ip_pim,
+       interface_ip_pim_cmd,
+       "ip pim",
+       IP_STR
+       PIM_STR)
+{
+       return interface_ip_pim_helper(vty);
+}
+
 static int pim_cmd_interface_delete(struct interface *ifp)
 {
        struct pim_interface *pim_ifp = ifp->info;
@@ -6478,13 +6473,7 @@ static int pim_cmd_interface_delete(struct interface *ifp)
        return 1;
 }
 
-DEFUN_HIDDEN (interface_no_ip_pim_ssm,
-       interface_no_ip_pim_ssm_cmd,
-       "no ip pim ssm",
-       NO_STR
-       IP_STR
-       PIM_STR
-       IFACE_PIM_STR)
+static int interface_no_ip_pim_helper(struct vty *vty)
 {
        VTY_DECLVAR_CONTEXT(interface, ifp);
        if (!pim_cmd_interface_delete(ifp)) {
@@ -6495,7 +6484,18 @@ DEFUN_HIDDEN (interface_no_ip_pim_ssm,
        return CMD_SUCCESS;
 }
 
-DEFUN (interface_no_ip_pim_sm,
+DEFUN_HIDDEN (interface_no_ip_pim_ssm,
+       interface_no_ip_pim_ssm_cmd,
+       "no ip pim ssm",
+       NO_STR
+       IP_STR
+       PIM_STR
+       IFACE_PIM_STR)
+{
+       return interface_no_ip_pim_helper(vty);
+}
+
+DEFUN_HIDDEN (interface_no_ip_pim_sm,
        interface_no_ip_pim_sm_cmd,
        "no ip pim sm",
        NO_STR
@@ -6503,13 +6503,17 @@ DEFUN (interface_no_ip_pim_sm,
        PIM_STR
        IFACE_PIM_SM_STR)
 {
-       VTY_DECLVAR_CONTEXT(interface, ifp);
-       if (!pim_cmd_interface_delete(ifp)) {
-               vty_out(vty, "Unable to delete interface information\n");
-               return CMD_WARNING_CONFIG_FAILED;
-       }
+       return interface_no_ip_pim_helper(vty);
+}
 
-       return CMD_SUCCESS;
+DEFUN (interface_no_ip_pim,
+       interface_no_ip_pim_cmd,
+       "no ip pim",
+       NO_STR
+       IP_STR
+       PIM_STR)
+{
+       return interface_no_ip_pim_helper(vty);
 }
 
 /* boundaries */
@@ -7466,7 +7470,7 @@ DEFUN (interface_pim_use_source,
        interface_pim_use_source_cmd,
        "ip pim use-source A.B.C.D",
        IP_STR
-       "pim multicast routing\n"
+       PIM_STR
        "Configure primary IP address\n"
        "source ip address\n")
 {
@@ -7478,7 +7482,7 @@ DEFUN (interface_no_pim_use_source,
        "no ip pim use-source [A.B.C.D]",
        NO_STR
        IP_STR
-       "pim multicast routing\n"
+       PIM_STR
        "Delete source IP address\n"
        "source ip address\n")
 {
@@ -8634,8 +8638,6 @@ void pim_cmd_init(void)
 
        install_node(&debug_node, pim_debug_config_write);
 
-       install_element(CONFIG_NODE, &ip_multicast_routing_cmd);
-       install_element(CONFIG_NODE, &no_ip_multicast_routing_cmd);
        install_element(CONFIG_NODE, &ip_pim_rp_cmd);
        install_element(VRF_NODE, &ip_pim_rp_cmd);
        install_element(CONFIG_NODE, &no_ip_pim_rp_cmd);
@@ -8721,6 +8723,8 @@ void pim_cmd_init(void)
        install_element(INTERFACE_NODE, &interface_no_ip_pim_ssm_cmd);
        install_element(INTERFACE_NODE, &interface_ip_pim_sm_cmd);
        install_element(INTERFACE_NODE, &interface_no_ip_pim_sm_cmd);
+       install_element(INTERFACE_NODE, &interface_ip_pim_cmd);
+       install_element(INTERFACE_NODE, &interface_no_ip_pim_cmd);
        install_element(INTERFACE_NODE, &interface_ip_pim_drprio_cmd);
        install_element(INTERFACE_NODE, &interface_no_ip_pim_drprio_cmd);
        install_element(INTERFACE_NODE, &interface_ip_pim_hello_cmd);