capture: remove unnecessary mtu check

pull/8288/head
Victor Julien 4 years ago
parent f45914cd99
commit 16c19bd2f6

@ -650,7 +650,6 @@ typedef struct Packet_
} Packet; } Packet;
/** highest mtu of the interfaces we monitor */ /** highest mtu of the interfaces we monitor */
extern int g_default_mtu;
#define DEFAULT_MTU 1500 #define DEFAULT_MTU 1500
#define MINIMUM_MTU 68 /**< ipv4 minimum: rfc791 */ #define MINIMUM_MTU 68 /**< ipv4 minimum: rfc791 */

@ -182,9 +182,6 @@ int g_detect_disabled = 0;
/** set caps or not */ /** set caps or not */
int sc_set_caps = FALSE; int sc_set_caps = FALSE;
/** highest mtu of the interfaces we monitor */
int g_default_mtu = 0;
bool g_system = false; bool g_system = false;
/** disable randomness to get reproducible results accross runs */ /** disable randomness to get reproducible results accross runs */
@ -2408,7 +2405,6 @@ static int ConfigGetCaptureValue(SCInstance *suri)
* back on a sane default. */ * back on a sane default. */
const char *temp_default_packet_size; const char *temp_default_packet_size;
if ((ConfGet("default-packet-size", &temp_default_packet_size)) != 1) { if ((ConfGet("default-packet-size", &temp_default_packet_size)) != 1) {
int mtu = 0;
int lthread; int lthread;
int nlive; int nlive;
int strip_trailing_plus = 0; int strip_trailing_plus = 0;
@ -2419,13 +2415,10 @@ static int ConfigGetCaptureValue(SCInstance *suri)
mtu = GetGlobalMTUWin32(); mtu = GetGlobalMTUWin32();
if (mtu > 0) { if (mtu > 0) {
g_default_mtu = mtu;
/* SLL_HEADER_LEN is the longest header + 8 for VLAN */ /* SLL_HEADER_LEN is the longest header + 8 for VLAN */
default_packet_size = mtu + SLL_HEADER_LEN + 8; default_packet_size = mtu + SLL_HEADER_LEN + 8;
break; break;
} }
g_default_mtu = DEFAULT_MTU;
default_packet_size = DEFAULT_PACKET_SIZE; default_packet_size = DEFAULT_PACKET_SIZE;
break; break;
#endif /* WINDIVERT */ #endif /* WINDIVERT */
@ -2454,9 +2447,6 @@ static int ConfigGetCaptureValue(SCInstance *suri)
dev[len-1] = '\0'; dev[len-1] = '\0';
} }
} }
mtu = GetIfaceMTU(dev);
g_default_mtu = MAX(mtu, g_default_mtu);
unsigned int iface_max_packet_size = GetIfaceMaxPacketSize(dev); unsigned int iface_max_packet_size = GetIfaceMaxPacketSize(dev);
if (iface_max_packet_size > default_packet_size) if (iface_max_packet_size > default_packet_size)
default_packet_size = iface_max_packet_size; default_packet_size = iface_max_packet_size;
@ -2465,7 +2455,6 @@ static int ConfigGetCaptureValue(SCInstance *suri)
break; break;
/* fall through */ /* fall through */
default: default:
g_default_mtu = DEFAULT_MTU;
default_packet_size = DEFAULT_PACKET_SIZE; default_packet_size = DEFAULT_PACKET_SIZE;
} }
} else { } else {

Loading…
Cancel
Save