if_vxlan question

Jacques Fourie jacques.fourie at gmail.com
Thu Mar 19 21:06:39 UTC 2020


Hi,

I noticed that my FreeBSD box was dropping vxlan packets with higher VNI's.
Looking at the code it seems that the check at line 2548 is not correct:

if (vxh->vxlh_flags != htonl(VXLAN_HDR_FLAGS_VALID_VNI) ||
            vxh->vxlh_vni & ~htonl(VXLAN_VNI_MASK))     <----- Incorrect?
                goto out;

Let's say the VNI is 99901. This will arrive on the wire as
0x01,0x86,0x3d,0x00. The above check will compute 0x3d8601 & 0xff, which
will return 0x01. I think the correct version should be without the
htonl(), ie:

vxh->vxh_vni & ~VXLAN_VNI_MASK

Can someone please double check?

Thanks,
Jacques


More information about the freebsd-net mailing list