mirror of
https://github.com/openvswitch/ovs
synced 2025-08-30 22:05:19 +00:00
compat: Fix RHEL7 build.
Tested against 3.10.0-229.el7.x86_64. Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
This commit is contained in:
48
acinclude.m4
48
acinclude.m4
@@ -254,6 +254,37 @@ AC_DEFUN([OVS_GREP_IFELSE], [
|
||||
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.
|
||||
@@ -294,6 +325,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
|
||||
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])
|
||||
@@ -366,6 +399,12 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
|
||||
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])
|
||||
@@ -390,9 +429,16 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
|
||||
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])])
|
||||
|
||||
|
@@ -25,10 +25,10 @@
|
||||
#include <net/route.h>
|
||||
#include <net/xfrm.h>
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)
|
||||
#define GROUP_ID(grp) 0
|
||||
#else
|
||||
#ifdef HAVE_GENL_MULTICAST_GROUP_WITH_ID
|
||||
#define GROUP_ID(grp) ((grp)->id)
|
||||
#else
|
||||
#define GROUP_ID(grp) 0
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include <net/genetlink.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
|
||||
#ifndef HAVE_GENL_NOTIFY_TAKES_FAMILY
|
||||
|
||||
#undef genl_notify
|
||||
|
||||
|
@@ -14,8 +14,11 @@
|
||||
#define SKB_GSO_UDP_TUNNEL 0
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
|
||||
#ifndef HAVE_SKB_GSO_GRE_CSUM
|
||||
#define SKB_GSO_GRE_CSUM 0
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SKB_GSO_UDP_TUNNEL_CSUM
|
||||
#define SKB_GSO_UDP_TUNNEL_CSUM 0
|
||||
#endif
|
||||
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#define portid pid
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
|
||||
#ifndef HAVE_GENL_NOTIFY_TAKES_FAMILY
|
||||
struct rpl_genl_family {
|
||||
struct genl_family compat_family;
|
||||
unsigned int id;
|
||||
@@ -122,7 +122,11 @@ static inline int genl_has_listeners(struct genl_family *family,
|
||||
static inline int rpl_genl_has_listeners(struct genl_family *family,
|
||||
struct net *net, unsigned int group)
|
||||
{
|
||||
#ifdef HAVE_GENL_NOTIFY_TAKES_FAMILY
|
||||
return genl_has_listeners(family, net->genl_sock, group);
|
||||
#else
|
||||
return genl_has_listeners(&family->compat_family, net->genl_sock, group);
|
||||
#endif
|
||||
}
|
||||
|
||||
#define genl_has_listeners rpl_genl_has_listeners
|
||||
|
@@ -12,7 +12,7 @@ static inline bool ip_is_fragment(const struct iphdr *iph)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
|
||||
#ifndef HAVE_INET_GET_LOCAL_PORT_RANGE_USING_NET
|
||||
static inline void rpl_inet_get_local_port_range(struct net *net, int *low,
|
||||
int *high)
|
||||
{
|
||||
|
@@ -2,11 +2,20 @@
|
||||
#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;
|
||||
|
||||
@@ -33,15 +42,19 @@ static inline __be16 udp_flow_src_port(struct net *net, struct sk_buff *skb,
|
||||
|
||||
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
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include <linux/version.h>
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
|
||||
#ifndef HAVE_UDP_SET_CSUM
|
||||
|
||||
#include <net/udp.h>
|
||||
|
||||
|
Reference in New Issue
Block a user