diff options
Diffstat (limited to 'bgpd/bgp_vty.c')
| -rw-r--r-- | bgpd/bgp_vty.c | 185 |
1 files changed, 118 insertions, 67 deletions
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index fe52b73438..af02e13340 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -65,6 +65,7 @@ #include "bgpd/bgp_io.h" #include "bgpd/bgp_evpn.h" #include "bgpd/bgp_evpn_vty.h" +#include "bgpd/bgp_evpn_mh.h" #include "bgpd/bgp_addpath.h" #include "bgpd/bgp_mac.h" #include "bgpd/bgp_flowspec.h" @@ -1093,7 +1094,8 @@ DEFUN_HIDDEN (bgp_local_mac, return CMD_WARNING; } - rv = bgp_evpn_local_macip_add(bgp, vni, &mac, &ip, 0 /* flags */, seq); + rv = bgp_evpn_local_macip_add(bgp, vni, &mac, &ip, 0 /* flags */, seq, + zero_esi); if (rv < 0) { vty_out(vty, "Internal error\n"); return CMD_WARNING; @@ -4330,8 +4332,7 @@ static int peer_flag_modify_vty(struct vty *vty, const char *ip_str, */ if (peer->conf_if && (flag == PEER_FLAG_DISABLE_CONNECTED_CHECK)) { vty_out(vty, - "%s is directly connected peer, cannot accept disable-" - "connected-check\n", + "%s is directly connected peer, cannot accept disable-connected-check\n", ip_str); return CMD_WARNING_CONFIG_FAILED; } @@ -4389,7 +4390,7 @@ DEFUN (neighbor_shutdown_msg, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Administratively shut down this neighbor\n" - "Add a shutdown message (draft-ietf-idr-shutdown-06)\n" + "Add a shutdown message (RFC 8203)\n" "Shutdown message\n") { int idx_peer = 1; @@ -4421,7 +4422,7 @@ DEFUN (no_neighbor_shutdown_msg, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Administratively shut down this neighbor\n" - "Remove a shutdown message (draft-ietf-idr-shutdown-06)\n" + "Remove a shutdown message (RFC 8203)\n" "Shutdown message\n") { int idx_peer = 2; @@ -6703,7 +6704,8 @@ static int peer_maximum_prefix_set_vty(struct vty *vty, const char *ip_str, afi_t afi, safi_t safi, const char *num_str, const char *threshold_str, int warning, - const char *restart_str) + const char *restart_str, + const char *force_str) { int ret; struct peer *peer; @@ -6727,7 +6729,7 @@ static int peer_maximum_prefix_set_vty(struct vty *vty, const char *ip_str, restart = 0; ret = peer_maximum_prefix_set(peer, afi, safi, max, threshold, warning, - restart); + restart, force_str ? true : false); return bgp_vty_return(vty, ret); } @@ -6798,172 +6800,220 @@ DEFUN(no_neighbor_maximum_prefix_out, return CMD_SUCCESS; } -/* Maximum number of prefix configuration. prefix count is different - for each peer configuration. So this configuration can be set for +/* Maximum number of prefix configuration. Prefix count is different + for each peer configuration. So this configuration can be set for each peer configuration. */ DEFUN (neighbor_maximum_prefix, neighbor_maximum_prefix_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295)", + "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) [force]", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" - "maximum no. of prefix limit\n") + "maximum no. of prefix limit\n" + "Force checking all received routes not only accepted\n") { int idx_peer = 1; int idx_number = 3; + int idx_force = 0; + char *force = NULL; + + if (argv_find(argv, argc, "force", &idx_force)) + force = argv[idx_force]->arg; + return peer_maximum_prefix_set_vty( vty, argv[idx_peer]->arg, bgp_node_afi(vty), bgp_node_safi(vty), - argv[idx_number]->arg, NULL, 0, NULL); + argv[idx_number]->arg, NULL, 0, NULL, force); } ALIAS_HIDDEN(neighbor_maximum_prefix, neighbor_maximum_prefix_hidden_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295)", + "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) [force]", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" - "maximum no. of prefix limit\n") + "maximum no. of prefix limit\n" + "Force checking all received routes not only accepted\n") DEFUN (neighbor_maximum_prefix_threshold, neighbor_maximum_prefix_threshold_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100)", + "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) [force]", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" "maximum no. of prefix limit\n" - "Threshold value (%) at which to generate a warning msg\n") + "Threshold value (%) at which to generate a warning msg\n" + "Force checking all received routes not only accepted\n") { int idx_peer = 1; int idx_number = 3; int idx_number_2 = 4; + int idx_force = 0; + char *force = NULL; + + if (argv_find(argv, argc, "force", &idx_force)) + force = argv[idx_force]->arg; + return peer_maximum_prefix_set_vty( vty, argv[idx_peer]->arg, bgp_node_afi(vty), bgp_node_safi(vty), - argv[idx_number]->arg, argv[idx_number_2]->arg, 0, NULL); + argv[idx_number]->arg, argv[idx_number_2]->arg, 0, NULL, force); } ALIAS_HIDDEN( neighbor_maximum_prefix_threshold, neighbor_maximum_prefix_threshold_hidden_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100)", + "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) [force]", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" "maximum no. of prefix limit\n" - "Threshold value (%) at which to generate a warning msg\n") + "Threshold value (%) at which to generate a warning msg\n" + "Force checking all received routes not only accepted\n") DEFUN (neighbor_maximum_prefix_warning, neighbor_maximum_prefix_warning_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) warning-only", + "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) warning-only [force]", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" "maximum no. of prefix limit\n" - "Only give warning message when limit is exceeded\n") + "Only give warning message when limit is exceeded\n" + "Force checking all received routes not only accepted\n") { int idx_peer = 1; int idx_number = 3; + int idx_force = 0; + char *force = NULL; + + if (argv_find(argv, argc, "force", &idx_force)) + force = argv[idx_force]->arg; + return peer_maximum_prefix_set_vty( vty, argv[idx_peer]->arg, bgp_node_afi(vty), bgp_node_safi(vty), - argv[idx_number]->arg, NULL, 1, NULL); + argv[idx_number]->arg, NULL, 1, NULL, force); } ALIAS_HIDDEN( neighbor_maximum_prefix_warning, neighbor_maximum_prefix_warning_hidden_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) warning-only", + "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) warning-only [force]", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" "maximum no. of prefix limit\n" - "Only give warning message when limit is exceeded\n") + "Only give warning message when limit is exceeded\n" + "Force checking all received routes not only accepted\n") DEFUN (neighbor_maximum_prefix_threshold_warning, neighbor_maximum_prefix_threshold_warning_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) warning-only", + "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) warning-only [force]", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" "maximum no. of prefix limit\n" "Threshold value (%) at which to generate a warning msg\n" - "Only give warning message when limit is exceeded\n") + "Only give warning message when limit is exceeded\n" + "Force checking all received routes not only accepted\n") { int idx_peer = 1; int idx_number = 3; int idx_number_2 = 4; + int idx_force = 0; + char *force = NULL; + + if (argv_find(argv, argc, "force", &idx_force)) + force = argv[idx_force]->arg; + return peer_maximum_prefix_set_vty( vty, argv[idx_peer]->arg, bgp_node_afi(vty), bgp_node_safi(vty), - argv[idx_number]->arg, argv[idx_number_2]->arg, 1, NULL); + argv[idx_number]->arg, argv[idx_number_2]->arg, 1, NULL, force); } ALIAS_HIDDEN( neighbor_maximum_prefix_threshold_warning, neighbor_maximum_prefix_threshold_warning_hidden_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) warning-only", + "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) warning-only [force]", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" "maximum no. of prefix limit\n" "Threshold value (%) at which to generate a warning msg\n" - "Only give warning message when limit is exceeded\n") + "Only give warning message when limit is exceeded\n" + "Force checking all received routes not only accepted\n") DEFUN (neighbor_maximum_prefix_restart, neighbor_maximum_prefix_restart_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) restart (1-65535)", + "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) restart (1-65535) [force]", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" "maximum no. of prefix limit\n" "Restart bgp connection after limit is exceeded\n" - "Restart interval in minutes\n") + "Restart interval in minutes\n" + "Force checking all received routes not only accepted\n") { int idx_peer = 1; int idx_number = 3; int idx_number_2 = 5; + int idx_force = 0; + char *force = NULL; + + if (argv_find(argv, argc, "force", &idx_force)) + force = argv[idx_force]->arg; + return peer_maximum_prefix_set_vty( vty, argv[idx_peer]->arg, bgp_node_afi(vty), bgp_node_safi(vty), - argv[idx_number]->arg, NULL, 0, argv[idx_number_2]->arg); + argv[idx_number]->arg, NULL, 0, argv[idx_number_2]->arg, force); } ALIAS_HIDDEN( neighbor_maximum_prefix_restart, neighbor_maximum_prefix_restart_hidden_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) restart (1-65535)", + "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) restart (1-65535) [force]", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" "maximum no. of prefix limit\n" "Restart bgp connection after limit is exceeded\n" - "Restart interval in minutes\n") + "Restart interval in minutes\n" + "Force checking all received routes not only accepted\n") DEFUN (neighbor_maximum_prefix_threshold_restart, neighbor_maximum_prefix_threshold_restart_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) restart (1-65535)", + "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) restart (1-65535) [force]", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefixes to accept from this peer\n" "maximum no. of prefix limit\n" "Threshold value (%) at which to generate a warning msg\n" "Restart bgp connection after limit is exceeded\n" - "Restart interval in minutes\n") + "Restart interval in minutes\n" + "Force checking all received routes not only accepted\n") { int idx_peer = 1; int idx_number = 3; int idx_number_2 = 4; int idx_number_3 = 6; + int idx_force = 0; + char *force = NULL; + + if (argv_find(argv, argc, "force", &idx_force)) + force = argv[idx_force]->arg; + return peer_maximum_prefix_set_vty( vty, argv[idx_peer]->arg, bgp_node_afi(vty), bgp_node_safi(vty), argv[idx_number]->arg, argv[idx_number_2]->arg, 0, - argv[idx_number_3]->arg); + argv[idx_number_3]->arg, force); } ALIAS_HIDDEN( neighbor_maximum_prefix_threshold_restart, neighbor_maximum_prefix_threshold_restart_hidden_cmd, - "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) restart (1-65535)", + "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) restart (1-65535) [force]", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefixes to accept from this peer\n" "maximum no. of prefix limit\n" "Threshold value (%) at which to generate a warning msg\n" "Restart bgp connection after limit is exceeded\n" - "Restart interval in minutes\n") + "Restart interval in minutes\n" + "Force checking all received routes not only accepted\n") DEFUN (no_neighbor_maximum_prefix, no_neighbor_maximum_prefix_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix [(1-4294967295) [(1-100)] [restart (1-65535)] [warning-only]]", + "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix [(1-4294967295) [(1-100)] [restart (1-65535)] [warning-only] [force]]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -6972,7 +7022,8 @@ DEFUN (no_neighbor_maximum_prefix, "Threshold value (%) at which to generate a warning msg\n" "Restart bgp connection after limit is exceeded\n" "Restart interval in minutes\n" - "Only give warning message when limit is exceeded\n") + "Only give warning message when limit is exceeded\n" + "Force checking all received routes not only accepted\n") { int idx_peer = 2; return peer_maximum_prefix_unset_vty(vty, argv[idx_peer]->arg, @@ -6982,14 +7033,15 @@ DEFUN (no_neighbor_maximum_prefix, ALIAS_HIDDEN( no_neighbor_maximum_prefix, no_neighbor_maximum_prefix_hidden_cmd, - "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix [(1-4294967295) [(1-100)] [restart (1-65535)] [warning-only]]", + "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix [(1-4294967295) [(1-100)] [restart (1-65535)] [warning-only] [force]]", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefixes to accept from this peer\n" "maximum no. of prefix limit\n" "Threshold value (%) at which to generate a warning msg\n" "Restart bgp connection after limit is exceeded\n" "Restart interval in minutes\n" - "Only give warning message when limit is exceeded\n") + "Only give warning message when limit is exceeded\n" + "Force checking all received routes not only accepted\n") /* "neighbor allowas-in" */ @@ -9352,8 +9404,7 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi, memory_order_relaxed); vty_out(vty, - "4 %10u %9u %9u %8" PRIu64 - " %4zu %4zu %8s", + "4 %10u %9u %9u %8" PRIu64" %4zu %4zu %8s", peer->as, PEER_TOTAL_RX(peer), PEER_TOTAL_TX(peer), peer->version[afi][safi], inq_count, @@ -9372,7 +9423,7 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi, "(Policy)"); else vty_out(vty, - " %12" PRIu32, + " %12u", peer->pcount [afi] [pfx_rcd_safi]); @@ -9390,7 +9441,7 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi, "(Policy)"); else vty_out(vty, - " %8" PRIu32, + " %8u", (PAF_SUBGRP( paf)) ->scount); @@ -9407,7 +9458,7 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi, lookup_msg(bgp_status_msg, peer->status, NULL)); - vty_out(vty, " %8" PRIu32, 0); + vty_out(vty, " %8u", 0); } vty_out(vty, "\n"); } @@ -10430,8 +10481,7 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi, paf = peer_af_find(p, afi, safi); if (paf && PAF_SUBGRP(paf)) { - vty_out(vty, " Update group %" PRIu64 - ", subgroup %" PRIu64 "\n", + vty_out(vty, " Update group %" PRIu64", subgroup %" PRIu64 "\n", PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id); vty_out(vty, " Packet Queue length %d\n", bpacket_queue_virtual_length(paf)); @@ -10682,20 +10732,20 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi, filter->usmap.name); /* Receive prefix count */ - vty_out(vty, " %" PRIu32 " accepted prefixes\n", + vty_out(vty, " %u accepted prefixes\n", p->pcount[afi][safi]); /* maximum-prefix-out */ if (CHECK_FLAG(p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_OUT)) vty_out(vty, - " Maximum allowed prefixes sent %" PRIu32 "\n", + " Maximum allowed prefixes sent %u\n", p->pmax_out[afi][safi]); /* Maximum prefix */ if (CHECK_FLAG(p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) { vty_out(vty, - " Maximum prefixes allowed %" PRIu32 "%s\n", + " Maximum prefixes allowed %u%s\n", p->pmax[afi][safi], CHECK_FLAG(p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) @@ -10884,10 +10934,9 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json, p->group, &prefix); if (range) { - prefix2str(range, buf1, sizeof(buf1)); vty_out(vty, - " Belongs to the subnet range group: %s\n", - buf1); + " Belongs to the subnet range group: %pFX\n", + range); } } } @@ -12697,11 +12746,13 @@ static void bgp_show_all_instances_neighbors_vty(struct vty *vty, use_json, json); } json_object_free(json); + json = NULL; } if (use_json) { vty_out(vty, "}\n"); - json_object_free(json); + if (json) + json_object_free(json); } else if (!nbr_output) vty_out(vty, "%% BGP instance not found\n"); @@ -13522,10 +13573,10 @@ static int bgp_show_one_peer_group(struct vty *vty, struct peer_group *group) conf = group->conf; if (conf->as_type == AS_SPECIFIED || conf->as_type == AS_EXTERNAL) { - vty_out(vty, "\nBGP peer-group %s, remote AS %" PRIu32 "\n", + vty_out(vty, "\nBGP peer-group %s, remote AS %u\n", group->name, conf->as); } else if (conf->as_type == AS_INTERNAL) { - vty_out(vty, "\nBGP peer-group %s, remote AS %" PRIu32 "\n", + vty_out(vty, "\nBGP peer-group %s, remote AS %u\n", group->name, group->bgp->as); } else { vty_out(vty, "\nBGP peer-group %s\n", group->name); @@ -15044,7 +15095,7 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp, /* maximum-prefix. */ if (peergroup_af_flag_check(peer, afi, safi, PEER_FLAG_MAX_PREFIX)) { - vty_out(vty, " neighbor %s maximum-prefix %" PRIu32, addr, + vty_out(vty, " neighbor %s maximum-prefix %u", addr, peer->pmax[afi][safi]); if (peer->pmax_threshold[afi][safi] @@ -15056,13 +15107,16 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp, if (peer->pmax_restart[afi][safi]) vty_out(vty, " restart %u", peer->pmax_restart[afi][safi]); + if (peer_af_flag_check(peer, afi, safi, + PEER_FLAG_MAX_PREFIX_FORCE)) + vty_out(vty, " force"); vty_out(vty, "\n"); } /* maximum-prefix-out */ if (peergroup_af_flag_check(peer, afi, safi, PEER_FLAG_MAX_PREFIX_OUT)) - vty_out(vty, " neighbor %s maximum-prefix-out %" PRIu32 "\n", + vty_out(vty, " neighbor %s maximum-prefix-out %u\n", addr, peer->pmax_out[afi][safi]); /* Route server client. */ @@ -18097,8 +18151,7 @@ static int community_list_config_write(struct vty *vty) for (list = cm->str.head; list; list = list->next) for (entry = list->head; entry; entry = entry->next) { vty_out(vty, - "bgp extcommunity-list %s %s seq %" PRId64 - " %s %s\n", + "bgp extcommunity-list %s %s seq %" PRId64" %s %s\n", entry->style == EXTCOMMUNITY_LIST_STANDARD ? "standard" : "expanded", @@ -18116,8 +18169,7 @@ 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, - "bgp large-community-list %s seq %" PRId64 - " %s %s\n", + "bgp large-community-list %s seq %" PRId64" %s %s\n", list->name, entry->seq, community_direct_str(entry->direct), community_list_config_str(entry)); @@ -18126,8 +18178,7 @@ static int community_list_config_write(struct vty *vty) for (list = cm->str.head; list; list = list->next) for (entry = list->head; entry; entry = entry->next) { vty_out(vty, - "bgp large-community-list %s %s seq %" PRId64 - " %s %s\n", + "bgp large-community-list %s %s seq %" PRId64" %s %s\n", entry->style == LARGE_COMMUNITY_LIST_STANDARD ? "standard" |
