Skip to content

bgpd: fix set evpn gateway-ip ipv[46] route-map (backport #18378)#18463

Merged
donaldsharp merged 3 commits intostable/10.3from
mergify/bp/stable/10.3/pr-18378
Mar 23, 2025
Merged

bgpd: fix set evpn gateway-ip ipv[46] route-map (backport #18378)#18463
donaldsharp merged 3 commits intostable/10.3from
mergify/bp/stable/10.3/pr-18378

Conversation

@mergify
Copy link

@mergify mergify bot commented Mar 23, 2025

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")


This is an automatic backport of pull request #18378 done by Mergify.

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)
@frrbot frrbot bot added bgp bugfix tests Topotests, make check, etc labels Mar 23, 2025
@donaldsharp donaldsharp merged commit b02ecbf into stable/10.3 Mar 23, 2025
19 of 20 checks passed
@Jafaral Jafaral deleted the mergify/bp/stable/10.3/pr-18378 branch July 31, 2025 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants