how to program a conntrack module

Fai Yip kenyip@genienrm.com
Fri, 26 Oct 2001 18:14:25 +0800


Hi,
I know little about the kernel program, however I need to write a module
base on netfilter to listen for tcp connection on to port 80. I read the
ftp connection tracking module and follow it's style to write my own
one. But there is no anything coming into the module after I type insmod
mymod.o. The help function is simply print out information about any
matched tcp packet which is list as following.

static int
tcp_help( const struct iphdr *iph, size_t len,
struct ip_conntrack *ct,
enum ip_conntrack_info ctinfo )
{
struct tcphdr *th = ( struct tcphdr *)(iph+iph->ihl*4 );

printk("ctinfo = %u\n", ctinfo );
printk( "[tcp_help()]: source %d.%d.%d.%d dst %d.%d.%d.%d sport %u dport
%u\n"
, NIPQUAD( iph->saddr), NIPQUAD( iph->daddr ), th->source, th->dest );

return NF_ACCEPT;
}

and the init is:
static int __init
init(void)
{
memset( &tcphelp, 0x00, sizeof( struct ip_conntrack_helper ) );

tcphelp.tuple.dst.protonum = IPPROTO_TCP;
tcphelp.tuple.dst.u.tcp.port = htons(80);
tcphelp.mask.dst.protonum = 0xFFFF;
tcphelp.mask.dst.u.tcp.port = 0xFFFF;
tcphelp.help = tcp_help;

printk("[tcptk init()]: tcpH loaded\n");
return ip_conntrack_helper_register(&tcphelp);
}

Did Ií@miss anything which is needed to trigger the tcp_help function????

thanks


ken