From: Guy Harris Date: Sun, 14 Aug 2011 22:21:28 +0000 (-0700) Subject: Don't assume any of the ETHTOOL_ offloading values are defined. X-Git-Tag: libpcap-1.3-bp~41 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/34042f15e03680dddec4e81024b850c47621febe?ds=sidebyside Don't assume any of the ETHTOOL_ offloading values are defined. Some older Linuxes appear to have the ethtool ioctls but not define ETHTOOL_GTSO, ETHTOOL_GUFO, or ETHTOOL_GGSO. --- diff --git a/pcap-linux.c b/pcap-linux.c index ea7618dd..cedc2caf 100644 --- a/pcap-linux.c +++ b/pcap-linux.c @@ -4789,18 +4789,23 @@ iface_get_offload(pcap_t *handle) { int ret; +#ifdef ETHTOOL_GTSO ret = iface_ethtool_ioctl(handle, ETHTOOL_GTSO, "ETHTOOL_GTSO"); if (ret == -1) return -1; if (ret) return 1; /* TCP segmentation offloading on */ +#endif +#ifdef ETHTOOL_GUFO ret = iface_ethtool_ioctl(handle, ETHTOOL_GUFO, "ETHTOOL_GUFO"); if (ret == -1) return -1; if (ret) return 1; /* UDP fragmentation offloading on */ +#endif +#ifdef ETHTOOL_GGSO /* * XXX - will this cause large unsegmented packets to be * handed to PF_PACKET sockets on transmission? If not, @@ -4811,6 +4816,7 @@ iface_get_offload(pcap_t *handle) return -1; if (ret) return 1; /* generic segmentation offloading on */ +#endif #ifdef ETHTOOL_GFLAGS ret = iface_ethtool_ioctl(handle, ETHTOOL_GFLAGS, "ETHTOOL_GFLAGS");