From: Quentin Young Date: Wed, 9 Nov 2016 07:24:51 +0000 (+0000) Subject: bgpd, vtysh: Fix failing bgp cli X-Git-Tag: frr-3.0-branchpoint~129^2~43 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=4c4ff4c13693ff2beb18931577423edcdc4a0403;p=mirror%2Ffrr.git bgpd, vtysh: Fix failing bgp cli * bgp bestpath as-path multipath-relax * address-family encap * address-family encapv4 Signed-off-by: Quentin Young --- diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 5cc4a4f7e1..707fc0d9fa 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -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, diff --git a/vtysh/extract.pl.in b/vtysh/extract.pl.in index 8850ec0e84..6709826599 100755 --- a/vtysh/extract.pl.in +++ b/vtysh/extract.pl.in @@ -60,8 +60,7 @@ $ignore{'"address-family ipv6 "'} = "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 "'} = "ignore"; $ignore{'"address-family encapv6"'} = "ignore"; $ignore{'"address-family vpnv6"'} = "ignore"; $ignore{'"address-family vpnv6 unicast"'} = "ignore"; diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index e4c3ce76f7..36ec565ec3 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -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 ", "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);