billconan 发表于 2005-7-7 15:39:12

2.4的inet_create()代码问题

我在网上找到的老版代码清晰明了 新版的有了很大的变化 看不懂了

这个函数中有一个

        list_for_each(p, &inetsw) {
                /*得到当前访问的节点*/
                answer = list_entry(p, struct inet_protosw, list);

                /* Check the non-wild match. */
               
                if (protocol == answer->protocol) {
                        if (protocol != IPPROTO_IP)
                                break;
                } else {
                        /* Check for the two wild cases. */
                        if (IPPROTO_IP == protocol) {
                                protocol = answer->protocol;
                                break;
                        }
                        if (IPPROTO_IP == answer->protocol)
                                break;
                }
                answer = NULL;
        }
        br_read_unlock_bh(BR_NETPROTO_LOCK);

        if (!answer)
                goto free_and_badtype;
        if (answer->capability > 0 && !capable(answer->capability))
                goto free_and_badperm;
        if (!protocol)
                goto free_and_noproto;

请问这段遍历是在干什么?
页: [1]
查看完整版本: 2.4的inet_create()代码问题