diff options
author | Harald Welte <laforge@gnumonks.org> | 2016-07-04 09:55:26 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2016-07-04 10:29:48 +0200 |
commit | b4698ef0d923c3a904b6c3ea9ce3fcfd36481af0 (patch) | |
tree | 522de00d11775741af6f549dc80612bcbe8315ce | |
parent | 47bee5bed50d1b6d6004428a2fac50f57764e7bd (diff) |
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
-rw-r--r-- | src/input/lapd_pcap.c | 11 |
1 files changed, 8 insertions, 3 deletions
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 @@ struct pcap_lapdhdr { 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 @@ int osmo_pcap_lapd_write(int fd, int direction, struct msgb *msg) 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); |