From 0e151f3987c80f2ec17e1c1143f36bb47ec4b7cd Mon Sep 17 00:00:00 2001 From: Pantar Ana Date: Tue, 15 Jan 2019 14:38:09 +0100 Subject: [PATCH] ebhscr: increasing ebhscr snaplen Change-Id: Ie033196c099927912b1e7849299e786dc8416923 Reviewed-on: https://code.wireshark.org/review/31554 Petri-Dish: Anders Broman Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- dumpcap.c | 9 +++++++++ wiretap/file_access.c | 3 +++ wiretap/pcap-common.c | 5 +++++ wiretap/wtap.h | 1 + 4 files changed, 18 insertions(+) diff --git a/dumpcap.c b/dumpcap.c index 65252580a9..26f9c08d90 100644 --- a/dumpcap.c +++ b/dumpcap.c @@ -1980,7 +1980,16 @@ pcap_pipe_open_live(int fd, pcap_src->cap_pipe_max_pkt_size = WTAP_MAX_PACKET_SIZE_DBUS; } else #endif + if (pcap_src->linktype == 279) { /* DLT_EBHSCR */ + /* + * The maximum EBHSCR message size is 8MB, so allow packets up + * to that size. + */ + pcap_src->cap_pipe_max_pkt_size = WTAP_MAX_PACKET_SIZE_EBHSCR; + } + else { pcap_src->cap_pipe_max_pkt_size = WTAP_MAX_PACKET_SIZE_STANDARD; + } if (hdr->version_major < 2) { g_snprintf(errmsg, (gulong)errmsgl, diff --git a/wiretap/file_access.c b/wiretap/file_access.c index 698d02b9b5..894da7b085 100644 --- a/wiretap/file_access.c +++ b/wiretap/file_access.c @@ -2343,6 +2343,7 @@ wtap_dump_init_dumper(int file_type_subtype, wtap_compression_type compression_t * * We use WTAP_MAX_PACKET_SIZE_STANDARD for everything except * D-Bus, which has a maximum packet size of 128MB, + * and EBHSCR, which has a maximum packet size of 8MB, * which is more than we want to put into files * with other link-layer header types, as that * might cause some software reading those files @@ -2351,6 +2352,8 @@ wtap_dump_init_dumper(int file_type_subtype, wtap_compression_type compression_t */ if (params->encap == WTAP_ENCAP_DBUS) snaplen = 128*1024*1024; + else if (params->encap == WTAP_ENCAP_EBHSCR) + snaplen = 8*1024*1024; else snaplen = WTAP_MAX_PACKET_SIZE_STANDARD; } diff --git a/wiretap/pcap-common.c b/wiretap/pcap-common.c index 9f1d10da7a..812d2ef289 100644 --- a/wiretap/pcap-common.c +++ b/wiretap/pcap-common.c @@ -738,14 +738,19 @@ wtap_wtap_encap_to_pcap_encap(int encap) * some programs reading them to allocate a huge and wasteful buffer * and, at least on 32-bit platforms, run the risk of running out of * memory. + * For EBHSCR, we use WTAP_MAX_PACKET_SIZE_EBHSCR, because the maximum + * EBHSCR message size is 8MB */ guint wtap_max_snaplen_for_encap(int wtap_encap) { if (wtap_encap == WTAP_ENCAP_DBUS) return WTAP_MAX_PACKET_SIZE_DBUS; + else if (wtap_encap == WTAP_ENCAP_EBHSCR) + return WTAP_MAX_PACKET_SIZE_EBHSCR; else return WTAP_MAX_PACKET_SIZE_STANDARD; + } /* diff --git a/wiretap/wtap.h b/wiretap/wtap.h index 2f907feae3..96631b8e99 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -409,6 +409,7 @@ extern "C" { * allocate a buffer much larger than necessary, wasting memory. */ #define WTAP_MAX_PACKET_SIZE_STANDARD 262144 +#define WTAP_MAX_PACKET_SIZE_EBHSCR (8*1024*1024) #define WTAP_MAX_PACKET_SIZE_DBUS (128*1024*1024) /*