diff --git a/src/source-af-packet.c b/src/source-af-packet.c index 0c50ed219a..317c8704e5 100644 --- a/src/source-af-packet.c +++ b/src/source-af-packet.c @@ -1573,7 +1573,7 @@ sockaddr_ll) + ETH_HLEN) - ETH_HLEN); int snaplen = default_packet_size; if (snaplen == 0) { - snaplen = GetIfaceMaxPacketSize(ptv->iface); + snaplen = GetIfaceMaxPacketSize(ptv->livedev); if (snaplen <= 0) { SCLogWarning("%s: unable to get MTU, setting snaplen default of 1514", ptv->iface); snaplen = 1514; @@ -1607,7 +1607,7 @@ static int AFPComputeRingParamsV3(AFPThreadVars *ptv) int snaplen = default_packet_size; if (snaplen == 0) { - snaplen = GetIfaceMaxPacketSize(ptv->iface); + snaplen = GetIfaceMaxPacketSize(ptv->livedev); if (snaplen <= 0) { SCLogWarning("%s: unable to get MTU, setting snaplen default of 1514", ptv->iface); snaplen = 1514; diff --git a/src/source-pcap.c b/src/source-pcap.c index a36c2b646f..f916d69354 100644 --- a/src/source-pcap.c +++ b/src/source-pcap.c @@ -514,7 +514,7 @@ static TmEcode ReceivePcapThreadInit(ThreadVars *tv, const void *initdata, void if (pcapconfig->snaplen == 0) { /* We set snaplen if we can get the MTU */ - ptv->pcap_snaplen = GetIfaceMaxPacketSize(pcapconfig->iface); + ptv->pcap_snaplen = GetIfaceMaxPacketSize(ptv->livedev); } else { ptv->pcap_snaplen = pcapconfig->snaplen; } diff --git a/src/suricata.c b/src/suricata.c index 7fe469acf2..d9adcaf07b 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -2486,7 +2486,8 @@ static int ConfigGetCaptureValue(SCInstance *suri) dev[len-1] = '\0'; } } - unsigned int iface_max_packet_size = GetIfaceMaxPacketSize(dev); + LiveDevice *ld = LiveGetDevice(dev); + unsigned int iface_max_packet_size = GetIfaceMaxPacketSize(ld); if (iface_max_packet_size > default_packet_size) default_packet_size = iface_max_packet_size; } diff --git a/src/util-ioctl.c b/src/util-ioctl.c index 97f8dd378f..399751b056 100644 --- a/src/util-ioctl.c +++ b/src/util-ioctl.c @@ -114,11 +114,15 @@ int GetIfaceMTU(const char *dev) * for the link. In case of uncertainty, it will output a * majorant to be sure avoid the cost of dynamic allocation. * - * \param Name of a network interface + * \param LiveDevice object * \retval 0 in case of error */ -int GetIfaceMaxPacketSize(const char *dev) +int GetIfaceMaxPacketSize(LiveDevice *ld) { + if (ld == NULL) + return 0; + + const char *dev = ld->dev; if ((dev == NULL) || strlen(dev) == 0) return 0; diff --git a/src/util-ioctl.h b/src/util-ioctl.h index 2d0c74740d..24f8974875 100644 --- a/src/util-ioctl.h +++ b/src/util-ioctl.h @@ -25,7 +25,7 @@ #include "util-device.h" int GetIfaceMTU(const char *pcap_dev); -int GetIfaceMaxPacketSize(const char *pcap_dev); +int GetIfaceMaxPacketSize(LiveDevice *ld); int GetIfaceOffloading(const char *dev, int csum, int other); int GetIfaceRSSQueuesNum(const char *pcap_dev); #ifdef SIOCGIFFLAGS