[PATCH 09/28] batctl: tcpdump: fix coded packet mac dest mac addresses

Sven Eckelmann <[email protected]> Sun, 21 Jun 2026 16:23:59 +0200
Newsgroups org.open-mesh.lists.batman
Message-ID <[email protected]>
get_name_by_macaddr uses returns shared buffer. The content of the buffer
must therefore be processed first before the next get_name_by_macaddr()
call is performed.

Fixes: 9aae3c9f27b8 ("batctl: tcpdump: Add support for coded packets")
Signed-off-by: Sven Eckelmann <[email protected]>
---
 tcpdump.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tcpdump.c b/tcpdump.c
index 3409e59..aced4d3 100644
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -1152,9 +1152,10 @@ static void dump_batman_coded(unsigned char *packet_buff, ssize_t buff_len,
 	       get_name_by_macaddr((struct ether_addr *)ether_header->ether_shost,
 				   read_opt));
 
-	printf("%s|%s: CODED, ttvn %d|%d, ttl %hhu\n",
+	printf("%s|",
 	       get_name_by_macaddr((struct ether_addr *)coded_packet->first_orig_dest,
-				   read_opt),
+				   read_opt));
+	printf("%s: CODED, ttvn %d|%d, ttl %hhu\n",
 	       get_name_by_macaddr((struct ether_addr *)coded_packet->second_dest,
 				   read_opt),
 	       coded_packet->first_ttvn, coded_packet->second_ttvn,

-- 
2.47.3