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

📄 ospf_routing_table.c

📁 vxworks下ospf协议栈
💻 C
📖 第 1 页 / 共 5 页
字号:
        return;        }    cost_IAC = sptr_routing_table_entry_for_BR->path_cost + tos0_metric;    if (cost_IAC < sptr_routing_table_entry_for_N->path_cost)        {        if (sptr_routing_table_entry_for_N->sptr_next_hop != NULL)            {            ospf_free_entire_list ((OSPF_GENERIC_NODE *) sptr_routing_table_entry_for_N->sptr_next_hop); /* Jack July 7/31 ### inher rt_entry not mallocked */            }        sptr_routing_table_entry_for_N->sptr_next_hop =        ospf_inherit_the_set_of_next_hops_from_node_X (sptr_routing_table_entry_for_BR->sptr_next_hop);        sptr_routing_table_entry_for_N->path_cost = cost_IAC;        }    else if (cost_IAC == sptr_routing_table_entry_for_N->path_cost)        {        ospf_add_new_path_to_routing_table_entry_and_update_rtm (sptr_routing_table_node_for_N,                                                                 area_border_router_BR, sptr_routing_table_entry_for_BR);        }#if defined (__RFC_2328__)    else if ((sptr_routing_table_entry_for_N->sptr_next_hop == NULL) && (sptr_routing_table_entry_for_N->sptr_area->sptr_interfaces->type == OSPF_VIRTUAL_LINK))        {		/* SPR#76812 */        ospf_delete_routing_table_node(sptr_routing_table_node_for_N);        }#endif    return;    }/**********************************************************************************************************************************/enum BOOLEAN ospf_add_new_path_to_routing_table_entry_and_update_rtm (OSPF_ROUTING_TABLE_NODE *sptr_routing_table_node_for_N,                                                                      ULONG next_hop_router, OSPF_ROUTING_TABLE_ENTRY *sptr_routing_table_entry)    {    OSPF_NEXT_HOP_BLOCK *sptr_next_hop;    OSPF_ROUTING_TABLE_ENTRY *sptr_routing_table_entry_for_N;    OSPF_NEXT_HOP_BLOCK *sptr_next_hop_from_routing_table_entry;    OSPF_NEXT_HOP_BLOCK *sptr_next_hop_from_N;    OSPF_NEXT_HOP_BLOCK *sptr_next_hop_for_next_iteration;    OSPF_PRINTF_DEBUG (OSPF_DEBUG_PRINTF, "OSPF: Entering ospf_add_new_path_to_routing_table_entry_and_update_rtm\r\n");    sptr_next_hop_for_next_iteration = NULL;    sptr_routing_table_entry_for_N = sptr_routing_table_node_for_N->sptr_routing_table_entry;    PARAMETER_NOT_USED (next_hop_router);    /* sptr_next_hop is a copy of the list if its not NULL */    sptr_next_hop = ospf_inherit_the_set_of_next_hops_from_node_X (sptr_routing_table_entry->sptr_next_hop);    for (sptr_next_hop_from_N = sptr_routing_table_entry_for_N->sptr_next_hop; sptr_next_hop_from_N != NULL;        sptr_next_hop_from_N = sptr_next_hop_from_N->sptr_forward_link )        {        if (sptr_next_hop != NULL)            {            for (sptr_next_hop_from_routing_table_entry = sptr_next_hop; sptr_next_hop_from_routing_table_entry != NULL; sptr_next_hop_from_routing_table_entry = sptr_next_hop_for_next_iteration)                {                sptr_next_hop_for_next_iteration = sptr_next_hop_from_routing_table_entry->sptr_forward_link; /* current node may be freed this assignment is necessary */                if ( (sptr_next_hop_from_routing_table_entry->next_hop_router == sptr_next_hop_from_N->next_hop_router) &&                     (sptr_next_hop_from_routing_table_entry->outgoing_router_interface == sptr_next_hop_from_N->outgoing_router_interface) )                    {                    sptr_next_hop_from_N->route_status = OSPF_ROUTE_IS_NOT_NEW;  /* JACK July ### 7/30 */                    /* identical next hops no point in adding */                    ospf_remove_node_from_list ((OSPF_GENERIC_NODE **) &sptr_next_hop, (OSPF_GENERIC_NODE *) sptr_next_hop_from_routing_table_entry);                    table_free ((void *) sptr_next_hop_from_routing_table_entry);                    sptr_next_hop_from_routing_table_entry = NULL;                    break;                    }                else                    {                    /* From the perspective of sptr_routing_table_node_for_N the status of next_hop is new  */                    sptr_next_hop_from_routing_table_entry->route_status = OSPF_ROUTE_IS_NEW;                    }                }            }        else            {            break;            }        }    if (sptr_next_hop != NULL)        {        if (sptr_routing_table_entry_for_N->sptr_next_hop == NULL)            {            sptr_routing_table_entry_for_N->sptr_next_hop = sptr_next_hop;            }        else            {            ospf_add_node_to_end_of_list ((OSPF_GENERIC_NODE *) sptr_next_hop, (OSPF_GENERIC_NODE *) sptr_routing_table_entry_for_N->sptr_next_hop);            }        sptr_routing_table_node_for_N->route_node_status = OSPF_ROUTE_IS_NEW;#if defined (__RTM__) /* JACK July ### 7/30 */        ospf_export_route_to_other_protocols (OSPF_ADD_PATH, sptr_routing_table_entry_for_N);#endif        return(TRUE);        }    else        {        sptr_routing_table_node_for_N->route_node_status = OSPF_ROUTE_IS_NOT_NEW;        return(FALSE);        }    }/* SPR#76812 -- Begin *//*************************************************************************************************//* section 16.7 (page 163-164) */static void ospf_generate_events_due_to_routing_table_changes (OSPF_ROUTING_TABLE_NODE *sptr_old_routing_table_head[OSPF_ROUTE_TABLE_MAX][OSPF_RT_HASH_TABLE_SIZE])    {    enum BOOLEAN I_am_an_area_border_router;    OSPF_ROUTING_TABLE_NODE *sptr_old_routing_table_node;    OSPF_ROUTING_TABLE_NODE *sptr_routing_table_node;    OSPF_ROUTING_TABLE_NODE *sptr_routing_table_node_2;    OSPF_AREA_ENTRY *sptr_area = NULL;    OSPF_AREA_ENTRY *sptr_next_area = NULL;    /* SPR 88613 Begin */    BOOLEAN      already_advertised = FALSE;    BOOLEAN      test_return_type;    OSPF_ADDRESS_RANGE_LIST_ENTRY *sptr_address_range;    ULONG        metric_cost;    /* SPR 88613 End */    ULONG index;	enum OSPF_ROUTE_TABLE_TYPE table_type;    OSPF_PRINTF_DEBUG (OSPF_DEBUG_PRINTF, "OSPF: Entering ospf_generate_events_due_to_routing_table_changes\r\n");    I_am_an_area_border_router = ospf_check_if_area_border_router ();    sptr_area = NULL;	for(table_type = OSPF_ROUTE_TABLE_NETWORK; table_type < OSPF_ROUTE_TABLE_MAX; table_type++)	{		for(index = 0x00000000L; index < OSPF_RT_HASH_TABLE_SIZE; index++)		{	    	for (sptr_old_routing_table_node = sptr_old_routing_table_head[table_type][index];	    		 sptr_old_routing_table_node != NULL;        		 sptr_old_routing_table_node = sptr_old_routing_table_node->sptr_forward_link)        	{        		for (sptr_routing_table_node = ospf.sptr_routing_table_head[table_type][index];        			 sptr_routing_table_node != NULL;            		 sptr_routing_table_node = sptr_routing_table_node->sptr_forward_link)            	{            		if (sptr_routing_table_node->sptr_routing_table_entry->destination_id ==            	    	sptr_old_routing_table_node->sptr_routing_table_entry->destination_id)            	    {            		    break;            	    }            	}        		if (sptr_routing_table_node == NULL)            	{#if defined (__RTM__)            		/* As a result of this non availabilty, a previously existing route may be the best route */            		/* hme 291001 begin */            		ospf_export_route_to_other_protocols (OSPF_DELETE_PATH, sptr_old_routing_table_node->sptr_routing_table_entry);            		/* hme 291001 end */#endif            		/* a previously advertised entry has been deleted or is now unreachable */            		/* incorporated in ospf_delete_and_free_route_node_no_longer_available */                	for (sptr_area = ospf.sptr_area_list; sptr_area != NULL; sptr_area = sptr_next_area)                    {                	    sptr_next_area = sptr_area->sptr_forward_link;                	    if ((sptr_area != ospf.sptr_backbone_area) &&                	       ((sptr_old_routing_table_node->sptr_routing_table_entry->path_type == OSPF_ROUTE_PATH_TYPE_INTRA) ||                	       (sptr_old_routing_table_node->sptr_routing_table_entry->path_type == OSPF_ROUTE_PATH_TYPE_INTER)))                        {                        	ospf_originate_a_single_summary_links_advertisement (sptr_old_routing_table_node->sptr_routing_table_entry,                        	                                                     sptr_area, TRUE);                        }                    	else if ((sptr_area == ospf.sptr_backbone_area) &&                              	(sptr_old_routing_table_node->sptr_routing_table_entry->path_type == OSPF_ROUTE_PATH_TYPE_INTRA) )                        {                        	/* ONLY intra area routes are flooded through backbone */                        	ospf_originate_a_single_summary_links_advertisement (sptr_old_routing_table_node->sptr_routing_table_entry,                        	                                                     sptr_area, TRUE);                        	/* REVISIT(patch): PR#2412 - as a result of the route changed,                        	 *                 the corresponding route for the virtual link                        	 *                 may no longer reachable (section 16.7).                        	 *                 Destroyed the adjacency if necessary.                        	 */                        	sptr_area->bring_up_virtual_links = TRUE;                        }                    }            	}        		else        	    {        		    if ((sptr_old_routing_table_node->sptr_routing_table_entry->path_cost !=        	           sptr_routing_table_node->sptr_routing_table_entry->path_cost) ||        		       (sptr_old_routing_table_node->sptr_routing_table_entry->type2_cost !=                 	   sptr_routing_table_node->sptr_routing_table_entry->type2_cost) ||                       (sptr_old_routing_table_node->sptr_routing_table_entry->path_type !=                       sptr_routing_table_node->sptr_routing_table_entry->path_type) ||                       (ospf_next_hop_block_changed (sptr_old_routing_table_node, sptr_routing_table_node) == TRUE) ||                       ((sptr_old_routing_table_node->sptr_routing_table_entry->abr == 0) && (sptr_routing_table_node->sptr_routing_table_entry->abr == 1)))                	{#if defined (__RTM__)                		ospf_export_route_to_other_protocols (OSPF_DELETE_PATH, sptr_old_routing_table_node->sptr_routing_table_entry);                		ospf_export_route_to_other_protocols (OSPF_ADD_PATH, sptr_routing_table_node->sptr_routing_table_entry);#endif                		if ((sptr_routing_table_node->sptr_routing_table_entry->destination_type == OSPF_DESTINATION_TYPE_NETWORK) ||                		    (sptr_routing_table_node->sptr_routing_table_entry->destination_type == OSPF_DESTINATION_TYPE_ASBR) ||                        /* SPR# 87382 - Begin */                        /*                         * Add the case that new RT entry is ASE and old RT                          * entry is INTRA/INTER -> need to send LSA to withdraw                         * that INTRA/INTER RT entry form the neighbors LSDB.                          */                            (sptr_routing_table_node->sptr_routing_table_entry->destination_type == OSPF_DESTINATION_TYPE_ASE))                        /* SPR# 87382 - End */                    	{                    		/* new summary link advertisements may have to be generated */                    		/* ONLY intra area routes are flooded through backbone - implicitly taken care in ospf_generate_events_for_changed_or_new_routes */ /*#$-NOTE:note50-$#*/                    		if (sptr_routing_table_node->sptr_routing_table_entry->path_type == OSPF_ROUTE_PATH_TYPE_INTRA)                    	    {                    		    ospf_originate_a_single_summary_links_advertisement (sptr_routing_table_node->sptr_routing_table_entry,                    		                                                         ospf.sptr_backbone_area, FALSE);                    	    }                    		/*                    		 * An intra area route, at the end of virtual link, that is not in the backbone may have become invalid                    		 * As a result of the virtual link configuration, an inter area route might have shown up. So age out the old intra rae summary                    		 * and don't summarize the new inter area one.                    		 */                    		if ((sptr_old_routing_table_node->sptr_routing_table_entry->path_type == OSPF_ROUTE_PATH_TYPE_INTRA) &&

⌨️ 快捷键说明

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