📄 ospf_timer.c
字号:
((sptr_interface->type == OSPF_VIRTUAL_LINK) && (sptr_interface->area_id == OSPF_BACKBONE) && (sptr_area->area_id == OSPF_STARTING_AREA_ID_FOR_VIRTUAL_INTERFACE))) { ip_address = sptr_interface->address; ip_address = host_to_net_long (ip_address);#if defined (__UNNUMBERED_LINK__) if ((ip_address == 0) && (sptr_interface->type == OSPF_POINT_TO_POINT)) /* unnumbered link */ { if(ospf_is_if_unnumbered_up(sptr_interface) == false) { continue; } else { if (sptr_interface->state == OSPF_INTERFACE_IS_DOWN) { sptr_interface->state = OSPF_INTERFACE_UP; ospf_execute_interface_state_machine (OSPF_INTERFACE_UP, OSPF_INTERFACE_IS_DOWN, sptr_interface); sptr_interface->sptr_area->build_router = TRUE; ospf_generate_network_and_router_link_state_advertisements (sptr_interface); OSPF_PRINTF_ALARM (OSPF_ALARM_PRINTF, "OSPF: Unnumbered PORT%d INTERFACE UP\r\n", sptr_interface->port_number); } } } else /* not unnumbered link */ {#endif /* __UNNUMBERED_LINK__*/#if !defined(__OSPF_ROUTER_STACK__) if (ospf_is_if_up (ip_address) == false) { continue; } else { if (sptr_interface->state == OSPF_INTERFACE_IS_DOWN) { sptr_interface->state = OSPF_INTERFACE_UP; ospf_execute_interface_state_machine (OSPF_INTERFACE_UP, OSPF_INTERFACE_IS_DOWN, sptr_interface); sptr_interface->sptr_area->build_router = TRUE; ospf_generate_network_and_router_link_state_advertisements (sptr_interface); OSPF_PRINTF_ALARM (OSPF_ALARM_PRINTF, "OSPF: INTERFACE UP with address (HEX) %lx\r\n", sptr_interface->address); } }#if defined (__UNNUMBERED_LINK__) }#endif /* __UNNUMBERED_LINK__*/#else /* __OSPF_ROUTER_STACK__ */#if defined (__UNNUMBERED_LINK__) }#endif /* __UNNUMBERED_LINK__*/#endif /*__OSPF_ROUTER_STACK__*/ /* SPR 85432 -- Begin */ ++sptr_interface->periodic_delayed_acknowledgement_time_counter; if ((sptr_interface->delayed_acknowledgement_timer_enabled == TRUE) && (sptr_interface->periodic_delayed_acknowledgement_time_counter > OSPF_ACKNOWLEDGEMENT_INTERVAL)) { return_type = ospf_send_acknowledgement (sptr_interface, NULL, &(sptr_interface->sptr_head_of_delayed_acknowledgement_list)); if (return_type == OSPF_ACKNOWLEDGEMENTS_LEFT) { sptr_interface->periodic_delayed_acknowledgement_time_counter = 0x00000000L; /* try sending remaining acks later */ } else { sptr_interface->delayed_acknowledgement_timer_enabled = FALSE; /* all acknowledgements were sent */ } } ++sptr_interface->periodic_retransmit_time_counter; if ((sptr_interface->retransmit_timer_enabled == TRUE) && (sptr_interface->periodic_retransmit_time_counter > sptr_interface->retransmit_interval)) { ospf_retransmit_database_and_ls_request_packets ( sptr_interface); ospf_retransmit_link_state_advertisements ( sptr_interface); sptr_interface->periodic_retransmit_time_counter = 0; } /* SPR 85432 -- End */ ++sptr_interface->periodic_wait_time_counter; /* section 9, (page 61) */ if ((sptr_interface->point_timer_enabled == TRUE) && (sptr_interface->periodic_wait_time_counter > sptr_interface->router_dead_interval )) { sptr_interface->point_timer_enabled = FALSE; ospf_execute_interface_state_machine (OSPF_WAIT_TIMER, sptr_interface->state, sptr_interface); } if ((sptr_interface->wait_timer_enabled == TRUE) && (sptr_interface->periodic_wait_time_counter > sptr_interface->router_dead_interval )) { ospf_execute_interface_state_machine (OSPF_WAIT_TIMER, sptr_interface->state, sptr_interface); sptr_interface->wait_timer_enabled = FALSE; /* single shot timer */ } for (sptr_neighbor = sptr_interface->sptr_neighbor; sptr_neighbor != NULL; sptr_neighbor = sptr_next_neighbor ) { sptr_next_neighbor = sptr_neighbor->sptr_forward_link; neighbors_old_state = sptr_neighbor->state; ++sptr_neighbor->periodic_inactivity_time_counter; /* section 10, (page 73-74) */ if ((sptr_neighbor->inactivity_timer_enabled == TRUE) && (sptr_neighbor->periodic_inactivity_time_counter > sptr_interface->router_dead_interval)) {#if !defined (__OSPF_VIRTUAL_LINK__) if (sptr_interface->type == OSPF_VIRTUAL_LINK) { ospf_execute_interface_state_machine (OSPF_INTERFACE_DOWN, sptr_interface->state, sptr_interface); ospf_generate_network_and_router_link_state_advertisements (sptr_interface); }#else /*__OSPF_VIRTUAL_LINK__*/ if (sptr_interface->type == OSPF_VIRTUAL_LINK) { ospf_execute_neighbor_state_machine (OSPF_INACTIVITY_TIMER, sptr_neighbor->state, sptr_interface, sptr_neighbor); }#endif /* __OSPF_VIRTUAL_LINK__ */ else { ospf_execute_neighbor_state_machine (OSPF_INACTIVITY_TIMER, sptr_neighbor->state, sptr_interface, sptr_neighbor); ospf_originate_router_links_advertisement (sptr_interface->sptr_area); } sptr_neighbor->inactivity_timer_enabled = FALSE; /* single shot timer */ } if ( (neighbors_old_state > OSPF_NEIGHBOR_DOWN ) && (sptr_neighbor->state == OSPF_NEIGHBOR_DOWN) ) { /* * This node will be removed from the list but won't be freed * in the function: remove_neighbor_from_interface_neighbor_list * * REASON: Here I should be able to check the neighbors state; after * the state machine's action and determine what to do. If it's freed * there it can't be done here. */ if (sptr_interface->type == OSPF_BROADCAST) /* OSPF_BROADCAST interface's neighbors are dynamically learnt */ { ospf_free_neighbor (sptr_neighbor); } continue; } ++sptr_neighbor->periodic_slave_hold_time_counter; if ((sptr_neighbor->mode == OSPF_SLAVE_HOLD) && (sptr_neighbor->periodic_slave_hold_time_counter > sptr_interface->router_dead_interval)) { sptr_neighbor->mode = OSPF_SLAVE; /* single shot timer */ if (sptr_neighbor->sptr_database_summary != NULL) { ospf_free_neighbor_database_summary_list (sptr_neighbor); } } } } /* end for sptr_interface */ ++sptr_area->shortest_path_calculation_time_counter; if ((sptr_area->shortest_path_calculation_time_counter > OSPF_ROUTING_TABLE_BUILD_INTERVAL) && (sptr_area->run_shortest_path_calculation == TRUE) && (ospf.build_routing_table == FALSE)) { ospf_calculate_shortest_path_tree (sptr_area); sptr_area->shortest_path_calculation_time_counter = 0x00000000L; sptr_area->run_shortest_path_calculation = FALSE; } if (sptr_area->bring_up_virtual_links == TRUE ) { ospf_bring_up_virtual_links_if_necessary (sptr_area); sptr_area->bring_up_virtual_links = FALSE; } } } /* end for area list */ ++ospf.routing_table_build_time_counter; if (ospf.external_lsa_queue_process_interval > OSPF_EXTERNAL_LSA_QUEUE_PROCESS_INTERVAL) { ospf_process_external_route_to_ospf (); ospf.external_lsa_queue_process_interval = 0x00000000L; } else { ++ospf.external_lsa_queue_process_interval; } if ((ospf.routing_table_build_time_counter > OSPF_ROUTING_TABLE_BUILD_INTERVAL) && (ospf.build_routing_table == TRUE)) { ospf_build_routing_table (); ospf.routing_table_build_time_counter = 0x00000000L; } if ((ospf.sptr_ospf_export_route_queue != NULL) && (ospf.ospf_queue_interval_counter > ospf.ospf_export_route_queue_process_interval)) { ospf_process_export_route_queue (); ospf.ospf_queue_interval_counter = 0x00000000L; } semGive (ospf_global_mutex); }/******************************************************************************//* section 14, (page 145) */static void ospf_age_the_link_state_database ( OSPF_AREA_ENTRY * sptr_area ) { enum OSPF_LS_TYPE ls_type; OSPF_LS_DATABASE_HEAD *sptr_ls_database_head; OSPF_LS_DATABASE_ENTRY *sptr_database_entry; OSPF_LS_DATABASE_ENTRY *sptr_next_database_entry = NULL; div_t div_result; USHORT age; enum TEST test_return_type; ULONG index; ULONG advertising_router;#if defined (__OPAQUE_LSA__) enum BOOLEAN first_pass_external = TRUE;#endif /* __OPAQUE_LSA__ */#if !defined (__NSSA__) for (ls_type = OSPF_LS_ROUTER; ls_type <= OSPF_LS_AS_EXTERNAL; ++ls_type) /* for each type of advertisement */#else for (ls_type = OSPF_LS_ROUTER; ls_type <= OSPF_LS_TYPE_7; ++ls_type) /* for each type of advertisement */#endif /*__NSSA__*/ {#if defined (__NSSA__) if (ls_type == OSPF_LS_MULTICAST ) { continue; }#endif /*__NSSA__*/ for (index = 0x00000000L, sptr_ls_database_head = &(sptr_area->ls_database_hash_table[ls_type][index]); /* for each hash list */ index < OSPF_HASH_TABLE_SIZE; ++index, sptr_ls_database_head = &(sptr_area->ls_database_hash_table[ls_type][index])) { /* SPR#76812 */ for (sptr_database_entry = sptr_ls_database_head->sptr_linear_database_entry; sptr_database_entry != NULL; sptr_database_entry = sptr_next_database_entry) { sptr_next_database_entry = sptr_database_entry->sptr_forward_link; age = sptr_database_entry->advertisement.sptr_router->ls_header.age; age = net_to_host_short (age); /* SPR 85432 -- Begin */ if (age != OSPF_MAXIMUM_AGE) /* SPR 85432 -- End */ { ++age; sptr_database_entry->advertisement.sptr_router->ls_header.age = age; sptr_database_entry->advertisement.sptr_router->ls_header.age = host_to_net_short (sptr_database_entry->advertisement.sptr_router->ls_header.age); #if defined (__OSPF_MIB__) /* tell MIB API to update this link state advertisement */ ospf2Mapi_request( (void *)sptr_database_entry, ospfLsdbUpdateReqType ); #endif /* __OSPF_MIB__ */ } div_result = div ((int) age, (int) OSPF_CheckAge); if (div_result.rem == (int) NULL) /* advertisement's LS age is a multiple of OSPF_CheckAge, so verify the LS checksum */ { age = sptr_database_entry->advertisement.sptr_router->ls_header.age; sptr_database_entry->advertisement.sptr_router->ls_header.age = 0x0000; test_return_type = ospf_verify_LS_checksum ((void *) sptr_database_entry->advertisement.sptr_router, sptr_database_entry->advertisement.sptr_router->ls_header.length /* in network order */, sptr_database_entry->advertisement.sptr_router->ls_header.checksum); sptr_database_entry->advertisement.sptr_router->ls_header.age = age; } age = sptr_database_entry->advertisement.sptr_router->ls_header.age; age = net_to_host_short (age);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -