Change in osmo-pcap[master]: client: Set snaplen to MAXIMUM_SNAPLEN

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/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Mon Oct 8 10:37:06 UTC 2018


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/11264


Change subject: client: Set snaplen to MAXIMUM_SNAPLEN
......................................................................

client: Set snaplen to MAXIMUM_SNAPLEN

Despite this value not being exported publicly, the truth is that
tcpdump and wireshark nowadays avoid processing any file with snaplen
bigger than this value:
"tcpdump: pcap_loop: invalid packet capture length 861244, bigger than
snaplen of 262144"
It also fails to set snaplen to values bigger than that:
"tcpdump -s 262145" --> "tcpdump: invalid snaplen 262145"

pcapfix also warns about wrong packet length if bigger than same value
(defined as PCAP_MAX_SNAPLEN there).

MAXIMUM_SPANPLEN is defined in tcpdump's netdissect.h and libpcap's
pcap-int.h. It is also defined as WTAP_MAX_PACKET_SIZE in
wireshark/wiretap/wtap.h (this one being the only publicly available).

Change-Id: Ib7449d5aba9da342c150704ebd0e1f09e7f7276c
---
M src/osmo_client_network.c
1 file changed, 6 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcap refs/changes/64/11264/1

diff --git a/src/osmo_client_network.c b/src/osmo_client_network.c
index ec03b09..6b84337 100644
--- a/src/osmo_client_network.c
+++ b/src/osmo_client_network.c
@@ -42,6 +42,11 @@
 #include <string.h>
 #include <unistd.h>
 
+/* defined in libpcap's pcap-int.h, which is not public */
+#ifndef MAXIMUM_SNAPLEN
+#define MAXIMUM_SNAPLEN	262144
+#endif
+
 
 static void _osmo_client_connect(void *_data)
 {
@@ -257,7 +262,7 @@
 	hdr->version_minor = 4;
 	hdr->thiszone = 0;
 	hdr->sigfigs = 0;
-	hdr->snaplen = UINT_MAX;
+	hdr->snaplen = MAXIMUM_SNAPLEN;
 	hdr->linktype = pcap_datalink(conn->client->handle);
 
 	write_data(conn, msg);

-- 
To view, visit https://gerrit.osmocom.org/11264
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcap
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib7449d5aba9da342c150704ebd0e1f09e7f7276c
Gerrit-Change-Number: 11264
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181008/0366b90f/attachment.htm>


More information about the gerrit-log mailing list