Chinaunix首页 | 论坛 | 博客
  • 博客访问: 132499
  • 博文数量: 24
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 280
  • 用 户 组: 普通用户
  • 注册时间: 2006-11-14 15:19
文章分类

全部博文(24)

文章存档

2014年(6)

2008年(3)

2007年(15)

我的朋友

分类: LINUX

2008-03-06 10:12:30

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.        






 
阅读(1378) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~