Browse Source

zebra: fix link-params CLI handling

vtysh was breaking in a rather ugly way, and some "no" forms were
missing too.
David Lamparter 4 years ago
parent
commit
f2f44eaa32
2 changed files with 21 additions and 1 deletions
  1. 13 1
      vtysh/vtysh_config.c
  2. 8 0
      zebra/interface.c

+ 13 - 1
vtysh/vtysh_config.c

@@ -184,8 +184,20 @@ vtysh_config_parse_line (const char *line)
 	  else if (strncmp (line, " address-family ipv6",
 		   strlen (" address-family ipv6")) == 0)
 	    config = config_get (BGP_IPV6_NODE, line);
+	  else if (strncmp (line, " link-params", strlen (" link-params")) == 0)
+	    {
+	      config_add_line (config->line, line);
+	      config->index = LINK_PARAMS_NODE;
+	    }
+	  else if (config->index == LINK_PARAMS_NODE &&
+	           strncmp (line, "  exit", strlen ("  exit")) == 0)
+	    {
+	      config_add_line (config->line, line);
+	      config->index = INTERFACE_NODE;
+	    }
 	  else if (config->index == RMAP_NODE ||
-		   config->index == VTY_NODE)
+	      config->index == INTERFACE_NODE ||
+	      config->index == VTY_NODE)
 	    config_add_line_uniq (config->line, line);
 	  else
 	    config_add_line (config->line, line);

+ 8 - 0
zebra/interface.c

@@ -2636,6 +2636,7 @@ link_params_config_write (struct vty *vty, struct interface *ifp)
   if (IS_PARAM_SET(iflp, LP_RMT_AS))
     vty_out(vty, "  neighbor %s as %u%s", inet_ntoa(iflp->rmt_ip),
         iflp->rmt_as, VTY_NEWLINE);
+  vty_out(vty, "  exit%s", VTY_NEWLINE);
   return 0;
 }
 
@@ -2786,13 +2787,20 @@ zebra_if_init (void)
   install_element(LINK_PARAMS_NODE, &link_params_max_rsv_bw_cmd);
   install_element(LINK_PARAMS_NODE, &link_params_unrsv_bw_cmd);
   install_element(LINK_PARAMS_NODE, &link_params_admin_grp_cmd);
+  install_element(LINK_PARAMS_NODE, &no_link_params_admin_grp_cmd);
   install_element(LINK_PARAMS_NODE, &link_params_inter_as_cmd);
   install_element(LINK_PARAMS_NODE, &no_link_params_inter_as_cmd);
   install_element(LINK_PARAMS_NODE, &link_params_delay_cmd);
+  install_element(LINK_PARAMS_NODE, &no_link_params_delay_cmd);
   install_element(LINK_PARAMS_NODE, &link_params_delay_mm_cmd);
   install_element(LINK_PARAMS_NODE, &link_params_delay_var_cmd);
+  install_element(LINK_PARAMS_NODE, &no_link_params_delay_var_cmd);
   install_element(LINK_PARAMS_NODE, &link_params_pkt_loss_cmd);
+  install_element(LINK_PARAMS_NODE, &no_link_params_pkt_loss_cmd);
   install_element(LINK_PARAMS_NODE, &link_params_ava_bw_cmd);
+  install_element(LINK_PARAMS_NODE, &no_link_params_ava_bw_cmd);
   install_element(LINK_PARAMS_NODE, &link_params_res_bw_cmd);
+  install_element(LINK_PARAMS_NODE, &no_link_params_res_bw_cmd);
   install_element(LINK_PARAMS_NODE, &link_params_use_bw_cmd);
+  install_element(LINK_PARAMS_NODE, &no_link_params_use_bw_cmd);
 }