if (ret < 0)
bgp_clear_vty_error(vty, peer, afi, safi, ret);
- else
- found = true;
}
/* This is to apply read-only mode on this clear. */
if (stype == BGP_CLEAR_SOFT_NONE)
bgp->update_delay_over = 0;
- if (!found)
- vty_out(vty, "%%BGP: No %s peer configured\n",
- afi_safi_print(afi, safi));
-
return CMD_SUCCESS;
}
/* "router bgp" commands. */
DEFUN_NOSH (router_bgp,
router_bgp_cmd,
- "router bgp [(1-4294967295) [<view|vrf> VIEWVRFNAME]]",
+ "router bgp [(1-4294967295)$instasn [<view|vrf> VIEWVRFNAME]]",
ROUTER_STR
BGP_STR
AS_STR
ret = bgp_get(&bgp, &as, name, inst_type);
switch (ret) {
- case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
- vty_out(vty,
- "Please specify 'bgp multiple-instance' first\n");
- return CMD_WARNING_CONFIG_FAILED;
case BGP_ERR_AS_MISMATCH:
vty_out(vty, "BGP is already running; AS is %u\n", as);
return CMD_WARNING_CONFIG_FAILED;
if (is_new_bgp && inst_type == BGP_INSTANCE_TYPE_DEFAULT)
vpn_leak_postchange_all();
+ if (inst_type == BGP_INSTANCE_TYPE_VRF)
+ bgp_vpn_leak_export(bgp);
/* Pending: handle when user tries to change a view to vrf n vv.
*/
}
/* "no router bgp" commands. */
DEFUN (no_router_bgp,
no_router_bgp_cmd,
- "no router bgp [(1-4294967295) [<view|vrf> VIEWVRFNAME]]",
+ "no router bgp [(1-4294967295)$instasn [<view|vrf> VIEWVRFNAME]]",
NO_STR
ROUTER_STR
BGP_STR
}
}
+ if (bgp_vpn_leak_unimport(bgp, vty))
+ return CMD_WARNING_CONFIG_FAILED;
+
bgp_delete(bgp);
return CMD_SUCCESS;
{
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
} else if (argv_find(argv, argc, "PGNAME", &idx)) {
clr_sort = clear_peer;
clr_arg = argv[idx]->arg;
+ } else if (argv_find(argv, argc, "WORD", &idx)) {
+ clr_sort = clear_peer;
+ clr_arg = argv[idx]->arg;
} else if (argv_find(argv, argc, "(1-4294967295)", &idx)) {
clr_sort = clear_as;
clr_arg = argv[idx]->arg;
count * sizeof(struct peer_group)));
/* Other */
- if ((count = mtype_stats_alloc(MTYPE_HASH)))
- vty_out(vty, "%ld hash tables, using %s of memory\n", count,
- mtype_memstr(memstrbuf, sizeof(memstrbuf),
- count * sizeof(struct hash)));
- if ((count = mtype_stats_alloc(MTYPE_HASH_BACKET)))
- vty_out(vty, "%ld hash buckets, using %s of memory\n", count,
- mtype_memstr(memstrbuf, sizeof(memstrbuf),
- count * sizeof(struct hash_bucket)));
if ((count = mtype_stats_alloc(MTYPE_BGP_REGEXP)))
vty_out(vty, "%ld compiled regexes, using %s of memory\n",
count, mtype_memstr(memstrbuf, sizeof(memstrbuf),
json_object_array_add(json_import_vrfs,
json_object_new_string(vname));
+ json_object_object_add(json, "importFromVrfs",
+ json_import_vrfs);
dir = BGP_VPN_POLICY_DIR_FROMVPN;
- ecom_str = ecommunity_ecom2str(
+ if (bgp->vpn_policy[afi].rtlist[dir]) {
+ ecom_str = ecommunity_ecom2str(
bgp->vpn_policy[afi].rtlist[dir],
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
- json_object_object_add(json, "importFromVrfs",
- json_import_vrfs);
- json_object_string_add(json, "importRts", ecom_str);
-
- XFREE(MTYPE_ECOMMUNITY_STR, ecom_str);
+ json_object_string_add(json, "importRts",
+ ecom_str);
+ XFREE(MTYPE_ECOMMUNITY_STR, ecom_str);
+ } else
+ json_object_string_add(json, "importRts",
+ "none");
}
if (!CHECK_FLAG(bgp->af_flags[afi][safi],
buf1, RD_ADDRSTRLEN));
dir = BGP_VPN_POLICY_DIR_TOVPN;
- ecom_str = ecommunity_ecom2str(
+ if (bgp->vpn_policy[afi].rtlist[dir]) {
+ ecom_str = ecommunity_ecom2str(
bgp->vpn_policy[afi].rtlist[dir],
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
- json_object_string_add(json, "exportRts", ecom_str);
-
- XFREE(MTYPE_ECOMMUNITY_STR, ecom_str);
+ json_object_string_add(json, "exportRts",
+ ecom_str);
+ XFREE(MTYPE_ECOMMUNITY_STR, ecom_str);
+ } else
+ json_object_string_add(json, "exportRts",
+ "none");
}
if (use_json) {
vty_out(vty, " %s\n", vname);
dir = BGP_VPN_POLICY_DIR_FROMVPN;
- ecom_str = ecommunity_ecom2str(
+ ecom_str = NULL;
+ if (bgp->vpn_policy[afi].rtlist[dir]) {
+ ecom_str = ecommunity_ecom2str(
bgp->vpn_policy[afi].rtlist[dir],
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
- vty_out(vty, "Import RT(s): %s\n", ecom_str);
+ vty_out(vty, "Import RT(s): %s\n", ecom_str);
- XFREE(MTYPE_ECOMMUNITY_STR, ecom_str);
+ XFREE(MTYPE_ECOMMUNITY_STR, ecom_str);
+ } else
+ vty_out(vty, "Import RT(s):\n");
}
if (!CHECK_FLAG(bgp->af_flags[afi][safi],
buf1, RD_ADDRSTRLEN));
dir = BGP_VPN_POLICY_DIR_TOVPN;
- ecom_str = ecommunity_ecom2str(
+ if (bgp->vpn_policy[afi].rtlist[dir]) {
+ ecom_str = ecommunity_ecom2str(
bgp->vpn_policy[afi].rtlist[dir],
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
- vty_out(vty, "Export RT: %s\n", ecom_str);
- XFREE(MTYPE_ECOMMUNITY_STR, ecom_str);
+ vty_out(vty, "Export RT: %s\n", ecom_str);
+ XFREE(MTYPE_ECOMMUNITY_STR, ecom_str);
+ } else
+ vty_out(vty, "Import RT(s):\n");
}
}
DEFUN (no_bgp_redistribute_ipv4_ospf,
no_bgp_redistribute_ipv4_ospf_cmd,
- "no redistribute <ospf|table> (1-65535) [metric (0-4294967295)] [route-map WORD]",
+ "no redistribute <ospf|table> (1-65535) [{metric (0-4294967295)|route-map WORD}]",
NO_STR
"Redistribute information from another routing protocol\n"
"Open Shortest Path First (OSPFv2)\n"
ALIAS_HIDDEN(
no_bgp_redistribute_ipv4_ospf, no_bgp_redistribute_ipv4_ospf_hidden_cmd,
- "no redistribute <ospf|table> (1-65535) [metric (0-4294967295)] [route-map WORD]",
+ "no redistribute <ospf|table> (1-65535) [{metric (0-4294967295)|route-map WORD}]",
NO_STR
"Redistribute information from another routing protocol\n"
"Open Shortest Path First (OSPFv2)\n"
DEFUN (no_bgp_redistribute_ipv4,
no_bgp_redistribute_ipv4_cmd,
- "no redistribute " FRR_IP_REDIST_STR_BGPD " [metric (0-4294967295)] [route-map WORD]",
+ "no redistribute " FRR_IP_REDIST_STR_BGPD " [{metric (0-4294967295)|route-map WORD}]",
NO_STR
"Redistribute information from another routing protocol\n"
FRR_IP_REDIST_HELP_STR_BGPD
ALIAS_HIDDEN(
no_bgp_redistribute_ipv4, no_bgp_redistribute_ipv4_hidden_cmd,
"no redistribute " FRR_IP_REDIST_STR_BGPD
- " [metric (0-4294967295)] [route-map WORD]",
+ " [{metric (0-4294967295)|route-map WORD}]",
NO_STR
"Redistribute information from another routing protocol\n" FRR_IP_REDIST_HELP_STR_BGPD
"Metric for redistributed routes\n"
DEFUN (no_bgp_redistribute_ipv6,
no_bgp_redistribute_ipv6_cmd,
- "no redistribute " FRR_IP6_REDIST_STR_BGPD " [metric (0-4294967295)] [route-map WORD]",
+ "no redistribute " FRR_IP6_REDIST_STR_BGPD " [{metric (0-4294967295)|route-map WORD}]",
NO_STR
"Redistribute information from another routing protocol\n"
FRR_IP6_REDIST_HELP_STR_BGPD
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);