aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/netfilter_ipv4/ip_conntrack.h
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2005-01-16 22:01:26 -0800
committerDavid S. Miller <davem@nuts.davemloft.net>2005-01-16 22:01:26 -0800
commit8d5f3377d48c74df38990688f09e773887ba4eb5 (patch)
tree25465714cf5b26bd8ad9cddd402d6e42b6eb3c09 /include/linux/netfilter_ipv4/ip_conntrack.h
parentcd79564003e1b16ebc4090d3a2055e30e08898fc (diff)
downloadhistory-8d5f3377d48c74df38990688f09e773887ba4eb5.tar.gz
[NETFILTER]: Remove manip array from conntrack entry
Original patch and multo bugfixes by Krisztian Kovacs. Now NAT has been simplified, there is only one place to NAT each packet. That means we can intuit what to do by looking at the difference between this packet and the reply we expect, getting rid of the manips[] array in the connection tracking structure, which is 72 bytes. Rework NAT to be based on 'change this packet to make src/dst look like this tuple'. 1) Each protocol's manip_pkt takes a 'struct ip_conntrack_manip', which is half (the source half) of a tuple. Hand the whole desired tuple to the NAT code and have it use the 'maniptype' arg to decide what part to copy. 2) Krisztian points out that we don't need the NAT lock to read the NAT information (or the tuples) as they never change once set, and while being set we have exclusive access. A lock is only needed to deal with only remaining NAT list: the bysource hash. 3) We don't need to rehash for the bysource hash: it depends on the incoming packet, which we can't change. 4) Many NAT functions only need the maniptype they are to perform, not the actual hook, which makes the code clearer. 5) New status bits to indicate what NAT needs to be done. We can always figure it out by inverting the tuple we expect in the other direction and comparing it, but this is faster. 6) Rename 'do_bindings' to 'nat_packet'. 7) ICMP handing is vastly simplified: we unconditionally change to look the way we want. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netfilter_ipv4/ip_conntrack.h')
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
index be86d7d28a635..05c771d1cf3e6 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack.h
@@ -40,6 +40,17 @@ enum ip_conntrack_status {
/* Connection is confirmed: originating packet has left box */
IPS_CONFIRMED_BIT = 3,
IPS_CONFIRMED = (1 << IPS_CONFIRMED_BIT),
+
+ /* Connection needs src nat in orig dir. This bit never changed. */
+ IPS_SRC_NAT_BIT = 4,
+ IPS_SRC_NAT = (1 << IPS_SRC_NAT_BIT),
+
+ /* Connection needs dst nat in orig dir. This bit never changed. */
+ IPS_DST_NAT_BIT = 5,
+ IPS_DST_NAT = (1 << IPS_DST_NAT_BIT),
+
+ /* Both together. */
+ IPS_NAT_MASK = (IPS_DST_NAT | IPS_SRC_NAT),
};
#ifdef __KERNEL__