]> git.proxmox.com Git - mirror_frr.git/commitdiff
bfdd: Fix malformed session with vrf
authoranlan_cs <vic.lan@pica8.com>
Wed, 10 May 2023 14:04:33 +0000 (22:04 +0800)
committeranlan_cs <vic.lan@pica8.com>
Thu, 11 May 2023 02:22:40 +0000 (10:22 +0800)
With this configuration:

```
bfd
 peer 33:33::66 local-address 33:33::88 vrf vrf8 interface enp1s0
 exit
 !
exit
```

The bfd session can't be established with error:

```
bfdd[18663]: [YA0Q5-C0BPV] control-packet: wrong vrfid. [mhop:no peer:33:33::66 local:33:33::88 port:2 vrf:61]
```

The vrf check should use the carefully adjusted `vrfid`, which is
based on globally/reliable interface.  We can't believe the
`bvrf->vrf->vrf_id` because the `/proc/sys/net/ipv4/udp_l3mdev_accept`
maybe is set "1" in VRF-lite backend even with security drawback.

Just correct the vrf check.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
bfdd/bfd_packet.c

index 311ce4d37905d167381d2bfe9f625767f3cbf0ea..ea7a1038ae6b974b56bf337ad27bb50831137849 100644 (file)
@@ -878,7 +878,7 @@ void bfd_recv_cb(struct event *t)
        /*
         * We may have a situation where received packet is on wrong vrf
         */
-       if (bfd && bfd->vrf && bfd->vrf != bvrf->vrf) {
+       if (bfd && bfd->vrf && bfd->vrf->vrf_id != vrfid) {
                cp_debug(is_mhop, &peer, &local, ifindex, vrfid,
                         "wrong vrfid.");
                return;