fi
])
+dnl OVS_FIND_FIELD_IFELSE(FILE, STRUCTURE, REGEX, [IF-MATCH], [IF-NO-MATCH])
+dnl
+dnl Looks for STRUCTURE in FILE. If it is found, greps for REGEX within the
+dnl structure definition. If this is successful, runs IF-MATCH, otherwise
+dnl IF_NO_MATCH. If IF-MATCH is empty then it defines to
+dnl OVS_DEFINE(HAVE_<STRUCTURE>_WITH_<REGEX>), with <STRUCTURE> and <REGEX>
+dnl translated to uppercase.
+AC_DEFUN([OVS_FIND_FIELD_IFELSE], [
+ AC_MSG_CHECKING([whether $2 has member $3 in $1])
+ if test -f $1; then
+ awk '/$2.{/,/^}/' $1 2>/dev/null | grep '$3'
+ status=$?
+ case $status in
+ 0)
+ AC_MSG_RESULT([yes])
+ m4_if([$4], [], [OVS_DEFINE([HAVE_]m4_toupper([$2])[_WITH_]m4_toupper([$3]))], [$4])
+ ;;
+ 1)
+ AC_MSG_RESULT([no])
+ $5
+ ;;
+ *)
+ AC_MSG_ERROR([grep exited with status $status])
+ ;;
+ esac
+ else
+ AC_MSG_RESULT([file not found])
+ $5
+ fi
+])
+
dnl OVS_DEFINE(NAME)
dnl
dnl Defines NAME to 1 in kcompat.h.
OVS_GREP_IFELSE([$KSRC/include/linux/in.h], [ipv4_is_multicast])
OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [__ip_select_ident.*dst_entry],
[OVS_DEFINE([HAVE_IP_SELECT_IDENT_USING_DST_ENTRY])])
+ OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [inet_get_local_port_range.*net],
+ [OVS_DEFINE([HAVE_INET_GET_LOCAL_PORT_RANGE_USING_NET])])
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [dev_disable_lro])
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [dev_get_stats])
OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [netlink_has_listeners(net->genl_sock],
[OVS_DEFINE([HAVE_GENL_HAS_LISTENERS_TAKES_NET])])
OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [genlmsg_parse])
+ OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [genl_notify.*family],
+ [OVS_DEFINE([HAVE_GENL_NOTIFY_TAKES_FAMILY])])
+
+ OVS_FIND_FIELD_IFELSE([$KSRC/include/net/genetlink.h],
+ [genl_multicast_group], [id])
+
OVS_GREP_IFELSE([$KSRC/include/net/gre.h], [gre_cisco_register])
OVS_GREP_IFELSE([$KSRC/include/net/ipv6.h], [IP6_FH_F_SKIP_RH])
OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_get_be16])
OVS_GREP_IFELSE([$KSRC/include/net/vxlan.h], [struct vxlan_metadata],
[OVS_DEFINE([HAVE_VXLAN_METADATA])])
OVS_GREP_IFELSE([$KSRC/include/net/udp.h], [udp_flow_src_port],
- [OVS_DEFINE([HAVE_UDP_FLOW_SRC_PORT])])
+ [OVS_GREP_IFELSE([$KSRC/include/net/udp.h], [inet_get_local_port_range(net],
+ [OVS_DEFINE([HAVE_UDP_FLOW_SRC_PORT])])])
+ OVS_GREP_IFELSE([$KSRC/include/net/udp.h], [udp_v4_check])
+ OVS_GREP_IFELSE([$KSRC/include/net/udp.h], [udp_set_csum])
OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [ignore_df:1],
[OVS_DEFINE([HAVE_IGNORE_DF_RENAME])])
+ OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [SKB_GSO_GRE_CSUM],
+ [OVS_DEFINE([HAVE_SKB_GSO_GRE_CSUM])])
+ OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [SKB_GSO_UDP_TUNNEL_CSUM],
+ [OVS_DEFINE([HAVE_SKB_GSO_UDP_TUNNEL_CSUM])])
OVS_GREP_IFELSE([$KSRC/include/uapi/linux/netdevice.h], [NET_NAME_UNKNOWN],
[OVS_DEFINE([HAVE_NET_NAME_UNKNOWN])])
#define __NET_UDP_WRAPPER_H 1
#include <linux/version.h>
+
+#ifdef inet_get_local_port_range
+/* RHEL7 backports udp_flow_src_port() using an older version of
+ * inet_get_local_port_range(). */
+#undef inet_get_local_port_range
+#include_next <net/udp.h>
+#define inet_get_local_port_range rpl_inet_get_local_port_range
+#else
#include_next <net/udp.h>
+#endif
#ifndef HAVE_UDP_FLOW_SRC_PORT
-static inline __be16 udp_flow_src_port(struct net *net, struct sk_buff *skb,
- int min, int max, bool use_eth)
+static inline __be16 rpl_udp_flow_src_port(struct net *net, struct sk_buff *skb,
+ int min, int max, bool use_eth)
{
u32 hash;
return htons((((u64) hash * (max - min)) >> 32) + min);
}
+
+#define udp_flow_src_port rpl_udp_flow_src_port
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
+#ifndef HAVE_UDP_V4_CHECK
static inline __sum16 udp_v4_check(int len, __be32 saddr,
__be32 daddr, __wsum base)
{
return csum_tcpudp_magic(saddr, daddr, len, IPPROTO_UDP, base);
}
+#endif
+#ifndef HAVE_UDP_SET_CSUM
void udp_set_csum(bool nocheck, struct sk_buff *skb,
__be32 saddr, __be32 daddr, int len);
#endif