aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/e1_input.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-02-12 14:00:23 +0100
committerHarald Welte <laforge@gnumonks.org>2011-02-13 15:44:22 +0100
commit95aa5c4ae37cc946de68fca3af1961e706c892c1 (patch)
treeff96703551aed35153db54fe8cbf54ef30ee9b7c /openbsc/src/e1_input.c
parentf27d043032e6263f5b8f3b0c1db9594d3bba4156 (diff)
E1 INPUT: Fix PCAP file generation for non-mISDN case
Diffstat (limited to 'openbsc/src/e1_input.c')
-rw-r--r--openbsc/src/e1_input.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/openbsc/src/e1_input.c b/openbsc/src/e1_input.c
index b131844bb..3605f9339 100644
--- a/openbsc/src/e1_input.c
+++ b/openbsc/src/e1_input.c
@@ -143,7 +143,6 @@ static void write_pcap_packet(int direction, int sapi, int tei,
int ret;
time_t cur_time;
struct tm *tm;
- int mi_head = (direction==PCAP_INPUT) ? MISDN_HEADER_LEN : 0;
struct fake_linux_lapd_header header = {
.pkttype = 4,
@@ -165,12 +164,10 @@ static void write_pcap_packet(int direction, int sapi, int tei,
struct pcaprec_hdr payload_header = {
.ts_sec = 0,
.ts_usec = 0,
- .incl_len = msg->len + sizeof(struct fake_linux_lapd_header)
- + sizeof(struct lapd_header)
- - mi_head,
- .orig_len = msg->len + sizeof(struct fake_linux_lapd_header)
- + sizeof(struct lapd_header)
- - mi_head,
+ .incl_len = msgb_l2len(msg) + sizeof(struct fake_linux_lapd_header)
+ + sizeof(struct lapd_header),
+ .orig_len = msgb_l2len(msg) + sizeof(struct fake_linux_lapd_header)
+ + sizeof(struct lapd_header),
};
@@ -181,8 +178,7 @@ static void write_pcap_packet(int direction, int sapi, int tei,
ret = write(pcap_fd, &payload_header, sizeof(payload_header));
ret = write(pcap_fd, &header, sizeof(header));
ret = write(pcap_fd, &lapd_header, sizeof(lapd_header));
- ret = write(pcap_fd, msg->data + mi_head,
- msg->len - mi_head);
+ ret = write(pcap_fd, msg->l2h, msgb_l2len(msg));
}
static const char *sign_types[] = {