mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-28 10:50:18 +00:00
Revert "bgpd: convert max prefix clis to transactional"
This reverts commit 04261decb9
.
This commit is contained in:
parent
c36bc05fcd
commit
7e62b79286
@ -2594,7 +2594,6 @@ const struct frr_yang_module_info frr_bgp_info = {
|
||||
.cbs = {
|
||||
.create = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_create,
|
||||
.destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_destroy,
|
||||
.apply_finish = bgp_neighbors_neighbor_afi_safi_prefix_limit_apply_finish,
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -2922,7 +2921,6 @@ const struct frr_yang_module_info frr_bgp_info = {
|
||||
.cbs = {
|
||||
.create = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_create,
|
||||
.destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_destroy,
|
||||
.apply_finish = bgp_neighbors_neighbor_afi_safi_prefix_limit_apply_finish,
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -3135,7 +3133,6 @@ const struct frr_yang_module_info frr_bgp_info = {
|
||||
.cbs = {
|
||||
.create = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_create,
|
||||
.destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_destroy,
|
||||
.apply_finish = bgp_neighbors_neighbor_afi_safi_prefix_limit_apply_finish,
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -3348,7 +3345,6 @@ const struct frr_yang_module_info frr_bgp_info = {
|
||||
.cbs = {
|
||||
.create = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_create,
|
||||
.destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_destroy,
|
||||
.apply_finish = bgp_neighbors_neighbor_afi_safi_prefix_limit_apply_finish,
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -3561,7 +3557,6 @@ const struct frr_yang_module_info frr_bgp_info = {
|
||||
.cbs = {
|
||||
.create = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_create,
|
||||
.destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_destroy,
|
||||
.apply_finish = bgp_neighbors_neighbor_afi_safi_prefix_limit_apply_finish,
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -3774,7 +3769,6 @@ const struct frr_yang_module_info frr_bgp_info = {
|
||||
.cbs = {
|
||||
.create = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_create,
|
||||
.destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_destroy,
|
||||
.apply_finish = bgp_neighbors_neighbor_afi_safi_prefix_limit_apply_finish,
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -3966,7 +3960,6 @@ const struct frr_yang_module_info frr_bgp_info = {
|
||||
.cbs = {
|
||||
.create = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_create,
|
||||
.destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_destroy,
|
||||
.apply_finish = bgp_neighbors_neighbor_afi_safi_prefix_limit_apply_finish,
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -4158,7 +4151,6 @@ const struct frr_yang_module_info frr_bgp_info = {
|
||||
.cbs = {
|
||||
.create = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_create,
|
||||
.destroy = bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_destroy,
|
||||
.apply_finish = bgp_neighbors_neighbor_afi_safi_prefix_limit_apply_finish,
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -4449,7 +4441,6 @@ const struct frr_yang_module_info frr_bgp_info = {
|
||||
.cbs = {
|
||||
.create = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_create,
|
||||
.destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_destroy,
|
||||
.apply_finish = bgp_unnumbered_neighbor_afi_safi_prefix_limit_apply_finish,
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -4777,7 +4768,6 @@ const struct frr_yang_module_info frr_bgp_info = {
|
||||
.cbs = {
|
||||
.create = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_create,
|
||||
.destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_destroy,
|
||||
.apply_finish = bgp_unnumbered_neighbor_afi_safi_prefix_limit_apply_finish,
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -5414,7 +5404,6 @@ const struct frr_yang_module_info frr_bgp_info = {
|
||||
.cbs = {
|
||||
.create = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_create,
|
||||
.destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_destroy,
|
||||
.apply_finish = bgp_unnumbered_neighbor_afi_safi_prefix_limit_apply_finish,
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -5627,7 +5616,6 @@ const struct frr_yang_module_info frr_bgp_info = {
|
||||
.cbs = {
|
||||
.create = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_create,
|
||||
.destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_destroy,
|
||||
.apply_finish = bgp_unnumbered_neighbor_afi_safi_prefix_limit_apply_finish,
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -5819,7 +5807,6 @@ const struct frr_yang_module_info frr_bgp_info = {
|
||||
.cbs = {
|
||||
.create = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_create,
|
||||
.destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_destroy,
|
||||
.apply_finish = bgp_unnumbered_neighbor_afi_safi_prefix_limit_apply_finish,
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -6011,7 +5998,6 @@ const struct frr_yang_module_info frr_bgp_info = {
|
||||
.cbs = {
|
||||
.create = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_create,
|
||||
.destroy = bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_destroy,
|
||||
.apply_finish = bgp_unnumbered_neighbor_afi_safi_prefix_limit_apply_finish,
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -6302,7 +6288,6 @@ const struct frr_yang_module_info frr_bgp_info = {
|
||||
.cbs = {
|
||||
.create = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_create,
|
||||
.destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_direction_list_destroy,
|
||||
.apply_finish = bgp_peer_group_afi_safi_prefix_limit_apply_finish,
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -6630,7 +6615,6 @@ const struct frr_yang_module_info frr_bgp_info = {
|
||||
.cbs = {
|
||||
.create = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_create,
|
||||
.destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_direction_list_destroy,
|
||||
.apply_finish = bgp_peer_group_afi_safi_prefix_limit_apply_finish,
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -6843,7 +6827,6 @@ const struct frr_yang_module_info frr_bgp_info = {
|
||||
.cbs = {
|
||||
.create = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_create,
|
||||
.destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direction_list_destroy,
|
||||
.apply_finish = bgp_peer_group_afi_safi_prefix_limit_apply_finish,
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -7062,7 +7045,6 @@ const struct frr_yang_module_info frr_bgp_info = {
|
||||
.cbs = {
|
||||
.create = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_create,
|
||||
.destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direction_list_destroy,
|
||||
.apply_finish = bgp_peer_group_afi_safi_prefix_limit_apply_finish,
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -7281,7 +7263,6 @@ const struct frr_yang_module_info frr_bgp_info = {
|
||||
.cbs = {
|
||||
.create = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_create,
|
||||
.destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_direction_list_destroy,
|
||||
.apply_finish = bgp_peer_group_afi_safi_prefix_limit_apply_finish,
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -7494,7 +7475,6 @@ const struct frr_yang_module_info frr_bgp_info = {
|
||||
.cbs = {
|
||||
.create = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_create,
|
||||
.destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_direction_list_destroy,
|
||||
.apply_finish = bgp_peer_group_afi_safi_prefix_limit_apply_finish,
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -7686,7 +7666,6 @@ const struct frr_yang_module_info frr_bgp_info = {
|
||||
.cbs = {
|
||||
.create = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_create,
|
||||
.destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_direction_list_destroy,
|
||||
.apply_finish = bgp_peer_group_afi_safi_prefix_limit_apply_finish,
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -7878,7 +7857,6 @@ const struct frr_yang_module_info frr_bgp_info = {
|
||||
.cbs = {
|
||||
.create = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_create,
|
||||
.destroy = bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_direction_list_destroy,
|
||||
.apply_finish = bgp_peer_group_afi_safi_prefix_limit_apply_finish,
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -3663,12 +3663,6 @@ void bgp_peer_groups_peer_group_admin_shutdown_apply_finish(
|
||||
struct nb_cb_apply_finish_args *args);
|
||||
void bgp_peer_groups_peer_group_local_as_apply_finish(
|
||||
struct nb_cb_apply_finish_args *args);
|
||||
void bgp_neighbors_neighbor_afi_safi_prefix_limit_apply_finish(
|
||||
struct nb_cb_apply_finish_args *args);
|
||||
void bgp_unnumbered_neighbor_afi_safi_prefix_limit_apply_finish(
|
||||
struct nb_cb_apply_finish_args *args);
|
||||
void bgp_peer_group_afi_safi_prefix_limit_apply_finish(
|
||||
struct nb_cb_apply_finish_args *args);
|
||||
|
||||
/* xpath macros */
|
||||
/* route-list */
|
||||
|
@ -13933,46 +13933,6 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_default_originate_opt
|
||||
return NB_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
bgp_neighbor_afi_safi_prefix_limit_list_destroy(struct nb_cb_destroy_args *args)
|
||||
{
|
||||
struct bgp *bgp;
|
||||
const char *peer_str;
|
||||
struct peer *peer;
|
||||
const struct lyd_node *nbr_dnode;
|
||||
const struct lyd_node *nbr_af_dnode;
|
||||
const char *af_name;
|
||||
afi_t afi;
|
||||
safi_t safi;
|
||||
int direction;
|
||||
|
||||
nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi");
|
||||
af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name");
|
||||
yang_afi_safi_identity2value(af_name, &afi, &safi);
|
||||
|
||||
nbr_dnode = yang_dnode_get_parent(nbr_af_dnode, "neighbor");
|
||||
bgp = nb_running_get_entry(nbr_dnode, NULL, true);
|
||||
peer_str = yang_dnode_get_string(nbr_dnode, "./remote-address");
|
||||
peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg,
|
||||
args->errmsg_len);
|
||||
if (!peer)
|
||||
return NB_ERR_INCONSISTENCY;
|
||||
|
||||
direction = yang_dnode_get_enum(args->dnode, "./direction");
|
||||
|
||||
switch (direction) {
|
||||
case 1:
|
||||
peer_maximum_prefix_unset(peer, afi, safi);
|
||||
break;
|
||||
case 2:
|
||||
UNSET_FLAG(peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_OUT);
|
||||
peer->pmax_out[afi][safi] = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* XPath:
|
||||
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list
|
||||
@ -13999,101 +13959,14 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_limit_directio
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_neighbor_afi_safi_prefix_limit_list_destroy(args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
bgp_peer_afi_safi_maximum_prefix_set(struct nb_cb_apply_finish_args *args,
|
||||
struct peer *peer, afi_t afi, safi_t safi)
|
||||
{
|
||||
int direction;
|
||||
uint32_t max;
|
||||
uint8_t threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
|
||||
uint16_t restart = 0;
|
||||
bool warning = false;
|
||||
bool force;
|
||||
|
||||
max = yang_dnode_get_uint32(args->dnode, "./max-prefixes");
|
||||
direction = yang_dnode_get_enum(args->dnode, "./direction");
|
||||
switch (direction) {
|
||||
case 1:
|
||||
force = yang_dnode_get_bool(args->dnode, "./force-check");
|
||||
|
||||
if (yang_dnode_exists(args->dnode,
|
||||
"./options/shutdown-threshold-pct"))
|
||||
threshold = yang_dnode_get_uint8(
|
||||
args->dnode,
|
||||
"./options/shutdown-threshold-pct");
|
||||
if (yang_dnode_exists(args->dnode,
|
||||
"./options/tw-shutdown-threshold-pct"))
|
||||
threshold = yang_dnode_get_uint8(
|
||||
args->dnode,
|
||||
"./options/tw-shutdown-threshold-pct");
|
||||
if (yang_dnode_exists(args->dnode,
|
||||
"./options/tr-shutdown-threshold-pct"))
|
||||
threshold = yang_dnode_get_uint8(
|
||||
args->dnode,
|
||||
"./options/tr-shutdown-threshold-pct");
|
||||
|
||||
if (yang_dnode_exists(args->dnode, "./options/warning-only"))
|
||||
warning = yang_dnode_get_bool(args->dnode,
|
||||
"./options/warning-only");
|
||||
if (yang_dnode_exists(args->dnode, "./options/tw-warning-only"))
|
||||
warning = yang_dnode_get_bool(
|
||||
args->dnode, "./options/tw-warning-only");
|
||||
|
||||
if (yang_dnode_exists(args->dnode, "./options/restart-timer"))
|
||||
restart = yang_dnode_get_uint16(
|
||||
args->dnode, "./options/restart-timer");
|
||||
if (yang_dnode_exists(args->dnode,
|
||||
"./options/tr-restart-timer"))
|
||||
restart = yang_dnode_get_uint16(
|
||||
args->dnode, "./options/tr-restart-timer");
|
||||
|
||||
peer_maximum_prefix_set(peer, afi, safi, max, threshold,
|
||||
warning, restart, force);
|
||||
|
||||
break;
|
||||
case 2:
|
||||
SET_FLAG(peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_OUT);
|
||||
peer->pmax_out[afi][safi] = max;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void bgp_neighbors_neighbor_afi_safi_prefix_limit_apply_finish(
|
||||
struct nb_cb_apply_finish_args *args)
|
||||
{
|
||||
struct bgp *bgp;
|
||||
const char *peer_str;
|
||||
struct peer *peer;
|
||||
const struct lyd_node *nbr_dnode;
|
||||
const struct lyd_node *nbr_af_dnode;
|
||||
const char *af_name;
|
||||
afi_t afi;
|
||||
safi_t safi;
|
||||
|
||||
nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi");
|
||||
af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name");
|
||||
yang_afi_safi_identity2value(af_name, &afi, &safi);
|
||||
|
||||
nbr_dnode = yang_dnode_get_parent(nbr_af_dnode, "neighbor");
|
||||
bgp = nb_running_get_entry(nbr_dnode, NULL, true);
|
||||
peer_str = yang_dnode_get_string(nbr_dnode, "./remote-address");
|
||||
peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg,
|
||||
args->errmsg_len);
|
||||
if (!peer)
|
||||
return;
|
||||
|
||||
bgp_peer_afi_safi_maximum_prefix_set(args, peer, afi, safi);
|
||||
}
|
||||
|
||||
/*
|
||||
* XPath:
|
||||
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/max-prefixes
|
||||
@ -15582,9 +15455,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_limit_directio
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_neighbor_afi_safi_prefix_limit_list_destroy(args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
@ -16487,9 +16360,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_limit_direct
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_neighbor_afi_safi_prefix_limit_list_destroy(args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
@ -17392,9 +17265,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_limit_direct
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_neighbor_afi_safi_prefix_limit_list_destroy(args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
@ -18297,9 +18170,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_limit_
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_neighbor_afi_safi_prefix_limit_list_destroy(args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
@ -19202,9 +19075,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_limit_
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_neighbor_afi_safi_prefix_limit_list_destroy(args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
@ -20005,9 +19878,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limit_di
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_neighbor_afi_safi_prefix_limit_list_destroy(args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
@ -20808,9 +20681,9 @@ int bgp_neighbors_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limit_di
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_neighbor_afi_safi_prefix_limit_list_destroy(args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
@ -22013,46 +21886,6 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_default_or
|
||||
return NB_OK;
|
||||
}
|
||||
|
||||
static int bgp_unnumbered_neighbor_afi_safi_prefix_limit_list_destroy(
|
||||
struct nb_cb_destroy_args *args)
|
||||
{
|
||||
struct bgp *bgp;
|
||||
const char *peer_str;
|
||||
struct peer *peer;
|
||||
const struct lyd_node *nbr_dnode;
|
||||
const struct lyd_node *nbr_af_dnode;
|
||||
const char *af_name;
|
||||
afi_t afi;
|
||||
safi_t safi;
|
||||
int direction;
|
||||
|
||||
nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi");
|
||||
af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name");
|
||||
yang_afi_safi_identity2value(af_name, &afi, &safi);
|
||||
|
||||
nbr_dnode = yang_dnode_get_parent(nbr_af_dnode, "unnumbered-neighbor");
|
||||
bgp = nb_running_get_entry(nbr_dnode, NULL, true);
|
||||
peer_str = yang_dnode_get_string(nbr_dnode, "./interface");
|
||||
peer = bgp_unnumbered_neighbor_peer_lookup(bgp, peer_str, args->errmsg,
|
||||
args->errmsg_len);
|
||||
if (!peer)
|
||||
return NB_ERR_INCONSISTENCY;
|
||||
|
||||
direction = yang_dnode_get_enum(args->dnode, "./direction");
|
||||
|
||||
switch (direction) {
|
||||
case 1:
|
||||
peer_maximum_prefix_unset(peer, afi, safi);
|
||||
break;
|
||||
case 2:
|
||||
UNSET_FLAG(peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_OUT);
|
||||
peer->pmax_out[afi][safi] = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* XPath:
|
||||
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list
|
||||
@ -22079,42 +21912,14 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_unicast_prefix_lim
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_unnumbered_neighbor_afi_safi_prefix_limit_list_destroy(
|
||||
args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
}
|
||||
|
||||
void bgp_unnumbered_neighbor_afi_safi_prefix_limit_apply_finish(
|
||||
struct nb_cb_apply_finish_args *args)
|
||||
{
|
||||
struct bgp *bgp;
|
||||
const char *peer_str;
|
||||
struct peer *peer;
|
||||
const struct lyd_node *nbr_dnode;
|
||||
const struct lyd_node *nbr_af_dnode;
|
||||
const char *af_name;
|
||||
afi_t afi;
|
||||
safi_t safi;
|
||||
|
||||
nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi");
|
||||
af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name");
|
||||
yang_afi_safi_identity2value(af_name, &afi, &safi);
|
||||
|
||||
nbr_dnode = yang_dnode_get_parent(nbr_af_dnode, "unnumbered-neighbor");
|
||||
bgp = nb_running_get_entry(nbr_dnode, NULL, true);
|
||||
peer_str = yang_dnode_get_string(nbr_dnode, "./interface");
|
||||
peer = bgp_unnumbered_neighbor_peer_lookup(bgp, peer_str, args->errmsg,
|
||||
args->errmsg_len);
|
||||
if (!peer)
|
||||
return;
|
||||
|
||||
bgp_peer_afi_safi_maximum_prefix_set(args, peer, afi, safi);
|
||||
}
|
||||
|
||||
/*
|
||||
* XPath:
|
||||
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/max-prefixes
|
||||
@ -23604,10 +23409,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_unicast_prefix_lim
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_unnumbered_neighbor_afi_safi_prefix_limit_list_destroy(
|
||||
args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
@ -24510,10 +24314,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_multicast_prefix_l
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_unnumbered_neighbor_afi_safi_prefix_limit_list_destroy(
|
||||
args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
@ -25416,10 +25219,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_multicast_prefix_l
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_unnumbered_neighbor_afi_safi_prefix_limit_list_destroy(
|
||||
args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
@ -26322,10 +26124,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv4_labeled_unicast_pr
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_unnumbered_neighbor_afi_safi_prefix_limit_list_destroy(
|
||||
args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
@ -27228,10 +27029,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_ipv6_labeled_unicast_pr
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_unnumbered_neighbor_afi_safi_prefix_limit_list_destroy(
|
||||
args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
@ -28032,10 +27832,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv4_unicast_pref
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_unnumbered_neighbor_afi_safi_prefix_limit_list_destroy(
|
||||
args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
@ -28836,10 +28635,9 @@ int bgp_neighbors_unnumbered_neighbor_afi_safis_afi_safi_l3vpn_ipv6_unicast_pref
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_unnumbered_neighbor_afi_safi_prefix_limit_list_destroy(
|
||||
args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
@ -30039,44 +29837,6 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_default_originate
|
||||
return NB_OK;
|
||||
}
|
||||
|
||||
static int bgp_peer_group_afi_safi_prefix_limit_list_destroy(
|
||||
struct nb_cb_destroy_args *args)
|
||||
{
|
||||
struct bgp *bgp;
|
||||
const char *peer_str;
|
||||
struct peer *peer;
|
||||
const struct lyd_node *nbr_dnode;
|
||||
const struct lyd_node *nbr_af_dnode;
|
||||
const char *af_name;
|
||||
afi_t afi;
|
||||
safi_t safi;
|
||||
int direction;
|
||||
|
||||
nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi");
|
||||
af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name");
|
||||
yang_afi_safi_identity2value(af_name, &afi, &safi);
|
||||
|
||||
nbr_dnode = yang_dnode_get_parent(nbr_af_dnode, "peer-group");
|
||||
bgp = nb_running_get_entry(nbr_dnode, NULL, true);
|
||||
peer_str = yang_dnode_get_string(nbr_dnode, "./peer-group-name");
|
||||
peer = bgp_peer_group_peer_lookup(bgp, peer_str);
|
||||
if (!peer)
|
||||
return NB_ERR_INCONSISTENCY;
|
||||
|
||||
direction = yang_dnode_get_enum(args->dnode, "./direction");
|
||||
|
||||
switch (direction) {
|
||||
case 1:
|
||||
peer_maximum_prefix_unset(peer, afi, safi);
|
||||
break;
|
||||
case 2:
|
||||
UNSET_FLAG(peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_OUT);
|
||||
peer->pmax_out[afi][safi] = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
}
|
||||
/*
|
||||
* XPath:
|
||||
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list
|
||||
@ -30103,39 +29863,14 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_unicast_prefix_limit_dire
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_peer_group_afi_safi_prefix_limit_list_destroy(args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
}
|
||||
|
||||
void bgp_peer_group_afi_safi_prefix_limit_apply_finish(
|
||||
struct nb_cb_apply_finish_args *args)
|
||||
{
|
||||
struct bgp *bgp;
|
||||
const char *peer_str;
|
||||
struct peer *peer;
|
||||
const struct lyd_node *nbr_dnode;
|
||||
const struct lyd_node *nbr_af_dnode;
|
||||
const char *af_name;
|
||||
afi_t afi;
|
||||
safi_t safi;
|
||||
|
||||
nbr_af_dnode = yang_dnode_get_parent(args->dnode, "afi-safi");
|
||||
af_name = yang_dnode_get_string(nbr_af_dnode, "./afi-safi-name");
|
||||
yang_afi_safi_identity2value(af_name, &afi, &safi);
|
||||
|
||||
nbr_dnode = yang_dnode_get_parent(nbr_af_dnode, "peer-group");
|
||||
bgp = nb_running_get_entry(nbr_dnode, NULL, true);
|
||||
peer_str = yang_dnode_get_string(nbr_dnode, "./peer-group-name");
|
||||
peer = bgp_peer_group_peer_lookup(bgp, peer_str);
|
||||
if (!peer)
|
||||
return;
|
||||
|
||||
bgp_peer_afi_safi_maximum_prefix_set(args, peer, afi, safi);
|
||||
}
|
||||
/*
|
||||
* XPath:
|
||||
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/afi-safis/afi-safi/ipv4-unicast/prefix-limit/direction-list/max-prefixes
|
||||
@ -31622,9 +31357,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_unicast_prefix_limit_dire
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_peer_group_afi_safi_prefix_limit_list_destroy(args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
@ -32527,9 +32262,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_multicast_prefix_limit_di
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_peer_group_afi_safi_prefix_limit_list_destroy(args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
@ -33432,9 +33167,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_multicast_prefix_limit_di
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_peer_group_afi_safi_prefix_limit_list_destroy(args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
@ -34337,9 +34072,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv4_labeled_unicast_prefix_li
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_peer_group_afi_safi_prefix_limit_list_destroy(args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
@ -35242,9 +34977,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_labeled_unicast_prefix_li
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_peer_group_afi_safi_prefix_limit_list_destroy(args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
@ -36045,9 +35780,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv4_unicast_prefix_limi
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_peer_group_afi_safi_prefix_limit_list_destroy(args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
@ -36848,9 +36583,9 @@ int bgp_peer_groups_peer_group_afi_safis_afi_safi_l3vpn_ipv6_unicast_prefix_limi
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
return bgp_peer_group_afi_safi_prefix_limit_list_destroy(args);
|
||||
/* TODO: implement me. */
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
|
311
bgpd/bgp_vty.c
311
bgpd/bgp_vty.c
@ -8390,6 +8390,55 @@ ALIAS_HIDDEN(no_neighbor_unsuppress_map, no_neighbor_unsuppress_map_hidden_cmd,
|
||||
"Route-map to selectively unsuppress suppressed routes\n"
|
||||
"Name of route map\n")
|
||||
|
||||
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 *force_str)
|
||||
{
|
||||
int ret;
|
||||
struct peer *peer;
|
||||
uint32_t max;
|
||||
uint8_t threshold;
|
||||
uint16_t restart;
|
||||
|
||||
peer = peer_and_group_lookup_vty(vty, ip_str);
|
||||
if (!peer)
|
||||
return CMD_WARNING_CONFIG_FAILED;
|
||||
|
||||
max = strtoul(num_str, NULL, 10);
|
||||
if (threshold_str)
|
||||
threshold = atoi(threshold_str);
|
||||
else
|
||||
threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
|
||||
|
||||
if (restart_str)
|
||||
restart = atoi(restart_str);
|
||||
else
|
||||
restart = 0;
|
||||
|
||||
ret = peer_maximum_prefix_set(peer, afi, safi, max, threshold, warning,
|
||||
restart, force_str ? true : false);
|
||||
|
||||
return bgp_vty_return(vty, ret);
|
||||
}
|
||||
|
||||
static int peer_maximum_prefix_unset_vty(struct vty *vty, const char *ip_str,
|
||||
afi_t afi, safi_t safi)
|
||||
{
|
||||
int ret;
|
||||
struct peer *peer;
|
||||
|
||||
peer = peer_and_group_lookup_vty(vty, ip_str);
|
||||
if (!peer)
|
||||
return CMD_WARNING_CONFIG_FAILED;
|
||||
|
||||
ret = peer_maximum_prefix_unset(peer, afi, safi);
|
||||
|
||||
return bgp_vty_return(vty, ret);
|
||||
}
|
||||
|
||||
/* Maximum number of prefix to be sent to the neighbor. */
|
||||
DEFUN(neighbor_maximum_prefix_out,
|
||||
neighbor_maximum_prefix_out_cmd,
|
||||
@ -8399,32 +8448,23 @@ DEFUN(neighbor_maximum_prefix_out,
|
||||
"Maximum number of prefixes to be sent to this peer\n"
|
||||
"Maximum no. of prefix limit\n")
|
||||
{
|
||||
char base_xpath[XPATH_MAXLEN];
|
||||
char af_xpath[XPATH_MAXLEN];
|
||||
char attr_xpath[XPATH_MAXLEN];
|
||||
int idx_peer = 1;
|
||||
int idx_number = 3;
|
||||
struct peer *peer;
|
||||
uint32_t max;
|
||||
afi_t afi = bgp_node_afi(vty);
|
||||
safi_t safi = bgp_node_safi(vty);
|
||||
|
||||
snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH,
|
||||
yang_afi_safi_value2identity(afi, safi));
|
||||
if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath,
|
||||
sizeof(base_xpath), af_xpath)
|
||||
< 0)
|
||||
peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg);
|
||||
if (!peer)
|
||||
return CMD_WARNING_CONFIG_FAILED;
|
||||
|
||||
snprintf(attr_xpath, sizeof(attr_xpath),
|
||||
"/%s/prefix-limit/direction-list[direction='out']",
|
||||
bgp_afi_safi_get_container_str(afi, safi));
|
||||
strlcat(base_xpath, attr_xpath, sizeof(base_xpath));
|
||||
max = strtoul(argv[idx_number]->arg, NULL, 10);
|
||||
|
||||
nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL);
|
||||
SET_FLAG(peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_OUT);
|
||||
peer->pmax_out[afi][safi] = max;
|
||||
|
||||
nb_cli_enqueue_change(vty, "./max-prefixes", NB_OP_MODIFY,
|
||||
argv[idx_number]->arg);
|
||||
|
||||
return nb_cli_apply_changes(vty, base_xpath);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(no_neighbor_maximum_prefix_out,
|
||||
@ -8435,28 +8475,19 @@ DEFUN(no_neighbor_maximum_prefix_out,
|
||||
NEIGHBOR_ADDR_STR2
|
||||
"Maximum number of prefixes to be sent to this peer\n")
|
||||
{
|
||||
char base_xpath[XPATH_MAXLEN];
|
||||
char af_xpath[XPATH_MAXLEN];
|
||||
char attr_xpath[XPATH_MAXLEN];
|
||||
int idx_peer = 2;
|
||||
struct peer *peer;
|
||||
afi_t afi = bgp_node_afi(vty);
|
||||
safi_t safi = bgp_node_safi(vty);
|
||||
|
||||
snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH,
|
||||
yang_afi_safi_value2identity(afi, safi));
|
||||
if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath,
|
||||
sizeof(base_xpath), af_xpath)
|
||||
< 0)
|
||||
peer = peer_and_group_lookup_vty(vty, argv[idx_peer]->arg);
|
||||
if (!peer)
|
||||
return CMD_WARNING_CONFIG_FAILED;
|
||||
|
||||
snprintf(attr_xpath, sizeof(attr_xpath),
|
||||
"/%s/prefix-limit/direction-list[direction='out']",
|
||||
bgp_afi_safi_get_container_str(afi, safi));
|
||||
strlcat(base_xpath, attr_xpath, sizeof(base_xpath));
|
||||
UNSET_FLAG(peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_OUT);
|
||||
peer->pmax_out[afi][safi] = 0;
|
||||
|
||||
nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
|
||||
|
||||
return nb_cli_apply_changes(vty, base_xpath);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
/* Maximum number of prefix configuration. Prefix count is different
|
||||
@ -8474,33 +8505,14 @@ DEFUN (neighbor_maximum_prefix,
|
||||
int idx_peer = 1;
|
||||
int idx_number = 3;
|
||||
int idx_force = 0;
|
||||
char base_xpath[XPATH_MAXLEN];
|
||||
char af_xpath[XPATH_MAXLEN];
|
||||
char attr_xpath[XPATH_MAXLEN];
|
||||
afi_t afi = bgp_node_afi(vty);
|
||||
safi_t safi = bgp_node_safi(vty);
|
||||
char *force = NULL;
|
||||
|
||||
snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH,
|
||||
yang_afi_safi_value2identity(afi, safi));
|
||||
if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath,
|
||||
sizeof(base_xpath), af_xpath)
|
||||
< 0)
|
||||
return CMD_WARNING_CONFIG_FAILED;
|
||||
|
||||
snprintf(attr_xpath, sizeof(attr_xpath),
|
||||
"/%s/prefix-limit/direction-list[direction='in']",
|
||||
bgp_afi_safi_get_container_str(afi, safi));
|
||||
strlcat(base_xpath, attr_xpath, sizeof(base_xpath));
|
||||
|
||||
nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL);
|
||||
|
||||
nb_cli_enqueue_change(vty, "./max-prefixes", NB_OP_MODIFY,
|
||||
argv[idx_number]->arg);
|
||||
if (argv_find(argv, argc, "force", &idx_force))
|
||||
nb_cli_enqueue_change(vty, "./force-check", NB_OP_MODIFY,
|
||||
"true");
|
||||
force = argv[idx_force]->arg;
|
||||
|
||||
return nb_cli_apply_changes(vty, base_xpath);
|
||||
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, force);
|
||||
}
|
||||
|
||||
ALIAS_HIDDEN(neighbor_maximum_prefix, neighbor_maximum_prefix_hidden_cmd,
|
||||
@ -8524,37 +8536,14 @@ DEFUN (neighbor_maximum_prefix_threshold,
|
||||
int idx_number = 3;
|
||||
int idx_number_2 = 4;
|
||||
int idx_force = 0;
|
||||
char base_xpath[XPATH_MAXLEN];
|
||||
char af_xpath[XPATH_MAXLEN];
|
||||
char attr_xpath[XPATH_MAXLEN];
|
||||
afi_t afi = bgp_node_afi(vty);
|
||||
safi_t safi = bgp_node_safi(vty);
|
||||
|
||||
snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH,
|
||||
yang_afi_safi_value2identity(afi, safi));
|
||||
if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath,
|
||||
sizeof(base_xpath), af_xpath)
|
||||
< 0)
|
||||
return CMD_WARNING_CONFIG_FAILED;
|
||||
|
||||
snprintf(attr_xpath, sizeof(attr_xpath),
|
||||
"/%s/prefix-limit/direction-list[direction='in']",
|
||||
bgp_afi_safi_get_container_str(afi, safi));
|
||||
strlcat(base_xpath, attr_xpath, sizeof(base_xpath));
|
||||
|
||||
nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL);
|
||||
|
||||
nb_cli_enqueue_change(vty, "./max-prefixes", NB_OP_MODIFY,
|
||||
argv[idx_number]->arg);
|
||||
|
||||
nb_cli_enqueue_change(vty, "./options/shutdown-threshold-pct",
|
||||
NB_OP_MODIFY, argv[idx_number_2]->arg);
|
||||
char *force = NULL;
|
||||
|
||||
if (argv_find(argv, argc, "force", &idx_force))
|
||||
nb_cli_enqueue_change(vty, "./force-check", NB_OP_MODIFY,
|
||||
"true");
|
||||
force = argv[idx_force]->arg;
|
||||
|
||||
return nb_cli_apply_changes(vty, base_xpath);
|
||||
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, force);
|
||||
}
|
||||
|
||||
ALIAS_HIDDEN(
|
||||
@ -8580,36 +8569,14 @@ DEFUN (neighbor_maximum_prefix_warning,
|
||||
int idx_peer = 1;
|
||||
int idx_number = 3;
|
||||
int idx_force = 0;
|
||||
char base_xpath[XPATH_MAXLEN];
|
||||
char af_xpath[XPATH_MAXLEN];
|
||||
char attr_xpath[XPATH_MAXLEN];
|
||||
afi_t afi = bgp_node_afi(vty);
|
||||
safi_t safi = bgp_node_safi(vty);
|
||||
char *force = NULL;
|
||||
|
||||
snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH,
|
||||
yang_afi_safi_value2identity(afi, safi));
|
||||
if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath,
|
||||
sizeof(base_xpath), af_xpath)
|
||||
< 0)
|
||||
return CMD_WARNING_CONFIG_FAILED;
|
||||
|
||||
snprintf(attr_xpath, sizeof(attr_xpath),
|
||||
"/%s/prefix-limit/direction-list[direction='in']",
|
||||
bgp_afi_safi_get_container_str(afi, safi));
|
||||
strlcat(base_xpath, attr_xpath, sizeof(base_xpath));
|
||||
|
||||
nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL);
|
||||
|
||||
nb_cli_enqueue_change(vty, "./max-prefixes", NB_OP_MODIFY,
|
||||
argv[idx_number]->arg);
|
||||
|
||||
nb_cli_enqueue_change(vty, "./options/warning-only", NB_OP_MODIFY,
|
||||
"true");
|
||||
if (argv_find(argv, argc, "force", &idx_force))
|
||||
nb_cli_enqueue_change(vty, "./force-check", NB_OP_MODIFY,
|
||||
"true");
|
||||
force = argv[idx_force]->arg;
|
||||
|
||||
return nb_cli_apply_changes(vty, base_xpath);
|
||||
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, force);
|
||||
}
|
||||
|
||||
ALIAS_HIDDEN(
|
||||
@ -8637,37 +8604,14 @@ DEFUN (neighbor_maximum_prefix_threshold_warning,
|
||||
int idx_number = 3;
|
||||
int idx_number_2 = 4;
|
||||
int idx_force = 0;
|
||||
char base_xpath[XPATH_MAXLEN];
|
||||
char af_xpath[XPATH_MAXLEN];
|
||||
char attr_xpath[XPATH_MAXLEN];
|
||||
afi_t afi = bgp_node_afi(vty);
|
||||
safi_t safi = bgp_node_safi(vty);
|
||||
char *force = NULL;
|
||||
|
||||
snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH,
|
||||
yang_afi_safi_value2identity(afi, safi));
|
||||
if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath,
|
||||
sizeof(base_xpath), af_xpath)
|
||||
< 0)
|
||||
return CMD_WARNING_CONFIG_FAILED;
|
||||
|
||||
snprintf(attr_xpath, sizeof(attr_xpath),
|
||||
"/%s/prefix-limit/direction-list[direction='in']",
|
||||
bgp_afi_safi_get_container_str(afi, safi));
|
||||
strlcat(base_xpath, attr_xpath, sizeof(base_xpath));
|
||||
|
||||
nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL);
|
||||
|
||||
nb_cli_enqueue_change(vty, "./max-prefixes", NB_OP_MODIFY,
|
||||
argv[idx_number]->arg);
|
||||
nb_cli_enqueue_change(vty, "./options/tw-shutdown-threshold-pct",
|
||||
NB_OP_MODIFY, argv[idx_number_2]->arg);
|
||||
nb_cli_enqueue_change(vty, "./options/tw-warning-only", NB_OP_MODIFY,
|
||||
"true");
|
||||
if (argv_find(argv, argc, "force", &idx_force))
|
||||
nb_cli_enqueue_change(vty, "./force-check", NB_OP_MODIFY,
|
||||
"true");
|
||||
force = argv[idx_force]->arg;
|
||||
|
||||
return nb_cli_apply_changes(vty, base_xpath);
|
||||
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, force);
|
||||
}
|
||||
|
||||
ALIAS_HIDDEN(
|
||||
@ -8696,35 +8640,14 @@ DEFUN (neighbor_maximum_prefix_restart,
|
||||
int idx_number = 3;
|
||||
int idx_number_2 = 5;
|
||||
int idx_force = 0;
|
||||
char base_xpath[XPATH_MAXLEN];
|
||||
char af_xpath[XPATH_MAXLEN];
|
||||
char attr_xpath[XPATH_MAXLEN];
|
||||
afi_t afi = bgp_node_afi(vty);
|
||||
safi_t safi = bgp_node_safi(vty);
|
||||
char *force = NULL;
|
||||
|
||||
snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH,
|
||||
yang_afi_safi_value2identity(afi, safi));
|
||||
if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath,
|
||||
sizeof(base_xpath), af_xpath)
|
||||
< 0)
|
||||
return CMD_WARNING_CONFIG_FAILED;
|
||||
|
||||
snprintf(attr_xpath, sizeof(attr_xpath),
|
||||
"/%s/prefix-limit/direction-list[direction='in']",
|
||||
bgp_afi_safi_get_container_str(afi, safi));
|
||||
strlcat(base_xpath, attr_xpath, sizeof(base_xpath));
|
||||
|
||||
nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL);
|
||||
|
||||
nb_cli_enqueue_change(vty, "./max-prefixes", NB_OP_MODIFY,
|
||||
argv[idx_number]->arg);
|
||||
nb_cli_enqueue_change(vty, "./options/restart-timer", NB_OP_MODIFY,
|
||||
argv[idx_number_2]->arg);
|
||||
if (argv_find(argv, argc, "force", &idx_force))
|
||||
nb_cli_enqueue_change(vty, "./force-check", NB_OP_MODIFY,
|
||||
"true");
|
||||
force = argv[idx_force]->arg;
|
||||
|
||||
return nb_cli_apply_changes(vty, base_xpath);
|
||||
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, force);
|
||||
}
|
||||
|
||||
ALIAS_HIDDEN(
|
||||
@ -8755,37 +8678,15 @@ DEFUN (neighbor_maximum_prefix_threshold_restart,
|
||||
int idx_number_2 = 4;
|
||||
int idx_number_3 = 6;
|
||||
int idx_force = 0;
|
||||
char base_xpath[XPATH_MAXLEN];
|
||||
char af_xpath[XPATH_MAXLEN];
|
||||
char attr_xpath[XPATH_MAXLEN];
|
||||
afi_t afi = bgp_node_afi(vty);
|
||||
safi_t safi = bgp_node_safi(vty);
|
||||
char *force = NULL;
|
||||
|
||||
snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH,
|
||||
yang_afi_safi_value2identity(afi, safi));
|
||||
if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath,
|
||||
sizeof(base_xpath), af_xpath)
|
||||
< 0)
|
||||
return CMD_WARNING_CONFIG_FAILED;
|
||||
|
||||
snprintf(attr_xpath, sizeof(attr_xpath),
|
||||
"/%s/prefix-limit/direction-list[direction='in']",
|
||||
bgp_afi_safi_get_container_str(afi, safi));
|
||||
strlcat(base_xpath, attr_xpath, sizeof(base_xpath));
|
||||
|
||||
nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL);
|
||||
|
||||
nb_cli_enqueue_change(vty, "./max-prefixes", NB_OP_MODIFY,
|
||||
argv[idx_number]->arg);
|
||||
nb_cli_enqueue_change(vty, "./options/tr-shutdown-threshold-pct",
|
||||
NB_OP_MODIFY, argv[idx_number_2]->arg);
|
||||
nb_cli_enqueue_change(vty, "./options/tr-restart-timer", NB_OP_MODIFY,
|
||||
argv[idx_number_3]->arg);
|
||||
if (argv_find(argv, argc, "force", &idx_force))
|
||||
nb_cli_enqueue_change(vty, "./force-check", NB_OP_MODIFY,
|
||||
"true");
|
||||
force = argv[idx_force]->arg;
|
||||
|
||||
return nb_cli_apply_changes(vty, base_xpath);
|
||||
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, force);
|
||||
}
|
||||
|
||||
ALIAS_HIDDEN(
|
||||
@ -8815,27 +8716,9 @@ DEFUN (no_neighbor_maximum_prefix,
|
||||
"Force checking all received routes not only accepted\n")
|
||||
{
|
||||
int idx_peer = 2;
|
||||
char base_xpath[XPATH_MAXLEN];
|
||||
char af_xpath[XPATH_MAXLEN];
|
||||
char attr_xpath[XPATH_MAXLEN];
|
||||
afi_t afi = bgp_node_afi(vty);
|
||||
safi_t safi = bgp_node_safi(vty);
|
||||
|
||||
snprintf(af_xpath, sizeof(af_xpath), FRR_BGP_AF_XPATH,
|
||||
yang_afi_safi_value2identity(afi, safi));
|
||||
if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath,
|
||||
sizeof(base_xpath), af_xpath)
|
||||
< 0)
|
||||
return CMD_WARNING_CONFIG_FAILED;
|
||||
|
||||
snprintf(attr_xpath, sizeof(attr_xpath),
|
||||
"/%s/prefix-limit/direction-list[direction='in']",
|
||||
bgp_afi_safi_get_container_str(afi, safi));
|
||||
strlcat(base_xpath, attr_xpath, sizeof(base_xpath));
|
||||
|
||||
nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
|
||||
|
||||
return nb_cli_apply_changes(vty, base_xpath);
|
||||
return peer_maximum_prefix_unset_vty(vty, argv[idx_peer]->arg,
|
||||
bgp_node_afi(vty),
|
||||
bgp_node_safi(vty));
|
||||
}
|
||||
|
||||
ALIAS_HIDDEN(
|
||||
|
Loading…
Reference in New Issue
Block a user