diff options
author | Andreas Eversberg <Andreas.Eversberg@versatel.de> | 2009-06-10 14:47:33 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2009-06-10 14:47:33 +0200 |
commit | 20152a35e35e790ae281cd2445b746e338eb669c (patch) | |
tree | ea3519da348227056f43828d68e598b393541b03 /openbsc/src | |
parent | 85a7b363d97db5c7be45bfb93079e8db46e90a81 (diff) |
[pcap] Write incoming packages without the extra mISDN header
This patch fixes the PCAP logging. If frames are received from E1
interface, an 8 byte mISDN header (MISDN_HEADER_LEN) is in front of the
RSL packet. When frames are transmitted to the E1 interface, the
pcap_write_packet function will get a message buffer without the mISDN
header in front of the RSL packet. The pcap file was tested and the
output is correct.
Follow up patches should make use the msgb->l2, make the ipaccess
code use the pcap writing too...
Diffstat (limited to 'openbsc/src')
-rw-r--r-- | openbsc/src/e1_input.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/openbsc/src/e1_input.c b/openbsc/src/e1_input.c index c3c7c7597..034bd9723 100644 --- a/openbsc/src/e1_input.c +++ b/openbsc/src/e1_input.c @@ -140,6 +140,7 @@ 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, @@ -163,13 +164,15 @@ static void write_pcap_packet(int direction, int sapi, int tei, .ts_usec = 0, .incl_len = msg->len + sizeof(struct fake_linux_lapd_header) + sizeof(struct lapd_header) - - MISDN_HEADER_LEN, + - mi_head, .orig_len = msg->len + sizeof(struct fake_linux_lapd_header) + sizeof(struct lapd_header) - - MISDN_HEADER_LEN, + - mi_head, }; + printf("Packet of: %d\n", direction); + cur_time = time(NULL); tm = localtime(&cur_time); payload_header.ts_sec = mktime(tm); @@ -177,8 +180,8 @@ 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 + MISDN_HEADER_LEN, - msg->len - MISDN_HEADER_LEN); + ret = write(pcap_fd, msg->data + mi_head, + msg->len - mi_head); } static const char *sign_types[] = { |