]> The Tcpdump Group git mirrors - libpcap/commitdiff
Don't assume any of the ETHTOOL_ offloading values are defined.
authorGuy Harris <[email protected]>
Sun, 14 Aug 2011 22:21:28 +0000 (15:21 -0700)
committerGuy Harris <[email protected]>
Sun, 14 Aug 2011 22:21:28 +0000 (15:21 -0700)
Some older Linuxes appear to have the ethtool ioctls but not define
ETHTOOL_GTSO, ETHTOOL_GUFO, or ETHTOOL_GGSO.

pcap-linux.c

index ea7618dd00c47124d399df9af127c0fca7eb86ff..cedc2caf781b726c094b22bffd917cddcaf2f6ce 100644 (file)
@@ -4789,18 +4789,23 @@ iface_get_offload(pcap_t *handle)
 {
        int ret;
 
 {
        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 */
        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 */
        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,
        /*
         * 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 */
                return -1;
        if (ret)
                return 1;       /* generic segmentation offloading on */
+#endif
 
 #ifdef ETHTOOL_GFLAGS
        ret = iface_ethtool_ioctl(handle, ETHTOOL_GFLAGS, "ETHTOOL_GFLAGS");
 
 #ifdef ETHTOOL_GFLAGS
        ret = iface_ethtool_ioctl(handle, ETHTOOL_GFLAGS, "ETHTOOL_GFLAGS");