diff options
author | Julian Anastasov <ja@ssi.bg> | 2011-06-16 17:29:22 +0200 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2011-06-16 17:29:22 +0200 |
commit | 42c1edd345c8412d96e7a362ee06feb7be73bb6c (patch) | |
tree | 5b05b0324b8186fe8bc40ffced48c856b099547d /include/net | |
parent | netfilter: fix looped (broad|multi)cast's MAC handling (diff) | |
download | linux-42c1edd345c8412d96e7a362ee06feb7be73bb6c.tar.xz linux-42c1edd345c8412d96e7a362ee06feb7be73bb6c.zip |
netfilter: nf_nat: avoid double seq_adjust for loopback
Avoid double seq adjustment for loopback traffic
because it causes silent repetition of TCP data. One
example is passive FTP with DNAT rule and difference in the
length of IP addresses.
This patch adds check if packet is sent and
received via loopback device. As the same conntrack is
used both for outgoing and incoming direction, we restrict
seq adjustment to happen only in POSTROUTING.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/netfilter/nf_conntrack.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index c7c42e7acc31..5d4f8e586e32 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h @@ -307,6 +307,12 @@ static inline int nf_ct_is_untracked(const struct nf_conn *ct) return test_bit(IPS_UNTRACKED_BIT, &ct->status); } +/* Packet is received from loopback */ +static inline bool nf_is_loopback_packet(const struct sk_buff *skb) +{ + return skb->dev && skb->skb_iif && skb->dev->flags & IFF_LOOPBACK; +} + extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp); extern unsigned int nf_conntrack_htable_size; extern unsigned int nf_conntrack_max; |