From a3095987217356d3175874477c0c80c007c8fd4c Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 3 Jun 2016 12:38:08 +0200 Subject: [PATCH] netmap: work around mtu error on iface+ settings --- src/suricata.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/suricata.c b/src/suricata.c index c5c1c3a2f1..5482002a54 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -2182,15 +2182,30 @@ static int ConfigGetCaptureValue(SCInstance *suri) if ((ConfGet("default-packet-size", &temp_default_packet_size)) != 1) { int lthread; int nlive; + int strip_trailing_plus = 0; switch (suri->run_mode) { case RUNMODE_PCAP_DEV: case RUNMODE_AFP_DEV: case RUNMODE_NETMAP: + /* in netmap igb0+ has a special meaning, however the + * interface really is igb0 */ + strip_trailing_plus = 1; + /* fall through */ case RUNMODE_PFRING: nlive = LiveGetDeviceCount(); for (lthread = 0; lthread < nlive; lthread++) { char *live_dev = LiveGetDeviceName(lthread); - unsigned int iface_max_packet_size = GetIfaceMaxPacketSize(live_dev); + char dev[32]; + (void)strlcpy(dev, live_dev, sizeof(dev)); + + if (strip_trailing_plus) { + size_t len = strlen(dev); + if (len && dev[len-1] == '+') { + dev[len-1] = '\0'; + } + } + + unsigned int iface_max_packet_size = GetIfaceMaxPacketSize(dev); if (iface_max_packet_size > default_packet_size) default_packet_size = iface_max_packet_size; } -- 2.47.2