diff options
author | Florian Westphal <fw@strlen.de> | 2017-02-23 16:19:10 -0800 |
---|---|---|
committer | Joe Stringer <joe@ovn.org> | 2017-02-23 17:11:49 -0800 |
commit | 568b020934b2bdfbdd862f838fad4dd6effa33b6 (patch) | |
tree | e4f74cd0eefaea0123b6cd73ecaa0ff91ca64ca9 | |
parent | b641cb0bfb32cc6e9aa79d654612e85ab873f3ae (diff) | |
download | openvswitch-568b020934b2bdfbdd862f838fad4dd6effa33b6.tar.gz |
datapath: add and use nf_ct_set helper
Upstream commit:
commit c74454fadd5ea6fc866ffe2c417a0dba56b2bf1c
Author: Florian Westphal <fw@strlen.de>
Date: Mon Jan 23 18:21:57 2017 +0100
netfilter: add and use nf_ct_set helper
Add a helper to assign a nf_conn entry and the ctinfo bits to an sk_buff.
This avoids changing code in followup patch that merges skb->nfct and
skb->nfctinfo into skb->_nfct.
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
-rw-r--r-- | acinclude.m4 | 2 | ||||
-rw-r--r-- | datapath/conntrack.c | 6 | ||||
-rw-r--r-- | datapath/linux/compat/include/net/netfilter/nf_conntrack.h | 8 |
3 files changed, 12 insertions, 4 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index f26bcc1db..926ec8a2f 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -529,6 +529,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ OVS_FIND_PARAM_IFELSE([$KSRC/include/net/netfilter/nf_conntrack.h], [nf_ct_get_tuplepr], [struct.net], [OVS_DEFINE([HAVE_NF_CT_GET_TUPLEPR_TAKES_STRUCT_NET])]) + OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack.h], + [nf_ct_set]) OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_zones.h], [nf_ct_zone_init]) OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_labels.h], diff --git a/datapath/conntrack.c b/datapath/conntrack.c index 4a1b1ba69..df2bd9c0d 100644 --- a/datapath/conntrack.c +++ b/datapath/conntrack.c @@ -501,8 +501,7 @@ ovs_ct_find_existing(struct net *net, const struct nf_conntrack_zone *zone, ct = nf_ct_tuplehash_to_ctrack(h); - skb->nfct = &ct->ct_general; - skb->nfctinfo = ovs_ct_get_info(h); + nf_ct_set(skb, ct, ovs_ct_get_info(h)); return ct; } @@ -765,8 +764,7 @@ static int __ovs_ct_lookup(struct net *net, struct sw_flow_key *key, if (skb_nfct(skb)) nf_conntrack_put(skb_nfct(skb)); nf_conntrack_get(&tmpl->ct_general); - skb->nfct = &tmpl->ct_general; - skb->nfctinfo = IP_CT_NEW; + nf_ct_set(skb, tmpl, IP_CT_NEW); } /* Repeat if requested, see nf_iterate(). */ diff --git a/datapath/linux/compat/include/net/netfilter/nf_conntrack.h b/datapath/linux/compat/include/net/netfilter/nf_conntrack.h index e02e20b28..bb40b0f6d 100644 --- a/datapath/linux/compat/include/net/netfilter/nf_conntrack.h +++ b/datapath/linux/compat/include/net/netfilter/nf_conntrack.h @@ -14,4 +14,12 @@ static inline bool rpl_nf_ct_get_tuplepr(const struct sk_buff *skb, #define nf_ct_get_tuplepr rpl_nf_ct_get_tuplepr #endif +#ifndef HAVE_NF_CT_SET +static inline void +nf_ct_set(struct sk_buff *skb, struct nf_conn *ct, enum ip_conntrack_info info) +{ + skb->nfct = &ct->ct_general; + skb->nfctinfo = info; +} +#endif #endif /* _NF_CONNTRACK_WRAPPER_H */ |