mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-27 13:06:51 +00:00
Merge pull request #17195 from FRRouting/mergify/bp/dev/10.2/pr-17165
bgpd: Do not filter no-export community for BGP OAD (backport #17165)
This commit is contained in:
commit
c471385a21
@ -1779,14 +1779,13 @@ static bool bgp_community_filter(struct peer *peer, struct attr *attr)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* NO_EXPORT check. */
|
/* NO_EXPORT check. */
|
||||||
if (peer->sort == BGP_PEER_EBGP &&
|
if (peer->sort == BGP_PEER_EBGP && peer->sub_sort != BGP_PEER_EBGP_OAD &&
|
||||||
community_include(bgp_attr_get_community(attr),
|
community_include(bgp_attr_get_community(attr), COMMUNITY_NO_EXPORT))
|
||||||
COMMUNITY_NO_EXPORT))
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* NO_EXPORT_SUBCONFED check. */
|
/* NO_EXPORT_SUBCONFED check. */
|
||||||
if (peer->sort == BGP_PEER_EBGP
|
if ((peer->sort == BGP_PEER_EBGP && peer->sub_sort != BGP_PEER_EBGP_OAD) ||
|
||||||
|| peer->sort == BGP_PEER_CONFED)
|
peer->sort == BGP_PEER_CONFED)
|
||||||
if (community_include(bgp_attr_get_community(attr),
|
if (community_include(bgp_attr_get_community(attr),
|
||||||
COMMUNITY_NO_EXPORT_SUBCONFED))
|
COMMUNITY_NO_EXPORT_SUBCONFED))
|
||||||
return true;
|
return true;
|
||||||
|
@ -4,6 +4,7 @@ int r1-eth0
|
|||||||
!
|
!
|
||||||
router bgp 65001
|
router bgp 65001
|
||||||
no bgp ebgp-requires-policy
|
no bgp ebgp-requires-policy
|
||||||
|
no bgp network import-check
|
||||||
neighbor 192.168.1.2 remote-as external
|
neighbor 192.168.1.2 remote-as external
|
||||||
neighbor 192.168.1.2 timers 1 3
|
neighbor 192.168.1.2 timers 1 3
|
||||||
neighbor 192.168.1.2 timers connect 1
|
neighbor 192.168.1.2 timers connect 1
|
||||||
@ -12,10 +13,14 @@ router bgp 65001
|
|||||||
neighbor 192.168.1.4 timers 1 3
|
neighbor 192.168.1.4 timers 1 3
|
||||||
neighbor 192.168.1.4 timers connect 1
|
neighbor 192.168.1.4 timers connect 1
|
||||||
address-family ipv4 unicast
|
address-family ipv4 unicast
|
||||||
|
network 10.10.10.1/32 route-map local
|
||||||
neighbor 192.168.1.4 route-map r4 in
|
neighbor 192.168.1.4 route-map r4 in
|
||||||
exit-address-family
|
exit-address-family
|
||||||
!
|
!
|
||||||
route-map r4 permit 10
|
route-map r4 permit 10
|
||||||
set local-preference 123
|
set local-preference 123
|
||||||
set metric 123
|
set metric 123
|
||||||
exit
|
!
|
||||||
|
route-map local permit 10
|
||||||
|
set community no-export
|
||||||
|
!
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
"""
|
"""
|
||||||
Test if local-preference is passed between different EBGP peers when
|
Test if local-preference is passed between different EBGP peers when
|
||||||
EBGP-OAD is configured.
|
EBGP-OAD is configured.
|
||||||
|
|
||||||
|
Also check if no-export community is passed to the EBGP-OAD peer.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@ -51,6 +53,9 @@ def test_bgp_oad():
|
|||||||
pytest.skip(tgen.errors)
|
pytest.skip(tgen.errors)
|
||||||
|
|
||||||
r1 = tgen.gears["r1"]
|
r1 = tgen.gears["r1"]
|
||||||
|
r2 = tgen.gears["r2"]
|
||||||
|
r3 = tgen.gears["r3"]
|
||||||
|
r4 = tgen.gears["r4"]
|
||||||
|
|
||||||
def _bgp_converge():
|
def _bgp_converge():
|
||||||
output = json.loads(r1.vtysh_cmd("show bgp ipv4 unicast 10.10.10.10/32 json"))
|
output = json.loads(r1.vtysh_cmd("show bgp ipv4 unicast 10.10.10.10/32 json"))
|
||||||
@ -85,6 +90,37 @@ def test_bgp_oad():
|
|||||||
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
|
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
|
||||||
assert result is None, "Can't converge"
|
assert result is None, "Can't converge"
|
||||||
|
|
||||||
|
def _bgp_check_no_export(router, arg=[{"valid": True}]):
|
||||||
|
output = json.loads(router.vtysh_cmd("show bgp ipv4 unicast json"))
|
||||||
|
expected = {
|
||||||
|
"routes": {
|
||||||
|
"10.10.10.1/32": arg,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return topotest.json_cmp(output, expected)
|
||||||
|
|
||||||
|
test_func = functools.partial(
|
||||||
|
_bgp_check_no_export,
|
||||||
|
r2,
|
||||||
|
)
|
||||||
|
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
|
||||||
|
assert result is None, "10.10.10.1/32 should be advertised to r2"
|
||||||
|
|
||||||
|
test_func = functools.partial(
|
||||||
|
_bgp_check_no_export,
|
||||||
|
r3,
|
||||||
|
)
|
||||||
|
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
|
||||||
|
assert result is None, "10.10.10.1/32 should be advertised to r3"
|
||||||
|
|
||||||
|
test_func = functools.partial(
|
||||||
|
_bgp_check_no_export,
|
||||||
|
r4,
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
|
||||||
|
assert result is None, "10.10.10.1/32 should not be advertised to r4 (not OAD peer)"
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
args = ["-s"] + sys.argv[1:]
|
args = ["-s"] + sys.argv[1:]
|
||||||
|
Loading…
Reference in New Issue
Block a user