mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 15:33:56 +00:00
Merge pull request #12187 from mjstapp/mjs_fix_bgp_allowas
bgpd: fix unconfig of allowas_in; add to show output
This commit is contained in:
commit
bcc6ffbd7b
@ -4000,6 +4000,7 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
|
|||||||
bool force_evpn_import = false;
|
bool force_evpn_import = false;
|
||||||
safi_t orig_safi = safi;
|
safi_t orig_safi = safi;
|
||||||
bool leak_success = true;
|
bool leak_success = true;
|
||||||
|
int allowas_in = 0;
|
||||||
|
|
||||||
if (frrtrace_enabled(frr_bgp, process_update)) {
|
if (frrtrace_enabled(frr_bgp, process_update)) {
|
||||||
char pfxprint[PREFIX2STR_BUFFER];
|
char pfxprint[PREFIX2STR_BUFFER];
|
||||||
@ -4045,6 +4046,10 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
|
|||||||
&& peer != bgp->peer_self)
|
&& peer != bgp->peer_self)
|
||||||
bgp_adj_in_set(dest, peer, attr, addpath_id);
|
bgp_adj_in_set(dest, peer, attr, addpath_id);
|
||||||
|
|
||||||
|
/* Update permitted loop count */
|
||||||
|
if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN))
|
||||||
|
allowas_in = peer->allowas_in[afi][safi];
|
||||||
|
|
||||||
/* Check previously received route. */
|
/* Check previously received route. */
|
||||||
for (pi = bgp_dest_get_bgp_path_info(dest); pi; pi = pi->next)
|
for (pi = bgp_dest_get_bgp_path_info(dest); pi; pi = pi->next)
|
||||||
if (pi->peer == peer && pi->type == type
|
if (pi->peer == peer && pi->type == type
|
||||||
@ -4054,8 +4059,8 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
|
|||||||
|
|
||||||
/* AS path local-as loop check. */
|
/* AS path local-as loop check. */
|
||||||
if (peer->change_local_as) {
|
if (peer->change_local_as) {
|
||||||
if (peer->allowas_in[afi][safi])
|
if (allowas_in)
|
||||||
aspath_loop_count = peer->allowas_in[afi][safi];
|
aspath_loop_count = allowas_in;
|
||||||
else if (!CHECK_FLAG(peer->flags,
|
else if (!CHECK_FLAG(peer->flags,
|
||||||
PEER_FLAG_LOCAL_AS_NO_PREPEND))
|
PEER_FLAG_LOCAL_AS_NO_PREPEND))
|
||||||
aspath_loop_count = 1;
|
aspath_loop_count = 1;
|
||||||
@ -4078,11 +4083,10 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
|
|||||||
|
|
||||||
/* AS path loop check. */
|
/* AS path loop check. */
|
||||||
if (do_loop_check) {
|
if (do_loop_check) {
|
||||||
if (aspath_loop_check(attr->aspath, bgp->as)
|
if (aspath_loop_check(attr->aspath, bgp->as) > allowas_in ||
|
||||||
> peer->allowas_in[afi][safi]
|
(CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION) &&
|
||||||
|| (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)
|
(aspath_loop_check(attr->aspath, bgp->confed_id) >
|
||||||
&& aspath_loop_check(attr->aspath, bgp->confed_id)
|
allowas_in))) {
|
||||||
> peer->allowas_in[afi][safi])) {
|
|
||||||
peer->stat_pfx_aspath_loop++;
|
peer->stat_pfx_aspath_loop++;
|
||||||
reason = "as-path contains our own AS;";
|
reason = "as-path contains our own AS;";
|
||||||
goto filtered;
|
goto filtered;
|
||||||
|
@ -12282,6 +12282,16 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi,
|
|||||||
json_addr,
|
json_addr,
|
||||||
"privateAsNumsRemovedInUpdatesToNbr");
|
"privateAsNumsRemovedInUpdatesToNbr");
|
||||||
|
|
||||||
|
if (CHECK_FLAG(p->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN)) {
|
||||||
|
if (CHECK_FLAG(p->af_flags[afi][safi],
|
||||||
|
PEER_FLAG_ALLOWAS_IN_ORIGIN))
|
||||||
|
json_object_boolean_true_add(json_addr,
|
||||||
|
"allowAsInOrigin");
|
||||||
|
else
|
||||||
|
json_object_int_add(json_addr, "allowAsInCount",
|
||||||
|
p->allowas_in[afi][safi]);
|
||||||
|
}
|
||||||
|
|
||||||
if (p->addpath_type[afi][safi] != BGP_ADDPATH_NONE)
|
if (p->addpath_type[afi][safi] != BGP_ADDPATH_NONE)
|
||||||
json_object_boolean_true_add(
|
json_object_boolean_true_add(
|
||||||
json_addr,
|
json_addr,
|
||||||
@ -12598,6 +12608,17 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi,
|
|||||||
vty_out(vty,
|
vty_out(vty,
|
||||||
" Private AS numbers removed in updates to this neighbor\n");
|
" Private AS numbers removed in updates to this neighbor\n");
|
||||||
|
|
||||||
|
if (CHECK_FLAG(p->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN)) {
|
||||||
|
if (CHECK_FLAG(p->af_flags[afi][safi],
|
||||||
|
PEER_FLAG_ALLOWAS_IN_ORIGIN))
|
||||||
|
vty_out(vty,
|
||||||
|
" Local AS allowed as path origin\n");
|
||||||
|
else
|
||||||
|
vty_out(vty,
|
||||||
|
" Local AS allowed in path, %d occurrences\n",
|
||||||
|
p->allowas_in[afi][safi]);
|
||||||
|
}
|
||||||
|
|
||||||
if (p->addpath_type[afi][safi] != BGP_ADDPATH_NONE)
|
if (p->addpath_type[afi][safi] != BGP_ADDPATH_NONE)
|
||||||
vty_out(vty, " %s\n",
|
vty_out(vty, " %s\n",
|
||||||
bgp_addpath_names(p->addpath_type[afi][safi])
|
bgp_addpath_names(p->addpath_type[afi][safi])
|
||||||
|
Loading…
Reference in New Issue
Block a user