Linux Netfilter development
 help / color / mirror / Atom feed
From: Christoph Paasch <christoph.paasch@gmail.com>
To: netfilter-devel@vger.kernel.org
Subject: l4_packet returning NF_DROP
Date: Thu, 12 Mar 2009 14:44:30 +0100	[thread overview]
Message-ID: <200903121444.37625.christoph.paasch@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1534 bytes --]

Hi,

I have a question regarding the call to l4_packet, in nf_conntrack_in(...) 
from nf_conntrack_core.c

When a module like TCP returns -NF_DROP in tcp_packet(...), the packet won't 
get dropped, because NF_DROP = 0, and in nf_conntrack_in the return of the 
call to l4_packet is checked:
if (ret < 0) {
	...
}

So, there is no way to drop packets after l4_packet.

Why does this is implemented that way?

There are several points in tcp_packet where the function returns -NF_DROP and 
the comments in this function say that the packet will get blocked.

For example (from tcp_packet):

	if (index == TCP_SYNACK_SET
		    && ct->proto.tcp.last_index == TCP_SYN_SET
		    && ct->proto.tcp.last_dir != dir
		    && ntohl(th->ack_seq) == ct->proto.tcp.last_end) {
			/* b) This SYN/ACK acknowledges a SYN that we earlier
			 * ignored as invalid. This means that the client and
			 * the server are both in sync, while the firewall is
			 * not. We kill this session and block the SYN/ACK so
			 * that the client cannot but retransmit its SYN and
			 * thus initiate a clean new session.
			 */
			write_unlock_bh(&tcp_lock);
			if (LOG_INVALID(net, IPPROTO_TCP))
				nf_log_packet(pf, 0, skb, NULL, NULL, NULL,
					  "nf_ct_tcp: killing out of sync session ");
			nf_ct_kill(ct);
			return -NF_DROP;
		}

I hope, that I was clear.
Could someone please explain this to me?
And how can I block packets after the call to l4_packet?

Thanks

--
Christoph Paasch

www.rollerbulls.be
--

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

             reply	other threads:[~2009-03-12 13:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-12 13:44 Christoph Paasch [this message]
2009-03-12 15:02 ` l4_packet returning NF_DROP Christoph Paasch
2009-03-12 15:13   ` [PATCH] netfilter: Allow dropping packet after call to l4proto->packet Christoph Paasch
2009-03-12 15:34     ` Jan Engelhardt
2009-03-12 15:49       ` Christoph Paasch
2009-03-12 16:07         ` Jan Engelhardt
2009-03-12 17:27       ` Pablo Neira Ayuso
2009-03-12 17:26     ` Pablo Neira Ayuso
2009-03-13  8:27       ` Christoph Paasch

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=200903121444.37625.christoph.paasch@gmail.com \
    --to=christoph.paasch@gmail.com \
    --cc=netfilter-devel@vger.kernel.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