summaryrefslogtreecommitdiff
path: root/include/net/netfilter/nf_nat.h
diff options
context:
space:
mode:
authorXin Long <lucien.xin@gmail.com>2022-12-08 19:56:12 +0300
committerDavid S. Miller <davem@davemloft.net>2022-12-12 13:14:03 +0300
commitebddb1404900657b7f03a56ee4c34a9d218c4030 (patch)
tree229260979b87bd6cd585ebf94fbd7939fa8254cd /include/net/netfilter/nf_nat.h
parent0564c3e51bc7bb200e76d0cad2d7067cc77cb83e (diff)
downloadlinux-ebddb1404900657b7f03a56ee4c34a9d218c4030.tar.xz
net: move the nat function to nf_nat_ovs for ovs and tc
There are two nat functions are nearly the same in both OVS and TC code, (ovs_)ct_nat_execute() and ovs_ct_nat/tcf_ct_act_nat(). This patch creates nf_nat_ovs.c under netfilter and moves them there then exports nf_ct_nat() so that it can be shared by both OVS and TC, and keeps the nat (type) check and nat flag update in OVS and TC's own place, as these parts are different between OVS and TC. Note that in OVS nat function it was using skb->protocol to get the proto as it already skips vlans in key_extract(), while it doesn't in TC, and TC has to call skb_protocol() to get proto. So in nf_ct_nat_execute(), we keep using skb_protocol() which works for both OVS and TC contrack. Signed-off-by: Xin Long <lucien.xin@gmail.com> Acked-by: Aaron Conole <aconole@redhat.com> Acked-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/netfilter/nf_nat.h')
-rw-r--r--include/net/netfilter/nf_nat.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
index e9eb01e99d2f..9877f064548a 100644
--- a/include/net/netfilter/nf_nat.h
+++ b/include/net/netfilter/nf_nat.h
@@ -104,6 +104,10 @@ unsigned int
nf_nat_inet_fn(void *priv, struct sk_buff *skb,
const struct nf_hook_state *state);
+int nf_ct_nat(struct sk_buff *skb, struct nf_conn *ct,
+ enum ip_conntrack_info ctinfo, int *action,
+ const struct nf_nat_range2 *range, bool commit);
+
static inline int nf_nat_initialized(const struct nf_conn *ct,
enum nf_nat_manip_type manip)
{