2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-03 07:45:30 +00:00

datapath: introduce nf_conntrack_helper_put function

Upstream commit:
    commit d91fc59cd77c719f33eda65c194ad8f95a055190
    Author: Liping Zhang <zlpnobody@gmail.com>
    Date:   Sun May 7 22:01:55 2017 +0800

    netfilter: introduce nf_conntrack_helper_put helper function

    And convert module_put invocation to nf_conntrack_helper_put, this is
    prepared for the followup patch, which will add a refcnt for cthelper,
    so we can reject the deleting request when cthelper is in use.

    Signed-off-by: Liping Zhang <zlpnobody@gmail.com>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

Applied with additional use of HAVE_NF_CONNTRACK_HELPER_PUT compatibility
flag defined in acinclude.m4.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
This commit is contained in:
Greg Rose
2017-07-21 16:46:04 -07:00
committed by Joe Stringer
parent 67e3ddf1e9
commit ac8e3c6d14
4 changed files with 17 additions and 2 deletions

View File

@@ -748,6 +748,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
[OVS_DEFINE([HAVE_DEFRAG_ENABLE_TAKES_NET])])
OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [family_list],
[OVS_DEFINE([HAVE_GENL_FAMILY_LIST])])
OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_helper.h],
[nf_conntrack_helper_put])
if cmp -s datapath/linux/kcompat.h.new \
datapath/linux/kcompat.h >/dev/null 2>&1; then

View File

@@ -1164,7 +1164,7 @@ static int ovs_ct_add_helper(struct ovs_conntrack_info *info, const char *name,
help = nf_ct_helper_ext_add(info->ct, helper, GFP_KERNEL);
if (!help) {
module_put(helper->me);
nf_conntrack_helper_put(helper);
return -ENOMEM;
}
@@ -1634,7 +1634,7 @@ void ovs_ct_free_action(const struct nlattr *a)
static void __ovs_ct_free_action(struct ovs_conntrack_info *ct_info)
{
if (ct_info->helper)
module_put(ct_info->helper->me);
nf_conntrack_helper_put(ct_info->helper);
if (ct_info->ct)
nf_ct_tmpl_free(ct_info->ct);
}

View File

@@ -95,6 +95,7 @@ openvswitch_headers += \
linux/compat/include/net/netfilter/nf_conntrack.h \
linux/compat/include/net/netfilter/nf_conntrack_core.h \
linux/compat/include/net/netfilter/nf_conntrack_expect.h \
linux/compat/include/net/netfilter/nf_conntrack_helper.h \
linux/compat/include/net/netfilter/nf_conntrack_labels.h \
linux/compat/include/net/netfilter/nf_conntrack_seqadj.h \
linux/compat/include/net/netfilter/nf_conntrack_zones.h \

View File

@@ -0,0 +1,12 @@
#ifndef _NF_CONNTRACK_HELPER_WRAPPER_H
#define _NF_CONNTRACK_HELPER_WRAPPER_H
#include_next <net/netfilter/nf_conntrack_helper.h>
#ifndef HAVE_NF_CONNTRACK_HELPER_PUT
static inline void nf_conntrack_helper_put(struct nf_conntrack_helper *helper) {
module_put(helper->me);
}
#endif
#endif /* _NF_CONNTRACK_HELPER_WRAPPER_H */