]> git.proxmox.com Git - mirror_frr.git/commitdiff
Merge pull request #3325 from adeg/bugfix/bgpd-vtysh-fixes
authorRuss White <russ@riw.us>
Mon, 26 Nov 2018 03:39:47 +0000 (22:39 -0500)
committerGitHub <noreply@github.com>
Mon, 26 Nov 2018 03:39:47 +0000 (22:39 -0500)
bgp_vty: Fix vpn_leak_postchange_all() every time "router bgp ASNUM" context is entered

1  2 
bgpd/bgp_vty.c

diff --combined bgpd/bgp_vty.c
index 85b6414e481cd0aacb2363b1a3e768f9b5175d3e,f763d4b976f5b23f7f47de74622e99180bcf41a5..69a0b78378039fe23bb9644f8f5b72b7ed70cbba
@@@ -602,7 -602,7 +602,7 @@@ static int bgp_clear(struct vty *vty, s
                        bgp->update_delay_over = 0;
  
                if (!found)
-                       vty_out(vty, "%%BGP: No %s peer configured",
+                       vty_out(vty, "%%BGP: No %s peer configured\n",
                                afi_safi_print(afi, safi));
  
                return CMD_SUCCESS;
@@@ -972,6 -972,7 +972,7 @@@ DEFUN_NOSH (router_bgp
        int idx_asn = 2;
        int idx_view_vrf = 3;
        int idx_vrf = 4;
+       int is_new_bgp = 0;
        int ret;
        as_t as;
        struct bgp *bgp;
                                inst_type = BGP_INSTANCE_TYPE_VIEW;
                }
  
+               if (inst_type == BGP_INSTANCE_TYPE_DEFAULT)
+                       is_new_bgp = (bgp_lookup(as, name) == NULL);
                ret = bgp_get(&bgp, &as, name, inst_type);
                switch (ret) {
                case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
                 * any pending VRF-VPN leaking that was configured via
                 * earlier "router bgp X vrf FOO" blocks.
                 */
-               if (inst_type == BGP_INSTANCE_TYPE_DEFAULT)
+               if (is_new_bgp && inst_type == BGP_INSTANCE_TYPE_DEFAULT)
                        vpn_leak_postchange_all();
  
                /* Pending: handle when user tries to change a view to vrf n vv.
@@@ -13986,7 -13990,6 +13990,7 @@@ DEFUN (no_community_list_standard_all
         COMMUNITY_VAL_STR)
  {
        char *cl_name_or_number = NULL;
 +      char *str = NULL;
        int direct = 0;
        int style = COMMUNITY_LIST_STANDARD;
  
                zlog_warn("Deprecated option: 'no ip community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> |AA:NN' being used");
        }
  
 +      argv_find(argv, argc, "permit", &idx);
 +      argv_find(argv, argc, "deny", &idx);
 +
 +      if (idx) {
 +              direct = argv_find(argv, argc, "permit", &idx)
 +                               ? COMMUNITY_PERMIT
 +                               : COMMUNITY_DENY;
 +
 +              idx = 0;
 +              argv_find(argv, argc, "AA:NN", &idx);
 +              str = argv_concat(argv, argc, idx);
 +      }
 +
 +      idx = 0;
        argv_find(argv, argc, "(1-99)", &idx);
        argv_find(argv, argc, "WORD", &idx);
        cl_name_or_number = argv[idx]->arg;
 -      direct = argv_find(argv, argc, "permit", &idx) ? COMMUNITY_PERMIT
 -                                                     : COMMUNITY_DENY;
 -      argv_find(argv, argc, "AA:NN", &idx);
 -      char *str = argv_concat(argv, argc, idx);
  
        int ret = community_list_unset(bgp_clist, cl_name_or_number, str,
                                       direct, style);
@@@ -14042,20 -14035,6 +14046,20 @@@ ALIAS (no_community_list_standard_all
         "Specify community to accept\n"
         COMMUNITY_VAL_STR)
  
 +ALIAS(no_community_list_standard_all, no_bgp_community_list_standard_all_list_cmd,
 +      "no bgp community-list <(1-99)|standard WORD>",
 +      NO_STR BGP_STR COMMUNITY_LIST_STR
 +      "Community list number (standard)\n"
 +      "Add an standard community-list entry\n"
 +      "Community list name\n")
 +
 +ALIAS(no_community_list_standard_all, no_ip_community_list_standard_all_list_cmd,
 +      "no ip community-list <(1-99)|standard WORD>",
 +      NO_STR BGP_STR COMMUNITY_LIST_STR
 +      "Community list number (standard)\n"
 +      "Add an standard community-list entry\n"
 +      "Community list name\n")
 +
  /*community-list expanded */
  DEFUN (community_list_expanded_all,
         bgp_community_list_expanded_all_cmd,
@@@ -14128,7 -14107,6 +14132,7 @@@ DEFUN (no_community_list_expanded_all
         COMMUNITY_VAL_STR)
  {
        char *cl_name_or_number = NULL;
 +      char *str = NULL;
        int direct = 0;
        int style = COMMUNITY_LIST_EXPANDED;
  
        if (argv_find(argv, argc, "ip", &idx)) {
                vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n");
                vty_out(vty, "if you are using this please migrate to the below command.\n");
 -              vty_out(vty, "'no community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN'\n");
 -              zlog_warn("Deprecated option: 'no community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN' being used");
 +              vty_out(vty, "'no bgp community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN'\n");
 +              zlog_warn("Deprecated option: 'no ip community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN' being used");
        }
 +
 +      idx = 0;
 +      argv_find(argv, argc, "permit", &idx);
 +      argv_find(argv, argc, "deny", &idx);
 +
 +      if (idx) {
 +              direct = argv_find(argv, argc, "permit", &idx)
 +                               ? COMMUNITY_PERMIT
 +                               : COMMUNITY_DENY;
 +
 +              idx = 0;
 +              argv_find(argv, argc, "AA:NN", &idx);
 +              str = argv_concat(argv, argc, idx);
 +      }
 +
 +      idx = 0;
        argv_find(argv, argc, "(100-500)", &idx);
        argv_find(argv, argc, "WORD", &idx);
        cl_name_or_number = argv[idx]->arg;
 -      direct = argv_find(argv, argc, "permit", &idx) ? COMMUNITY_PERMIT
 -                                                     : COMMUNITY_DENY;
 -      argv_find(argv, argc, "AA:NN", &idx);
 -      char *str = argv_concat(argv, argc, idx);
  
        int ret = community_list_unset(bgp_clist, cl_name_or_number, str,
                                       direct, style);
@@@ -14185,20 -14151,6 +14189,20 @@@ ALIAS (no_community_list_expanded_all
         "Specify community to accept\n"
         COMMUNITY_VAL_STR)
  
 +ALIAS(no_community_list_expanded_all, no_bgp_community_list_expanded_all_list_cmd,
 +      "no bgp community-list <(100-500)|expanded WORD>",
 +      NO_STR IP_STR COMMUNITY_LIST_STR
 +      "Community list number (expanded)\n"
 +      "Add an expanded community-list entry\n"
 +      "Community list name\n")
 +
 +ALIAS(no_community_list_expanded_all, no_ip_community_list_expanded_all_list_cmd,
 +      "no ip community-list <(100-500)|expanded WORD>",
 +      NO_STR IP_STR COMMUNITY_LIST_STR
 +      "Community list number (expanded)\n"
 +      "Add an expanded community-list entry\n"
 +      "Community list name\n")
 +
  /* Return configuration string of community-list entry.  */
  static const char *community_list_config_str(struct community_entry *entry)
  {
@@@ -15279,17 -15231,13 +15283,17 @@@ static void community_list_vty(void
        install_element(CONFIG_NODE, &bgp_community_list_standard_cmd);
        install_element(CONFIG_NODE, &bgp_community_list_expanded_all_cmd);
        install_element(CONFIG_NODE, &no_bgp_community_list_standard_all_cmd);
 +      install_element(CONFIG_NODE, &no_bgp_community_list_standard_all_list_cmd);
        install_element(CONFIG_NODE, &no_bgp_community_list_expanded_all_cmd);
 +      install_element(CONFIG_NODE, &no_bgp_community_list_expanded_all_list_cmd);
        install_element(VIEW_NODE, &show_bgp_community_list_cmd);
        install_element(VIEW_NODE, &show_bgp_community_list_arg_cmd);
        install_element(CONFIG_NODE, &ip_community_list_standard_cmd);
        install_element(CONFIG_NODE, &ip_community_list_expanded_all_cmd);
        install_element(CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
 +      install_element(CONFIG_NODE, &no_ip_community_list_standard_all_list_cmd);
        install_element(CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
 +      install_element(CONFIG_NODE, &no_ip_community_list_expanded_all_list_cmd);
        install_element(VIEW_NODE, &show_ip_community_list_cmd);
        install_element(VIEW_NODE, &show_ip_community_list_arg_cmd);