Skip to contentSkip to conversation

Questions on conntrack

DISCUSSION Christian Hentschel 1 participant 1 message Feb 10, 2005 netfilter

lore
Share & tools
lore
#0 lore raw

Hi,
I'm trying to write a new UDP conntrack helper for netfilter and
looking at existing code, i have a few questions.

1). Do I need to check for the full UDP header?.. i can see some tcp helper that do it, but udp helpers does not.

        th = skb_header_pointer(skb, skb->nh.iph->ihl*4, sizeof(_tcph),
&_tcph);
        if (th == NULL)
                return NF_ACCEPT;

2). After that, some (TCP) helpers check for data avail. doing something like this:

        dataoff = skb->nh.iph->ihl*4 + th->doff*4;
        /* No data? */
        if (dataoff >= skb->len) {
                DEBUGP("ftp: skblen = %u\n", skb->len);
                return NF_ACCEPT;
        }
        datalen = skb->len - dataoff;

Again, ie, tftp helper (UDP) does not.

3). The last one ;).. is if someone can tell me why is the lock for. Is that because we can't use data directly from skb?.

        LOCK_BH(&ip_ftp_lock);
        fb_ptr = skb_header_pointer(skb, dataoff, skb->len - dataoff,

ftp_buffer);

Sorry for my english, and if they r stupid questions. Thanks in advance.

Christian Hentschel.