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

📄 ospf_flood.c

📁 vxworks下ospf协议栈
💻 C
📖 第 1 页 / 共 3 页
字号:
/* ospf_flood.c - used for flooding routines *//* Copyright 1998-2003 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01l,21jul03,agi     Fixed compiler warnings for opaque LSAs 02j,11jul03,kkz     Fixed crash in ospf_examine_each_neighbor_and_add_advertisement_to_the_retransmission_list_if_necessary01k,23jun03,agi     Fixed flooding logic - do not construct retransmit list if                    it is not to be used01g,29may03,kkz     SPR 87375 - ANVL testcase 2.5 - LSAs being flooded back out                    receiving interface need to be put on retransmit list01f,26may03,kkz     SPR 87372 - comment update01e,22may03,kkz     SPR 88613 - change boundary condition02a,22apr03,ram     SPR#76812 Modifications for OSPF performance enhancements01d,20feb03,kc      Fixed SPR#86139 - rename inject_default_route_if_stub_area to                    inject_summary_lsa_into_stub_area in the routine                    ospf_flood_advertisement_throughout_a_specific_area().01d,24dec02,dsk fixed SPR#75194, ANVL 27.1501c,09dec02,hme     Fixed SPR#75796 ANVL 37.101b,19nov02,mwv     Merge TMS code SPR 8428401v,16apr02,jkw     One copy of external and type 11 lsa01u,30jan02,jkw     Fix routes not being propagated.01t,09dec02,jkw     Send link state advertisement with OSPF_MAXIMUM_AGE for                    premature aging.01s,20dec01,jkw     Removed sptr_area->sptr_interfaces structure.01r,11oct01,jkw     Set pointer to NULL after table_free.01q,03aug01,jkw     Compiler warning fixes01p,26sep00,reshma  Added WindRiver CopyRight01o,25sep00,reshma  RFC-1587 implementation for OSPF NSSA Option, also tested against ANVL.01n,07jul00,reshma  Unix compatibility related changes.01m,04apr00,reshma  Added some MIB support (Read only).Passed all important ANVL OSPF                    tests.01l,23dec99,reshma  Compatibility with VxWorks-IP and VxWorks RTM-interface01k,28dec98,jack    Compiled and added some comments01j,11nov98,jack    Config changes, linted and big endian changes01i,30oct98,jack    Incorporate changes for compilation on Vxworks01h,23aug98,jack    ANVL tested OSPF with PATRICIA tree route table and no recursion01g,10aug98,jack    PATRICIA Route Table Based OSPF Code Base01f,04jun98,jack    Integration with RTM and BGP01e,24apr98,jack    RTM changes01d,10jul97,cindy   Pre-release v1.52b01c,02oct97,cindy   Release Version 1.5201b,22oct96,cindy   Release Version 1.5001a,05jun96,cindy   First Beta Release*//*DESCRIPTIONospf_flood.c is used for flooding OSPF packets.This file is used when an OSPF packets needs to be flooded out to other OSPF routers.*/#include "ospf.h"#if defined (__OSPF_VIRTUAL_STACK__)#include "ospf_vs_lib.h"#endif /* __OSPF_VIRTUAL_STACK__ *//********************************************************************************************************************************/static char *cptr_ls_type_string[] = {"Stub","Router","Network","Summary Network","Summary AS Boundary Router","AS External",    "Bad LS Type"};static enum BOOLEAN advertisement_was_flooded_back_out_receiving_interface;/********************************************************************************************************************************/static void ospf_flood_advertisement_throughout_the_entire_autonomous_system  (OSPF_ROUTER_LINK_ADVERTISEMENT_HEADER *sptr_advertisement,    OSPF_INTERFACE *sptr_interface_advertisement_received_on,OSPF_NEIGHBOR *sptr_neighbor_advertisement_received_from, enum BOOLEAN advertisement_installed);static void ospf_flood_advertisement_throughout_a_specific_area (OSPF_ROUTER_LINK_ADVERTISEMENT_HEADER *sptr_advertisement,OSPF_AREA_ENTRY *sptr_area,    OSPF_INTERFACE *sptr_interface_advertisement_received_on,OSPF_NEIGHBOR *sptr_neighbor_advertisement_received_from, enum BOOLEAN advertisement_installed);/*opaque lsa added new prototype ospf_flood_advertisement_throughout_a_link_local_scope jkw*/#if defined (__OPAQUE_LSA__)static void ospf_flood_advertisement_throughout_a_link_local_scope (OSPF_ROUTER_LINK_ADVERTISEMENT_HEADER *sptr_advertisement,OSPF_AREA_ENTRY *sptr_area,    OSPF_INTERFACE *sptr_interface_advertisement_received_on,OSPF_NEIGHBOR *sptr_neighbor_advertisement_received_from, enum BOOLEAN advertisement_installed);#endif /* __OPAQUE_LSA__ */static void ospf_flood_advertisement_out_eligible_interface (OSPF_ROUTER_LINK_ADVERTISEMENT_HEADER *sptr_advertisement,    OSPF_INTERFACE *sptr_interface,OSPF_INTERFACE *sptr_interface_advertisement_received_on,    OSPF_NEIGHBOR *sptr_neighbor_advertisement_received_from, enum BOOLEAN advertisement_installed);static enum BOOLEAN ospf_examine_each_neighbor_and_add_advertisement_to_the_retransmission_list_if_necessary (OSPF_INTERFACE *sptr_interface,    OSPF_LS_DATABASE_NODE **ptr_to_sptr_database_list,OSPF_ROUTER_LINK_ADVERTISEMENT_HEADER *sptr_advertisement,    OSPF_NEIGHBOR *sptr_neighbor_advertisement_received_from, enum BOOLEAN advertisement_installed);static enum BOOLEAN ospf_update_ls_request_list_for_this_adjacency (OSPF_ROUTER_LINK_ADVERTISEMENT_HEADER *sptr_advertisement,    OSPF_NEIGHBOR *sptr_neighbor);static OSPF_LS_DATABASE_NODE *ospf_add_advertisement_to_the_link_state_retransmission_list_for_the_adjacency (    OSPF_ROUTER_LINK_ADVERTISEMENT_HEADER *sptr_advertisement,OSPF_NEIGHBOR *sptr_neighbor,OSPF_LS_DATABASE_NODE *sptr_database_list,    enum BOOLEAN advertisement_was_added_to_a_retransmission_list, enum BOOLEAN *found_lsa, enum BOOLEAN advertisement_installed);/*************************************************************************** ospf_flood_advertisement_out_some_subset_of_the_routers_interfaces - flood advertisements out interfaces** This routine will call the functions to flood out advertisements* over virtual links, throughout areas, and throughout the whole* autonomous system.** <sptr_advertisement> Advertisement header** <sptr_area> Area associated with the advertisement** <sptr_interface_advertisement_received_on> Interface advertisement was received on** <sptr_neighbor_advertisement_received_from> Neighbor advertisement was received on** <advertisement_installed> Boolean to tell if advertisement is already installed** RETURNS: TRUE or FALSE** ERRNO: N/A** NOMANUAL*//****************************************************************************//* section 13.3 of OSPF specification (page 138) */enum BOOLEAN ospf_flood_advertisement_out_some_subset_of_the_routers_interfaces (OSPF_ROUTER_LINK_ADVERTISEMENT_HEADER *sptr_advertisement,    OSPF_AREA_ENTRY *sptr_area,OSPF_INTERFACE *sptr_interface_advertisement_received_on,OSPF_NEIGHBOR *sptr_neighbor_advertisement_received_from, enum BOOLEAN advertisement_installed){    OSPF_INTERFACE_NODE *sptr_interface_node = NULL;    OSPF_INTERFACE_NODE *sptr_next_interface_node = NULL;    bool backbone_present;    bool fully_adjacent_on_virtual_link;    OSPF_AREA_ENTRY *sptr_temp_area;    enum BOOLEAN I_am_an_area_border_router;    backbone_present = FALSE;    fully_adjacent_on_virtual_link = FALSE;    OSPF_PRINTF_PROLOGUE (OSPF_PROLOGUE_PRINTF, "OSPF: Entering ospf_flood_advertisement_out_some_subset_of_the_routers_interfaces\r\n");    advertisement_was_flooded_back_out_receiving_interface = FALSE;    /* Virtual link updates */    /* Stop flooding of summaries when the Virtual Link at non backbone ABR is not up  -bhanu */    if (sptr_advertisement->ls_header.type > OSPF_LS_NETWORK)        {        I_am_an_area_border_router = ospf_check_if_area_border_router ();        if (I_am_an_area_border_router == TRUE)            {            for (sptr_temp_area = ospf.sptr_area_list; sptr_temp_area != NULL; sptr_temp_area = sptr_temp_area->sptr_forward_link)                {                if (sptr_temp_area->area_id == OSPF_BACKBONE )                    {                    backbone_present = TRUE;                    break;                    }                }            if ( backbone_present == FALSE )                {                for ( sptr_interface_node = ospf.sptr_configured_virtual_links; sptr_interface_node != NULL; sptr_interface_node = sptr_next_interface_node)                {                    sptr_next_interface_node = sptr_interface_node->sptr_forward_link;                    if (sptr_interface_node->sptr_interface != NULL)                    {                        if (sptr_interface_node->sptr_interface->sptr_neighbor != NULL)                        {                            if (sptr_interface_node->sptr_interface->sptr_neighbor->state == OSPF_NEIGHBOR_FULL )                            {                            fully_adjacent_on_virtual_link = TRUE;                            break;                            }                        }                    }                }                if ( fully_adjacent_on_virtual_link == FALSE )                    {                    /* even though we dont have a fully adjacent neighbor, we should send those LSAs with max age set i.e. we are flushing out summaries we sent out earlier */                    if ( sptr_advertisement->ls_header.age != OSPF_MAXIMUM_AGE )                        {                        return (advertisement_was_flooded_back_out_receiving_interface);                        /* because even though we are the ABR, we dont have the BackBone and we are not fully adjacent on Virtual Link - bhanu  */                        }                    }                }            }        }    if (sptr_advertisement->ls_header.type == OSPF_LS_AS_EXTERNAL)        {        ospf_flood_advertisement_throughout_the_entire_autonomous_system (sptr_advertisement, sptr_interface_advertisement_received_on,            sptr_neighbor_advertisement_received_from, advertisement_installed);        }    /*opaque lsa flood out some subset of the routers interfaces jkw     RFC 2370 Section 3.1 item 3*/#if defined (__OPAQUE_LSA__)    else if (sptr_advertisement->ls_header.type == OSPF_LS_TYPE_11)        {        ospf_flood_advertisement_throughout_the_entire_autonomous_system (sptr_advertisement, sptr_interface_advertisement_received_on,            sptr_neighbor_advertisement_received_from, advertisement_installed);        }    /*opaque lsa flood out link-local flooding scope jkw      RFC 2370 Section 3.1 item 1*/    else if (sptr_advertisement->ls_header.type == OSPF_LS_TYPE_9)        {        ospf_flood_advertisement_throughout_a_link_local_scope (sptr_advertisement, sptr_area, sptr_interface_advertisement_received_on,            sptr_neighbor_advertisement_received_from, advertisement_installed);        }#endif /* __OPAQUE_LSA__ */    else{        /* SPR 88613 - remove code for ANVL 27.15.  It is replaced by a change in         * ospf_inter_area_route_calculation.c for SPR 88330         */        ospf_flood_advertisement_throughout_a_specific_area (sptr_advertisement, sptr_area, sptr_interface_advertisement_received_on,            sptr_neighbor_advertisement_received_from, advertisement_installed);        }    return (advertisement_was_flooded_back_out_receiving_interface);}/*************************************************************************** ospf_flood_advertisement_throughout_the_entire_autonomous_system - flood advertisements throughout the autonomous system** This routine will the advertisement throughout the whole* autonomous system.  This is called for AS_EXTERNAL LSAs and LS_TYPE_11 LSAs,* neither of which should ever be flooded into a stub area.** <sptr_advertisement> Advertisement header** <sptr_area> Area associated with the advertisement** <sptr_interface_advertisement_received_on> Interface advertisement was received on** <sptr_neighbor_advertisement_received_from> Neighbor advertisement was received on** <advertisement_installed> Boolean to tell if advertisement is already installed** RETURNS: N/A** ERRNO: N/A** NOMANUAL*//****************************************************************************//* section 13.3 of OSPF specification (page 138) */static void ospf_flood_advertisement_throughout_the_entire_autonomous_system  (OSPF_ROUTER_LINK_ADVERTISEMENT_HEADER *sptr_advertisement,    OSPF_INTERFACE *sptr_interface_advertisement_received_on,OSPF_NEIGHBOR *sptr_neighbor_advertisement_received_from, enum BOOLEAN advertisement_installed){    OSPF_AREA_ENTRY *sptr_area = NULL;    OSPF_AREA_ENTRY *sptr_next_area = NULL;    OSPF_INTERFACE *sptr_interface =NULL;    OSPF_INTERFACE *sptr_next_interface =NULL;    OSPF_PRINTF_PROLOGUE (OSPF_PROLOGUE_PRINTF, "OSPF: Entering ospf_flood_advertisement_throughout_the_entire_autonomous_system\r\n");    for (sptr_area = ospf.sptr_area_list; sptr_area != NULL; sptr_area = sptr_next_area)        {        sptr_next_area = sptr_area->sptr_forward_link;#if defined  (__NSSA__)        if( (sptr_area->flags._bit.stub == FALSE) && (sptr_area->flags._bit.nssa == FALSE))#else        if (sptr_area->flags._bit.stub == FALSE)#endif /*__NSSA__*/            {            for (sptr_interface = sptr_area->sptr_interfaces; sptr_interface != NULL; sptr_interface = sptr_next_interface)                {                sptr_next_interface = sptr_interface->sptr_forward_link;                if (sptr_interface->area_id == sptr_area->area_id)                    {                    if (sptr_interface->type != OSPF_VIRTUAL_LINK)                        {                        /* SPR 87372 - remove duplicate IF                        if (sptr_interface->area_id == sptr_area->area_id) */                        ospf_flood_advertisement_out_eligible_interface (sptr_advertisement, sptr_interface, sptr_interface_advertisement_received_on,                            sptr_neighbor_advertisement_received_from, advertisement_installed);                        }                    }                }            }        }    return;}/*************************************************************************** ospf_flood_advertisement_throughout_a_specific_area - flood advertisements throughout a specific area** This routine will the advertisement throughout the specified* area.** <sptr_advertisement> Advertisement header** <sptr_area> Area associated with the advertisement** <sptr_interface_advertisement_received_on> Interface advertisement was received on** <sptr_neighbor_advertisement_received_from> Neighbor advertisement was received on** <advertisement_installed> Boolean to tell if advertisement is already installed** RETURNS: N/A** ERRNO: N/A** NOMANUAL*//****************************************************************************//* section 13.3 of OSPF specification (page 138) */static void ospf_flood_advertisement_throughout_a_specific_area (OSPF_ROUTER_LINK_ADVERTISEMENT_HEADER *sptr_advertisement,OSPF_AREA_ENTRY *sptr_area,    OSPF_INTERFACE *sptr_interface_advertisement_received_on,OSPF_NEIGHBOR *sptr_neighbor_advertisement_received_from, enum BOOLEAN advertisement_installed){    OSPF_INTERFACE *sptr_interface = NULL;    OSPF_INTERFACE *sptr_next_interface = NULL;    enum OSPF_INTERFACE_TYPE interface_type_received_on;    OSPF_PRINTF_PROLOGUE (OSPF_PROLOGUE_PRINTF, "OSPF: Entering ospf_flood_advertisement_throughout_a_specific_area\r\n");

⌨️ 快捷键说明

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