* afi -> The parsed afi if it was included in the show command, returned here
* safi -> The parsed safi if it was included in the show command, returned here
* bgp -> Pointer to the bgp data structure we need to fill in.
+ * use_json -> json is configured or not
*
* The function returns the correct location in the parse tree for the
* last token found.
else {
*bgp = bgp_lookup_by_name(vrf_name);
if (!*bgp) {
- if (use_json)
- vty_out(vty, "{}\n");
+ if (use_json) {
+ json_object *json = NULL;
+ json = json_object_new_object();
+ json_object_string_add(
+ json, "warning",
+ "View/Vrf is unknown");
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(json,
+ JSON_C_TO_STRING_PRETTY));
+ json_object_free(json);
+ }
else
vty_out(vty, "View/Vrf %s is unknown\n",
vrf_name);
} else {
*bgp = bgp_get_default();
if (!*bgp) {
- if (use_json)
- vty_out(vty, "{}\n");
+ if (use_json) {
+ json_object *json = NULL;
+ json = json_object_new_object();
+ json_object_string_add(
+ json, "warning",
+ "Default BGP instance not found");
+ vty_out(vty, "%s\n",
+ json_object_to_json_string_ext(json,
+ JSON_C_TO_STRING_PRETTY));
+ json_object_free(json);
+ }
else
vty_out(vty,
"Default BGP instance not found\n");
return CMD_SUCCESS;
}
-static void bgp_redistribute_redo(struct bgp *bgp)
-{
- afi_t afi;
- int i;
- struct list *red_list;
- struct listnode *node;
- struct bgp_redist *red;
-
- for (afi = AFI_IP; afi < AFI_MAX; afi++) {
- for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
-
- red_list = bgp->redist[afi][i];
- if (!red_list)
- continue;
-
- for (ALL_LIST_ELEMENTS_RO(red_list, node, red)) {
- bgp_redistribute_resend(bgp, afi, i,
- red->instance);
- }
- }
- }
-}
-
/* "bgp graceful-shutdown" configuration */
DEFUN (bgp_graceful_shutdown,
bgp_graceful_shutdown_cmd,
DEFUN (bgp_listen_range,
bgp_listen_range_cmd,
- "bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group WORD",
+ "bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group PGNAME",
"BGP specific commands\n"
"Configure BGP dynamic neighbors listen range\n"
"Configure BGP dynamic neighbors listen range\n"
argv_find(argv, argc, "A.B.C.D/M", &idx);
argv_find(argv, argc, "X:X::X:X/M", &idx);
char *prefix = argv[idx]->arg;
- argv_find(argv, argc, "WORD", &idx);
+ argv_find(argv, argc, "PGNAME", &idx);
char *peergroup = argv[idx]->arg;
/* Convert IP prefix string to struct prefix. */
DEFUN (no_bgp_listen_range,
no_bgp_listen_range_cmd,
- "no bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group WORD",
+ "no bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group PGNAME",
NO_STR
"BGP specific commands\n"
"Unconfigure BGP dynamic neighbors listen range\n"
DEFUN (neighbor_interface_config,
neighbor_interface_config_cmd,
- "neighbor WORD interface [peer-group WORD]",
+ "neighbor WORD interface [peer-group PGNAME]",
NEIGHBOR_STR
"Interface name or neighbor tag\n"
"Enable BGP on interface\n"
DEFUN (neighbor_interface_config_v6only,
neighbor_interface_config_v6only_cmd,
- "neighbor WORD interface v6only [peer-group WORD]",
+ "neighbor WORD interface v6only [peer-group PGNAME]",
NEIGHBOR_STR
"Interface name or neighbor tag\n"
"Enable BGP on interface\n"
DEFUN (no_neighbor_interface_config,
no_neighbor_interface_config_cmd,
- "no neighbor WORD interface [v6only] [peer-group WORD] [remote-as <(1-4294967295)|internal|external>]",
+ "no neighbor WORD interface [v6only] [peer-group PGNAME] [remote-as <(1-4294967295)|internal|external>]",
NO_STR
NEIGHBOR_STR
"Interface name\n"
DEFUN (neighbor_set_peer_group,
neighbor_set_peer_group_cmd,
- "neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
+ "neighbor <A.B.C.D|X:X::X:X|WORD> peer-group PGNAME",
NEIGHBOR_STR
NEIGHBOR_ADDR_STR2
"Member of the peer-group\n"
}
ALIAS_HIDDEN(neighbor_set_peer_group, neighbor_set_peer_group_hidden_cmd,
- "neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
+ "neighbor <A.B.C.D|X:X::X:X|WORD> peer-group PGNAME",
NEIGHBOR_STR NEIGHBOR_ADDR_STR2
"Member of the peer-group\n"
"Peer-group name\n")
DEFUN (no_neighbor_set_peer_group,
no_neighbor_set_peer_group_cmd,
- "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
+ "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group PGNAME",
NO_STR
NEIGHBOR_STR
NEIGHBOR_ADDR_STR2
}
ALIAS_HIDDEN(no_neighbor_set_peer_group, no_neighbor_set_peer_group_hidden_cmd,
- "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
+ "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group PGNAME",
NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
"Member of the peer-group\n"
"Peer-group name\n")
"Disable the next hop calculation for this neighbor\n"
"Set the next hop to self for reflected routes\n")
+ALIAS_HIDDEN(neighbor_nexthop_self_force,
+ neighbor_nexthop_self_all_hidden_cmd,
+ "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self all",
+ NEIGHBOR_STR NEIGHBOR_ADDR_STR2
+ "Disable the next hop calculation for this neighbor\n"
+ "Set the next hop to self for reflected routes\n")
+
DEFUN (no_neighbor_nexthop_self,
no_neighbor_nexthop_self_cmd,
"no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
"Disable the next hop calculation for this neighbor\n"
"Set the next hop to self for reflected routes\n")
+ALIAS_HIDDEN(no_neighbor_nexthop_self_force,
+ no_neighbor_nexthop_self_all_hidden_cmd,
+ "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self all",
+ NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
+ "Disable the next hop calculation for this neighbor\n"
+ "Set the next hop to self for reflected routes\n")
+
/* neighbor as-override */
DEFUN (neighbor_as_override,
neighbor_as_override_cmd,
{
int ret;
struct peer *peer;
- struct route_map *route_map;
+ struct route_map *route_map = NULL;
peer = peer_and_group_lookup_vty(vty, peer_str);
if (!peer)
return CMD_WARNING_CONFIG_FAILED;
if (set) {
- route_map = route_map_lookup_warn_noexist(vty, rmap);
+ if (rmap)
+ route_map = route_map_lookup_warn_noexist(vty, rmap);
ret = peer_default_originate_set(peer, afi, safi,
rmap, route_map);
} else
/* one clear bgp command to rule them all */
DEFUN (clear_ip_bgp_all,
clear_ip_bgp_all_cmd,
- "clear [ip] bgp [<view|vrf> VIEWVRFNAME] [<ipv4|ipv6|l2vpn> [<unicast|multicast|vpn|labeled-unicast|flowspec|evpn>]] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> [<soft [<in|out>]|in [prefix-filter]|out>]",
+ "clear [ip] bgp [<view|vrf> VIEWVRFNAME] [<ipv4|ipv6|l2vpn> [<unicast|multicast|vpn|labeled-unicast|flowspec|evpn>]] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group PGNAME> [<soft [<in|out>]|in [prefix-filter]|out>]",
CLEAR_STR
IP_STR
BGP_STR
if (argv_find_and_parse_afi(argv, argc, &idx, &afi))
argv_find_and_parse_safi(argv, argc, &idx, &safi);
- /* <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> */
+ /* <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group PGNAME> */
if (argv_find(argv, argc, "*", &idx)) {
clr_sort = clear_all;
} else if (argv_find(argv, argc, "A.B.C.D", &idx)) {
clr_sort = clear_group;
idx++;
clr_arg = argv[idx]->arg;
- } else if (argv_find(argv, argc, "WORD", &idx)) {
+ } else if (argv_find(argv, argc, "PGNAME", &idx)) {
clr_sort = clear_peer;
clr_arg = argv[idx]->arg;
} else if (argv_find(argv, argc, "(1-4294967295)", &idx)) {
json, "ribMemory",
ents * sizeof(struct bgp_node));
- ents = listcount(bgp->peer);
+ ents = bgp->af_peer_count[afi][safi];
json_object_int_add(json, "peerCount", ents);
json_object_int_add(json, "peerMemory",
ents * sizeof(struct peer));
bgp_node)));
/* Peer related usage */
- ents = listcount(bgp->peer);
+ ents = bgp->af_peer_count[afi][safi];
vty_out(vty, "Peers %ld, using %s of memory\n",
ents,
mtype_memstr(
/* "neighbor next-hop-self force" commands. */
install_element(BGP_NODE, &neighbor_nexthop_self_force_hidden_cmd);
install_element(BGP_NODE, &no_neighbor_nexthop_self_force_hidden_cmd);
+ install_element(BGP_NODE, &neighbor_nexthop_self_all_hidden_cmd);
+ install_element(BGP_NODE, &no_neighbor_nexthop_self_all_hidden_cmd);
install_element(BGP_IPV4_NODE, &neighbor_nexthop_self_force_cmd);
install_element(BGP_IPV4_NODE, &no_neighbor_nexthop_self_force_cmd);
+ install_element(BGP_IPV4_NODE, &neighbor_nexthop_self_all_hidden_cmd);
+ install_element(BGP_IPV4_NODE,
+ &no_neighbor_nexthop_self_all_hidden_cmd);
install_element(BGP_IPV4M_NODE, &neighbor_nexthop_self_force_cmd);
install_element(BGP_IPV4M_NODE, &no_neighbor_nexthop_self_force_cmd);
+ install_element(BGP_IPV4M_NODE, &neighbor_nexthop_self_all_hidden_cmd);
+ install_element(BGP_IPV4M_NODE,
+ &no_neighbor_nexthop_self_all_hidden_cmd);
install_element(BGP_IPV4L_NODE, &neighbor_nexthop_self_force_cmd);
install_element(BGP_IPV4L_NODE, &no_neighbor_nexthop_self_force_cmd);
+ install_element(BGP_IPV4L_NODE, &neighbor_nexthop_self_all_hidden_cmd);
+ install_element(BGP_IPV4L_NODE,
+ &no_neighbor_nexthop_self_all_hidden_cmd);
install_element(BGP_IPV6_NODE, &neighbor_nexthop_self_force_cmd);
install_element(BGP_IPV6_NODE, &no_neighbor_nexthop_self_force_cmd);
+ install_element(BGP_IPV6_NODE, &neighbor_nexthop_self_all_hidden_cmd);
+ install_element(BGP_IPV6_NODE,
+ &no_neighbor_nexthop_self_all_hidden_cmd);
install_element(BGP_IPV6M_NODE, &neighbor_nexthop_self_force_cmd);
install_element(BGP_IPV6M_NODE, &no_neighbor_nexthop_self_force_cmd);
+ install_element(BGP_IPV6M_NODE, &neighbor_nexthop_self_all_hidden_cmd);
+ install_element(BGP_IPV6M_NODE,
+ &no_neighbor_nexthop_self_all_hidden_cmd);
install_element(BGP_IPV6L_NODE, &neighbor_nexthop_self_force_cmd);
install_element(BGP_IPV6L_NODE, &no_neighbor_nexthop_self_force_cmd);
+ install_element(BGP_IPV6L_NODE, &neighbor_nexthop_self_all_hidden_cmd);
+ install_element(BGP_IPV6L_NODE,
+ &no_neighbor_nexthop_self_all_hidden_cmd);
install_element(BGP_VPNV4_NODE, &neighbor_nexthop_self_force_cmd);
install_element(BGP_VPNV4_NODE, &no_neighbor_nexthop_self_force_cmd);
+ install_element(BGP_VPNV4_NODE, &neighbor_nexthop_self_all_hidden_cmd);
+ install_element(BGP_VPNV4_NODE,
+ &no_neighbor_nexthop_self_all_hidden_cmd);
install_element(BGP_VPNV6_NODE, &neighbor_nexthop_self_force_cmd);
install_element(BGP_VPNV6_NODE, &no_neighbor_nexthop_self_force_cmd);
+ install_element(BGP_VPNV6_NODE, &neighbor_nexthop_self_all_hidden_cmd);
+ install_element(BGP_VPNV6_NODE,
+ &no_neighbor_nexthop_self_all_hidden_cmd);
/* "neighbor as-override" commands. */
install_element(BGP_NODE, &neighbor_as_override_hidden_cmd);
if (entry == list->head) {
if (all_digit(list->name))
vty_out(vty, "Large community %s list %s\n",
- entry->style == EXTCOMMUNITY_LIST_STANDARD
+ entry->style ==
+ LARGE_COMMUNITY_LIST_STANDARD
? "standard"
: "(expanded) access",
list->name);
else
vty_out(vty,
"Named large community %s list %s\n",
- entry->style == EXTCOMMUNITY_LIST_STANDARD
+ entry->style ==
+ LARGE_COMMUNITY_LIST_STANDARD
? "standard"
: "expanded",
list->name);