dahdi_pcap: Fix the use of the pkttype field

* pkttype is big-endian, so '3' is not valid, but htons(3)
* let's not use magic numbers but the actual #define PACKET_*
* differentiate PACKET_HOST (rx) from PACKET_OUTGOING (tx),
  which makes wireshark properly show rx/tx packets, allows coloring
  or filtering based on direction, etc.

Change-Id: I8c66a011a0fa0c5275bf3d5cf6b42064f02e28c0
This commit is contained in:
Harald Welte 2022-02-21 20:39:30 +01:00
parent 89b6df7593
commit de9bd096c9
1 changed files with 2 additions and 1 deletions

View File

@ -41,6 +41,7 @@
#include <sys/ioctl.h>
#include <stdlib.h>
#include <getopt.h>
#include <linux/if_packet.h>
#define BLOCK_SIZE 512
#define MAX_CHAN 16
@ -161,7 +162,7 @@ int log_packet(struct chan_fds * fd, char is_read, pcap_dumper_t * dump)
hdr.caplen = res+sizeof(struct lapd_sll_hdr)-2;
hdr.len = res+sizeof(struct lapd_sll_hdr)-2;
lapd->sll_pkttype = 3;
lapd->sll_pkttype = htons(is_read ? PACKET_HOST : PACKET_OUTGOING);
lapd->sll_hatype = 0;
lapd->sll_halen = htons(8);
// lapd->sll_addr = ???