免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1018 | 回复: 0
打印 上一主题 下一主题

Zebra Codes Framework Analysis(2) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-03-06 10:12 |只看该作者 |倒序浏览
1. Descriptions
    Here in this topic, we'll focus on the routing table
of zebra and some detailes internal routing table. And we'll also
illustrate how the zebra communicating with the linux kernel.
    I always think that the routing software is the most
sophisticated technology and the routing codes is the most elegant and
trick codes.
2. Routing Framework Details
    We know that zebra is a multi-process based tool and
it includes several routing protocol process --- ospfd, ospf6d, ripd,
ripngd etc.
    Each routing protocol process has its own routing
table, but they can not communicate with linux kernel directly. These
routing protocol process can commnunicate with zebra --- the
main(control) process directly through linux IPC --- UNIX socket. And
the zebra process is responsible for communicating with the linux
kernel and exchanging the routing informations with the kernel FIB
table.
   
2.1 How communicate with linux kernel
    Zebra can communicate with linux kernel through ioctl, kernel socket and netlink, here we prefer to NETLINK.
    The NETLINK related functions are almost defined in rt_netlinkd.c and the most important functions are :
        kernel_init()
        kernel_read()
        netlink_parse_info()
        netlink_information_fetch()
    The data exchanging functions are defined in zebra_rib.c and they are :
        rib_install_kernel()
        rib_uninstall_kernel()
2.2 Prefix Utility Operation Functions
    The handling of prefix is very important, and almost all the prefix operations are defined in prefix.c.
    Almost all the functions in prefix.c are utility
functions used to convert the sting to prefix or prefix to string.
2.3 The Routing Table Of Zebra
           
           
        VRF_VECTOR
           
           
    ------------------------------
           
           
      |   
               
|
           
           
    index[][]   
      index[][]
               
---------------------------  ------------------------------
      
        
     
|         
|           
|         |
            
     table[][]   stable   
    table   stable[][]
      
       --------------   
                 
----------------
              
        |   
            
               |
           
      route node   
      
           
route node
         
---------------------------      
--------------------------------
              
       |      
           
               |
      
            
RIB         
         
static_ipv4/static_ipv6   
                --------------
                      |
                  next hop   
    We can see that the 'vrf_vector' is the 'root' of
the whole routing table in zebra. And the 'index' pointer of the
vrf_vector points to each routing table --- vrf_table.
    Each vrf_table has two tables --- table[][] and
stable[][]. 'stable' is used by configure the static routing and
'table' is used by RIB.
   
    The routing table is a little difficult, and we'll
describe it more detailedly latter.   
   


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/26397/showart_490343.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP