Patchwork netfilter 03/05: ctnetlink: allow changing NAT sequence adjustment in creation

login
register
mail settings
Submitter Patrick McHardy
Date Feb. 9, 2009, 4:39 p.m.
Message ID <20090209163930.13918.91017.sendpatchset@x2.localnet>
Download mbox | patch
Permalink /patch/22743/
State Accepted
Delegated to: David Miller
Headers show

Comments

Patrick McHardy - Feb. 9, 2009, 4:39 p.m.
commit 028cf4480479685d7768bfdd6afe3f7bf9545b39
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date:   Mon Feb 9 14:25:52 2009 +0100

    netfilter: ctnetlink: allow changing NAT sequence adjustment in creation
    
    This patch fixes an inconsistency in the current ctnetlink code
    since NAT sequence adjustment bit can only be updated but not set
    in the conntrack entry creation.
    
    This patch is used by conntrackd to successfully recover newly
    created entries that represent connections with helpers and NAT
    payload mangling.
    
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Patrick McHardy <kaber@trash.net>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index c32a7e8..9051bb4 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -1215,6 +1215,16 @@  ctnetlink_create_conntrack(struct nlattr *cda[],
 		}
 	}
 
+#ifdef CONFIG_NF_NAT_NEEDED
+	if (cda[CTA_NAT_SEQ_ADJ_ORIG] || cda[CTA_NAT_SEQ_ADJ_REPLY]) {
+		err = ctnetlink_change_nat_seq_adj(ct, cda);
+		if (err < 0) {
+			rcu_read_unlock();
+			goto err;
+		}
+	}
+#endif
+
 	if (cda[CTA_PROTOINFO]) {
 		err = ctnetlink_change_protoinfo(ct, cda);
 		if (err < 0) {