zebra/qugga ospf implemention 1

1. start an ospf process
a. data structure
ospf_master{}
  |--ospf--ospf{}
 
b. main routines
router_ospf
  |--ospf_get
       |--ospf_new
            |--ospf_lsa_maxage_walker
            |--ospf_lsa_refresh_walker
            |--ospf_sock_init
            |--ospf_read
              
c.notes            
-there is only one router ospf process, but cisco can have many ospf process.

2. set a network area
a. data structure
ospf{}                                         <--|       <--|
  |--networks--ospf_network{}    |            |
  |--areas--ospf_area{}            ---|            |
              |--oiflist--ospf_interface{}       ---|
                            |--nbrs--ospf_neighbor{}
                            |--nbr_self--ospf_neighbor{}               
b. main routines                              
ospf_network_area
  |--ospf_network_set
       |--ospf_if_new
       |--ospf_nbr_add_self
       |--ospf_network_run
            |--ospf_if_up
                 |--OSPF_ISM_EVENT_SCHEDULE (ISM_InterfaceUp)
                      |--ospf_ism_event(ISM_Down-->ISM_Waiting)

ospf_if_new: construct an ospf_interface and a pseudo self ospf_neighbor (its state is always NSM_TwoWay)
ospf_nbr_add_self: add self ospf_neighbor to ospf_interface{}--nbrs
                     
ospf_ism_event (ISM_Down-->ISM_Waiting)
  |--ism_interface_up
  |--ism_change_state
       |--ospf_check_abr_status
       |--ospf_router_lsa_timer_add
  |--ism_timer_set (ISM_Waiting)
       |--OSPF_ISM_TIMER_ON (ospf_hello_timer)
       |--OSPF_ISM_TIMER_ON (ospf_wait_timer)
      
ospf_wait_timer
  |--OSPF_ISM_EVENT_SCHEDULE (ISM_WaitTimer)
       |--ospf_ism_event (ISM_Waiting-->ISM_DR)
            |--ism_wait_timer
                 |--ospf_dr_election
            |--ism_change_state
                 |--ospf_network_lsa_timer_add
            |--ism_timer_set (ISM_DR)    
                 |--OSPF_ISM_TIMER_ON (ospf_hello_timer)
                 |--OSPF_ISM_TIMER_ON (ospf_ls_ack_timer);
                
                
3. interact with a neighbor

situation: after the router become DR, start the other router

a. data structure

b. main routines

ospf_hello
  |--ospf_nbr_get
       |--ospf_nbr_add
            |--ospf_nbr_new
            |--nbr->state = NSM_Down
  |--OSPF_NSM_EVENT_EXECUTE (NSM_HelloReceived)  
       |--ospf_nsm_event (NSM_Down-->NSM_Init)     
            |--nsm_hello_received
            |--nsm_change_state
                 |--OSPF_ISM_TIMER_ON (oi->t_hello, ospf_hello_timer, 1)
                
  if the router can see itself in the neighbor hello packet then
 
    |--OSPF_NSM_EVENT_EXECUTE (NSM_TwoWayReceived)
         |--ospf_nsm_event 
              |--nsm_twoway_received (NSM_Init-->NSM_ExStart) 
              |--nsm_change_state
                   |--ospf_db_desc_send ()
                   |--OSPF_ISM_EVENT_EXECUTE (ISM_NeighborChange)
                        |--ospf_ism_event (ISM_DR)
                             |--ospf_dr_election
                            
  if the router can not see itself in the neighbor hello packet then
 
    |--OSPF_NSM_EVENT_EXECUTE (NSM_OneWayReceived)
         |--ospf_nsm_event (NSM_Init-->NSM_Init) 
        
    after the router receive db desc packet from the neighbor.      
   
    ospf_db_desc                   
      |--OSPF_NSM_EVENT_EXECUTE (NSM_TwoWayReceived)    
  
    
          

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值