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

📄 ospf_routing_table.c

📁 vxworks下ospf协议栈
💻 C
📖 第 1 页 / 共 5 页
字号:
                    	       (sptr_routing_table_node->sptr_routing_table_entry->path_type == OSPF_ROUTE_PATH_TYPE_INTER) )                        	{                        		for (sptr_area = ospf.sptr_area_list; sptr_area != NULL; sptr_area = sptr_next_area)                        	    {                            		sptr_next_area = sptr_area->sptr_forward_link;                            		/* old route is an INTRA area routes so flood it all over and age it out */                            		ospf_originate_a_single_summary_links_advertisement (sptr_old_routing_table_node->sptr_routing_table_entry,                            		                                                     sptr_area, TRUE);                            	}                        	}                            /* 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.                              */                    		if (((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)) &&                                ((sptr_routing_table_node->sptr_routing_table_entry->path_type == OSPF_ROUTE_PATH_TYPE_1_EXTERNAL) ||                    		     (sptr_routing_table_node->sptr_routing_table_entry->path_type == OSPF_ROUTE_PATH_TYPE_2_EXTERNAL)))                        	{                        		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_old_routing_table_node->sptr_routing_table_entry->path_type == OSPF_ROUTE_PATH_TYPE_INTRA) ||                                        (sptr_area != ospf.sptr_backbone_area))  /* inter area routes are not flooded through backbone */                        	        {                        		        ospf_originate_a_single_summary_links_advertisement (sptr_old_routing_table_node->sptr_routing_table_entry,                        		                                                             sptr_area, TRUE);                        	        }                            	}                        	}                            /* SPR# 87382 - End */                    		/* ###THIS SECTION NEED TO BE INCORPORATED INTO PATRICIA - implicitly taken care in ospf_generate_events_for_changed_or_new_routes*/                    		if ((sptr_routing_table_node->sptr_routing_table_entry->path_type == OSPF_ROUTE_PATH_TYPE_INTRA) || /* if made else if, later else if made if again 7/1 */                    		   (sptr_routing_table_node->sptr_routing_table_entry->path_type == OSPF_ROUTE_PATH_TYPE_INTER) )                        	{                        		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)  /* inter area routes are not flooded through backbone */                        	        {                        		        ospf_originate_a_single_summary_links_advertisement (sptr_routing_table_node->sptr_routing_table_entry,                        		                                                             sptr_area, FALSE);                        	        }                            	}                        	}                    	/* ####end section */                    	}                	}            	}        	}		}	}    /*     * THIS SECTION NEED TO BE INCORPORATED INTO PATRICIA - incorporated in ospf_generate_events_for_changed_or_new_routes     * and ospf_generate_lsas_for_changed_or_new_routes combined     */	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_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)        	{                already_advertised = FALSE;	    		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)           		{             		if (sptr_routing_table_node->sptr_routing_table_entry->destination_id ==                		sptr_old_routing_table_node->sptr_routing_table_entry->destination_id)                	{                		/* kkz - SPR 84567 BEGIN */                		/* search for duplicate ABR / ASBR entries */                		if ((sptr_old_routing_table_node->sptr_routing_table_entry->destination_type == OSPF_DESTINATION_TYPE_ASBR) ||                		    ( sptr_old_routing_table_node->sptr_routing_table_entry->destination_type == OSPF_DESTINATION_TYPE_ABR))                    	{                    		for (sptr_routing_table_node_2 = sptr_routing_table_node; sptr_routing_table_node_2 != NULL;                        		 sptr_routing_table_node_2 = sptr_routing_table_node_2->sptr_forward_link)                        	{								if (sptr_routing_table_node->sptr_routing_table_entry->destination_id ==							       	sptr_routing_table_node_2->sptr_routing_table_entry->destination_id)                           		{							   		/* found duplicate: for sptr_old_routing_table_node, now have 2 duplicate entries:                            		 * sptr_routing_table_node, sptr_routing_table_node_2 */                            		/* verify if ASBR route has changed any relevant field */                            		if ((sptr_old_routing_table_node->sptr_routing_table_entry->path_cost != sptr_routing_table_node_2->sptr_routing_table_entry->path_cost) ||                            		    (sptr_old_routing_table_node->sptr_routing_table_entry->type2_cost != sptr_routing_table_node_2->sptr_routing_table_entry->type2_cost) ||                            		    (sptr_old_routing_table_node->sptr_routing_table_entry->path_type != sptr_routing_table_node_2->sptr_routing_table_entry->path_type) ||                            		    (ospf_next_hop_block_changed (sptr_old_routing_table_node, sptr_routing_table_node_2) == TRUE) ||                            		    ((sptr_old_routing_table_node->sptr_routing_table_entry->abr == 0) && (sptr_routing_table_node_2->sptr_routing_table_entry->abr == 1)))                                	{    #if defined (__RTM__)                                		ospf_export_route_to_other_protocols (OSPF_ADD_PATH, sptr_routing_table_node_2->sptr_routing_table_entry);    #endif                                		if ((sptr_routing_table_node_2->sptr_routing_table_entry->destination_type == OSPF_DESTINATION_TYPE_NETWORK) ||                                		    (sptr_routing_table_node_2->sptr_routing_table_entry->destination_type == OSPF_DESTINATION_TYPE_ASBR))                                    	{                                    		/* 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_2->sptr_routing_table_entry->path_type == OSPF_ROUTE_PATH_TYPE_INTRA)                                        	{                                    		    ospf_originate_a_single_summary_links_advertisement (sptr_routing_table_node_2->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) &&                                    		    (sptr_routing_table_node_2->sptr_routing_table_entry->path_type == OSPF_ROUTE_PATH_TYPE_INTER) )                                        	{                                        		for (sptr_area = ospf.sptr_area_list; sptr_area != NULL; sptr_area = sptr_next_area)                                            	{                                            		sptr_next_area = sptr_area->sptr_forward_link;                                            		/* old route is an INTRA area routes so flood it all over and age it out */                                            		ospf_originate_a_single_summary_links_advertisement (sptr_old_routing_table_node->sptr_routing_table_entry,                                                                                                 		sptr_area, TRUE);                                            	}                                        	}                                    		/* ###THIS SECTION NEED TO BE INCORPORATED INTO PATRICIA - implicitly taken care in ospf_generate_events_for_changed_or_new_routes*/                                    		if ((sptr_routing_table_node_2->sptr_routing_table_entry->path_type == OSPF_ROUTE_PATH_TYPE_INTRA) || /* if made else if, later else if made if again 7/1 */                                    		    (sptr_routing_table_node_2->sptr_routing_table_entry->path_type == OSPF_ROUTE_PATH_TYPE_INTER) )                                        	{                                        		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)  /* inter area routes are not flooded through backbone */                                                	{                                                		ospf_originate_a_single_summary_links_advertisement (sptr_routing_table_node_2->sptr_routing_table_entry,                                                		                                                     sptr_area, FALSE);                                                	}                                            	}                                        	}                                    	/* ####end section */                                    	}                                	}                            	}                        	} /* for rest of routing table */                    	}                		/* kkz - SPR 84567 END */                		break;                	}            	}        		if (sptr_old_routing_table_node == NULL)            /* sptr_routing_table_node is a new entry */            	{#if defined (__RTM__)            		ospf_export_route_to_other_protocols (OSPF_ADD_PATH, sptr_routing_table_node->sptr_routing_table_entry);#endif            /* SPR 88613 Begin             * make sure this is not a SUMMARY advertisement for an address range which has             * already been advertised             */            if (sptr_routing_table_node->sptr_routing_table_entry->sptr_area->sptr_address_ranges != NULL)                {                for (sptr_address_range = sptr_routing_table_node->sptr_routing_table_entry->sptr_area->sptr_address_ranges; sptr_address_range != NULL;                    sptr_address_range = sptr_address_range->sptr_forward_link)                    {                    test_return_type = ospf_check_if_ip_destination_falls_into_address_range (sptr_routing_table_node->sptr_routing_table_entry->destination_id,                        sptr_address_range->network, sptr_address_range->mask);                    if (test_return_type == PASS)                        {                        if (sptr_address_range->active)                            {                            /* address range is already active, therefore I don't need to advertise                             * it.  Just verify the cost.                             */                            metric_cost = ospf_get_metric_cost_of_address_range_with_head(sptr_address_range, sptr_old_routing_table_head);#if defined (__RFC_2328__)                            if (sptr_routing_table_node->sptr_routing_table_entry->path_cost > metric_cost)#else                            if (sptr_routing_table_node->sptr_routing_table_entry->path_cost < metric_cost)#endif                                {                                /* new route changes cost of range, so re-advertise */                                already_advertised = FALSE;                                }                            else                                already_advertised = TRUE;                            }                        else                            {                            /* this must be the first link in the address range */                            sptr_address_range->active = (BYTE_ENUM (BOOLEAN)) TRUE;                            sptr_address_range->cost = ospf_get_metric_cost_of_address_range_with_head(sptr_address_range, sptr_old_routing_table_head);                            already_advertised = FALSE;                            }                        break; /* found the address range link is in, so we are done */                        }                    }   /* end of FOR address range loop */                } /* end of IF address ranges exist */                /* SPR 88613 End */            if ((I_am_an_area_border_router == TRUE)  && (!already_advertised))                	{                		/* ONLY intra area routes are flooded through backbone */                		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);                    	}                		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_routing_table_node->sptr_routing_table_entry->path_type == OSPF_ROUTE_PATH_TYPE_INTRA) ||                		        (sptr_routing_table_node->sptr_routing_table_entry->path_type == OSPF_ROUTE_PATH_TYPE_INTER))                	        {                		        if (sptr_area != ospf.sptr_backbone_area) /* inter area routes are not flooded through backbone */                	            {                		            ospf_originate_a_single_summary_links_advertisement (sptr_routing_table_node->sptr_routing_table_entry,                		                                                                 sptr_area, FALSE);                     	        }                        	}                    	}                	}            	}        	}		}	}    return;    }/* SPR#76812 -- End *//**********************************************************************************************************************************/enum BOOLEAN ospf_next_hop_block_changed (OSPF_ROUTING_TABLE_NODE *sptr_old_routing_table_node,

⌨️ 快捷键说明

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