From patchwork Fri Apr 28 22:49:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarno Rajahalme X-Patchwork-Id: 756618 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wF8Cj6pYyz9s75 for ; Sat, 29 Apr 2017 08:50:09 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id E0D3CBD1; Fri, 28 Apr 2017 22:50:06 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id BE78D7A9 for ; Fri, 28 Apr 2017 22:50:05 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 0E5EC168 for ; Fri, 28 Apr 2017 22:50:04 +0000 (UTC) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by relay9-d.mail.gandi.net (Postfix) with ESMTPS id BEAC4402D7; Sat, 29 Apr 2017 00:50:03 +0200 (CEST) Received: from mfilter14-d.gandi.net (mfilter14-d.gandi.net [217.70.178.142]) by relay6-d.mail.gandi.net (Postfix) with ESMTP id AD065FB887; Sat, 29 Apr 2017 00:50:03 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter14-d.gandi.net Received: from relay6-d.mail.gandi.net ([IPv6:::ffff:217.70.183.198]) by mfilter14-d.gandi.net (mfilter14-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id 0yQw0N7VnPbW; Sat, 29 Apr 2017 00:50:02 +0200 (CEST) X-Originating-IP: 208.91.1.34 Received: from sc9-mailhost2.vmware.com (unknown [208.91.1.34]) (Authenticated sender: jarno@ovn.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 3D8DCFB87E; Sat, 29 Apr 2017 00:50:00 +0200 (CEST) From: Jarno Rajahalme To: dev@openvswitch.org Date: Fri, 28 Apr 2017 15:49:48 -0700 Message-Id: <1493419788-126308-1-git-send-email-jarno@ovn.org> X-Mailer: git-send-email 2.1.4 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [RFC PATCH] config: Compat for older kernels not having IPCT_LABEL. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org 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 Signed-off-by: Jarno Rajahalme --- 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__WITH_), with and -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.