From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50832C43381 for ; Wed, 20 Mar 2019 21:19:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1D0A8218AE for ; Wed, 20 Mar 2019 21:19:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Vgwb5CsF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727615AbfCTVTn (ORCPT ); Wed, 20 Mar 2019 17:19:43 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:43499 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727493AbfCTVTm (ORCPT ); Wed, 20 Mar 2019 17:19:42 -0400 Received: by mail-pg1-f196.google.com with SMTP id l11so2680265pgq.10 for ; Wed, 20 Mar 2019 14:19:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=ADwZKneDF0Gdq2+6BXPPyCG05ucrgVx9s6inktibzi0=; b=Vgwb5CsF6xQ/j2urvFnjog12LCWFOw76u735RRI/AIS6Bj0oPxF7oqZPw5XG9oFa6C VTpIxEZzbNCU1qMOvxXeQ4R3jq3R9ZOJjtSjUYKh1nRcaJUsMVg1VJuSTgd2Rm6jSYto rfZk4zBZs3YSkgbMJecdsmrLbTBm9m5l3DAOa+VDgE368xs1FARx5dbsaR47TtDcYN4i D0RLgJmiN2qm8k8fSghEFFiD3qzhof1lk+6NQ+t6bnjiKPOa3PrdNjZjuy/gZXRQeL+g jEJ7wQHzJY4xdq5NNbGOm1M8pW3AGqwFaDjbiDuV0pO7HcdE0xBSVrJuOE9dU5QwcmBk cCEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ADwZKneDF0Gdq2+6BXPPyCG05ucrgVx9s6inktibzi0=; b=bUuCy/o65v3J5Llby/uTzf/jAdPvS76JcLUGikzIrbeA/xS8/2baAFlEWlbtPkgFPI W+Ao944CI5HirNIksS9OZJhV00uLNkpF9fw6uyqDYaUcdU/lQVOjRf7eE8zKG1bIffwM 4iwhLMot6KRrOj/kLGPY2LpQltyVwQNN1m/CEnaLXlPmwIzrk8DeqRb39D1aK0cIUBBW tQO8xeuXdLAgteAB6vD6SP8h5Er6a7FxSGrH+I3Uq22ZBoDBEnnMtq4HcTRMu2r+YIj7 Vh2iiQD+SLUD7iKPks+pj4Iw7AZPKnIy3eA7ldQOkzc/qMNeSAYvzHhSGmtD83iDlWWD ZJVQ== X-Gm-Message-State: APjAAAVQnJJMHKGmAsbpff4gJs6EukSiP5wWHDlUycep3O0yLm2LIO9C Se1WFYBnOqlG0Q/r0qc8Go1tra2/ X-Google-Smtp-Source: APXvYqxLJ4l/05dCYsbJd19YXegX/1P/bjv3NkKPmGMy4UVuWwwvFsiAQ6aJv3y5Zpe7inxiq1AWhQ== X-Received: by 2002:a17:902:b48d:: with SMTP id y13mr10141390plr.310.1553116781232; Wed, 20 Mar 2019 14:19:41 -0700 (PDT) Received: from Husky.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id s5sm3977425pfm.184.2019.03.20.14.19.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Mar 2019 14:19:40 -0700 (PDT) From: Yi-Hung Wei To: netdev@vger.kernel.org Cc: Yi-Hung Wei , Pablo Neira Ayuso Subject: [PATCH net-next 1/2] netfilter: Export nf_ct_destroy_timeout() Date: Wed, 20 Mar 2019 14:11:34 -0700 Message-Id: <1553116295-16359-1-git-send-email-yihung.wei@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch moves xt_ct_destroy_timeout from xt_CT.c to nf_conntrack_timeout.c, renames it to nf_ct_destroy_timeout(), and exports it. It does not contain any functional change. It would be useful for other users (i.e. OVS) that utilizes the finer-grain conntrack timeout feature. CC: Pablo Neira Ayuso Signed-off-by: Yi-Hung Wei --- include/net/netfilter/nf_conntrack_timeout.h | 1 + net/netfilter/nf_conntrack_timeout.c | 21 +++++++++++++++++++++ net/netfilter/xt_CT.c | 22 +--------------------- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/include/net/netfilter/nf_conntrack_timeout.h b/include/net/netfilter/nf_conntrack_timeout.h index 3394d75e1c80..5ce62fa1e1e2 100644 --- a/include/net/netfilter/nf_conntrack_timeout.h +++ b/include/net/netfilter/nf_conntrack_timeout.h @@ -105,4 +105,5 @@ extern struct nf_ct_timeout *(*nf_ct_timeout_find_get_hook)(struct net *net, con extern void (*nf_ct_timeout_put_hook)(struct nf_ct_timeout *timeout); #endif +void nf_ct_destroy_timeout(struct nf_conn *ct); #endif /* _NF_CONNTRACK_TIMEOUT_H */ diff --git a/net/netfilter/nf_conntrack_timeout.c b/net/netfilter/nf_conntrack_timeout.c index 91fbd183da2d..11b7f58e7f88 100644 --- a/net/netfilter/nf_conntrack_timeout.c +++ b/net/netfilter/nf_conntrack_timeout.c @@ -48,6 +48,27 @@ void nf_ct_untimeout(struct net *net, struct nf_ct_timeout *timeout) } EXPORT_SYMBOL_GPL(nf_ct_untimeout); +void nf_ct_destroy_timeout(struct nf_conn *ct) +{ +#ifdef CONFIG_NF_CONNTRACK_TIMEOUT + struct nf_conn_timeout *timeout_ext; + typeof(nf_ct_timeout_put_hook) timeout_put; + + rcu_read_lock(); + timeout_put = rcu_dereference(nf_ct_timeout_put_hook); + + if (timeout_put) { + timeout_ext = nf_ct_timeout_find(ct); + if (timeout_ext) { + timeout_put(timeout_ext->timeout); + RCU_INIT_POINTER(timeout_ext->timeout, NULL); + } + } + rcu_read_unlock(); +#endif +} +EXPORT_SYMBOL_GPL(nf_ct_destroy_timeout); + static const struct nf_ct_ext_type timeout_extend = { .len = sizeof(struct nf_conn_timeout), .align = __alignof__(struct nf_conn_timeout), diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c index 0fa863f57575..14600ad731ce 100644 --- a/net/netfilter/xt_CT.c +++ b/net/netfilter/xt_CT.c @@ -328,26 +328,6 @@ static int xt_ct_tg_check_v2(const struct xt_tgchk_param *par) return xt_ct_tg_check(par, par->targinfo); } -static void xt_ct_destroy_timeout(struct nf_conn *ct) -{ -#ifdef CONFIG_NF_CONNTRACK_TIMEOUT - struct nf_conn_timeout *timeout_ext; - typeof(nf_ct_timeout_put_hook) timeout_put; - - rcu_read_lock(); - timeout_put = rcu_dereference(nf_ct_timeout_put_hook); - - if (timeout_put) { - timeout_ext = nf_ct_timeout_find(ct); - if (timeout_ext) { - timeout_put(timeout_ext->timeout); - RCU_INIT_POINTER(timeout_ext->timeout, NULL); - } - } - rcu_read_unlock(); -#endif -} - static void xt_ct_tg_destroy(const struct xt_tgdtor_param *par, struct xt_ct_target_info_v1 *info) { @@ -361,7 +341,7 @@ static void xt_ct_tg_destroy(const struct xt_tgdtor_param *par, nf_ct_netns_put(par->net, par->family); - xt_ct_destroy_timeout(ct); + nf_ct_destroy_timeout(ct); nf_ct_put(info->ct); } } -- 2.7.4