?? ospf_dijkstra.c
字號:
if ( (sptr_area->sptr_candidate != NULL) && (sptr_vertex_to_add != NULL) ) { ospf_remove_node_from_list ((OSPF_GENERIC_NODE **) &(sptr_area->sptr_candidate), (OSPF_GENERIC_NODE *) sptr_vertex_to_add); ospf_add_node_to_end_of_list ((OSPF_GENERIC_NODE *) sptr_vertex_to_add, (OSPF_GENERIC_NODE *) &(sptr_area->shortest_path_first_tree)); } return;}/**************************************************************************************** ospf_add_non_stub_intra_area_entry_to_ospf_routing_table - add non stub intra area entry to routing table** This routine will add the shortest path node to the routing table.** <sptr_vertex_V> Shortest path node to be added** <sptr_area> OSPF area** RETURNS: N/A** ERRNO: N/A** NOMANUAL*/static void ospf_add_non_stub_intra_area_entry_to_ospf_routing_table (OSPF_SHORTEST_PATH_NODE *sptr_vertex_V, OSPF_AREA_ENTRY *sptr_area){ BYTE_ENUM (OSPF_LS_TYPE) type_of_vertex; UNION_OSPF_ROUTER_LINK_BIT_OPTIONS bit_options; OSPF_PRINTF_PROLOGUE (OSPF_PROLOGUE_PRINTF, "OSPF: Entering ospf_add_non_stub_intra_area_entry_to_ospf_routing_table\r\n"); type_of_vertex = sptr_vertex_V->sptr_database_entry->advertisement.sptr_router->ls_header.type; if (type_of_vertex == OSPF_LS_ROUTER) { bit_options = sptr_vertex_V->sptr_database_entry->advertisement.sptr_router->bit_options; if (bit_options._bit.bit_B == TRUE) /* the newly added vertex is an area border router */ { ospf_add_routing_table_entry_for_area_border_router (sptr_vertex_V, sptr_area); }#if !defined (__NSSA__) if (bit_options._bit.bit_E == TRUE) /* the newly added vertex is an autonomous system boundary router */ { ospf_add_routing_table_entry_for_autonomous_system_boundary_router (sptr_vertex_V, sptr_area); }#else /* __NSSA__ */#if defined (__NSSA_FIXES__)/*****************SPR 75497****************/ if (sptr_area->flags._bit.nssa == TRUE) { if (bit_options._bit.bit_E == TRUE) { ospf_add_routing_table_entry_for_autonomous_system_boundary_router (sptr_vertex_V, sptr_area); } } else if ((bit_options._bit.bit_E == TRUE)) { ospf_add_routing_table_entry_for_autonomous_system_boundary_router (sptr_vertex_V, sptr_area); }#else /* __NSSA_FIXES__ */ if (sptr_area->flags._bit.nssa == TRUE) { if (bit_options._bit.bit_E != TRUE) /* the newly added vertex is an autonomous system boundary router */ { ospf_add_routing_table_entry_for_autonomous_system_boundary_router (sptr_vertex_V, sptr_area); } } else if (bit_options._bit.bit_E == TRUE) /* the newly added vertex is an autonomous system boundary router */ { ospf_add_routing_table_entry_for_autonomous_system_boundary_router (sptr_vertex_V, sptr_area); }#endif /* __NSSA_FIXES__ */#endif /*__NSSA__*/ } else if (type_of_vertex == OSPF_LS_NETWORK) /* the newly added vertex is a transit network */ { ospf_add_routing_table_entry_for_transit_network (sptr_vertex_V, sptr_area); /*#$-NOTE:NOTE NETWORK NODE-$#*/ }}/**************************************************************************************** ospf_add_routing_table_entry_for_area_border_router - add shortest path node entry to area border router routing table** This routine will add the shortest path node to the routing table* for an area border entry.** <sptr_vertex_V> Shortest path node to be added** <sptr_area> OSPF area** RETURNS: N/A** ERRNO: N/A** NOMANUAL*//*******************************************************************************************//* section 16.1, item (4) (page 153) */static void ospf_add_routing_table_entry_for_area_border_router (OSPF_SHORTEST_PATH_NODE *sptr_vertex_V, OSPF_AREA_ENTRY *sptr_area){ OSPF_ROUTING_TABLE_ENTRY *sptr_routing_table_entry_for_BR =NULL; OSPF_ROUTING_TABLE_NODE *sptr_routing_table_node =NULL; ULONG area_border_router_BR =0; OSPF_PRINTF_PROLOGUE (OSPF_PROLOGUE_PRINTF, "OSPF: Entering ospf_add_routing_table_entry_for_area_border_router\r\n"); area_border_router_BR = 0x00000000L; sptr_routing_table_node = NULL; sptr_routing_table_entry_for_BR = NULL; if (sptr_vertex_V->cost == OSPF_LSInfinity) /* the destination is unreachable */ { return; } area_border_router_BR = (sptr_vertex_V->vertex); /* SPR 86907 -- Begin */ sptr_routing_table_entry_for_BR = ospf_find_routing_table_entry_for_ABR(area_border_router_BR, sptr_area->area_id); /* SPR 86907 -- End */ if (sptr_routing_table_entry_for_BR != NULL) /* i.e sptr_routing_table_node != NULL */ { if (sptr_routing_table_entry_for_BR->path_cost < sptr_vertex_V->cost) { return; } } sptr_routing_table_node = ospf_add_fields_to_ospf_route_entry (area_border_router_BR, 0xffffffffL, sptr_vertex_V, sptr_area, OSPF_DESTINATION_TYPE_ABR); sptr_area->number_of_area_border_routers++; if (sptr_routing_table_node != NULL) { sptr_area->bring_up_virtual_links = TRUE; /* bring up virtual links after the routing table has been completely built */ } return;}/**************************************************************************************** ospf_bring_up_virtual_links_if_necessary - bring up virtual links if configured** This routine will bring up the virtual link for a particular area if configured.** RETURNS: N/A** ERRNO: N/A** NOMANUAL*/void ospf_bring_up_virtual_links_if_necessary (OSPF_AREA_ENTRY *sptr_area){ OSPF_INTERFACE_NODE *sptr_virtual_interface_node =NULL; OSPF_INTERFACE *sptr_virtual_interface =NULL; OSPF_ROUTING_TABLE_ENTRY *sptr_routing_table_entry =NULL; enum BOOLEAN found_match; OSPF_PRINTF_PROLOGUE (OSPF_PROLOGUE_PRINTF, "OSPF: Entering ospf_bring_up_virtual_links_if_necessary\r\n"); found_match = FALSE; for (sptr_virtual_interface_node = ospf.sptr_configured_virtual_links; sptr_virtual_interface_node != NULL ; sptr_virtual_interface_node = sptr_virtual_interface_node->sptr_forward_link) { sptr_virtual_interface = sptr_virtual_interface_node->sptr_interface; /* * SPR 86907 -- Begin * P. 48 Virtual links configured "Virtual links are brought up and down through * the building of the shortest-path trees for the Transit area */ if ((sptr_virtual_interface == NULL) || (sptr_virtual_interface->sptr_transit_area == NULL) || (sptr_virtual_interface->sptr_transit_area->area_id != sptr_area->area_id)) /* SPR 86907 -- End */ { continue; } /* SPR 86907 -- Begin */ sptr_routing_table_entry = ospf_find_routing_table_entry_for_ABR(sptr_virtual_interface->virtual_neighbor_rid, sptr_area->area_id); /* SPR 86907 -- End */ if ((sptr_routing_table_entry == NULL) || ((sptr_routing_table_entry->path_cost & OSPF_LSInfinity) >= OSPF_LSInfinity)) { /* No route - bring link down */ if (sptr_virtual_interface->state != OSPF_INTERFACE_IS_DOWN) { found_match = TRUE; ospf_execute_interface_state_machine (OSPF_INTERFACE_DOWN, sptr_virtual_interface->state, sptr_virtual_interface); } sptr_virtual_interface->address = 0x00000000L; /* take link down */ } else if (sptr_virtual_interface->state == OSPF_INTERFACE_IS_DOWN) { /* We have a route and link is down - bring it up */ found_match = TRUE; sptr_virtual_interface->cost = (USHORT) sptr_routing_table_entry->path_cost; sptr_virtual_interface->address = sptr_routing_table_entry->sptr_next_hop->outgoing_router_interface; /* Spec appendix C.4 */ ospf_execute_interface_state_machine (OSPF_INTERFACE_UP, OSPF_INTERFACE_IS_DOWN, sptr_virtual_interface); } else if (sptr_virtual_interface->cost != sptr_routing_table_entry->path_cost) { /* Metric has changed and link is not down - rebuild router links */ found_match = TRUE; sptr_virtual_interface->cost = (USHORT) sptr_routing_table_entry->path_cost; sptr_virtual_interface->address = sptr_routing_table_entry->sptr_next_hop->outgoing_router_interface; /* Spec appendix C.4 */ if (ospf.sptr_backbone_area != NULL) { if (ospf.sptr_backbone_area->lock_time == 0x00000000L) { /* SPR 84312 -- Begin */ ospf.sptr_backbone_area->lock_time = ospf_get_system_elapsed_time_second (); /* SPR 84312 -- End */ } } } } if ((found_match == FALSE) && (sptr_area->flags._bit.virtual_up == TRUE) && (ospf.sptr_backbone_area != NULL)) { ospf_schedule_shortest_path_first_job (ospf.sptr_backbone_area); /* need to recalculate the shortest path for the backbone area */ } return;}/**************************************************************************************** ospf_add_routing_table_entry_for_autonomous_system_boundary_router - add shortest path node entry to autonomous system boundary router routing table** This routine will add the shortest path node to the routing table* for an autonomous system boundary entry.** <sptr_vertex_V> Shortest path node to be added** <sptr_area> OSPF area** RETURNS: N/A** ERRNO: N/A** NOMANUAL*//*******************************************************************************************//* section 16.1, item (4) (page 153) */static void ospf_add_routing_table_entry_for_autonomous_system_boundary_router (OSPF_SHORTEST_PATH_NODE *sptr_vertex_V,OSPF_AREA_ENTRY *sptr_area){ OSPF_ROUTING_TABLE_ENTRY *sptr_routing_table_entry =NULL; OSPF_ROUTING_TABLE_ENTRY *sptr_routing_table_entry_for_ASBR =NULL; OSPF_ROUTING_TABLE_NODE *sptr_routing_table_node =NULL; ULONG autonomous_system_BR =0; OSPF_PRINTF_PROLOGUE (OSPF_PROLOGUE_PRINTF, "OSPF: Entering ospf_add_routing_table_entry_for_autonomous_system_boundary_router\r\n"); sptr_routing_table_entry = NULL; sptr_routing_table_entry_for_ASBR = NULL; sptr_routing_table_node = NULL; if (sptr_vertex_V->cost == OSPF_LSInfinity) /* the destination is unreachable */ { return; } autonomous_system_BR = (sptr_vertex_V->vertex /*sptr_database_entry->advertisement.sptr_router->ls_header.id*/); sptr_routing_table_entry_for_ASBR = ospf_find_routing_table_entry (autonomous_system_BR, OSPF_DESTINATION_TYPE_ASBR, OSPF_ROUTE_PATH_TYPE_WILDCARD, NULL); if (sptr_routing_table_entry_for_ASBR != NULL) /* i.e sptr_routing_table_node is not NULL */ { if (sptr_routing_table_entry_for_ASBR->path_cost < sptr_vertex_V->cost) { return; } } sptr_routing_table_node = ospf_add_fields_to_ospf_route_entry (autonomous_system_BR, 0xffffffffL, sptr_vertex_V, sptr_area, OSPF_DESTINATION_TYPE_ASBR); sptr_area->number_of_autonomous_system_boundary_routers++; return;}/**************************************************************************************** ospf_add_routing_table_entry_for_transit_network - add shortest path node entry to routing table for transit network** This routine will add the shortest path entry to the routing table for a* transit network.** <sptr_vertex_V> Shortest path node to be added** <sptr_area> OSPF area** RETURNS: N/A** ERRNO: N/A** NOMANUAL*/static void ospf_add_routing_table_entry_for_transit_network (OSPF_SHORTEST_PATH_NODE *sptr_vertex_V,OSPF_AREA_ENTRY *sptr_area){ OSPF_ROUTING_TABLE_NODE *sptr_routing_table_node =NULL; OSPF_ROUTING_TABLE_ENTRY *sptr_routing_table_entry =NULL; ULONG link_state_id_for_vertex_V =0; ULONG address_mask_for_vertex_V =0; ULONG destination_id_for_vertex_V =0; OSPF_PRINTF_PROLOGUE (OSPF_PROLOGUE_PRINTF, "OSPF: Entering ospf_add_routing_table_entry_for_transit_network\r\n"); if (sptr_vertex_V->cost == OSPF_LSInfinity) /* the destination is unreachable */ { return; } sptr_routing_table_node = NULL; /* These must be initialized JACK ### */ sptr_routing_table_entry = NULL;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -