<p>Pau Espin Pedrol has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/11264">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">client: Set snaplen to MAXIMUM_SNAPLEN<br><br>Despite this value not being exported publicly, the truth is that<br>tcpdump and wireshark nowadays avoid processing any file with snaplen<br>bigger than this value:<br>"tcpdump: pcap_loop: invalid packet capture length 861244, bigger than<br>snaplen of 262144"<br>It also fails to set snaplen to values bigger than that:<br>"tcpdump -s 262145" --> "tcpdump: invalid snaplen 262145"<br><br>pcapfix also warns about wrong packet length if bigger than same value<br>(defined as PCAP_MAX_SNAPLEN there).<br><br>MAXIMUM_SPANPLEN is defined in tcpdump's netdissect.h and libpcap's<br>pcap-int.h. It is also defined as WTAP_MAX_PACKET_SIZE in<br>wireshark/wiretap/wtap.h (this one being the only publicly available).<br><br>Change-Id: Ib7449d5aba9da342c150704ebd0e1f09e7f7276c<br>---<br>M src/osmo_client_network.c<br>1 file changed, 6 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-pcap refs/changes/64/11264/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/osmo_client_network.c b/src/osmo_client_network.c</span><br><span>index ec03b09..6b84337 100644</span><br><span>--- a/src/osmo_client_network.c</span><br><span>+++ b/src/osmo_client_network.c</span><br><span>@@ -42,6 +42,11 @@</span><br><span> #include <string.h></span><br><span> #include <unistd.h></span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/* defined in libpcap's pcap-int.h, which is not public */</span><br><span style="color: hsl(120, 100%, 40%);">+#ifndef MAXIMUM_SNAPLEN</span><br><span style="color: hsl(120, 100%, 40%);">+#define MAXIMUM_SNAPLEN 262144</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> </span><br><span> static void _osmo_client_connect(void *_data)</span><br><span> {</span><br><span>@@ -257,7 +262,7 @@</span><br><span>     hdr->version_minor = 4;</span><br><span>   hdr->thiszone = 0;</span><br><span>        hdr->sigfigs = 0;</span><br><span style="color: hsl(0, 100%, 40%);">-    hdr->snaplen = UINT_MAX;</span><br><span style="color: hsl(120, 100%, 40%);">+   hdr->snaplen = MAXIMUM_SNAPLEN;</span><br><span>   hdr->linktype = pcap_datalink(conn->client->handle);</span><br><span> </span><br><span>    write_data(conn, msg);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/11264">change 11264</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/11264"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-pcap </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ib7449d5aba9da342c150704ebd0e1f09e7f7276c </div>
<div style="display:none"> Gerrit-Change-Number: 11264 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Pau Espin Pedrol <pespin@sysmocom.de> </div>