mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-29 15:51:32 +00:00
Merge pull request #3225 from donaldsharp/revert_default_originate_changes
bgp: Revert default originate changes to allow set
This commit is contained in:
commit
0558dc67a3
@ -664,7 +664,8 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
|
|||||||
{
|
{
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
struct attr attr;
|
struct attr attr;
|
||||||
struct bgp_path_info *info, init_info, tmp_info;
|
struct aspath *aspath;
|
||||||
|
struct bgp_path_info tmp_info;
|
||||||
struct prefix p;
|
struct prefix p;
|
||||||
struct peer *from;
|
struct peer *from;
|
||||||
struct bgp_node *rn;
|
struct bgp_node *rn;
|
||||||
@ -688,59 +689,46 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
|
|||||||
from = bgp->peer_self;
|
from = bgp->peer_self;
|
||||||
|
|
||||||
bgp_attr_default_set(&attr, BGP_ORIGIN_IGP);
|
bgp_attr_default_set(&attr, BGP_ORIGIN_IGP);
|
||||||
|
aspath = attr.aspath;
|
||||||
|
|
||||||
attr.local_pref = bgp->default_local_pref;
|
attr.local_pref = bgp->default_local_pref;
|
||||||
|
|
||||||
if ((afi == AFI_IP6) || peer_cap_enhe(peer, afi, safi)) {
|
|
||||||
/* IPv6 global nexthop must be included.
|
|
||||||
*/
|
|
||||||
attr.mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL;
|
|
||||||
|
|
||||||
/* If the peer is on shared nextwork and
|
|
||||||
* we have link-local nexthop set it. */
|
|
||||||
if (peer->shared_network
|
|
||||||
&& !IN6_IS_ADDR_UNSPECIFIED(&peer->nexthop.v6_local))
|
|
||||||
attr.mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL;
|
|
||||||
}
|
|
||||||
init_info.attr = &attr;
|
|
||||||
info = &init_info;
|
|
||||||
bgp_attr_intern(info->attr);
|
|
||||||
|
|
||||||
memset(&p, 0, sizeof(p));
|
memset(&p, 0, sizeof(p));
|
||||||
p.family = afi2family(afi);
|
p.family = afi2family(afi);
|
||||||
p.prefixlen = 0;
|
p.prefixlen = 0;
|
||||||
|
|
||||||
|
if ((afi == AFI_IP6) || peer_cap_enhe(peer, afi, safi)) {
|
||||||
|
/* IPv6 global nexthop must be included. */
|
||||||
|
attr.mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL;
|
||||||
|
|
||||||
|
/* If the peer is on shared nextwork and we have link-local
|
||||||
|
nexthop set it. */
|
||||||
|
if (peer->shared_network
|
||||||
|
&& !IN6_IS_ADDR_UNSPECIFIED(&peer->nexthop.v6_local))
|
||||||
|
attr.mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL;
|
||||||
|
}
|
||||||
|
|
||||||
if (peer->default_rmap[afi][safi].name) {
|
if (peer->default_rmap[afi][safi].name) {
|
||||||
SET_FLAG(bgp->peer_self->rmap_type, PEER_RMAP_TYPE_DEFAULT);
|
SET_FLAG(bgp->peer_self->rmap_type, PEER_RMAP_TYPE_DEFAULT);
|
||||||
for (rn = bgp_table_top(bgp->rib[afi][safi]); rn;
|
for (rn = bgp_table_top(bgp->rib[afi][safi]); rn;
|
||||||
rn = bgp_route_next(rn)) {
|
rn = bgp_route_next(rn)) {
|
||||||
for (ri = rn->info; ri; ri = ri->next) {
|
for (ri = rn->info; ri; ri = ri->next) {
|
||||||
|
struct attr dummy_attr;
|
||||||
|
|
||||||
|
/* Provide dummy so the route-map can't modify
|
||||||
|
* the attributes */
|
||||||
|
bgp_attr_dup(&dummy_attr, ri->attr);
|
||||||
tmp_info.peer = ri->peer;
|
tmp_info.peer = ri->peer;
|
||||||
tmp_info.attr = ri->attr;
|
tmp_info.attr = &dummy_attr;
|
||||||
|
|
||||||
/* Reset attributes every time to avoid \
|
|
||||||
* unexpected as-path prepends */
|
|
||||||
bgp_attr_default_set(tmp_info.attr,
|
|
||||||
BGP_ORIGIN_IGP);
|
|
||||||
|
|
||||||
if ((afi == AFI_IP6)
|
|
||||||
|| peer_cap_enhe(peer, afi, safi)) {
|
|
||||||
tmp_info.attr->mp_nexthop_len =
|
|
||||||
BGP_ATTR_NHLEN_IPV6_GLOBAL;
|
|
||||||
|
|
||||||
if (peer->shared_network
|
|
||||||
&& !IN6_IS_ADDR_UNSPECIFIED(
|
|
||||||
&peer->nexthop.v6_local))
|
|
||||||
tmp_info.attr->mp_nexthop_len =
|
|
||||||
BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = route_map_apply(
|
ret = route_map_apply(
|
||||||
peer->default_rmap[afi][safi].map,
|
peer->default_rmap[afi][safi].map,
|
||||||
&rn->p, RMAP_BGP, &tmp_info);
|
&rn->p, RMAP_BGP, &tmp_info);
|
||||||
|
|
||||||
info = &tmp_info;
|
/* The route map might have set attributes. If
|
||||||
bgp_attr_intern(info->attr);
|
* we don't flush them
|
||||||
|
* here, they will be leaked. */
|
||||||
|
bgp_attr_flush(&dummy_attr);
|
||||||
if (ret != RMAP_DENYMATCH)
|
if (ret != RMAP_DENYMATCH)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -762,13 +750,12 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
|
|||||||
SUBGRP_STATUS_DEFAULT_ORIGINATE)) {
|
SUBGRP_STATUS_DEFAULT_ORIGINATE)) {
|
||||||
|
|
||||||
if (bgp_flag_check(bgp, BGP_FLAG_GRACEFUL_SHUTDOWN)) {
|
if (bgp_flag_check(bgp, BGP_FLAG_GRACEFUL_SHUTDOWN)) {
|
||||||
bgp_attr_add_gshut_community(info->attr);
|
bgp_attr_add_gshut_community(&attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
SET_FLAG(subgrp->sflags,
|
SET_FLAG(subgrp->sflags,
|
||||||
SUBGRP_STATUS_DEFAULT_ORIGINATE);
|
SUBGRP_STATUS_DEFAULT_ORIGINATE);
|
||||||
subgroup_default_update_packet(subgrp, info->attr,
|
subgroup_default_update_packet(subgrp, &attr, from);
|
||||||
from);
|
|
||||||
|
|
||||||
/* The 'neighbor x.x.x.x default-originate' default will
|
/* The 'neighbor x.x.x.x default-originate' default will
|
||||||
* act as an
|
* act as an
|
||||||
@ -788,7 +775,8 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
|
|||||||
BGP_ADDPATH_TX_ID_FOR_DEFAULT_ORIGINATE);
|
BGP_ADDPATH_TX_ID_FOR_DEFAULT_ORIGINATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aspath_unintern(&info->attr->aspath);
|
|
||||||
|
aspath_unintern(&aspath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1123,6 +1123,8 @@ void subgroup_default_update_packet(struct update_subgroup *subgrp,
|
|||||||
snprintf(tx_id_buf, sizeof(tx_id_buf),
|
snprintf(tx_id_buf, sizeof(tx_id_buf),
|
||||||
" with addpath ID %u",
|
" with addpath ID %u",
|
||||||
BGP_ADDPATH_TX_ID_FOR_DEFAULT_ORIGINATE);
|
BGP_ADDPATH_TX_ID_FOR_DEFAULT_ORIGINATE);
|
||||||
|
else
|
||||||
|
tx_id_buf[0] = '\0';
|
||||||
|
|
||||||
zlog_debug("u%" PRIu64 ":s%" PRIu64 " send UPDATE %s%s %s",
|
zlog_debug("u%" PRIu64 ":s%" PRIu64 " send UPDATE %s%s %s",
|
||||||
(SUBGRP_UPDGRP(subgrp))->id, subgrp->id,
|
(SUBGRP_UPDGRP(subgrp))->id, subgrp->id,
|
||||||
|
Loading…
Reference in New Issue
Block a user