⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ospf_routing_table_updates.c

📁 vxworks下ospf协议栈
💻 C
📖 第 1 页 / 共 3 页
字号:
                index < OSPF_HASH_TABLE_SIZE; ++index, sptr_ls_database_head = &(ospf.external_database_hash_table[LS_EXTERNAL_LSA][index]))                {                if (sptr_ls_database_head == NULL)                    {                    continue;                    }		        /* 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;                    if (sptr_database_entry->advertisement.sptr_external != NULL)                        {                        link_state_id = net_to_host_long (sptr_database_entry->advertisement.sptr_external->ls_header.id);                        if (link_state_id == destination_N)                            {                            ospf_calculate_routes_to_a_single_external_destination (&(sptr_database_entry->advertisement), new_summary_lsa_received);                            }                        }                    }                }            }        }    else if (sptr_routing_table_node_for_N == NULL)        {        ospf_calculate_routes_to_external_destinations ();        }    else        {        next_hops_have_changed = ospf_check_next_hops_for_changes (                                                                  sptr_new_routing_table_node_for_N->sptr_routing_table_entry->sptr_next_hop,                                                                  sptr_routing_table_node_for_N->sptr_routing_table_entry->sptr_next_hop);        if ((sptr_new_routing_table_node_for_N->sptr_routing_table_entry->path_cost !=             sptr_routing_table_node_for_N->sptr_routing_table_entry->path_cost) ||            (sptr_new_routing_table_node_for_N->sptr_routing_table_entry->path_type !=             sptr_routing_table_node_for_N->sptr_routing_table_entry->path_type) || (next_hops_have_changed == TRUE))            {            ospf_calculate_routes_to_external_destinations ();            }        }    return;    }/*************************************************************************************//* section 16.5 Case 2, (pages 162-163) */static void ospf_case_2_summary_link_incremental_update (OSPF_SUMMARY_LINK_ADVERTISEMENT_HEADER *sptr_summary,                                                         OSPF_AREA_ENTRY *sptr_area_A, enum BOOLEAN new_summary_lsa_received)    {    ULONG destination_N;    OSPF_ROUTING_TABLE_NODE *sptr_routing_table_node_for_N;    OSPF_ROUTING_TABLE_NODE *sptr_new_routing_table_node_for_N;    OSPF_ADVERTISEMENT_NODE advertisement_node;    enum BOOLEAN next_hops_have_changed;    ULONG link_state_id;    OSPF_LS_DATABASE_HEAD *sptr_ls_database_head = NULL;    OSPF_LS_DATABASE_ENTRY *sptr_database_entry = NULL;    OSPF_LS_DATABASE_ENTRY *sptr_next_database_entry = NULL;    ULONG index;    OSPF_AREA_ENTRY *sptr_area = NULL;    OSPF_AREA_ENTRY *sptr_next_area = NULL;    OSPF_PRINTF_DEBUG (OSPF_DEBUG_PRINTF, "OSPF: Entering ospf_case_2_summary_link_incremental_update\r\n");    destination_N = net_to_host_long (sptr_summary->ls_header.id);    sptr_routing_table_node_for_N = ospf_find_routing_table_node (destination_N, (enum OSPF_LS_TYPE) sptr_summary->ls_header.type,                                                                  OSPF_ROUTE_PATH_TYPE_INTER, sptr_area_A);       /* NEWRT LOOKUP */    if (sptr_routing_table_node_for_N != NULL)        {        ospf_invalidate_routing_table_entry (sptr_routing_table_node_for_N, sptr_summary->network_mask, destination_N, sptr_area_A);        }    advertisement_node.sptr_forward_link = NULL;    advertisement_node.sptr_backward_link = NULL;    advertisement_node.advertisement.sptr_summary = sptr_summary;    ospf_examine_a_single_destination_for_a_better_path (&advertisement_node, sptr_area_A);    sptr_new_routing_table_node_for_N = ospf_find_routing_table_node (destination_N, (enum OSPF_LS_TYPE) sptr_summary->ls_header.type,                                                                      OSPF_ROUTE_PATH_TYPE_INTER, sptr_area_A);                        /* NEWRT LOOKUP */    if ( (sptr_new_routing_table_node_for_N == NULL) && (sptr_routing_table_node_for_N != NULL ) )                      /* N is newly unreachable */        {        for (sptr_area = ospf.sptr_area_list; sptr_area != NULL; sptr_area = sptr_next_area)            {            sptr_next_area = sptr_area->sptr_forward_link;            /* Check for external lsdb */            for (index = 0x00000000L, sptr_ls_database_head = &(ospf.external_database_hash_table[LS_EXTERNAL_LSA][index]); /* for each hash list */                index < OSPF_HASH_TABLE_SIZE; ++index, sptr_ls_database_head = &(ospf.external_database_hash_table[LS_EXTERNAL_LSA][index]))                {                if (sptr_ls_database_head == NULL)                    {                    continue;                    }		        /* 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;                    if (sptr_database_entry->advertisement.sptr_external != NULL)                        {                        link_state_id = net_to_host_long (sptr_database_entry->advertisement.sptr_external->ls_header.id);                        if (link_state_id == destination_N)                            {                            ospf_calculate_routes_to_a_single_external_destination (&(sptr_database_entry->advertisement), new_summary_lsa_received);                            }                        }                    }                }            }        }    else if (sptr_routing_table_node_for_N == NULL)        {        ospf_calculate_inter_area_routes_for_a_single_summary_advertisement (&advertisement_node,                                                                             sptr_area_A, new_summary_lsa_received);        ospf_schedule_routing_table_build ();       /* the entire routing table must be recalculated */        }    else if (sptr_new_routing_table_node_for_N->sptr_routing_table_entry->path_cost >             sptr_routing_table_node_for_N->sptr_routing_table_entry->path_cost)        {        ospf_schedule_routing_table_build ();       /* the entire routing table must be recalculated */        }    else        {        next_hops_have_changed = ospf_check_next_hops_for_changes (sptr_new_routing_table_node_for_N->sptr_routing_table_entry->sptr_next_hop,                                                                   sptr_routing_table_node_for_N->sptr_routing_table_entry->sptr_next_hop);        if ((sptr_new_routing_table_node_for_N->sptr_routing_table_entry->path_cost !=             sptr_routing_table_node_for_N->sptr_routing_table_entry->path_cost) ||            (sptr_new_routing_table_node_for_N->sptr_routing_table_entry->path_type !=             sptr_routing_table_node_for_N->sptr_routing_table_entry->path_type) || (next_hops_have_changed == TRUE))            {            ospf_calculate_routes_to_external_destinations ();            }        }    return;    }/*******************************************************************************************************************************/static enum BOOLEAN ospf_check_next_hops_for_changes (OSPF_NEXT_HOP_BLOCK *sptr_new_next_hop, OSPF_NEXT_HOP_BLOCK *sptr_old_next_hop)    {    OSPF_NEXT_HOP_BLOCK *sptr_next_hop_new;    OSPF_NEXT_HOP_BLOCK *sptr_next_hop_old;    OSPF_PRINTF_DEBUG (OSPF_DEBUG_PRINTF, "OSPF: Entering ospf_check_next_hops_for_changes\r\n");    for (sptr_next_hop_new = sptr_new_next_hop, sptr_next_hop_old = sptr_old_next_hop;        (sptr_next_hop_new != NULL) && (sptr_next_hop_old != NULL);        sptr_next_hop_new = sptr_next_hop_new->sptr_forward_link, sptr_next_hop_old = sptr_next_hop_old->sptr_forward_link)        {        if ((sptr_next_hop_new->outgoing_router_interface != sptr_next_hop_old->outgoing_router_interface) ||            (sptr_next_hop_new->next_hop_router != sptr_next_hop_old->next_hop_router))            {            return(TRUE);            }        }    if ((sptr_next_hop_new != NULL) || (sptr_next_hop_old != NULL))        {        return(TRUE);        }    else        {        return(FALSE);        }    }#if defined (__NSSA__)/*******************************************************************************************************************************/ /* Section 3.6 RFC-1587 *//* Incremental updates -- Type-7 link advertisements */void ospf_update_routing_table_due_to_receipt_of_a_new_type_7_external_link_advertisement (OSPF_TYPE_7_LINK_ADVERTISEMENT_HEADER *sptr_type_7,                                                                                           OSPF_AREA_ENTRY *sptr_area_A)    {    ULONG tos0_metric;    USHORT age;    ULONG autonomous_system_boundary_router;    ULONG destination_N;    OSPF_ROUTING_TABLE_NODE *sptr_routing_table_node_for_N;    ULONG link_state_id;    enum BOOLEAN new_type_7_lsa_received;    OSPF_LS_DATABASE_HEAD *sptr_ls_database_head = NULL;    OSPF_LS_DATABASE_ENTRY *sptr_database_entry = NULL;    OSPF_LS_DATABASE_ENTRY *sptr_next_database_entry = NULL;    ULONG index;    OSPF_AREA_ENTRY *sptr_area = NULL;    OSPF_AREA_ENTRY *sptr_next_area = NULL;    OSPF_PRINTF_DEBUG (OSPF_DEBUG_PRINTF, "OSPF: Entering ospf_update_routing_table_due_to_receipt_of_a_new_type_7_external_link_advertisement\r\n");    new_type_7_lsa_received = TRUE;    tos0_metric = net_to_host_long (sptr_type_7->tos0_metric);    tos0_metric = tos0_metric & OSPF_LSInfinity;    age = net_to_host_short (sptr_type_7->ls_header.age);    autonomous_system_boundary_router = net_to_host_long (sptr_type_7->ls_header.advertising_router);    if ((tos0_metric == OSPF_LSInfinity) || (age == OSPF_MAXIMUM_AGE)/* || (autonomous_system_boundary_router == ospf.router_id)*/)        {        if ( (tos0_metric == OSPF_LSInfinity) || (age == OSPF_MAXIMUM_AGE) )            {            ospf_invalidate_type_7_route_entry (sptr_type_7);            ospf_display_routing_table ();            }        return;        }    destination_N = net_to_host_long (sptr_type_7->ls_header.id);    /* Fix for SPR# 297651 (SPR#83274). Mainly search for any network route with the desired path type which matches       the specified path type. This execludes searching for any network or router route to avoid       the bug that a network/host IP address matches a router ID which causes the new network/host       route not to be installed in ospf routing table*/    sptr_routing_table_node_for_N = ospf_find_router_or_network_routing_table_node (destination_N, sptr_type_7->ls_header.type, OSPF_ROUTE_PATH_TYPE_INTRA,                                                                                    sptr_area_A);   /* NEWRT LOOKUP */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -