From: Eric Leblond Date: Thu, 10 Apr 2014 09:05:46 +0000 (+0200) Subject: util-ioctl: only get MTU when iface name is set X-Git-Tag: suricata-2.0.1rc1~53 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6e77c4d1b41e0a4be65979ef6b2176bc67c66a4a;p=thirdparty%2Fsuricata.git util-ioctl: only get MTU when iface name is set This patch fixes a warning message when suricata is started without giving an interface name on the command line. The code was trying to get the MTU even if pcap_dev was not set. --- diff --git a/src/util-ioctl.c b/src/util-ioctl.c index 4b2923a32b..0f144ec511 100644 --- a/src/util-ioctl.c +++ b/src/util-ioctl.c @@ -117,7 +117,12 @@ int GetIfaceMTU(char *pcap_dev) int GetIfaceMaxPacketSize(char *pcap_dev) { int ll_header = GetIfaceMaxHWHeaderLength(pcap_dev); - int mtu = GetIfaceMTU(pcap_dev); + int mtu = 0; + + if ((pcap_dev == NULL) || strlen(pcap_dev) == 0) + return 0; + + mtu = GetIfaceMTU(pcap_dev); switch (mtu) { case 0: case -1: