QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1268|回复: 0

2.4的inet_create()代码问题

[复制链接]
发表于 2005-7-7 15:39:12 | 显示全部楼层 |阅读模式
我在网上找到的老版代码清晰明了 新版的有了很大的变化 看不懂了

这个函数中有一个

        list_for_each(p, &inetsw[sock->type]) {
                /*得到当前访问的节点*/
                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;

请问这段遍历是在干什么?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-6-29 08:18 , Processed in 0.113627 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表