From: Victor Julien Date: Fri, 3 Jun 2016 10:38:08 +0000 (+0200) Subject: netmap: work around mtu error on iface+ settings X-Git-Tag: suricata-3.1RC1~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3095987217356d3175874477c0c80c007c8fd4c;p=thirdparty%2Fsuricata.git netmap: work around mtu error on iface+ settings --- 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; }