netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] SNAT sometimes allows packets to pass through unchanged
@ 2009-02-11 17:37 Alan Stern
  2009-02-12  5:18 ` Patrick McHardy
  0 siblings, 1 reply; 10+ messages in thread
From: Alan Stern @ 2009-02-11 17:37 UTC (permalink / raw)
  To: netdev; +Cc: Kernel development list

I'm seeing some strange behavior on my firewall, which is running 
Fedora 8's version of 2.6.26.  Every so often a packet with a private 
source address is sent out the public interface unchanged, when it 
should be dropped.

This happens when internal hosts are slow to close their end of a TCP 
connection.  For example:

	Internal host A (using a private address) initiates a TCP
	connection to an external server B.

	Data is sent back and forth.

	External host B sends a FIN and host A responds with ACK.

	Several minutes later (after the tracking for this connection
	has expired), host A sends a FIN to host B.  This packet
	goes through the firewall unchanged and is sent out the
	public interface with the private source address intact.

Now I would expect that such packets would be dropped, because they 
don't belong to an existing connection and they can't be the start of a 
new connection.  The fact that this doesn't happen indicates there is a 
bug in the netfilter code somewhere.

For reference, here is a lightly-edited extract from my iptables 
script on the firewall:

------------------------------------------------------------------------
# Use SNAT for new outgoing connections from private addresses.
OUTIP=...  # The IP address of the firewall's public interface, eth1
iptables -t nat -N startnat
iptables -t nat -A startnat -p tcp -j SNAT --to-source $OUTIP:7000-65500
iptables -t nat -A startnat -p udp -j SNAT --to-source $OUTIP:7000-65500
iptables -t nat -A startnat -p icmp -j SNAT --to-source $OUTIP
iptables -t nat -A startnat -j DROP

iptables -t nat -A POSTROUTING -o eth1 -s 10.0.0.0/8 -j startnat
------------------------------------------------------------------------

Can anyone help figure out what's wrong?

Alan Stern


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-02-18 17:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-11 17:37 [BUG] SNAT sometimes allows packets to pass through unchanged Alan Stern
2009-02-12  5:18 ` Patrick McHardy
2009-02-12 15:11   ` Alan Stern
2009-02-16 10:43     ` Patrick McHardy
2009-02-16 16:19       ` Alan Stern
2009-02-16 16:25         ` Patrick McHardy
2009-02-16 16:41           ` Alan Stern
2009-02-18 16:49           ` Alan Stern
2009-02-18 16:58             ` Patrick McHardy
2009-02-18 17:41               ` Alan Stern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).