Skip to contentSkip to conversation

about the tcp connection state

DISCUSSION chuanbo zheng 3 participants 4 messages Feb 15, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

In ip_conntrack_proto_tcp.c==>tcp_new(),the newconntrack is set to,
newconntrack

		= tcp_conntracks[0][get_conntrack_index(tcph)]
		[TCP_CONNTRACK_NONE];

I noticed in the difination of tcp_conntracks, tcp_conntracks[0][2][TCP_CONNTRACK_NONE] will be TCP_CONNTRACK_ESTABLISHED. then when an ACK packet without SYN is received by netfilter, the state would be directly changed to ESTABLISHED. Is there reason for doing like this? or I made some mistake.

thanks.

regards,
Jack
[email protected]

#1 lore raw

Reading ICMP packet data

I am making a new TARGET for iptables which tries to read the ICMP ECHO/ECHO-REPLY packets data payload. Now my problem is how do i know that the packet contains data i.e.

IP Header+ICMP header+Data

and not

IP header+ICMP header

coz i see some utilities which will not send data part.

my TARGET hooks on NF_IP_INPUT_IN and i m using kernel 2.4.22.

Thanks
extreme

#2 lore raw

Re: Reading ICMP packet data

Quoted 7 lines · Vineet Mehta

Now my problem is how do i know that the packet contains data i.e.

IP Header+ICMP header+Data

and not

IP header+ICMP header

By the IP packet length and then when you know there is data by verifying the data looks sane before you use it.

Regards
Henrik

#3 lore raw
In reply to chuanbo zheng
Quoted 4 lines · chuanbo zheng

I noticed in the difination of tcp_conntracks, tcp_conntracks[0][2][TCP_CONNTRACK_NONE] will be TCP_CONNTRACK_ESTABLISHED. then when an ACK packet without SYN is received by netfilter, the state would be directly changed to ESTABLISHED. Is there reason for doing like this?

I think you are confusing to different ESTABLISHED concepts here.

TCP_CONNTRACK_ESTABLISHED is just the TCP state of the tracked connection, not the conntrack state. The two are not related other than timeouts.

The conntrack state of this packet is still NEW, as it would be for a SYN, as traffic has only been seen in one direction.

Note: conntrack is not about firewalling, it is about classifying traffic into connections.

Regards
Henrik