netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: KOVACS Krisztian <hidden@balabit.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>, netfilter-devel@vger.kernel.org
Cc: Alex Badics <alex.badics@balabit.com>,
	KOVACS Krisztian <hidden@balabit.com>
Subject: [PATCH] netfilter: xt_socket: fix transparent match for IPv6 request sockets
Date: Tue, 20 Sep 2016 15:26:37 +0200	[thread overview]
Message-ID: <20160920132637.221892-1-hidden@balabit.com> (raw)

The introduction of TCP_NEW_SYN_RECV state, and the addition of request
sockets to the ehash table seems to have broken the --transparent option
of the socket match for IPv6 (around commit a9407000).

Now that the socket lookup finds the TCP_NEW_SYN_RECV socket instead of the
listener, the --transparent option tries to match on the no_srccheck flag
of the request socket.

Unfortunately, that flag was only set for IPv4 sockets in tcp_v4_init_req()
by copying the transparent flag of the listener socket. This effectively
causes '-m socket --transparent' not match on the ACK packet sent by the
client in a TCP handshake.

This change adds the same code initializing no_srccheck to
tcp_v6_init_req(), rendering the above scenario working again.

Signed-off-by: Alex Badics <alex.badics@balabit.com>
Signed-off-by: KOVACS Krisztian <hidden@balabit.com>
---
 net/ipv6/tcp_ipv6.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 94f4f89..21f2e5c 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -690,6 +690,7 @@ static void tcp_v6_init_req(struct request_sock *req,
 
 	ireq->ir_v6_rmt_addr = ipv6_hdr(skb)->saddr;
 	ireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr;
+	ireq->no_srccheck = inet_sk(sk_listener)->transparent;
 
 	/* So that link locals have meaning */
 	if (!sk_listener->sk_bound_dev_if &&
-- 
2.10.0


             reply	other threads:[~2016-09-20 13:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-20 13:26 KOVACS Krisztian [this message]
2016-09-20 15:01 ` [PATCH] netfilter: xt_socket: fix transparent match for IPv6 request sockets Eric Dumazet
2016-09-20 15:05   ` Eric Dumazet
  -- strict thread matches above, loose matches on Subject: below --
2016-09-23  9:27 KOVACS Krisztian
2016-09-25 11:47 ` Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160920132637.221892-1-hidden@balabit.com \
    --to=hidden@balabit.com \
    --cc=alex.badics@balabit.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).