[PATCH] libosmo-abis[master]: lapd_pcap: Correctly set the pseudo-header packet type

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Jul 4 08:30:34 UTC 2016


Review at  https://gerrit.osmocom.org/453

lapd_pcap: Correctly set the pseudo-header packet type

We want the direction of the packet to be properly reflected in the
pseudo-header, so wireshark can display if the packet is sent in
network->user (BSC->BTS) direction, or in th reverse direction.

Related: OS#1764
Change-Id: I19afca0ce7e8b068bc64fa14bce6feb35aa9f1fc
---
M src/input/lapd_pcap.c
1 file changed, 8 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/53/453/1

diff --git a/src/input/lapd_pcap.c b/src/input/lapd_pcap.c
index 2a635cc..7374694 100644
--- a/src/input/lapd_pcap.c
+++ b/src/input/lapd_pcap.c
@@ -43,6 +43,8 @@
  * pcap format is from http://wiki.wireshark.org/Development/LibpcapFileFormat
  */
 #define DLT_LINUX_LAPD		177
+#define LINUX_SLL_HOST		0
+#define LINUX_SLL_OUTGOING	4
 
 struct pcap_hdr {
 	uint32_t magic_number;
@@ -65,7 +67,7 @@
 	uint16_t pkttype;
 	uint16_t hatype;
 	uint16_t halen;
-	uint64_t addr;
+	uint8_t addr[8];
 	int16_t protocol;
 } __attribute__((packed));
 
@@ -139,10 +141,13 @@
 	pcap_rechdr.incl_len   = msg->len + sizeof(struct pcap_lapdhdr);
 	pcap_rechdr.orig_len   = msg->len + sizeof(struct pcap_lapdhdr);
 
-	header.pkttype		= 4;
+	if (direction == OSMO_LAPD_PCAP_OUTPUT)
+		header.pkttype		= htons(LINUX_SLL_OUTGOING);
+	else
+		header.pkttype		= htons(LINUX_SLL_HOST);
 	header.hatype		= 0;
 	header.halen		= 0;
-	header.addr		= direction == OSMO_LAPD_PCAP_OUTPUT ? 0x0 : 0x1;
+	header.addr[0]		= 0x01;	/* we are the network side */
 	header.protocol		= ntohs(48);
 
 	gettimeofday(&tv, NULL);

-- 
To view, visit https://gerrit.osmocom.org/453
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I19afca0ce7e8b068bc64fa14bce6feb35aa9f1fc
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list