Q about ip_local_deliver_finish
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?
Signature · 1 line
Alexey
Quoted 6 lines
If I understand correctly it means that if we have two different protocols with the same (modulo
MAX_INET_PROTOS) protocol number thenip_local_deliverwill return the return value ofipprot->handlerfor the first protocol in the chain
inet_protos[protocol number moduloMAX_INET_PROTOS] and *always zero* for the second. Why? Is it a bug or I just do not understand something?
Of course I mean the return value for protocol handler if the chain contains only one protcol and *always zero* if the chain contains several protocols.
--
Alexey