Skip to contentSkip to conversation

about ip_conntrack code

DISCUSSION zhengchuanbo 2 participants 2 messages Feb 11, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

I'm trying to read the ip_conntrack code. But it is not easy for me to understand the code. So I wish someone could help. Thanks in advance.

When an skb is received, we could call the ip_conntrack_get as following to get the connection info,

	 ct = ip_conntrack_get((struct sk_buff *)skb, &ctinfo);
and it calls,
	__ip_conntrack_get(skb->nfct, ctinfo);

What I want to ask is in the __ip_conntrack_get, how is the ip_conntrack transformed from nfct? I can see that the code just makes a transform in the structure as follows,

		struct ip_conntrack *ct
		= (struct ip_conntrack *)nfct->master;

I can't understand how the connection info is got by the transform. Wish I could get some help.

BTW, is there some more detailed documnets on netfilter code?

Thanks again.

regards,

Jack

#1 lore raw

Hi!

I just asked the same question as you not a long time ago.

See:
http://lists.netfilter.org/pipermail/netfilter-devel/2003-December/013425.html

Quoted 12 lines · zhengchuanbo

I'm trying to read the ip_conntrack code. But it is not easy for me to understand the code. So I wish someone could help. Thanks in advance.

When an skb is received, we could call the ip_conntrack_get as following to get the connection info,

	 ct = ip_conntrack_get((struct sk_buff *)skb, &ctinfo);
and it calls,
	__ip_conntrack_get(skb->nfct, ctinfo);

What I want to ask is in the __ip_conntrack_get, how is the ip_conntrack transformed from nfct? I can see that the code just makes a transform in the structure as follows,

Quoted 9 lines
		struct ip_conntrack *ct
		= (struct ip_conntrack *)nfct->master;

I can't understand how the connection info is got by the transform. Wish I could get some help.

BTW, is there some more detailed documnets on netfilter code?

The netfilter hacking HOW-TO, this and a bit of patience worked for me :-).

best regards,
Pablo