Q about ip_local_deliver_finish

From: Alexey Vyskubov (alexey.vyskubov@nokia.com)
Date: Tue May 22 2001 - 06:34:07 EST


Hello.

I have a question (maybe stupid but I spent a lot of time trying to find an
answer)about ip_local_deliver_finish() in 2.4.4. kernel.
I'll be very grateful if someone explains me what's happening.

There is the following piece of code in ip_local_deliver_finish()
(in net/ipv4/ip_input.c):

if(ipprot != NULL) {
        if(raw_sk == NULL &&
           ipprot->next == NULL &&
           ipprot->protocol == protocol) {
                int ret;
                /* Fast path... */
                ret = ipprot->handler(skb);
                return ret;
        } else {
                flag = ip_run_ipprot(skb, skb->nh.iph, ipprot, (raw_sk != NULL));
        }

[some comments skipped]

if(raw_sk != NULL) { /* Shift to last raw user */
        raw_rcv(raw_sk, skb);
        sock_put(raw_sk);
} else if (!flag) { /* Free and report errors */
        icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PROT_UNREACH, 0);
out:
        kfree_skb(skb);
}
}

return 0;

But in ip_run_ipprot the return value of ipprot->handler is just ignored,
code below:

if(skb2 != NULL) {
        ret = 1;
        ipprot->handler(skb2);
}

If I understand correctly it means that if we have two different protocols
with the same (modulo MAX_INET_PROTOS) protocol number then
ip_local_deliver will return the return value of ipprot->handler for the
first protocol in the chain
inet_protos[protocol number modulo MAX_INET_PROTOS] and *always zero* for the
second. Why? Is it a bug or I just do not understand something?

-- 
Alexey
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed May 23 2001 - 21:00:45 EST