]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd, vtysh: Fix failing bgp cli
authorQuentin Young <qlyoung@cumulusnetworks.com>
Wed, 9 Nov 2016 07:24:51 +0000 (07:24 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Wed, 9 Nov 2016 07:24:51 +0000 (07:24 +0000)
* bgp bestpath as-path multipath-relax
* address-family encap
* address-family encapv4

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
bgpd/bgp_vty.c
vtysh/extract.pl.in
vtysh/vtysh.c

index 5cc4a4f7e18c2745645e5b45c11862e9c62dcaa7..707fc0d9fa15f8b33e0b7066860131b6061765c3 100644 (file)
@@ -1919,7 +1919,7 @@ DEFUN (bgp_bestpath_aspath_multipath_relax,
        "Generate an AS_SET\n"
        "Do not generate an AS_SET\n")
 {
-  int idx_as_set = 4;
+  int idx = 0;
   struct bgp *bgp;
 
   bgp = vty->index;
@@ -1927,7 +1927,7 @@ DEFUN (bgp_bestpath_aspath_multipath_relax,
 
   /* no-as-set is now the default behavior so we can silently
    * ignore it */
-  if (argv[idx_as_set]->arg != NULL && strncmp (argv[idx_as_set]->arg, "a", 1) == 0)
+  if (argv_find (argv, argc, "as-set", &idx))
     bgp_flag_set (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET);
   else
     bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET) ;
@@ -3832,21 +3832,22 @@ DEFUN (neighbor_send_community_type,
        "Send Extended Community attributes\n"
        "Send Standard Community attributes\n")
 {
-  int idx_peer = 1;
-  int idx_type = 3;
-  if (strncmp (argv[idx_type]->arg, "s", 1) == 0)
-    return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty),
-                                bgp_node_safi (vty),
-                                PEER_FLAG_SEND_COMMUNITY);
-  if (strncmp (argv[idx_type]->arg, "e", 1) == 0)
-    return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty),
-                                bgp_node_safi (vty),
-                                PEER_FLAG_SEND_EXT_COMMUNITY);
+  int idx = 0;
+  u_int32_t flag = 0;
 
-  return peer_af_flag_set_vty (vty, argv[idx_peer]->arg, bgp_node_afi (vty),
-                              bgp_node_safi (vty),
-                              (PEER_FLAG_SEND_COMMUNITY|
-                               PEER_FLAG_SEND_EXT_COMMUNITY));
+  char *peer = argv[1]->arg;
+
+  if (argv_find (argv, argc, "standard", &idx))
+    SET_FLAG (flag, PEER_FLAG_SEND_COMMUNITY);
+  else if (argv_find (argv, argc, "extended", &idx))
+    SET_FLAG (flag, PEER_FLAG_SEND_EXT_COMMUNITY);
+  else
+  {
+    SET_FLAG (flag, PEER_FLAG_SEND_COMMUNITY);
+    SET_FLAG (flag, PEER_FLAG_SEND_EXT_COMMUNITY);
+  }
+
+  return peer_af_flag_set_vty (vty, peer, bgp_node_afi (vty), bgp_node_safi (vty), flag);
 }
 
 DEFUN (no_neighbor_send_community_type,
index 8850ec0e8444651d4fc22d5bdedb09362693307b..6709826599d494f9aed581afe883cc1005a1e568 100755 (executable)
@@ -60,8 +60,7 @@ $ignore{'"address-family ipv6 <unicast|multicast>"'} = "ignore";
 $ignore{'"address-family vpnv4"'} = "ignore";
 $ignore{'"address-family vpnv4 unicast"'} = "ignore";
 $ignore{'"address-family ipv4 vrf NAME"'} = "ignore";
-$ignore{'"address-family encap"'} = "ignore";
-$ignore{'"address-family encapv4"'} = "ignore";
+$ignore{'"address-family <encap|encapv4>"'} = "ignore";
 $ignore{'"address-family encapv6"'} = "ignore";
 $ignore{'"address-family vpnv6"'} = "ignore";
 $ignore{'"address-family vpnv6 unicast"'} = "ignore";
index e4c3ce76f7650a66efe3f5c1580136221d5acf17..36ec565ec3037d74224e1d7fc8803d15870081a0 100644 (file)
@@ -1115,22 +1115,12 @@ DEFUNSH (VTYSH_BGPD,
   return CMD_SUCCESS;
 }
 
-DEFUNSH (VTYSH_BGPD,
-        address_family_encap,
-        address_family_encap_cmd,
-        "address-family encap",
-        "Enter Address Family command mode\n"
-        "Address Family\n")
-{
-  vty->node = BGP_ENCAP_NODE;
-  return CMD_SUCCESS;
-}
-
 DEFUNSH (VTYSH_BGPD,
         address_family_encapv4,
         address_family_encapv4_cmd,
-        "address-family encapv4",
+        "address-family <encap|encapv4>",
         "Enter Address Family command mode\n"
+         "Address Family\n"
         "Address Family\n")
 {
   vty->node = BGP_ENCAP_NODE;
@@ -3220,7 +3210,7 @@ vtysh_init_vty (void)
   install_element (CONFIG_NODE, &router_bgp_cmd);
   install_element (BGP_NODE, &address_family_vpnv4_cmd);
   install_element (BGP_NODE, &address_family_vpnv6_cmd);
-  install_element (BGP_NODE, &address_family_encap_cmd);
+  install_element (BGP_NODE, &address_family_encapv4_cmd);
   install_element (BGP_NODE, &address_family_encapv6_cmd);
 #if defined(ENABLE_BGP_VNC)
   install_element (BGP_NODE, &vnc_defaults_cmd);