git: 7ba9c38b703d - main - if_geneve: Do not byte-swap the option length

From: Pouria Mousavizadeh Tehrani <pouria_at_FreeBSD.org>
Date: Fri, 13 Nov 2026 11:42:41 UTC
The branch main has been updated by pouria:

URL: https://cgit.FreeBSD.org/src/commit/?id=7ba9c38b703d7acdc472939d54703b9bc38fb6f3

commit 7ba9c38b703d7acdc472939d54703b9bc38fb6f3
Author:     Kevin Day <kevin@your.org>
AuthorDate: 2026-11-13 11:26:54 +0000
Commit:     Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
CommitDate: 2026-11-13 11:41:53 +0000

    if_geneve: Do not byte-swap the option length
    
    geneve_optlen is a 6-bit bitfield within a single byte, so it has no
    byte order.  Applying ntohs() to it on little-endian machines turned
    an option length of 1 into 256, causing every received packet carrying
    options to dropped.
    
    PR:             300453
    Reviewed by:    pouria
    Fixes:  e44d2e941e8e ("if_geneve: Add Support for Geneve (RFC8926)")
---
 sys/net/if_geneve.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/net/if_geneve.c b/sys/net/if_geneve.c
index e68bdfb76e4b..c7571984c4cf 100644
--- a/sys/net/if_geneve.c
+++ b/sys/net/if_geneve.c
@@ -3013,7 +3013,7 @@ geneve_udp_input(struct mbuf *m, int offset, struct inpcb *inpcb,
 	 * The length of the option fields, expressed in 4-byte multiples, not
 	 * including the 8-byte fixed tunnel header.
 	 */
-	optlen = ntohs(gnvh->geneve_optlen) * 4;
+	optlen = gnvh->geneve_optlen * 4;
 	error = geneve_next_option(gnvso, gnvh, &m);
 	if (error != 0)
 		return (false);