INVALID state
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
Hi,
Quoted 3 lines · Gilad Benjamini
-
init_conntrackcallsl4proto->new. If a zero value is returned,nf_conntrack_freeis called and the packet's connection is considered INVALID
In fact, the packet isn't marked "INVALID", there is just xt_state.c, who detects an invalid packet, if nf_ct_get(...) returns 0 or null. Which means, that skb->nfct == NULL. Which in turn means, that nf_conntrack_in doesn't assigned a connection to the packet.
And that will be the case, if any of these calls return a negative value (take a look at nf_conntrack_in and the functions it's calling):l3proto->get_l4protol3proto->pkt_to_tuplel3proto->invert_tuplel4proto->errorl4proto->pkt_to_tuplel4proto->invert_tuplel4proto->newl4proto->packetnf_conntrack_alloc
So, there can be A LOT of cases, where conntrack detects an invalid packet...
--
Christoph Paasch
www.rollerbulls.be
--
Back to my original question then: what is the rule of thumb ? In other words, for a non-programmer reading proper documentation, how would the documentation describe INVALID ?
Quoted 47 lines
-----Original Message-----
From: [email protected] [mailto:netfilter- [email protected]] On Behalf Of Christoph Paasch
Sent: Thursday, November 13, 2008 2:31 PM
To: Gilad Benjamini
Cc: [email protected]
Subject: Re: INVALID stateHi,
Quoted 3 lines · Gilad Benjamini
-
init_conntrackcallsl4proto->new. If a zero value is returned,nf_conntrack_freeis called and the packet's connection is considered INVALIDIn fact, the packet isn't marked "INVALID", there is just
xt_state.c, who
detects an invalid packet, ifnf_ct_get(...)returns 0 or null. Which means,
thatskb->nfct== NULL. Which in turn means, thatnf_conntrack_indoesn't
assigned a connection to the packet.And that will be the case, if any of these calls return a negative value (take
a look atnf_conntrack_inand the functions it's calling):l3proto->get_l4protol3proto->pkt_to_tuplel3proto->invert_tuplel4proto->errorl4proto->pkt_to_tuplel4proto->invert_tuplel4proto->newl4proto->packetnf_conntrack_allocSo, there can be A LOT of cases, where conntrack detects an invalid packet...
--
Christoph Paaschwww.rollerbulls.be
--
--
To unsubscribe from this list: send the line "unsubscribe netfilter" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 3 lines · Gilad Benjamini
Back to my original question then: what is the rule of thumb ? In other words, for a non-programmer reading proper documentation, how would the documentation describe INVALID ?
In the "Packet Filtering HOWTO" of netfilter.org, they say:
A packet which could not be identified for some reason: this includes running out of memoory and ICMP errors which don't correspond to any known connection.
By looking to the code, I would say, that a packet is invalid, if the connection tracker doesn't manages to create a proper connection-state for that packet (memory-errors while treating the packet, ...), or the tests defined by the specific protocol-handlers fail.
But I'm also asking me this question, because I have to implement shim6- support in netfilter in the case of my Master Thesis. So does somebody can give me a reference which will explain me, what a firewall should check, and what not...? Should it check, if the packet respects the whole protocol (in case of
shim6: nonces, cga/hba, ...)?
Thanks for your help, and sorry, if i'm running out of the topic of that thread.
--
Christoph Paasch
www.rollerbulls.be
--