]> git.puffer.fish Git - matthieu/frr.git/commit
bgpd: fix `set evpn gateway-ip ipv[46]` route-map
authorTuetuopay <tuetuopay@me.com>
Fri, 14 Mar 2025 19:21:46 +0000 (20:21 +0100)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Sun, 23 Mar 2025 10:40:48 +0000 (10:40 +0000)
commit4ee47bfc83e1977458a6049c653019d6b7576320
treed01e442d4b59d6f2a585dc52d316a23d55f9f246
parent588462f12b188daa4ac03e80dd0d70d4aee93489
bgpd: fix `set evpn gateway-ip ipv[46]` route-map

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: d0a4ee6010a ("bgpd: Add "set evpn gateway-ip" clause for route-map")
Signed-off-by: Tuetuopay <tuetuopay@me.com>
(cherry picked from commit 0b0e7015971a788c14dd1dc9b5bac8cb66175c29)
bgpd/bgp_routemap.c