From 16c19bd2f604d3e7bff69b7591636f25ac7b5f5c Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Wed, 30 Nov 2022 18:22:48 +0100 Subject: [PATCH] capture: remove unnecessary mtu check --- src/decode.h | 1 - src/suricata.c | 11 ----------- 2 files changed, 12 deletions(-) diff --git a/src/decode.h b/src/decode.h index 6709aa775b..b229d38c37 100644 --- a/src/decode.h +++ b/src/decode.h @@ -650,7 +650,6 @@ typedef struct Packet_ } Packet; /** highest mtu of the interfaces we monitor */ -extern int g_default_mtu; #define DEFAULT_MTU 1500 #define MINIMUM_MTU 68 /**< ipv4 minimum: rfc791 */ diff --git a/src/suricata.c b/src/suricata.c index 1f09213530..3dfbdf3541 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -182,9 +182,6 @@ int g_detect_disabled = 0; /** set caps or not */ int sc_set_caps = FALSE; -/** highest mtu of the interfaces we monitor */ -int g_default_mtu = 0; - bool g_system = false; /** disable randomness to get reproducible results accross runs */ @@ -2408,7 +2405,6 @@ static int ConfigGetCaptureValue(SCInstance *suri) * back on a sane default. */ const char *temp_default_packet_size; if ((ConfGet("default-packet-size", &temp_default_packet_size)) != 1) { - int mtu = 0; int lthread; int nlive; int strip_trailing_plus = 0; @@ -2419,13 +2415,10 @@ static int ConfigGetCaptureValue(SCInstance *suri) mtu = GetGlobalMTUWin32(); if (mtu > 0) { - g_default_mtu = mtu; /* SLL_HEADER_LEN is the longest header + 8 for VLAN */ default_packet_size = mtu + SLL_HEADER_LEN + 8; break; } - - g_default_mtu = DEFAULT_MTU; default_packet_size = DEFAULT_PACKET_SIZE; break; #endif /* WINDIVERT */ @@ -2454,9 +2447,6 @@ static int ConfigGetCaptureValue(SCInstance *suri) dev[len-1] = '\0'; } } - mtu = GetIfaceMTU(dev); - g_default_mtu = MAX(mtu, g_default_mtu); - unsigned int iface_max_packet_size = GetIfaceMaxPacketSize(dev); if (iface_max_packet_size > default_packet_size) default_packet_size = iface_max_packet_size; @@ -2465,7 +2455,6 @@ static int ConfigGetCaptureValue(SCInstance *suri) break; /* fall through */ default: - g_default_mtu = DEFAULT_MTU; default_packet_size = DEFAULT_PACKET_SIZE; } } else {