netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] geneve: Fix function matching VNI and tunnel ID on big-endian
@ 2017-10-19 11:31 Stefano Brivio
  2017-10-19 12:08 ` Jakub Sitnicki
  2017-10-21  1:51 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Stefano Brivio @ 2017-10-19 11:31 UTC (permalink / raw)
  To: David S . Miller, netdev
  Cc: pravin shelar, Girish Moodalbail, Sabrina Dubroca

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: 2e0b26e10352 ("geneve: Optimize geneve device lookup.")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
I guess this should be queued up for -stable, back to 4.10

 drivers/net/geneve.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index f6404074b7b0..ed51018a813e 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -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)
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-10-21  1:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-19 11:31 [PATCH net] geneve: Fix function matching VNI and tunnel ID on big-endian Stefano Brivio
2017-10-19 12:08 ` Jakub Sitnicki
2017-10-21  1:51 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).