Linux Netfilter discussions
 help / color / mirror / Atom feed
* INVALID state
@ 2010-02-28  9:24 Nemeth Denes
  2010-02-28 10:10 ` Mart Frauenlob
  0 siblings, 1 reply; 13+ messages in thread
From: Nemeth Denes @ 2010-02-28  9:24 UTC (permalink / raw)
  To: netfilter

Dear all

Could someone help me to identify the difference between
the following 3 rules.

1. iptables -t mangle -A PREROUTING -p tcp ! --syn -m state --state 
INVALID -j DROP
2. iptables -A INPUT -p tcp ! --syn -m state --state INVALID -j DROP
3. iptables -A INPUP -p tcp ! --syn -m conntrack --cstate INVALID -j DROP

Many thanks



^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: INVALID state
@ 2008-11-13 18:16 Gilad Benjamini
  2008-11-13 22:31 ` Christoph Paasch
  0 siblings, 1 reply; 13+ messages in thread
From: Gilad Benjamini @ 2008-11-13 18:16 UTC (permalink / raw)
  To: netfilter

Here is my partial analysis of the code (2.6.24) , trying to understand what
INVALID state means.
Feedbacks are appreciated.

- init_conntrack calls l4proto->new. If a zero value is returned,
nf_conntrack_free is called and the packet's connection is considered
INVALID
- l4proto->new can be one of
	- tcp_new
		- Determines the new state according to tcp_conntracks
		- Returns 0 in these cases:
			- The new state is invalid
			- The new state is not SYN_SENT, and loose TCP is
turned off
	- icmp_new
		- Return 1 only for ICMP: ECHO,
TIMESTAMP,INFO_REQUEST,ADDRESS
	- icmpv6_new
		- Return 1 only for ECHO, NI_QUERY
	- sctp_new
		- (not sure of the details) 
	- A list of functions which always return 1; i.e. never produce an
INVALID state
		- udp_new
		- new (@nf_conntrack_proto_generic.c)
		- gre_new
		- udplite_new



^ permalink raw reply	[flat|nested] 13+ messages in thread
* INVALID state
@ 2008-11-12 22:08 Gilad Benjamini
  2008-11-13 11:13 ` Thomas Jacob
  0 siblings, 1 reply; 13+ messages in thread
From: Gilad Benjamini @ 2008-11-12 22:08 UTC (permalink / raw)
  To: netfilter

iptables allows querying for 4 states: NEW, ESTABLISHED, RELATED, INVALID
The first three are pretty obvious.
What exactly are the semantics of the INVALID state ?

My setup involves a firewall on a bridge and a dual-NIC protected machine

Network A -- Protected machine -- Network B -- Firewall

The protected machine has asymmetric routing. A ping arriving via network A
is replied via network B. The reply packet is seen as part of an INVALID
connection.
Same thing happens for a SYN packet from network A, which leads to a SYN-ACK
on network B.

I read somewhere that an ACK packet belonging to a non-existing connection,
for example, will be in NEW state. I was assuming that SYN-ACK will behave
the same.

So when is a connection considered INVALID ?

P.S: By now this is a theoretical question, as the asymmetric routing was a
misconfiguration. Nevertheless, I am trying to understand what happened.


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

end of thread, other threads:[~2010-02-28 11:15 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-28  9:24 INVALID state Nemeth Denes
2010-02-28 10:10 ` Mart Frauenlob
2010-02-28 10:52   ` Nemeth Denes
2010-02-28 11:15     ` Mart Frauenlob
  -- strict thread matches above, loose matches on Subject: below --
2008-11-13 18:16 Gilad Benjamini
2008-11-13 22:31 ` Christoph Paasch
2008-11-13 22:34   ` Gilad Benjamini
2008-11-13 23:01     ` Christoph Paasch
2008-11-12 22:08 Gilad Benjamini
2008-11-13 11:13 ` Thomas Jacob
2008-11-13 12:16   ` Christoph Paasch
2008-11-13 12:48     ` Thomas Jacob
2008-11-13 13:08       ` Christoph Paasch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox