linux-Tcp IP协议栈源码阅读笔记(6)

来源:未知 责任编辑:责任编辑 发表时间:2015-10-08 14:16 点击:

  inet_register_protosw(q);

 

 /*

  * Set the ARP module up 

  */

 

 arp_init();

 

   /*

    * Set the IP module up

    */

 

 ip_init();

 

 tcp_v4_init(&inet_family_ops);

 

 /* Setup TCP slab cache for open requests. */

 tcp_init();

 

 /*

  * Set the ICMP layer up

  */

 

 icmp_init(&inet_family_ops);

 

 /* I wish inet_add_protocol had no constructor hook...

    I had to move IPIP from net/ipv4/protocol.c :-( --ANK

  */

#ifdef CONFIG_NET_IPIP

 ipip_init();

#endif

#ifdef CONFIG_NET_IPGRE

 ipgre_init();

#endif

 

 /*

  * Initialise the multicast router

  */

#if defined(CONFIG_IP_MROUTE)

 ip_mr_init();

#endif

 

 /*

  * Create all the /proc entries.

  */

#ifdef CONFIG_PROC_FS

 proc_net_create ("raw", 0, raw_get_info);

 proc_net_create ("netstat", 0, netstat_get_info);

 proc_net_create ("snmp", 0, snmp_get_info);

 proc_net_create ("sockstat", 0, afinet_get_info);

 proc_net_create ("tcp", 0, tcp_get_info);

 proc_net_create ("udp", 0, udp_get_info);

#endif  /* CONFIG_PROC_FS */

 

 ipfrag_init();

 

 return 0;

}  

module_init(inet_init);

 

                                                

 

     2.4 路由初始化(包括neighbour表、FIB表、和路由缓存表的初始化工作)

 

            2.4.1 rtcache表ip_rt_init()函数 在net/ipv4/ip_output中调用,net/ipv4/route.c中定义

 

            2.4.2 FIB初始化 在ip_rt_init()中调用 在net/ipv4/fib_front.c中定义

 

           2.4.3 neigbour表初始化  arp_init()函数中定义

 

     2.5 网络接口设备初始化

            

             在系统中网络接口都是由一个dev_base链表进行管理的。通过内核的启动方式也是通过这个链表进行操作的。在系统启动之初,将所有内核能够支持的网络接口都初始化成这个链表中的一个节点,并且每个节点都需要初始化出init函数指针,用来检测网络接口设备。然后,系统遍历整个dev_base链表,对每个节点分别调用init函数指针,如果成功,证明网络接口设备可用,那么这个节点就可以进一步初始化,如果返回失败,那么证明该网络设备不存在或是不可用,只能将该节点删除。启动结束之后,在dev_base中剩下的都是可以用的网络接口设备。

发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
用户名: 验证码:点击我更换图片
最新评论 更多>>

推荐热点

  • /etc/fstab 详解
  •  LVS-NAT和LVS-DR模式的实现详解
  •  RHCE考试之磁盘配额
  • nginx主主集群
  •  LVM逻辑卷管理器
  • 学习笔记:ACL详解
  • suse linux双网卡双网关配置
  • puppet文件服务配置
  •  Nginx主主负载均衡架构

快速直达

操作系统导航

LinuxWindows虚拟机
网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
Copyright © 2008-2015 计算机技术学习交流网. 版权所有

豫ICP备11007008号-1