netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Netfilter owner match breakage
@ 2013-08-27 20:24 Phil Oester
  2013-08-27 20:43 ` Eric Dumazet
  0 siblings, 1 reply; 2+ messages in thread
From: Phil Oester @ 2013-08-27 20:24 UTC (permalink / raw)
  To: netdev, netfilter-devel; +Cc: edumazet

In commit 90ba9b19 (tcp: tcp_make_synack() can use alloc_skb()), Eric changed
the call to sock_wmalloc in tcp_make_synack to alloc_skb.  In doing so,
the netfilter owner match lost its ability to block the SYNACK packet on
outbound listening sockets.  For example:

[phil@f19_main ~]$ id
uid=1000(phil) gid=1000(phil) groups=1000(phil)

[phil@f19_main ~]$ sudo iptables -A OUTPUT -p tcp -m owner --uid-owner 1000 -j REJECT

[phil@f19_main ~]$ echo hi | nc -l -p 8888

Before this commit, attempting to connect to the port 8888 listener generated
this:

10.10.10.1.47457 > 10.10.10.110.8888: Flags [S], seq 1855270582 [...]
10.10.10.110 > 10.10.10.110: ICMP 10.10.10.1 tcp port 47457 unreachable, length 68

After this commit, the session is established but the first packet of the
session gets rejected:

10.10.10.1.47453 > 10.10.10.110.8888: Flags [S], seq 2089355862 [...]
10.10.10.110.8888 > 10.10.10.1.47453: Flags [S.], seq 2554257713, ack 2089355863 [...]
10.10.10.1.47453 > 10.10.10.110.8888: Flags [.], ack 1, win 115 [...]
10.10.10.110 > 10.10.10.110: ICMP 10.10.10.1 tcp port 47453 unreachable, length 63

Reverting 90ba9b19 (and adjusting for the removal of s_data_desired) fixes the
problem.  Is there a better way to do this?

Phil

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

* Re: Netfilter owner match breakage
  2013-08-27 20:24 Netfilter owner match breakage Phil Oester
@ 2013-08-27 20:43 ` Eric Dumazet
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Dumazet @ 2013-08-27 20:43 UTC (permalink / raw)
  To: Phil Oester; +Cc: netdev, netfilter-devel, edumazet

On Tue, 2013-08-27 at 13:24 -0700, Phil Oester wrote:
> In commit 90ba9b19 (tcp: tcp_make_synack() can use alloc_skb()), Eric changed
> the call to sock_wmalloc in tcp_make_synack to alloc_skb.  In doing so,
> the netfilter owner match lost its ability to block the SYNACK packet on
> outbound listening sockets.  For example:
> 
> [phil@f19_main ~]$ id
> uid=1000(phil) gid=1000(phil) groups=1000(phil)
> 
> [phil@f19_main ~]$ sudo iptables -A OUTPUT -p tcp -m owner --uid-owner 1000 -j REJECT
> 

Oh well.

> [phil@f19_main ~]$ echo hi | nc -l -p 8888
> 
> Before this commit, attempting to connect to the port 8888 listener generated
> this:
> 
> 10.10.10.1.47457 > 10.10.10.110.8888: Flags [S], seq 1855270582 [...]
> 10.10.10.110 > 10.10.10.110: ICMP 10.10.10.1 tcp port 47457 unreachable, length 68
> 

Hmm... I think TCP stack should send more SYNACK, no ?

It sounds more logical to block the incoming SYN, but whatever.

> After this commit, the session is established but the first packet of the
> session gets rejected:
> 
> 10.10.10.1.47453 > 10.10.10.110.8888: Flags [S], seq 2089355862 [...]
> 10.10.10.110.8888 > 10.10.10.1.47453: Flags [S.], seq 2554257713, ack 2089355863 [...]
> 10.10.10.1.47453 > 10.10.10.110.8888: Flags [.], ack 1, win 115 [...]
> 10.10.10.110 > 10.10.10.110: ICMP 10.10.10.1 tcp port 47453 unreachable, length 63
> 
> Reverting 90ba9b19 (and adjusting for the removal of s_data_desired) fixes the
> problem.  Is there a better way to do this?

Well, a revert seems OK to me, it was not a critical change.

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

end of thread, other threads:[~2013-08-27 20:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-27 20:24 Netfilter owner match breakage Phil Oester
2013-08-27 20:43 ` Eric Dumazet

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).