From: Tobias Brunner Date: Fri, 18 Jan 2019 10:00:14 +0000 (+0100) Subject: kernel-netlink: Fix compilation on old kernels (< 2.6.39) X-Git-Tag: 5.8.0dr1~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c7f579fa178ad53ed2af8a0dc31e26a07d6be2ee;p=thirdparty%2Fstrongswan.git kernel-netlink: Fix compilation on old kernels (< 2.6.39) --- diff --git a/src/libcharon/plugins/kernel_netlink/kernel_netlink_ipsec.c b/src/libcharon/plugins/kernel_netlink/kernel_netlink_ipsec.c index 40fff7e05a..2819cbe8b5 100644 --- a/src/libcharon/plugins/kernel_netlink/kernel_netlink_ipsec.c +++ b/src/libcharon/plugins/kernel_netlink/kernel_netlink_ipsec.c @@ -260,27 +260,6 @@ static kernel_algorithm_t compression_algs[] = { {IPCOMP_LZJH, "lzjh" }, }; -/** - * IPsec HW offload state in kernel - */ -typedef enum { - NL_OFFLOAD_UNKNOWN, - NL_OFFLOAD_UNSUPPORTED, - NL_OFFLOAD_SUPPORTED -} nl_offload_state_t; - -/** - * Global metadata used for IPsec HW offload - */ -static struct { - /** bit in feature set */ - u_int bit; - /** total number of device feature blocks */ - u_int total_blocks; - /** determined HW offload state */ - nl_offload_state_t state; -} netlink_hw_offload; - /** * Look up a kernel algorithm name and its key size */ @@ -1352,6 +1331,31 @@ static bool add_uint32(struct nlmsghdr *hdr, int buflen, return TRUE; } +/* ETHTOOL_GSSET_INFO is available since 2.6.34 and ETH_SS_FEATURES (enum) and + * ETHTOOL_GFEATURES since 2.6.39, so check for the latter */ +#ifdef ETHTOOL_GFEATURES + +/** + * IPsec HW offload state in kernel + */ +typedef enum { + NL_OFFLOAD_UNKNOWN, + NL_OFFLOAD_UNSUPPORTED, + NL_OFFLOAD_SUPPORTED +} nl_offload_state_t; + +/** + * Global metadata used for IPsec HW offload + */ +static struct { + /** bit in feature set */ + u_int bit; + /** total number of device feature blocks */ + u_int total_blocks; + /** determined HW offload state */ + nl_offload_state_t state; +} netlink_hw_offload; + /** * Check if kernel supports HW offload */ @@ -1479,6 +1483,15 @@ out: return ret; } +#else + +static bool netlink_detect_offload(const char *ifname) +{ + return FALSE; +} + +#endif + /** * There are 3 HW offload configuration values: * 1. HW_OFFLOAD_NO : Do not configure HW offload.