Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 772e97b5 authored by Stefano Brivio's avatar Stefano Brivio Committed by David S. Miller
Browse files

geneve: Fix function matching VNI and tunnel ID on big-endian



On big-endian machines, functions converting between tunnel ID
and VNI use the three LSBs of tunnel ID storage to map VNI.

The comparison function eq_tun_id_and_vni(), on the other hand,
attempted to map the VNI from the three MSBs. Fix it by using
the same check implemented on LE, which maps VNI from the three
LSBs of tunnel ID.

Fixes: 2e0b26e1 ("geneve: Optimize geneve device lookup.")
Signed-off-by: default avatarStefano Brivio <sbrivio@redhat.com>
Reviewed-by: default avatarJakub Sitnicki <jkbs@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c69d75ae
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -113,13 +113,7 @@ static void tunnel_id_to_vni(__be64 tun_id, __u8 *vni)

static bool eq_tun_id_and_vni(u8 *tun_id, u8 *vni)
{
#ifdef __BIG_ENDIAN
	return (vni[0] == tun_id[2]) &&
	       (vni[1] == tun_id[1]) &&
	       (vni[2] == tun_id[0]);
#else
	return !memcmp(vni, &tun_id[5], 3);
#endif
}

static sa_family_t geneve_get_sk_family(struct geneve_sock *gs)