mirror of https://gerrit.osmocom.org/osmo-pcap
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
This commit is contained in:
parent
db7be44632
commit
168949e119
|
@ -58,4 +58,9 @@ extern const char *osmopcap_copyright;
|
|||
extern int osmopcap_go_parent(struct vty *vty);
|
||||
extern int osmopcap_is_config_node(struct vty *vty, int node);
|
||||
|
||||
/* defined in libpcap's pcap-int.h, which is not public */
|
||||
#ifndef MAXIMUM_SNAPLEN
|
||||
#define MAXIMUM_SNAPLEN 262144
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
static void _osmo_client_connect(void *_data)
|
||||
{
|
||||
osmo_client_connect((struct osmo_pcap_client_conn *) _data);
|
||||
|
@ -257,7 +256,7 @@ void osmo_client_send_link(struct osmo_pcap_client_conn *conn)
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue