aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/netfilter/iptable_nat.c
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2014-04-28 21:09:50 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2014-04-29 20:56:22 +0200
commitf768e5bdefe1ec9adbf7a116dfb156b73cacb582 (patch)
tree1d49bc5b3184cc71d34090a4b056e3b9a9427fb9 /net/ipv4/netfilter/iptable_nat.c
parent683399eddb9fff742b1a14c5a5d03e12bfc0afff (diff)
downloadlinux-f768e5bdefe1ec9adbf7a116dfb156b73cacb582.tar.gz
netfilter: add helper for adding nat extension
Reduce copy-past a bit by adding a common helper. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/ipv4/netfilter/iptable_nat.c')
-rw-r--r--net/ipv4/netfilter/iptable_nat.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/net/ipv4/netfilter/iptable_nat.c b/net/ipv4/netfilter/iptable_nat.c
index ee2886126e3dfa..f1787c04a4ddfe 100644
--- a/net/ipv4/netfilter/iptable_nat.c
+++ b/net/ipv4/netfilter/iptable_nat.c
@@ -91,17 +91,9 @@ nf_nat_ipv4_fn(const struct nf_hook_ops *ops,
if (nf_ct_is_untracked(ct))
return NF_ACCEPT;
- nat = nfct_nat(ct);
- if (!nat) {
- /* NAT module was loaded late. */
- if (nf_ct_is_confirmed(ct))
- return NF_ACCEPT;
- nat = nf_ct_ext_add(ct, NF_CT_EXT_NAT, GFP_ATOMIC);
- if (nat == NULL) {
- pr_debug("failed to add NAT extension\n");
- return NF_ACCEPT;
- }
- }
+ nat = nf_ct_nat_ext_add(ct);
+ if (nat == NULL)
+ return NF_ACCEPT;
switch (ctinfo) {
case IP_CT_RELATED: