From 6e77c4d1b41e0a4be65979ef6b2176bc67c66a4a Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Thu, 10 Apr 2014 11:05:46 +0200 Subject: [PATCH] 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. --- src/util-ioctl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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: