From patchwork Tue Apr 25 15:26:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guoshuai Li X-Patchwork-Id: 754867 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 3wC6X60Lvdz9s80 for ; Wed, 26 Apr 2017 01:27:18 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 94D72BBD; Tue, 25 Apr 2017 15:27:16 +0000 (UTC) X-Original-To: ovs-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 31306B64 for ; Tue, 25 Apr 2017 15:27:15 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from smtp2203-239.mail.aliyun.com (smtp2203-239.mail.aliyun.com [121.197.203.239]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id 9308E226 for ; Tue, 25 Apr 2017 15:27:12 +0000 (UTC) X-Alimail-AntiSpam: AC=CONTINUE; BC=0.07940794|-1; FP=0|0|0|0|0|-1|-1|-1; HT=e02c03291; MF=ligs@dtdream.com; NM=1; PH=DS; RN=2; RT=2; SR=0; TI=SMTPD_---.8-X1Thw_1493134028; Received: from localhost.localdomain(mailfrom:ligs@dtdream.com ip:111.198.29.132) by smtp.aliyun-inc.com(10.147.40.200); Tue, 25 Apr 2017 23:27:08 +0800 From: Guoshuai Li To: ovs-dev@openvswitch.org Date: Tue, 25 Apr 2017 23:26:56 +0800 Message-Id: <20170425152656.15328-1-ligs@dtdream.com> X-Mailer: git-send-email 2.10.1.windows.1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY 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] [PATCH] compat: Fix build error in kernel 4.10.0 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 In kernel 4.10.0, the function "nf_defrag_ipv6_enable" need parameters "struct net *", so we need call it for each namespace init to load netfilter fragment kmod. Reported-by: Raymond Burkholder Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-April/331411.html Signed-off-by: Guoshuai Li Reviewed-by: Greg Rose --- datapath/linux/compat/ip_fragment.c | 14 ++++++++++++++ datapath/linux/compat/nf_conntrack_reasm.c | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/datapath/linux/compat/ip_fragment.c b/datapath/linux/compat/ip_fragment.c index b0f5d0e..efa86fc 100644 --- a/datapath/linux/compat/ip_fragment.c +++ b/datapath/linux/compat/ip_fragment.c @@ -729,18 +729,32 @@ int rpl_ip_defrag(struct net *net, struct sk_buff *skb, u32 user) return -ENOMEM; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) +static int __net_init ipv4_frags_init_net(struct net *net) +{ + nf_defrag_ipv4_enable(net); + + return 0; +} +#endif + static void __net_exit ipv4_frags_exit_net(struct net *net) { inet_frags_exit_net(&net->ipv4.frags, &ip4_frags); } static struct pernet_operations ip4_frags_ops = { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) + .init = ipv4_frags_init_net, +#endif .exit = ipv4_frags_exit_net, }; int __init rpl_ipfrag_init(void) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0) nf_defrag_ipv4_enable(); +#endif register_pernet_subsys(&ip4_frags_ops); ip4_frags.hashfn = ip4_hashfn; ip4_frags.constructor = ip4_frag_init; diff --git a/datapath/linux/compat/nf_conntrack_reasm.c b/datapath/linux/compat/nf_conntrack_reasm.c index 0bc4d9e..cb6da6c 100644 --- a/datapath/linux/compat/nf_conntrack_reasm.c +++ b/datapath/linux/compat/nf_conntrack_reasm.c @@ -558,12 +558,24 @@ out_unlock: return ret; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) +static int nf_ct_net_init(struct net *net) +{ + nf_defrag_ipv6_enable(net); + + return 0; +} +#endif + static void nf_ct_net_exit(struct net *net) { inet_frags_exit_net(&net->nf_frag.frags, &nf_frags); } static struct pernet_operations nf_ct_net_ops = { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) + .init = nf_ct_net_init, +#endif .exit = nf_ct_net_exit, }; @@ -571,7 +583,9 @@ int rpl_nf_ct_frag6_init(void) { int ret = 0; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0) nf_defrag_ipv6_enable(); +#endif nf_frags.hashfn = nf_hashfn; nf_frags.constructor = ip6_frag_init; nf_frags.destructor = NULL;