bgpd: fix set evpn gateway-ip ipv[46] route-map (backport #18378)#18463
Merged
donaldsharp merged 3 commits intostable/10.3from Mar 23, 2025
Merged
bgpd: fix set evpn gateway-ip ipv[46] route-map (backport #18378)#18463donaldsharp merged 3 commits intostable/10.3from
set evpn gateway-ip ipv[46] route-map (backport #18378)#18463donaldsharp merged 3 commits intostable/10.3from
Conversation
The `route_set_evpn_gateway_ip` function copies `gw_ip->ip.addr` in the
route's gateway ip. In a nutshell, this skips the `ipa_type` field,
writing the actual IP in the IP type. This later rightfully trips
asserts about unknown IP types.
The following route-map...
```
route-map test permit 10
set evpn gateway-ip ipv4 1.1.1.1
```
...will make the following gateway IP in the route:
```
(gdb) p/x a1->evpn_overlay->gw_ip
$11 = {ipa_type = 0x1010101, ip = {addr = 0x0, addrbytes = {
0x0 <repeats 16 times>}, _v4_addr = {s_addr = 0x0}, _v6_addr = {
__in6_u = {__u6_addr8 = {0x0 <repeats 16 times>}, __u6_addr16 = {0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, __u6_addr32 = {0x0, 0x0, 0x0,
0x0}}}}}
```
We do indeed see the IP Address in the `ipa_type` field.
Fix by starting the memcpy at the root of `struct ipaddr` instead of
skipping the `ipa_type` field.
Fixes: d0a4ee6 ("bgpd: Add "set evpn gateway-ip" clause for route-map")
Signed-off-by: Tuetuopay <tuetuopay@me.com>
(cherry picked from commit 0b0e701)
This test does not actually look at the route since the gateway-ip is not exposed in vtysh output. However, this ensures such a route-map does not crash bgpd. Signed-off-by: Tuetuopay <tuetuopay@me.com> (cherry picked from commit 05a7432)
All assignments of the EVPN attributes (ESI and Gateway IP) are gated behind the peer being set up for inbound soft-reconfiguration. There are no actual reasons for this limitation, so let's perform the EVPN attribute assignment no matter what when soft reconfiguration is not enabled. Fixes: 6e076ba ("bgpd: Fix for ain->attr corruption during path update") Signed-off-by: Tuetuopay <tuetuopay@me.com> (cherry picked from commit 7320659)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
route_set_evpn_gateway_ipfunction copiesgw_ip->ip.addrin the route's gateway ip. In a nutshell, this skips theipa_typefield, writing the actual IP in the IP type. This later rightfully trips asserts about unknown IP types.The following route-map...
...will make the following gateway IP in the route:
We do indeed see the IP Address in the
ipa_typefield.Fix by starting the memcpy at the root of
struct ipaddrinstead of skipping theipa_typefield.Fixes: d0a4ee6 ("bgpd: Add "set evpn gateway-ip" clause for route-map")
This is an automatic backport of pull request #18378 done by Mergify.