ebhscr: increasing ebhscr snaplen

Change-Id: Ie033196c099927912b1e7849299e786dc8416923
Reviewed-on: https://code.wireshark.org/review/31554
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Pantar Ana 2019-01-15 14:38:09 +01:00 committed by Anders Broman
parent 10bcb40c5e
commit 0e151f3987
4 changed files with 18 additions and 0 deletions

View File

@ -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,

View File

@ -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;
}

View File

@ -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;
}
/*

View File

@ -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)
/*