diff options
| -rw-r--r-- | bgpd/bgp_filter.c | 133 | ||||
| -rw-r--r-- | bgpd/bgp_vty.c | 588 | ||||
| -rw-r--r-- | doc/user/routemap.rst | 12 | ||||
| -rw-r--r-- | ospfd/ospf_flood.c | 2 | ||||
| -rw-r--r-- | ospfd/ospf_vty.c | 26 | ||||
| -rw-r--r-- | ospfd/ospf_zebra.c | 133 | ||||
| -rw-r--r-- | vtysh/vtysh_config.c | 16 |
7 files changed, 759 insertions, 151 deletions
diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c index c7977a9af4..1ccb8fb245 100644 --- a/bgpd/bgp_filter.c +++ b/bgpd/bgp_filter.c @@ -77,7 +77,7 @@ struct as_list { struct as_filter *tail; }; -/* ip as-path access-list 10 permit AS1. */ +/* as-path access-list 10 permit AS1. */ static struct as_list_master as_list_master = {{NULL, NULL}, {NULL, NULL}, @@ -401,9 +401,9 @@ static int config_bgp_aspath_validate(const char *regstr) return 0; } -DEFUN(ip_as_path, ip_as_path_cmd, - "ip as-path access-list WORD <deny|permit> LINE...", - IP_STR +DEFUN(as_path, bgp_as_path_cmd, + "bgp as-path access-list WORD <deny|permit> LINE...", + BGP_STR "BGP autonomous system path filter\n" "Specify an access list name\n" "Regular expression access list name\n" @@ -418,6 +418,13 @@ DEFUN(ip_as_path, ip_as_path_cmd, regex_t *regex; char *regstr; + 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, "'bgp as-path access-list WORD <deny|permit> LINE'\n"); + zlog_warn("Deprecated option: 'ip as-path access-list WORD <deny|permit> LINE' being used"); + } + /* Retrieve access list name */ argv_find(argv, argc, "WORD", &idx); char *alname = argv[idx]->arg; @@ -459,9 +466,23 @@ DEFUN(ip_as_path, ip_as_path_cmd, return CMD_SUCCESS; } -DEFUN(no_ip_as_path, no_ip_as_path_cmd, - "no ip as-path access-list WORD <deny|permit> LINE...", - NO_STR IP_STR +#if CONFDATE > 20191005 +CPP_NOTICE("bgpd: remove deprecated 'ip as-path access-list WORD <deny|permit> LINE' command") +#endif +ALIAS(as_path, ip_as_path_cmd, + "ip as-path access-list WORD <deny|permit> LINE...", + IP_STR + "BGP autonomous system path filter\n" + "Specify an access list name\n" + "Regular expression access list name\n" + "Specify packets to reject\n" + "Specify packets to forward\n" + "A regular-expression (1234567890_(^|[,{}() ]|$)) to match the BGP AS paths\n") + +DEFUN(no_as_path, no_bgp_as_path_cmd, + "no bgp as-path access-list WORD <deny|permit> LINE...", + NO_STR + BGP_STR "BGP autonomous system path filter\n" "Specify an access list name\n" "Regular expression access list name\n" @@ -476,13 +497,19 @@ DEFUN(no_ip_as_path, no_ip_as_path_cmd, char *regstr; regex_t *regex; + 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 bgp as-path access-list WORD <deny|permit> LINE'\n"); + zlog_warn("Deprecated option: 'no ip as-path access-list WORD <deny|permit> LINE' being used"); + } char *aslistname = argv_find(argv, argc, "WORD", &idx) ? argv[idx]->arg : NULL; /* Lookup AS list from AS path list. */ aslist = as_list_lookup(aslistname); if (aslist == NULL) { - vty_out(vty, "ip as-path access-list %s doesn't exist\n", + vty_out(vty, "bgp as-path access-list %s doesn't exist\n", aslistname); return CMD_WARNING_CONFIG_FAILED; } @@ -530,21 +557,39 @@ DEFUN(no_ip_as_path, no_ip_as_path_cmd, return CMD_SUCCESS; } -DEFUN (no_ip_as_path_all, - no_ip_as_path_all_cmd, - "no ip as-path access-list WORD", +ALIAS(no_as_path, no_ip_as_path_cmd, + "no ip as-path access-list WORD <deny|permit> LINE...", + NO_STR IP_STR + "BGP autonomous system path filter\n" + "Specify an access list name\n" + "Regular expression access list name\n" + "Specify packets to reject\n" + "Specify packets to forward\n" + "A regular-expression (1234567890_(^|[,{}() ]|$)) to match the BGP AS paths\n") + +DEFUN (no_as_path_all, + no_bgp_as_path_all_cmd, + "no bgp as-path access-list WORD", NO_STR - IP_STR + BGP_STR "BGP autonomous system path filter\n" "Specify an access list name\n" "Regular expression access list name\n") { int idx_word = 4; struct as_list *aslist; + int idx = 0; + + 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 bgp as-path access-list WORD'\n"); + zlog_warn("Deprecated option: `no ip as-path access-list WORD` being used"); + } aslist = as_list_lookup(argv[idx_word]->arg); if (aslist == NULL) { - vty_out(vty, "ip as-path access-list %s doesn't exist\n", + vty_out(vty, "bgp as-path access-list %s doesn't exist\n", argv[idx_word]->arg); return CMD_WARNING_CONFIG_FAILED; } @@ -558,6 +603,15 @@ DEFUN (no_ip_as_path_all, return CMD_SUCCESS; } +ALIAS (no_as_path_all, + no_ip_as_path_all_cmd, + "no ip as-path access-list WORD", + NO_STR + IP_STR + "BGP autonomous system path filter\n" + "Specify an access list name\n" + "Regular expression access list name\n") + static void as_list_show(struct vty *vty, struct as_list *aslist) { struct as_filter *asfilter; @@ -598,17 +652,24 @@ static void as_list_show_all(struct vty *vty) } } -DEFUN (show_ip_as_path_access_list, - show_ip_as_path_access_list_cmd, - "show ip as-path-access-list WORD", +DEFUN (show_as_path_access_list, + show_bgp_as_path_access_list_cmd, + "show bgp as-path-access-list WORD", SHOW_STR - IP_STR + BGP_STR "List AS path access lists\n" "AS path access list name\n") { int idx_word = 3; struct as_list *aslist; + int idx = 0; + 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, "'show bgp as-path-access-list WORD'\n"); + zlog_warn("Deprecated option: 'show ip as-path-access-list WORD' being used"); + } aslist = as_list_lookup(argv[idx_word]->arg); if (aslist) as_list_show(vty, aslist); @@ -616,17 +677,40 @@ DEFUN (show_ip_as_path_access_list, return CMD_SUCCESS; } -DEFUN (show_ip_as_path_access_list_all, - show_ip_as_path_access_list_all_cmd, - "show ip as-path-access-list", +ALIAS (show_as_path_access_list, + show_ip_as_path_access_list_cmd, + "show ip as-path-access-list WORD", SHOW_STR IP_STR + "List AS path access lists\n" + "AS path access list name\n") + +DEFUN (show_as_path_access_list_all, + show_bgp_as_path_access_list_all_cmd, + "show bgp as-path-access-list", + SHOW_STR + BGP_STR "List AS path access lists\n") { + int idx = 0; + + 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, "'show bgp as-path-access-list'\n"); + zlog_warn("Deprecated option: 'show ip as-path-access-list' being used"); + } as_list_show_all(vty); return CMD_SUCCESS; } +ALIAS (show_as_path_access_list_all, + show_ip_as_path_access_list_all_cmd, + "show ip as-path-access-list", + SHOW_STR + IP_STR + "List AS path access lists\n") + static int config_write_as_list(struct vty *vty) { struct as_list *aslist; @@ -636,7 +720,7 @@ static int config_write_as_list(struct vty *vty) for (aslist = as_list_master.num.head; aslist; aslist = aslist->next) for (asfilter = aslist->head; asfilter; asfilter = asfilter->next) { - vty_out(vty, "ip as-path access-list %s %s %s\n", + vty_out(vty, "bgp as-path access-list %s %s %s\n", aslist->name, filter_type_str(asfilter->type), asfilter->reg_str); write++; @@ -645,7 +729,7 @@ static int config_write_as_list(struct vty *vty) for (aslist = as_list_master.str.head; aslist; aslist = aslist->next) for (asfilter = aslist->head; asfilter; asfilter = asfilter->next) { - vty_out(vty, "ip as-path access-list %s %s %s\n", + vty_out(vty, "bgp as-path access-list %s %s %s\n", aslist->name, filter_type_str(asfilter->type), asfilter->reg_str); write++; @@ -660,11 +744,16 @@ void bgp_filter_init(void) { install_node(&as_list_node, config_write_as_list); + install_element(CONFIG_NODE, &bgp_as_path_cmd); install_element(CONFIG_NODE, &ip_as_path_cmd); + install_element(CONFIG_NODE, &no_bgp_as_path_cmd); install_element(CONFIG_NODE, &no_ip_as_path_cmd); + install_element(CONFIG_NODE, &no_bgp_as_path_all_cmd); install_element(CONFIG_NODE, &no_ip_as_path_all_cmd); + install_element(VIEW_NODE, &show_bgp_as_path_access_list_cmd); install_element(VIEW_NODE, &show_ip_as_path_access_list_cmd); + install_element(VIEW_NODE, &show_bgp_as_path_access_list_all_cmd); install_element(VIEW_NODE, &show_ip_as_path_access_list_all_cmd); } diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 58f23fd2f4..e705a714e9 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -13725,11 +13725,11 @@ static void community_list_perror(struct vty *vty, int ret) /* "community-list" keyword help string. */ #define COMMUNITY_LIST_STR "Add a community list entry\n" -/* ip community-list standard */ -DEFUN (ip_community_list_standard, - ip_community_list_standard_cmd, - "ip community-list <(1-99)|standard WORD> <deny|permit> AA:NN...", - IP_STR +/*community-list standard */ +DEFUN (community_list_standard, + bgp_community_list_standard_cmd, + "bgp community-list <(1-99)|standard WORD> <deny|permit> AA:NN...", + BGP_STR COMMUNITY_LIST_STR "Community list number (standard)\n" "Add an standard community-list entry\n" @@ -13743,6 +13743,14 @@ DEFUN (ip_community_list_standard, int style = COMMUNITY_LIST_STANDARD; int idx = 0; + + 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, "'bgp community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN'\n"); + zlog_warn("Deprecated option: 'ip community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN' being used"); + } + argv_find(argv, argc, "(1-99)", &idx); argv_find(argv, argc, "WORD", &idx); cl_name_or_number = argv[idx]->arg; @@ -13765,10 +13773,12 @@ DEFUN (ip_community_list_standard, return CMD_SUCCESS; } -DEFUN (no_ip_community_list_standard_all, - no_ip_community_list_standard_all_cmd, - "no ip community-list <(1-99)|standard WORD> <deny|permit> AA:NN...", - NO_STR +#if CONFDATE > 20191005 +CPP_NOTICE("bgpd: remove deprecated 'ip community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN' command") +#endif +ALIAS (community_list_standard, + ip_community_list_standard_cmd, + "ip community-list <(1-99)|standard WORD> <deny|permit> AA:NN...", IP_STR COMMUNITY_LIST_STR "Community list number (standard)\n" @@ -13777,12 +13787,33 @@ DEFUN (no_ip_community_list_standard_all, "Specify community to reject\n" "Specify community to accept\n" COMMUNITY_VAL_STR) + +DEFUN (no_community_list_standard_all, + no_bgp_community_list_standard_all_cmd, + "no bgp community-list <(1-99)|standard WORD> <deny|permit> AA:NN...", + NO_STR + BGP_STR + COMMUNITY_LIST_STR + "Community list number (standard)\n" + "Add an standard community-list entry\n" + "Community list name\n" + "Specify community to reject\n" + "Specify community to accept\n" + COMMUNITY_VAL_STR) { char *cl_name_or_number = NULL; int direct = 0; int style = COMMUNITY_LIST_STANDARD; int idx = 0; + + 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 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"); + } + argv_find(argv, argc, "(1-99)", &idx); argv_find(argv, argc, "WORD", &idx); cl_name_or_number = argv[idx]->arg; @@ -13803,13 +13834,25 @@ DEFUN (no_ip_community_list_standard_all, return CMD_SUCCESS; } - -/* ip community-list expanded */ -DEFUN (ip_community_list_expanded_all, - ip_community_list_expanded_all_cmd, - "ip community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...", +ALIAS (no_community_list_standard_all, + no_ip_community_list_standard_all_cmd, + "no ip community-list <(1-99)|standard WORD> <deny|permit> AA:NN...", + NO_STR IP_STR COMMUNITY_LIST_STR + "Community list number (standard)\n" + "Add an standard community-list entry\n" + "Community list name\n" + "Specify community to reject\n" + "Specify community to accept\n" + COMMUNITY_VAL_STR) + +/*community-list expanded */ +DEFUN (community_list_expanded_all, + bgp_community_list_expanded_all_cmd, + "bgp community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...", + BGP_STR + COMMUNITY_LIST_STR "Community list number (expanded)\n" "Add an expanded community-list entry\n" "Community list name\n" @@ -13822,6 +13865,12 @@ DEFUN (ip_community_list_expanded_all, int style = COMMUNITY_LIST_EXPANDED; int idx = 0; + 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, "'bgp community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN'\n"); + zlog_warn("Deprecated option: 'ip community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN' being used"); + } argv_find(argv, argc, "(100-500)", &idx); argv_find(argv, argc, "WORD", &idx); cl_name_or_number = argv[idx]->arg; @@ -13844,10 +13893,9 @@ DEFUN (ip_community_list_expanded_all, return CMD_SUCCESS; } -DEFUN (no_ip_community_list_expanded_all, - no_ip_community_list_expanded_all_cmd, - "no ip community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...", - NO_STR +ALIAS (community_list_expanded_all, + ip_community_list_expanded_all_cmd, + "ip community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...", IP_STR COMMUNITY_LIST_STR "Community list number (expanded)\n" @@ -13856,12 +13904,31 @@ DEFUN (no_ip_community_list_expanded_all, "Specify community to reject\n" "Specify community to accept\n" COMMUNITY_VAL_STR) + +DEFUN (no_community_list_expanded_all, + no_bgp_community_list_expanded_all_cmd, + "no bgp community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...", + NO_STR + BGP_STR + COMMUNITY_LIST_STR + "Community list number (expanded)\n" + "Add an expanded community-list entry\n" + "Community list name\n" + "Specify community to reject\n" + "Specify community to accept\n" + COMMUNITY_VAL_STR) { char *cl_name_or_number = NULL; int direct = 0; int style = COMMUNITY_LIST_EXPANDED; int idx = 0; + 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"); + } argv_find(argv, argc, "(100-500)", &idx); argv_find(argv, argc, "WORD", &idx); cl_name_or_number = argv[idx]->arg; @@ -13883,6 +13950,19 @@ DEFUN (no_ip_community_list_expanded_all, return CMD_SUCCESS; } +ALIAS (no_community_list_expanded_all, + no_ip_community_list_expanded_all_cmd, + "no ip community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...", + NO_STR + IP_STR + COMMUNITY_LIST_STR + "Community list number (expanded)\n" + "Add an expanded community-list entry\n" + "Community list name\n" + "Specify community to reject\n" + "Specify community to accept\n" + COMMUNITY_VAL_STR) + /* Return configuration string of community-list entry. */ static const char *community_list_config_str(struct community_entry *entry) { @@ -13930,16 +14010,23 @@ static void community_list_show(struct vty *vty, struct community_list *list) } } -DEFUN (show_ip_community_list, - show_ip_community_list_cmd, - "show ip community-list", +DEFUN (show_community_list, + show_bgp_community_list_cmd, + "show bgp community-list", SHOW_STR - IP_STR + BGP_STR "List community-list\n") { struct community_list *list; struct community_list_master *cm; + int idx = 0; + 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, "'show bgp community-list <(1-500)|WORD>'\n"); + zlog_warn("Deprecated option: 'ip show community-list <(1-500)|WORD>' being used"); + } cm = community_list_master_lookup(bgp_clist, COMMUNITY_LIST_MASTER); if (!cm) return CMD_SUCCESS; @@ -13953,11 +14040,18 @@ DEFUN (show_ip_community_list, return CMD_SUCCESS; } -DEFUN (show_ip_community_list_arg, - show_ip_community_list_arg_cmd, - "show ip community-list <(1-500)|WORD>", +ALIAS (show_community_list, + show_ip_community_list_cmd, + "show ip community-list", SHOW_STR IP_STR + "List community-list\n") + +DEFUN (show_community_list_arg, + show_bgp_community_list_arg_cmd, + "show bgp community-list <(1-500)|WORD>", + SHOW_STR + BGP_STR "List community-list\n" "Community-list number\n" "Community-list name\n") @@ -13965,6 +14059,13 @@ DEFUN (show_ip_community_list_arg, int idx_comm_list = 3; struct community_list *list; + int idx = 0; + 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, "'show bgp community-list <(1-500)|WORD>'\n"); + zlog_warn("Deprecated option: 'ip show community-list <(1-500)|WORD>' being used"); + } list = community_list_lookup(bgp_clist, argv[idx_comm_list]->arg, COMMUNITY_LIST_MASTER); if (!list) { @@ -13977,6 +14078,15 @@ DEFUN (show_ip_community_list_arg, return CMD_SUCCESS; } +ALIAS (show_community_list_arg, + show_ip_community_list_arg_cmd, + "show ip community-list <(1-500)|WORD>", + SHOW_STR + IP_STR + "List community-list\n" + "Community-list number\n" + "Community-list name\n") + /* * Large Community code. */ @@ -13990,6 +14100,12 @@ static int lcommunity_list_set_vty(struct vty *vty, int argc, int idx = 0; char *cl_name; + 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, "'bgp large-community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:BB:CC>'\n"); + zlog_warn("Deprecated option: 'large-community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:BB:CC>' being used"); + } direct = argv_find(argv, argc, "permit", &idx) ? COMMUNITY_PERMIT : COMMUNITY_DENY; @@ -14035,6 +14151,12 @@ static int lcommunity_list_unset_vty(struct vty *vty, int argc, char *str = NULL; int idx = 0; + 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 bgp large-community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:BB:CC>'\n"); + zlog_warn("Deprecated option: 'no ip large-community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:BB:CC>' being used"); + } argv_find(argv, argc, "permit", &idx); argv_find(argv, argc, "deny", &idx); @@ -14078,7 +14200,23 @@ static int lcommunity_list_unset_vty(struct vty *vty, int argc, #define LCOMMUNITY_LIST_STR "Add a large community list entry\n" #define LCOMMUNITY_VAL_STR "large community in 'aa:bb:cc' format\n" -DEFUN (ip_lcommunity_list_standard, +#if CONFDATE > 20191005 +CPP_NOTICE("bgpd: remove deprecated 'ip large-community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:BB:CC>' command") +#endif +DEFUN (lcommunity_list_standard, + bgp_lcommunity_list_standard_cmd, + "bgp large-community-list (1-99) <deny|permit>", + BGP_STR + LCOMMUNITY_LIST_STR + "Large Community list number (standard)\n" + "Specify large community to reject\n" + "Specify large community to accept\n") +{ + return lcommunity_list_set_vty(vty, argc, argv, + LARGE_COMMUNITY_LIST_STANDARD, 0); +} + +ALIAS (lcommunity_list_standard, ip_lcommunity_list_standard_cmd, "ip large-community-list (1-99) <deny|permit>", IP_STR @@ -14086,12 +14224,22 @@ DEFUN (ip_lcommunity_list_standard, "Large Community list number (standard)\n" "Specify large community to reject\n" "Specify large community to accept\n") + +DEFUN (lcommunity_list_standard1, + bgp_lcommunity_list_standard1_cmd, + "bgp large-community-list (1-99) <deny|permit> AA:BB:CC...", + BGP_STR + LCOMMUNITY_LIST_STR + "Large Community list number (standard)\n" + "Specify large community to reject\n" + "Specify large community to accept\n" + LCOMMUNITY_VAL_STR) { return lcommunity_list_set_vty(vty, argc, argv, LARGE_COMMUNITY_LIST_STANDARD, 0); } -DEFUN (ip_lcommunity_list_standard1, +ALIAS (lcommunity_list_standard1, ip_lcommunity_list_standard1_cmd, "ip large-community-list (1-99) <deny|permit> AA:BB:CC...", IP_STR @@ -14100,12 +14248,22 @@ DEFUN (ip_lcommunity_list_standard1, "Specify large community to reject\n" "Specify large community to accept\n" LCOMMUNITY_VAL_STR) + +DEFUN (lcommunity_list_expanded, + bgp_lcommunity_list_expanded_cmd, + "bgp large-community-list (100-500) <deny|permit> LINE...", + BGP_STR + LCOMMUNITY_LIST_STR + "Large Community list number (expanded)\n" + "Specify large community to reject\n" + "Specify large community to accept\n" + "An ordered list as a regular-expression\n") { return lcommunity_list_set_vty(vty, argc, argv, - LARGE_COMMUNITY_LIST_STANDARD, 0); + LARGE_COMMUNITY_LIST_EXPANDED, 0); } -DEFUN (ip_lcommunity_list_expanded, +ALIAS (lcommunity_list_expanded, ip_lcommunity_list_expanded_cmd, "ip large-community-list (100-500) <deny|permit> LINE...", IP_STR @@ -14114,12 +14272,22 @@ DEFUN (ip_lcommunity_list_expanded, "Specify large community to reject\n" "Specify large community to accept\n" "An ordered list as a regular-expression\n") + +DEFUN (lcommunity_list_name_standard, + bgp_lcommunity_list_name_standard_cmd, + "bgp large-community-list standard WORD <deny|permit>", + BGP_STR + LCOMMUNITY_LIST_STR + "Specify standard large-community-list\n" + "Large Community list name\n" + "Specify large community to reject\n" + "Specify large community to accept\n") { return lcommunity_list_set_vty(vty, argc, argv, - LARGE_COMMUNITY_LIST_EXPANDED, 0); + LARGE_COMMUNITY_LIST_STANDARD, 1); } -DEFUN (ip_lcommunity_list_name_standard, +ALIAS (lcommunity_list_name_standard, ip_lcommunity_list_name_standard_cmd, "ip large-community-list standard WORD <deny|permit>", IP_STR @@ -14128,12 +14296,23 @@ DEFUN (ip_lcommunity_list_name_standard, "Large Community list name\n" "Specify large community to reject\n" "Specify large community to accept\n") + +DEFUN (lcommunity_list_name_standard1, + bgp_lcommunity_list_name_standard1_cmd, + "bgp large-community-list standard WORD <deny|permit> AA:BB:CC...", + BGP_STR + LCOMMUNITY_LIST_STR + "Specify standard large-community-list\n" + "Large Community list name\n" + "Specify large community to reject\n" + "Specify large community to accept\n" + LCOMMUNITY_VAL_STR) { return lcommunity_list_set_vty(vty, argc, argv, LARGE_COMMUNITY_LIST_STANDARD, 1); } -DEFUN (ip_lcommunity_list_name_standard1, +ALIAS (lcommunity_list_name_standard1, ip_lcommunity_list_name_standard1_cmd, "ip large-community-list standard WORD <deny|permit> AA:BB:CC...", IP_STR @@ -14143,12 +14322,23 @@ DEFUN (ip_lcommunity_list_name_standard1, "Specify large community to reject\n" "Specify large community to accept\n" LCOMMUNITY_VAL_STR) + +DEFUN (lcommunity_list_name_expanded, + bgp_lcommunity_list_name_expanded_cmd, + "bgp large-community-list expanded WORD <deny|permit> LINE...", + BGP_STR + LCOMMUNITY_LIST_STR + "Specify expanded large-community-list\n" + "Large Community list name\n" + "Specify large community to reject\n" + "Specify large community to accept\n" + "An ordered list as a regular-expression\n") { return lcommunity_list_set_vty(vty, argc, argv, - LARGE_COMMUNITY_LIST_STANDARD, 1); + LARGE_COMMUNITY_LIST_EXPANDED, 1); } -DEFUN (ip_lcommunity_list_name_expanded, +ALIAS (lcommunity_list_name_expanded, ip_lcommunity_list_name_expanded_cmd, "ip large-community-list expanded WORD <deny|permit> LINE...", IP_STR @@ -14158,12 +14348,22 @@ DEFUN (ip_lcommunity_list_name_expanded, "Specify large community to reject\n" "Specify large community to accept\n" "An ordered list as a regular-expression\n") + +DEFUN (no_lcommunity_list_standard_all, + no_bgp_lcommunity_list_standard_all_cmd, + "no bgp large-community-list <(1-99)|(100-500)|WORD>", + NO_STR + BGP_STR + LCOMMUNITY_LIST_STR + "Large Community list number (standard)\n" + "Large Community list number (expanded)\n" + "Large Community list name\n") { - return lcommunity_list_set_vty(vty, argc, argv, - LARGE_COMMUNITY_LIST_EXPANDED, 1); + return lcommunity_list_unset_vty(vty, argc, argv, + LARGE_COMMUNITY_LIST_STANDARD); } -DEFUN (no_ip_lcommunity_list_standard_all, +ALIAS (no_lcommunity_list_standard_all, no_ip_lcommunity_list_standard_all_cmd, "no ip large-community-list <(1-99)|(100-500)|WORD>", NO_STR @@ -14172,12 +14372,21 @@ DEFUN (no_ip_lcommunity_list_standard_all, "Large Community list number (standard)\n" "Large Community list number (expanded)\n" "Large Community list name\n") + +DEFUN (no_lcommunity_list_name_expanded_all, + no_bgp_lcommunity_list_name_expanded_all_cmd, + "no bgp large-community-list expanded WORD", + NO_STR + BGP_STR + LCOMMUNITY_LIST_STR + "Specify expanded large-community-list\n" + "Large Community list name\n") { return lcommunity_list_unset_vty(vty, argc, argv, - LARGE_COMMUNITY_LIST_STANDARD); + LARGE_COMMUNITY_LIST_EXPANDED); } -DEFUN (no_ip_lcommunity_list_name_expanded_all, +ALIAS (no_lcommunity_list_name_expanded_all, no_ip_lcommunity_list_name_expanded_all_cmd, "no ip large-community-list expanded WORD", NO_STR @@ -14185,12 +14394,23 @@ DEFUN (no_ip_lcommunity_list_name_expanded_all, LCOMMUNITY_LIST_STR "Specify expanded large-community-list\n" "Large Community list name\n") + +DEFUN (no_lcommunity_list_standard, + no_bgp_lcommunity_list_standard_cmd, + "no bgp large-community-list (1-99) <deny|permit> AA:AA:NN...", + NO_STR + BGP_STR + LCOMMUNITY_LIST_STR + "Large Community list number (standard)\n" + "Specify large community to reject\n" + "Specify large community to accept\n" + LCOMMUNITY_VAL_STR) { return lcommunity_list_unset_vty(vty, argc, argv, - LARGE_COMMUNITY_LIST_EXPANDED); + LARGE_COMMUNITY_LIST_STANDARD); } -DEFUN (no_ip_lcommunity_list_standard, +ALIAS (no_lcommunity_list_standard, no_ip_lcommunity_list_standard_cmd, "no ip large-community-list (1-99) <deny|permit> AA:AA:NN...", NO_STR @@ -14200,12 +14420,23 @@ DEFUN (no_ip_lcommunity_list_standard, "Specify large community to reject\n" "Specify large community to accept\n" LCOMMUNITY_VAL_STR) + +DEFUN (no_lcommunity_list_expanded, + no_bgp_lcommunity_list_expanded_cmd, + "no bgp large-community-list (100-500) <deny|permit> LINE...", + NO_STR + BGP_STR + LCOMMUNITY_LIST_STR + "Large Community list number (expanded)\n" + "Specify large community to reject\n" + "Specify large community to accept\n" + "An ordered list as a regular-expression\n") { return lcommunity_list_unset_vty(vty, argc, argv, - LARGE_COMMUNITY_LIST_STANDARD); + LARGE_COMMUNITY_LIST_EXPANDED); } -DEFUN (no_ip_lcommunity_list_expanded, +ALIAS (no_lcommunity_list_expanded, no_ip_lcommunity_list_expanded_cmd, "no ip large-community-list (100-500) <deny|permit> LINE...", NO_STR @@ -14215,12 +14446,24 @@ DEFUN (no_ip_lcommunity_list_expanded, "Specify large community to reject\n" "Specify large community to accept\n" "An ordered list as a regular-expression\n") + +DEFUN (no_lcommunity_list_name_standard, + no_bgp_lcommunity_list_name_standard_cmd, + "no bgp large-community-list standard WORD <deny|permit> AA:AA:NN...", + NO_STR + BGP_STR + LCOMMUNITY_LIST_STR + "Specify standard large-community-list\n" + "Large Community list name\n" + "Specify large community to reject\n" + "Specify large community to accept\n" + LCOMMUNITY_VAL_STR) { return lcommunity_list_unset_vty(vty, argc, argv, - LARGE_COMMUNITY_LIST_EXPANDED); + LARGE_COMMUNITY_LIST_STANDARD); } -DEFUN (no_ip_lcommunity_list_name_standard, +ALIAS (no_lcommunity_list_name_standard, no_ip_lcommunity_list_name_standard_cmd, "no ip large-community-list standard WORD <deny|permit> AA:AA:NN...", NO_STR @@ -14231,12 +14474,24 @@ DEFUN (no_ip_lcommunity_list_name_standard, "Specify large community to reject\n" "Specify large community to accept\n" LCOMMUNITY_VAL_STR) + +DEFUN (no_lcommunity_list_name_expanded, + no_bgp_lcommunity_list_name_expanded_cmd, + "no bgp large-community-list expanded WORD <deny|permit> LINE...", + NO_STR + BGP_STR + LCOMMUNITY_LIST_STR + "Specify expanded large-community-list\n" + "Large community list name\n" + "Specify large community to reject\n" + "Specify large community to accept\n" + "An ordered list as a regular-expression\n") { return lcommunity_list_unset_vty(vty, argc, argv, - LARGE_COMMUNITY_LIST_STANDARD); + LARGE_COMMUNITY_LIST_EXPANDED); } -DEFUN (no_ip_lcommunity_list_name_expanded, +ALIAS (no_lcommunity_list_name_expanded, no_ip_lcommunity_list_name_expanded_cmd, "no ip large-community-list expanded WORD <deny|permit> LINE...", NO_STR @@ -14247,10 +14502,6 @@ DEFUN (no_ip_lcommunity_list_name_expanded, "Specify large community to reject\n" "Specify large community to accept\n" "An ordered list as a regular-expression\n") -{ - return lcommunity_list_unset_vty(vty, argc, argv, - LARGE_COMMUNITY_LIST_EXPANDED); -} static void lcommunity_list_show(struct vty *vty, struct community_list *list) { @@ -14282,15 +14533,23 @@ static void lcommunity_list_show(struct vty *vty, struct community_list *list) } } -DEFUN (show_ip_lcommunity_list, - show_ip_lcommunity_list_cmd, - "show ip large-community-list", +DEFUN (show_lcommunity_list, + show_bgp_lcommunity_list_cmd, + "show bgp large-community-list", SHOW_STR - IP_STR + BGP_STR "List large-community list\n") { struct community_list *list; struct community_list_master *cm; + int idx = 0; + + 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, "'show bgp large-community-list <(1-500)|WORD>'\n"); + zlog_warn("Deprecated option: 'ip show large-community-list <(1-500)|WORD>' being used"); + } cm = community_list_master_lookup(bgp_clist, LARGE_COMMUNITY_LIST_MASTER); @@ -14306,16 +14565,31 @@ DEFUN (show_ip_lcommunity_list, return CMD_SUCCESS; } -DEFUN (show_ip_lcommunity_list_arg, - show_ip_lcommunity_list_arg_cmd, - "show ip large-community-list <(1-500)|WORD>", +ALIAS (show_lcommunity_list, + show_ip_lcommunity_list_cmd, + "show ip large-community-list", SHOW_STR IP_STR + "List large-community list\n") + +DEFUN (show_lcommunity_list_arg, + show_bgp_lcommunity_list_arg_cmd, + "show bgp large-community-list <(1-500)|WORD>", + SHOW_STR + BGP_STR "List large-community list\n" "large-community-list number\n" "large-community-list name\n") { struct community_list *list; + int idx = 0; + + 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, "'show bgp large-community-list <(1-500)|WORD>'\n"); + zlog_warn("Deprecated option: 'ip show large-community-list <(1-500)|WORD>' being used"); + } list = community_list_lookup(bgp_clist, argv[3]->arg, LARGE_COMMUNITY_LIST_MASTER); @@ -14329,14 +14603,23 @@ DEFUN (show_ip_lcommunity_list_arg, return CMD_SUCCESS; } +ALIAS (show_lcommunity_list_arg, + show_ip_lcommunity_list_arg_cmd, + "show ip large-community-list <(1-500)|WORD>", + SHOW_STR + IP_STR + "List large-community list\n" + "large-community-list number\n" + "large-community-list name\n") + /* "extcommunity-list" keyword help string. */ #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" -DEFUN (ip_extcommunity_list_standard, - ip_extcommunity_list_standard_cmd, - "ip extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...", - IP_STR +DEFUN (extcommunity_list_standard, + bgp_extcommunity_list_standard_cmd, + "bgp extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...", + BGP_STR EXTCOMMUNITY_LIST_STR "Extended Community list number (standard)\n" "Specify standard extcommunity-list\n" @@ -14350,6 +14633,12 @@ DEFUN (ip_extcommunity_list_standard, char *cl_number_or_name = NULL; int idx = 0; + 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, "'bgp extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>'\n"); + zlog_warn("Deprecated option: 'ip extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>' being used"); + } argv_find(argv, argc, "(1-99)", &idx); argv_find(argv, argc, "WORD", &idx); cl_number_or_name = argv[idx]->arg; @@ -14371,11 +14660,26 @@ DEFUN (ip_extcommunity_list_standard, return CMD_SUCCESS; } -DEFUN (ip_extcommunity_list_name_expanded, - ip_extcommunity_list_name_expanded_cmd, - "ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...", +#if CONFDATE > 20191005 +CPP_NOTICE("bgpd: remove deprecated 'ip extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>' command") +#endif +ALIAS (extcommunity_list_standard, + ip_extcommunity_list_standard_cmd, + "ip extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...", IP_STR EXTCOMMUNITY_LIST_STR + "Extended Community list number (standard)\n" + "Specify standard extcommunity-list\n" + "Community list name\n" + "Specify community to reject\n" + "Specify community to accept\n" + EXTCOMMUNITY_VAL_STR) + +DEFUN (extcommunity_list_name_expanded, + bgp_extcommunity_list_name_expanded_cmd, + "bgp extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...", + BGP_STR + EXTCOMMUNITY_LIST_STR "Extended Community list number (expanded)\n" "Specify expanded extcommunity-list\n" "Extended Community list name\n" @@ -14388,6 +14692,13 @@ DEFUN (ip_extcommunity_list_name_expanded, char *cl_number_or_name = NULL; int idx = 0; + 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, "'extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>'\n"); + zlog_warn("Deprecated option: ‘ip extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>' being used"); + } + argv_find(argv, argc, "(100-500)", &idx); argv_find(argv, argc, "WORD", &idx); cl_number_or_name = argv[idx]->arg; @@ -14409,12 +14720,24 @@ DEFUN (ip_extcommunity_list_name_expanded, return CMD_SUCCESS; } -DEFUN (no_ip_extcommunity_list_standard_all, - no_ip_extcommunity_list_standard_all_cmd, - "no ip extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...", - NO_STR +ALIAS (extcommunity_list_name_expanded, + ip_extcommunity_list_name_expanded_cmd, + "ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...", IP_STR EXTCOMMUNITY_LIST_STR + "Extended Community list number (expanded)\n" + "Specify expanded extcommunity-list\n" + "Extended Community list name\n" + "Specify community to reject\n" + "Specify community to accept\n" + "An ordered list as a regular-expression\n") + +DEFUN (no_extcommunity_list_standard_all, + no_bgp_extcommunity_list_standard_all_cmd, + "no bgp extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...", + NO_STR + BGP_STR + EXTCOMMUNITY_LIST_STR "Extended Community list number (standard)\n" "Specify standard extcommunity-list\n" "Community list name\n" @@ -14427,6 +14750,12 @@ DEFUN (no_ip_extcommunity_list_standard_all, char *cl_number_or_name = NULL; int idx = 0; + 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 bgp extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>'\n"); + zlog_warn("Deprecated option: ‘no ip extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>' being used"); + } argv_find(argv, argc, "(1-99)", &idx); argv_find(argv, argc, "WORD", &idx); cl_number_or_name = argv[idx]->arg; @@ -14448,12 +14777,25 @@ DEFUN (no_ip_extcommunity_list_standard_all, return CMD_SUCCESS; } -DEFUN (no_ip_extcommunity_list_expanded_all, - no_ip_extcommunity_list_expanded_all_cmd, - "no ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...", +ALIAS (no_extcommunity_list_standard_all, + no_ip_extcommunity_list_standard_all_cmd, + "no ip extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...", NO_STR IP_STR EXTCOMMUNITY_LIST_STR + "Extended Community list number (standard)\n" + "Specify standard extcommunity-list\n" + "Community list name\n" + "Specify community to reject\n" + "Specify community to accept\n" + EXTCOMMUNITY_VAL_STR) + +DEFUN (no_extcommunity_list_expanded_all, + no_bgp_extcommunity_list_expanded_all_cmd, + "no bgp extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...", + NO_STR + BGP_STR + EXTCOMMUNITY_LIST_STR "Extended Community list number (expanded)\n" "Specify expanded extcommunity-list\n" "Extended Community list name\n" @@ -14466,6 +14808,12 @@ DEFUN (no_ip_extcommunity_list_expanded_all, char *cl_number_or_name = NULL; int idx = 0; + 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 bgp extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>'\n"); + zlog_warn("Deprecated option: ‘no ip extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>' being used"); + } argv_find(argv, argc, "(100-500)", &idx); argv_find(argv, argc, "WORD", &idx); cl_number_or_name = argv[idx]->arg; @@ -14487,6 +14835,19 @@ DEFUN (no_ip_extcommunity_list_expanded_all, return CMD_SUCCESS; } +ALIAS (no_extcommunity_list_expanded_all, + no_ip_extcommunity_list_expanded_all_cmd, + "no ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...", + NO_STR + IP_STR + EXTCOMMUNITY_LIST_STR + "Extended Community list number (expanded)\n" + "Specify expanded extcommunity-list\n" + "Extended Community list name\n" + "Specify community to reject\n" + "Specify community to accept\n" + "An ordered list as a regular-expression\n") + static void extcommunity_list_show(struct vty *vty, struct community_list *list) { struct community_entry *entry; @@ -14517,16 +14878,23 @@ static void extcommunity_list_show(struct vty *vty, struct community_list *list) } } -DEFUN (show_ip_extcommunity_list, - show_ip_extcommunity_list_cmd, - "show ip extcommunity-list", +DEFUN (show_extcommunity_list, + show_bgp_extcommunity_list_cmd, + "show bgp extcommunity-list", SHOW_STR - IP_STR + BGP_STR "List extended-community list\n") { struct community_list *list; struct community_list_master *cm; + int idx = 0; + 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, "'show bgp extcommunity-list <(1-500)|WORD>'\n"); + zlog_warn("Deprecated option: 'ip show extcommunity-list <(1-500)|WORD>' being used"); + } cm = community_list_master_lookup(bgp_clist, EXTCOMMUNITY_LIST_MASTER); if (!cm) return CMD_SUCCESS; @@ -14540,18 +14908,32 @@ DEFUN (show_ip_extcommunity_list, return CMD_SUCCESS; } -DEFUN (show_ip_extcommunity_list_arg, - show_ip_extcommunity_list_arg_cmd, - "show ip extcommunity-list <(1-500)|WORD>", +ALIAS (show_extcommunity_list, + show_ip_extcommunity_list_cmd, + "show ip extcommunity-list", SHOW_STR IP_STR + "List extended-community list\n") + +DEFUN (show_extcommunity_list_arg, + show_bgp_extcommunity_list_arg_cmd, + "show bgp extcommunity-list <(1-500)|WORD>", + SHOW_STR + BGP_STR "List extended-community list\n" "Extcommunity-list number\n" "Extcommunity-list name\n") { int idx_comm_list = 3; struct community_list *list; + int idx = 0; + 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, "'show bgp extcommunity-list <(1-500)|WORD>'\n"); + zlog_warn("Deprecated option: 'ip show extcommunity-list <(1-500)|WORD>' being used"); + } list = community_list_lookup(bgp_clist, argv[idx_comm_list]->arg, EXTCOMMUNITY_LIST_MASTER); if (!list) { @@ -14564,6 +14946,15 @@ DEFUN (show_ip_extcommunity_list_arg, return CMD_SUCCESS; } +ALIAS (show_extcommunity_list_arg, + show_ip_extcommunity_list_arg_cmd, + "show ip extcommunity-list <(1-500)|WORD>", + SHOW_STR + IP_STR + "List extended-community list\n" + "Extcommunity-list number\n" + "Extcommunity-list name\n") + /* Display community-list and extcommunity-list configuration. */ static int community_list_config_write(struct vty *vty) { @@ -14577,14 +14968,14 @@ static int community_list_config_write(struct vty *vty) for (list = cm->num.head; list; list = list->next) for (entry = list->head; entry; entry = entry->next) { - vty_out(vty, "ip community-list %s %s %s\n", list->name, + vty_out(vty, "bgp community-list %s %s %s\n", list->name, community_direct_str(entry->direct), community_list_config_str(entry)); write++; } for (list = cm->str.head; list; list = list->next) for (entry = list->head; entry; entry = entry->next) { - vty_out(vty, "ip community-list %s %s %s %s\n", + vty_out(vty, "bgp community-list %s %s %s %s\n", entry->style == COMMUNITY_LIST_STANDARD ? "standard" : "expanded", @@ -14598,14 +14989,14 @@ static int community_list_config_write(struct vty *vty) for (list = cm->num.head; list; list = list->next) for (entry = list->head; entry; entry = entry->next) { - vty_out(vty, "ip extcommunity-list %s %s %s\n", + vty_out(vty, "bgp extcommunity-list %s %s %s\n", list->name, community_direct_str(entry->direct), community_list_config_str(entry)); write++; } for (list = cm->str.head; list; list = list->next) for (entry = list->head; entry; entry = entry->next) { - vty_out(vty, "ip extcommunity-list %s %s %s %s\n", + vty_out(vty, "bgp extcommunity-list %s %s %s %s\n", entry->style == EXTCOMMUNITY_LIST_STANDARD ? "standard" : "expanded", @@ -14621,14 +15012,14 @@ static int community_list_config_write(struct vty *vty) for (list = cm->num.head; list; list = list->next) for (entry = list->head; entry; entry = entry->next) { - vty_out(vty, "ip large-community-list %s %s %s\n", + vty_out(vty, "bgp large-community-list %s %s %s\n", list->name, community_direct_str(entry->direct), community_list_config_str(entry)); write++; } for (list = cm->str.head; list; list = list->next) for (entry = list->head; entry; entry = entry->next) { - vty_out(vty, "ip large-community-list %s %s %s %s\n", + vty_out(vty, "bgp large-community-list %s %s %s %s\n", entry->style == LARGE_COMMUNITY_LIST_STANDARD ? "standard" : "expanded", @@ -14649,6 +15040,12 @@ static void community_list_vty(void) install_node(&community_list_node, community_list_config_write); /* Community-list. */ + 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_expanded_all_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); @@ -14657,6 +15054,12 @@ static void community_list_vty(void) install_element(VIEW_NODE, &show_ip_community_list_arg_cmd); /* Extcommunity-list. */ + install_element(CONFIG_NODE, &bgp_extcommunity_list_standard_cmd); + install_element(CONFIG_NODE, &bgp_extcommunity_list_name_expanded_cmd); + install_element(CONFIG_NODE, &no_bgp_extcommunity_list_standard_all_cmd); + install_element(CONFIG_NODE, &no_bgp_extcommunity_list_expanded_all_cmd); + install_element(VIEW_NODE, &show_bgp_extcommunity_list_cmd); + install_element(VIEW_NODE, &show_bgp_extcommunity_list_arg_cmd); install_element(CONFIG_NODE, &ip_extcommunity_list_standard_cmd); install_element(CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); install_element(CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); @@ -14665,6 +15068,21 @@ static void community_list_vty(void) install_element(VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); /* Large Community List */ + install_element(CONFIG_NODE, &bgp_lcommunity_list_standard_cmd); + install_element(CONFIG_NODE, &bgp_lcommunity_list_standard1_cmd); + install_element(CONFIG_NODE, &bgp_lcommunity_list_expanded_cmd); + install_element(CONFIG_NODE, &bgp_lcommunity_list_name_standard_cmd); + install_element(CONFIG_NODE, &bgp_lcommunity_list_name_standard1_cmd); + install_element(CONFIG_NODE, &bgp_lcommunity_list_name_expanded_cmd); + install_element(CONFIG_NODE, &no_bgp_lcommunity_list_standard_all_cmd); + install_element(CONFIG_NODE, + &no_bgp_lcommunity_list_name_expanded_all_cmd); + install_element(CONFIG_NODE, &no_bgp_lcommunity_list_standard_cmd); + install_element(CONFIG_NODE, &no_bgp_lcommunity_list_expanded_cmd); + install_element(CONFIG_NODE, &no_bgp_lcommunity_list_name_standard_cmd); + install_element(CONFIG_NODE, &no_bgp_lcommunity_list_name_expanded_cmd); + install_element(VIEW_NODE, &show_bgp_lcommunity_list_cmd); + install_element(VIEW_NODE, &show_bgp_lcommunity_list_arg_cmd); install_element(CONFIG_NODE, &ip_lcommunity_list_standard_cmd); install_element(CONFIG_NODE, &ip_lcommunity_list_standard1_cmd); install_element(CONFIG_NODE, &ip_lcommunity_list_expanded_cmd); diff --git a/doc/user/routemap.rst b/doc/user/routemap.rst index 57b4875e23..42a8250ae0 100644 --- a/doc/user/routemap.rst +++ b/doc/user/routemap.rst @@ -105,10 +105,10 @@ Route Map Match Command Matches the specified `access_list` -.. index:: match ip address PREFIX-LIST -.. clicmd:: match ip address PREFIX-LIST +.. index:: match ip address prefix-list PREFIX_LIST +.. clicmd:: match ip address prefix-list PREFIX_LIST - Matches the specified `prefix-list` + Matches the specified `PREFIX_LIST` .. index:: match ip address prefix-len 0-32 .. clicmd:: match ip address prefix-len 0-32 @@ -120,10 +120,10 @@ Route Map Match Command Matches the specified `access_list` -.. index:: match ipv6 address PREFIX-LIST -.. clicmd:: match ipv6 address PREFIX-LIST +.. index:: match ipv6 address prefix-list PREFIX_LIST +.. clicmd:: match ipv6 address prefix-list PREFIX_LIST - Matches the specified `prefix-list` + Matches the specified `PREFIX_LIST` .. index:: match ipv6 address prefix-len 0-128 .. clicmd:: match ipv6 address prefix-len 0-128 diff --git a/ospfd/ospf_flood.c b/ospfd/ospf_flood.c index 8078455930..714c47b4e6 100644 --- a/ospfd/ospf_flood.c +++ b/ospfd/ospf_flood.c @@ -91,7 +91,7 @@ struct external_info *ospf_external_info_check(struct ospf *ospf, p.prefix = lsa->data->id; p.prefixlen = ip_masklen(al->mask); - for (type = 0; type < ZEBRA_ROUTE_MAX; type++) { + for (type = 0; type <= ZEBRA_ROUTE_MAX; type++) { int redist_on = 0; redist_on = diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 25d54a8553..652c47387a 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -8387,6 +8387,9 @@ DEFUN (ospf_default_information_originate, int metric = -1; struct ospf_redist *red; int idx = 0; + int cur_originate = ospf->default_originate; + int sameRtmap = 0; + char *rtmap = NULL; red = ospf_redist_add(ospf, DEFAULT_ROUTE, 0); @@ -8408,7 +8411,28 @@ DEFUN (ospf_default_information_originate, idx = 1; /* Get route-map */ if (argv_find(argv, argc, "WORD", &idx)) - ospf_routemap_set(red, argv[idx]->arg); + rtmap = argv[idx]->arg; + + /* To check ,if user is providing same route map */ + if ((rtmap == ROUTEMAP_NAME(red)) || + (rtmap && ROUTEMAP_NAME(red) + && (strcmp(rtmap, ROUTEMAP_NAME(red)) == 0))) + sameRtmap = 1; + + /* Don't allow if the same lsa is aleardy originated. */ + if ((sameRtmap) + && (red->dmetric.type == type) + && (red->dmetric.value == metric) + && (cur_originate == default_originate)) + return CMD_SUCCESS; + + /* Updating Metric details */ + red->dmetric.type = type; + red->dmetric.value = metric; + + /* updating route map details */ + if (rtmap) + ospf_routemap_set(red, rtmap); else ospf_routemap_unset(red); diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index fdb87bd1ff..ed19ae4f31 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -626,6 +626,8 @@ struct ospf_redist *ospf_redist_add(struct ospf *ospf, uint8_t type, red->instance = instance; red->dmetric.type = -1; red->dmetric.value = -1; + ROUTEMAP_NAME(red) = NULL; + ROUTEMAP(red) = NULL; listnode_add(red_list, red); @@ -753,11 +755,54 @@ int ospf_redistribute_unset(struct ospf *ospf, int type, int ospf_redistribute_default_set(struct ospf *ospf, int originate, int mtype, int mvalue) { + struct ospf_external *ext; + struct prefix_ipv4 p; + struct in_addr nexthop; + int cur_originate = ospf->default_originate; + + nexthop.s_addr = 0; + p.family = AF_INET; + p.prefix.s_addr = 0; + p.prefixlen = 0; + ospf->default_originate = originate; ospf_external_add(ospf, DEFAULT_ROUTE, 0); - if (ospf_is_type_redistributed(ospf, DEFAULT_ROUTE, 0)) + if (cur_originate == DEFAULT_ORIGINATE_NONE) { + /* First time configuration */ + if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) + zlog_debug("Redistribute[DEFAULT]: Start Type[%d], Metric[%d]", + metric_type(ospf, DEFAULT_ROUTE, 0), + metric_value(ospf, DEFAULT_ROUTE, 0)); + + if (ospf->router_id.s_addr == 0) + ospf->external_origin |= (1 << DEFAULT_ROUTE); + if ((originate == DEFAULT_ORIGINATE_ALWAYS) + && (ospf->router_id.s_addr)) { + + /* always , so originate lsa even it doesn't + * exist in RIB. + */ + ospf_external_info_add(ospf, DEFAULT_ROUTE, 0, + p, 0, nexthop, 0); + ospf_external_lsa_refresh_default(ospf); + + } else if (originate == DEFAULT_ORIGINATE_ZEBRA) { + /* Send msg to Zebra to validate default route + * existance. + */ + zclient_redistribute_default( + ZEBRA_REDISTRIBUTE_DEFAULT_ADD, + zclient, ospf->vrf_id); + } + + ospf_asbr_status_update(ospf, ++ospf->redistribute); + return CMD_SUCCESS; + + + } else if (originate == cur_originate) { + /* Refresh the lsa since metric might different */ if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) zlog_debug( "Redistribute[%s]: Refresh Type[%d], Metric[%d]", @@ -765,37 +810,58 @@ int ospf_redistribute_default_set(struct ospf *ospf, int originate, int mtype, metric_type(ospf, DEFAULT_ROUTE, 0), metric_value(ospf, DEFAULT_ROUTE, 0)); - zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_ADD, zclient, - ospf->vrf_id); + ospf_external_lsa_refresh_default(ospf); - if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) - zlog_debug("Redistribute[DEFAULT]: Start Type[%d], Metric[%d]", - metric_type(ospf, DEFAULT_ROUTE, 0), - metric_value(ospf, DEFAULT_ROUTE, 0)); + } else { + /* "default-info originate always" configured now, + * where "default-info originate" configured previoulsly. + */ + if (originate == DEFAULT_ORIGINATE_ALWAYS) { + + zclient_redistribute_default( + ZEBRA_REDISTRIBUTE_DEFAULT_DELETE, + zclient, ospf->vrf_id); + /* here , ex-info should be added since ex-info might + * have not updated earlier if def route is not exist. + * If ex-iinfo ex-info already exist , it will return + * smoothly. + */ + ospf_external_info_add(ospf, DEFAULT_ROUTE, 0, + p, 0, nexthop, 0); + ospf_external_lsa_refresh_default(ospf); - ospf_external_lsa_refresh_default(ospf); + } else { + /* "default-info originate" configured now,where + * "default-info originate always" configured + * previoulsy. + */ - if (ospf->router_id.s_addr == 0) - ospf->external_origin |= (1 << DEFAULT_ROUTE); - else - thread_add_timer(master, ospf_default_originate_timer, ospf, 1, - NULL); + ospf_external_lsa_flush(ospf, DEFAULT_ROUTE, &p, 0); - ospf_asbr_status_update(ospf, ++ospf->redistribute); + ext = ospf_external_lookup(ospf, DEFAULT_ROUTE, 0); + if (ext && EXTERNAL_INFO(ext)) + ospf_external_info_delete(ospf, + DEFAULT_ROUTE, 0, p); + + zclient_redistribute_default( + ZEBRA_REDISTRIBUTE_DEFAULT_ADD, + zclient, ospf->vrf_id); + } + } return CMD_SUCCESS; } - int ospf_redistribute_default_unset(struct ospf *ospf) { - if (!ospf_is_type_redistributed(ospf, DEFAULT_ROUTE, 0)) - return CMD_SUCCESS; + if (ospf->default_originate == DEFAULT_ORIGINATE_ZEBRA) { + if (!ospf_is_type_redistributed(ospf, DEFAULT_ROUTE, 0)) + return CMD_SUCCESS; + zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_DELETE, + zclient, ospf->vrf_id); + } ospf->default_originate = DEFAULT_ORIGINATE_NONE; - zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_DELETE, zclient, - ospf->vrf_id); - if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) zlog_debug("Redistribute[DEFAULT]: Stop"); @@ -941,6 +1007,7 @@ static int ospf_zebra_read_route(int command, struct zclient *zclient, struct external_info *ei; struct ospf *ospf; int i; + uint8_t rt_type; ospf = ospf_lookup_by_vrf_id(vrf_id); if (ospf == NULL) @@ -951,11 +1018,21 @@ static int ospf_zebra_read_route(int command, struct zclient *zclient, ifindex = api.nexthops[0].ifindex; nexthop = api.nexthops[0].gate.ipv4; + rt_type = api.type; memcpy(&p, &api.prefix, sizeof(p)); if (IPV4_NET127(ntohl(p.prefix.s_addr))) return 0; + /* Re-destributed route is default route. + * Here, route type is used as 'ZEBRA_ROUTE_KERNEL' for + * updating ex-info. But in resetting (no default-info + * originate)ZEBRA_ROUTE_MAX is used to delete the ex-info. + * Resolved this inconsistency by maintaining same route type. + */ + if (is_prefix_default(&p)) + rt_type = DEFAULT_ROUTE; + if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE)) { char buf_prefix[PREFIX_STRLEN]; prefix2str(&api.prefix, buf_prefix, sizeof(buf_prefix)); @@ -973,8 +1050,8 @@ static int ospf_zebra_read_route(int command, struct zclient *zclient, */ /* Protocol tag overwrites all other tag value sent by zebra */ - if (ospf->dtag[api.type] > 0) - api.tag = ospf->dtag[api.type]; + if (ospf->dtag[rt_type] > 0) + api.tag = ospf->dtag[rt_type]; /* * Given zebra sends update for a prefix via ADD message, it @@ -983,12 +1060,12 @@ static int ospf_zebra_read_route(int command, struct zclient *zclient, * source * types. */ - for (i = 0; i < ZEBRA_ROUTE_MAX; i++) - if (i != api.type) + for (i = 0; i <= ZEBRA_ROUTE_MAX; i++) + if (i != rt_type) ospf_external_info_delete(ospf, i, api.instance, p); - ei = ospf_external_info_add(ospf, api.type, api.instance, p, + ei = ospf_external_info_add(ospf, rt_type, api.instance, p, ifindex, nexthop, api.tag); if (ei == NULL) { /* Nothing has changed, so nothing to do; return */ @@ -997,7 +1074,7 @@ static int ospf_zebra_read_route(int command, struct zclient *zclient, if (ospf->router_id.s_addr == 0) /* Set flags to generate AS-external-LSA originate event for each redistributed protocols later. */ - ospf->external_origin |= (1 << api.type); + ospf->external_origin |= (1 << rt_type); else { if (ei) { if (is_prefix_default(&p)) @@ -1027,11 +1104,11 @@ static int ospf_zebra_read_route(int command, struct zclient *zclient, } } else /* if (command == ZEBRA_REDISTRIBUTE_ROUTE_DEL) */ { - ospf_external_info_delete(ospf, api.type, api.instance, p); + ospf_external_info_delete(ospf, rt_type, api.instance, p); if (is_prefix_default(&p)) ospf_external_lsa_refresh_default(ospf); else - ospf_external_lsa_flush(ospf, api.type, &p, + ospf_external_lsa_flush(ospf, rt_type, &p, ifindex /*, nexthop */); } diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c index 7a55da462d..7a7744f7c0 100644 --- a/vtysh/vtysh_config.c +++ b/vtysh/vtysh_config.c @@ -271,18 +271,18 @@ void vtysh_config_parse_line(void *arg, const char *line) strlen("ipv6 prefix-list")) == 0) config = config_get(PREFIX_IPV6_NODE, line); - else if (strncmp(line, "ip as-path access-list", - strlen("ip as-path access-list")) + else if (strncmp(line, "bgp as-path access-list", + strlen("bgp as-path access-list")) == 0) config = config_get(AS_LIST_NODE, line); - else if (strncmp(line, "ip community-list", - strlen("ip community-list")) + else if (strncmp(line, "bgp community-list", + strlen("bgp community-list")) == 0 - || strncmp(line, "ip extcommunity-list", - strlen("ip extcommunity-list")) + || strncmp(line, "bgp extcommunity-list", + strlen("bgp extcommunity-list")) == 0 - || strncmp(line, "ip large-community-list", - strlen("ip large-community-list")) + || strncmp(line, "bgp large-community-list", + strlen("bgp large-community-list")) == 0) config = config_get(COMMUNITY_LIST_NODE, line); else if (strncmp(line, "ip route", strlen("ip route")) == 0) |
