[PATCH 10/28] batctl: tcpdump: fix endianness of fragmentation sequence number

Sven Eckelmann <[email protected]> Sun, 21 Jun 2026 16:24:00 +0200
Newsgroups org.open-mesh.lists.batman
Message-ID <[email protected]>
The kernel returns the unicast fragmentation packet in network (big endian)
byte order. But the system might be little endian. In this case, the bytes
must be first reordered before they can be printed.

Fixes: 30f8fe9c105a ("batctl: tcpdump: Add support for unicast fragmentation")
Signed-off-by: Sven Eckelmann <[email protected]>
---
 tcpdump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tcpdump.c b/tcpdump.c
index aced4d3..ddcee03 100644
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -1050,7 +1050,7 @@ static void dump_batman_ucast_frag(unsigned char *packet_buff, ssize_t buff_len,
 	printf("%s: UCAST FRAG, seqno %d, no %d, ttl %hhu\n",
 	       get_name_by_macaddr((struct ether_addr *)frag_packet->dest,
 				   read_opt),
-	       frag_packet->seqno, frag_packet->no, frag_packet->ttl);
+	       ntohs(frag_packet->seqno), frag_packet->no, frag_packet->ttl);
 }
 
 static void dump_batman_bcast(unsigned char *packet_buff, ssize_t buff_len,

-- 
2.47.3