Message ID | 1493419788-126308-1-git-send-email-jarno@ovn.org |
---|---|
State | Superseded |
Headers | show |
On 28 April 2017 at 15:49, Jarno Rajahalme <jarno@ovn.org> wrote: > Detect the presence of enum ip_conntrack_events member IPCT_LABEL at > configure time, and define it in the generated odp-netlink.h if > missing. This allows OVS userspace to be compiled with older Linux > kernel headers, such as those used in Travis userspace builds. > > Reported-by: Joe Stringer <joe@ovn.org> > Signed-off-by: Jarno Rajahalme <jarno@ovn.org> > --- > acinclude.m4 | 7 ++++++- > build-aux/extract-odp-netlink-h | 4 ++++ > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/acinclude.m4 b/acinclude.m4 > index 7e4acc9..ea25e08 100644 > --- a/acinclude.m4 > +++ b/acinclude.m4 > @@ -322,7 +322,8 @@ 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. > +dnl translated to uppercase. Note that this works equally well for finding > +dnl enum definitions. > AC_DEFUN([OVS_FIND_FIELD_IFELSE], [ > AC_MSG_CHECKING([whether $2 has member $3 in $1]) > if test -f $1; then > @@ -551,6 +552,10 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ > OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_nat.h], [nf_ct_nat_ext_add]) > OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_nat.h], [nf_nat_alloc_null_binding]) > OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_seqadj.h], [nf_ct_seq_adjust]) > + OVS_FIND_FIELD_IFELSE([$KSRC/include/uapi/linux/netfilter/nf_conntrack_common.h], > + [ip_conntrack_events], [IPCT_LABEL], > + [AC_DEFINE([HAVE_IPCT_LABEL], [1], > + [Define to 1 if the kernel headers have the IPCT_LABEL defined in enum ip_conntrack_events])]) I haven't tried this, but doesn't it require you to configure with "--with-linux" to get $KSRC ?
> On Apr 28, 2017, at 4:53 PM, Joe Stringer <joe@ovn.org> wrote: > > On 28 April 2017 at 15:49, Jarno Rajahalme <jarno@ovn.org <mailto:jarno@ovn.org>> wrote: >> Detect the presence of enum ip_conntrack_events member IPCT_LABEL at >> configure time, and define it in the generated odp-netlink.h if >> missing. This allows OVS userspace to be compiled with older Linux >> kernel headers, such as those used in Travis userspace builds. >> >> Reported-by: Joe Stringer <joe@ovn.org> >> Signed-off-by: Jarno Rajahalme <jarno@ovn.org> >> --- >> acinclude.m4 | 7 ++++++- >> build-aux/extract-odp-netlink-h | 4 ++++ >> 2 files changed, 10 insertions(+), 1 deletion(-) >> >> diff --git a/acinclude.m4 b/acinclude.m4 >> index 7e4acc9..ea25e08 100644 >> --- a/acinclude.m4 >> +++ b/acinclude.m4 >> @@ -322,7 +322,8 @@ 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. >> +dnl translated to uppercase. Note that this works equally well for finding >> +dnl enum definitions. >> AC_DEFUN([OVS_FIND_FIELD_IFELSE], [ >> AC_MSG_CHECKING([whether $2 has member $3 in $1]) >> if test -f $1; then >> @@ -551,6 +552,10 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ >> OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_nat.h], [nf_ct_nat_ext_add]) >> OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_nat.h], [nf_nat_alloc_null_binding]) >> OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_seqadj.h], [nf_ct_seq_adjust]) >> + OVS_FIND_FIELD_IFELSE([$KSRC/include/uapi/linux/netfilter/nf_conntrack_common.h], >> + [ip_conntrack_events], [IPCT_LABEL], >> + [AC_DEFINE([HAVE_IPCT_LABEL], [1], >> + [Define to 1 if the kernel headers have the IPCT_LABEL defined in enum ip_conntrack_events])]) > > I haven't tried this, but doesn't it require you to configure with > "--with-linux" to get $KSRC ? Thanks for noticing this. I did a totally different approach for v2 that will work on all platforms. Jarno
diff --git a/acinclude.m4 b/acinclude.m4 index 7e4acc9..ea25e08 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -322,7 +322,8 @@ 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. +dnl translated to uppercase. Note that this works equally well for finding +dnl enum definitions. AC_DEFUN([OVS_FIND_FIELD_IFELSE], [ AC_MSG_CHECKING([whether $2 has member $3 in $1]) if test -f $1; then @@ -551,6 +552,10 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_nat.h], [nf_ct_nat_ext_add]) OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_nat.h], [nf_nat_alloc_null_binding]) OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_seqadj.h], [nf_ct_seq_adjust]) + OVS_FIND_FIELD_IFELSE([$KSRC/include/uapi/linux/netfilter/nf_conntrack_common.h], + [ip_conntrack_events], [IPCT_LABEL], + [AC_DEFINE([HAVE_IPCT_LABEL], [1], + [Define to 1 if the kernel headers have the IPCT_LABEL defined in enum ip_conntrack_events])]) OVS_GREP_IFELSE([$KSRC/include/linux/random.h], [prandom_u32]) OVS_GREP_IFELSE([$KSRC/include/linux/random.h], [prandom_u32_max]) diff --git a/build-aux/extract-odp-netlink-h b/build-aux/extract-odp-netlink-h index 7fb6ce8..60c0c0f 100755 --- a/build-aux/extract-odp-netlink-h +++ b/build-aux/extract-odp-netlink-h @@ -21,6 +21,10 @@ $i\ #include "OvsDpInterfaceCtExt.h"\ #else\ #include "linux/netfilter/nf_conntrack_common.h"\ +/* Allow building userspace with older kernel headers. */\ +#ifndef HAVE_IPCT_LABEL\ +#define IPCT_LABEL 10\ +#endif\ #endif\ # Use OVS's own struct eth_addr instead of a 6-byte char array.
Detect the presence of enum ip_conntrack_events member IPCT_LABEL at configure time, and define it in the generated odp-netlink.h if missing. This allows OVS userspace to be compiled with older Linux kernel headers, such as those used in Travis userspace builds. Reported-by: Joe Stringer <joe@ovn.org> Signed-off-by: Jarno Rajahalme <jarno@ovn.org> --- acinclude.m4 | 7 ++++++- build-aux/extract-odp-netlink-h | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-)