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>
This commit is contained in:
committed by
Patrick McHardy
parent
2c38de4c1f
commit
42c1edd345
@@ -121,7 +121,9 @@ static unsigned int ipv4_confirm(unsigned int hooknum,
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (test_bit(IPS_SEQ_ADJUST_BIT, &ct->status)) {
|
||||
/* adjust seqs for loopback traffic only in outgoing direction */
|
||||
if (test_bit(IPS_SEQ_ADJUST_BIT, &ct->status) &&
|
||||
!nf_is_loopback_packet(skb)) {
|
||||
typeof(nf_nat_seq_adjust_hook) seq_adjust;
|
||||
|
||||
seq_adjust = rcu_dereference(nf_nat_seq_adjust_hook);
|
||||
|
||||
Reference in New Issue
Block a user