All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Gruellich <frank@der-frank.org>
To: netfilter@lists.netfilter.org
Subject: Re: bad tcp packets
Date: Tue, 23 Nov 2004 14:59:10 +0100	[thread overview]
Message-ID: <20041123135910.GT21819@der-frank.org> (raw)
In-Reply-To: <web-23112413@infinito.it>

* hamals@infinito.it <hamals@infinito.it> 23. Nov 04:
> Hello to everyone

Hi,

> I'm reading "Iptables Tutorial 1.1.19" by Oskar 
> Andreasoon, and I cant understand these bad packets rules

Well choosen.  Please, don't wrap commands.  I'll fix in quoting.

> $IPTABLES -N bad_tcp_packets
> #
> #
> # bad_tcp_packets chain
> #
> $IPTABLES -A bad_tcp_packets -p tcp --tcp-flags SYN,ACK SYN,ACK \
> -m state --state NEW -j REJECT --reject-with tcp-reset

Conntrack treats a packet as state NEW, if it hits netfilter the first
time.  The first packet of a TCP stream will never have set both of SYN
and ACK.  This is the correct answer after a connection request (SYN)
from your network, but then it wouldn't be the first packet in stream.

> $IPTABLES -A bad_tcp_packets -p tcp ! --syn -m state --state NEW -j LOG \
> --log-prefix "New not syn:"

Same goes here: NEW in conntrack, but synflag not set should never
occure.  So LOG...

> $IPTABLES -A bad_tcp_packets -p tcp ! --syn -m state --state NEW -j DROP

... and DROP it.

> someone could explain me why that are bad tcp packets?

HTH,
 regards, Frank.
-- 
Sigmentation fault


  parent reply	other threads:[~2004-11-23 13:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-23 12:18 bad tcp packets hamals
2004-11-23 12:42 ` Miguel Angel Amador L
2004-11-23 13:49 ` Jason Opperisano
2004-11-23 13:59 ` Frank Gruellich [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-11-23 13:39 Scott Knake

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=20041123135910.GT21819@der-frank.org \
    --to=frank@der-frank.org \
    --cc=netfilter@lists.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.