?? ospf_mib_helper.c
字號:
/* ospf_mib_helper.c - Management Interface Helper routines for OSPFv2 MIB *//* Copyright 1998-2003 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------05g,10jun03,mwv SPR#88878 fixed compiler warnings related to (char *) references05f,04jun03,asr Changed back to use system memory instead of OSPF memory partition05e,02jun03,agi Added #include "ospf.h"05d,02jun03,ram Changed native memory usage to OSPF memory partition05c,08may03,kc Fixed SPR#88258 - changed the way Area ID is validated and commit in ospf_mApi_ifRowAccess() so that the Area ID changes can be detected correctly.05b,21mar03,kkz SPR 88613 - fixed areaAggregateDelete to tell OSPF to delete, before deregistering from area. Also, allow setting of agEffect to doNotAdvertiseMatching05a,28feb03,kc Fixed SPR#86505 - modified per new mibApi.h header file updates. Renamed MAPI_COMMIT_NVM and MAPI_GET_NVM mApiReqType_t request type to MAPI_COMMIT_FORCE and MAPI_GET_FORCE respectively.04z,24feb03,kc Fixed SPR#86385 - modified all ospf_mApi_xxxRowCreate(), ospf_mApi_xxxRowAccess() and ospf_mApi_xxxHelperSet() to return proper SNMPv2 error code using OSPF_MIB_ERROR_SET() macro.04y,21feb03,kc Fixed SPR#86346 - modified ospf_mApi_areaRowAccess() to accept sendAreaSummary(2) as the valid value for ospfAreaSummary object and to dynamically configured OSPF for changes to the ospfAreaSummary only if the area is configured as stub.04x,21feb03,kc Fixed SPR#86134 - modified ospf_mApi_areaAggregateRowAccess() to return error for ospfAreaAggregateEffect object validation if set to the unsupported doNotAdvertiseMatching(2).04w,18feb03,kc Fixed SPR#86135 - modified ospf_mApi_stubDelete() to reinitialize the OSPF Area using the default metric value when the stub entry is deleted from the ospfStubTable.04v,07feb03,kc Fixed SPR#86144 - removed the mApiReqType_t argument from all the ospf_mApi_xxxHelperCreate() routines. These routine no longer attempt to reconfigure OSPF if the reqType type is not MAPI_COMMIT_NVM. Also removed the dynamicConfig argument from ospf_mApi_ifRowSet() and ospf_mApi_virtIfRowSet() routines.04u,03feb03,kc Fixed SPR#85865 - modified ospf_mApi_configurationGet() to update the ABR status if necessary.04t,01feb03,kc Fixed SPR#86017 - modified ospf_mApi_areaDelete to set the rowStatus for the attached interface to notReady regardless if the OSPF protocol is running. Also reset all the read-only operational status and stats objects if interface is successfully removed from OSPF.04s,31jan03,kc Fixed SPR#86009 - modified ospf_mApi_ifRowCreate() to assign the actual value of the Area ID from mApiObject_t to the ospfIfAreaId columnar object during the MAPI_TEST phase.04r,31jan03,kc Fixed SPR#86006 - modified all the ospf_mApi_xxxHelperSet() routines to invoke avlDelete() to remove the row created from the avl tree.04q,12dec02,mwv Fix compiler warning04p,19nov02,kc Modified ospf_mApi_ifHelperCreate() and ospf_mApi_ifConfigAccess() to explicitly invoke the ospf_mApi_ifInfoGet() when ospf is reinitialized. SPR 84478, 84485, 8448604o,19nov02,mwv Merge TMS code SPR 8428404n,12nov02,kc Fixed SPR#75884 - Added ospf_mApi_nbrHelperDeregister().04m,08oct02,agi Fixed compiler warnings04l,15aug02,kc Modified ospf_mApi_virtIfRowStatusAccess() to place the return statement at the correct spot.04k,09aug02,kc Modified ospf_mApi_ifRowCreate() to correctly validate the index value for unnumbered interface. 04j,17jun02,kc Modified ospf_mApi_xxxHelperSet() to handle possible pObjCookie not implemented, thus corrected possible NULL pointer access.04i,25may02,kc Fixed PR #2700 - Added deleteFromOspf boolean flag function argument to ospf_mApi_ifDelete().04h,21may02,kc Fixed ospf_mApi_xxxHelperSet() to extract the object cookie data from the request message. Added the isLastColObject parameter to the rsRowStatusSet() function call.04g,23apr02,kc Fixed ospf_mApi_areaRegisterIf() to correctly increment the active interface counter for MAPI_COMMIT_NVM request.04f,18apr02,kc Don't trigger ospf_mApi_avlTreeWalk() for ospfNbrTable in ospf_mApi_reset(). The ospfNbrTable and ospfVirtNbrTable will be explicitly flushed by ospf2Mapi_shutdown().04e,16apr02,kc Modified authentication type and key set request in ospf_mApi_ifRowAccess() and ospf_mApi_virtIfRowAccess() to allow dynamic configuration only if both the authentication type and key have been defined.04d,16apr02,kc Modified ospf_mApi_md5KeyIdValidate() to make sure md5 key id is indeed within 1 to 255 and to return the md5 key id. Modified ospf_mApi_ifHelperGet() and ospf_mApi_virtIfHelperGet() to return the actual authentication key if request is MAPI_GET_NVM. Modified ospf_mApi_md5AuthKeyParsing() to correctly track the md5 authentication key and key id length from the given buffer.04c,15apr02,kc Renamed EmapiOspfAuthType_simplePasswd mApiOspfAuthType_t to EmApiOspfAuthType_simplePasswd. Renamed MAPI_NVM_SET to MAPI_COMMIT_NVM and pCookie pointer to pReqCookie pointer per mibApi.h update.04b,13apr02,kc Fixed PR #2611 - corrected simple authentication key processing for ospfIfAuthKey and ospfVirtIfAuthKey.04a,11apr02,kc Added ospf_mApi_ifHelperDelete() routine. Fixed ospf_mApi_ifDelete() to also check if interface row status is active and administrative status is enabled before deleting the interface from OSPF.03z,10apr02,kc Moved AVL_WALK_FUNC to ospf_mib_helper.h. Made ospf_mApi_avlTreeWalk() public. Added splnet() call in ospf_mApi_ifInfoGet() to lock spl semaphore so to allow ifa_ifwithaddr() to have exclusive access to the system interface list.03y,05apr02,kc Fixed ospf_mApi_xxxHelperSet() to delete the row if error occurs during validation phase. Corrected the area registration process for area aggregation. Fixed RS_ACCESS_COL_VALID for ospf_mApi_ifRowAccess() to return error if changing an interface area id breaks the virtual interface(s).03x,04apr02,kc Modified ospf_mApi_walkxxxTree() to force the row status transition only if the request is not NVM_SET. Invoke ospf_mApi_areaConfig() in ospf_mApi_areaRowStatusAccess() when the row is first created.03w,03apr02,kc Fixed ospf_mApi_areaAggregateRowCreate() to correctly lookup the area using the appropriate area id. Fixed ospf_mApi_areaStatusUpdate() to correctly decrement the numActiveArea counter when an area is deleted (or when the interface state has changed).03v,02apr02,kc Modified ospf_mApi_ifInfoGet() to locate the interface based on the complete interface address.03u,01apr02,kc Modified ospf_mApi_areaAggregateRowCreate() to look for the area to which the area aggregation instance is configured for prior memory is allocated for the instance.03t,29mar02,kc Fixed up virtual link configuration. Only allow virtual link to go active if there is at least one active interface in the transit area. Fixed area configuration so that if area is transit (with at least one active virtual interface configured), do not allow stub to be configured for that area.03s,29mar02,kc Added ospf_mApi_areaStatusUpdate() routine. Corrected the area registration and deregistration process for interface, virtual interface and host interface. Area now reported the number of active interface (all types) correctly.03r,22mar02,kc Modified ospf_mApi_hostRowCreate() to disallow createAndGo row operation if the backbone area doesn't exist. Modified ospf_mApi_stubRowCreate() to reject the request if trying to configure the ospf backbone area as stub. Fixed RS_ACCESS_COL_VALID for ospf_mApi_areaRowAccess() to return error if trying to set the ospfImportAsExtern object for backbone area to importNoExternal(2) or importNssa(3).03q,22mar02,kc Removed ospf_mApi_initBackbone() function. MIB API no longer automatically create the OSPF Backbone Area when initialized.03p,21mar02,kc Fixed RS_ACCESS_COL_SET for ospf_mApi_ifRowAccess() to only allow dynamic configuration if the adminstrative status is also set to enabled (besides checking if rowStatus is active). ospfIfAdminStat is the only exception.03o,09mar02,kc Modified ospf_mApi_ifRowCreate() to disallow createAndGo row operation if the backbone area doesn't exist.03n,15feb02,kc Modified ospf_mApi_ifRowCreate() to set interface type to PointToPoint if index values is for unnumbered interface.03m,13feb02,kc Fixed all ospf_mApi_xxxRowStatusAccess() to correctly handle the MAPI_NVM_SET request at system startup.03l,07feb02,kc Fixed all ospf_mApi_xxxRowCreate() to correctly handle the MAPI_NVM_SET request at system startup.03k,07feb02,kc Fixed debug statement in ospf_mApi_protoCheck().03j,06feb02,kc Fixed ospf_mApi_globalParmSet() to correctly handle the MAPI_NVM_SET request for ospfAdminStat.03i,21jan02,kc Fixed uninitialized ifm pointer in ospf_mApi_ifRowStatusAccess().03h,17jan02,kc Modified ospf_mApi_ifRowCreate() and ospf_mApi_ifHelperCreate() to perform proper index validation depends on whether the unnumbered interface is supported (via compiler preprocessor).03g,09jan02,kc Fixed ospf_mApi_hostRowAccess() - added mising break statement to RS_ACCESS_COL_SET. Fixed ospf_mApi_ifInfoGet() to correctly set the netmask for host interface.03f,08jan02,kc Fixed ospf_mApi_stubRowCreate() - correctly set the ospfStubMetric to the appropriate default value. Changed ospf_mApi_stubRowStatusAccess() to only allow stub area dynamic reconfiguration if such area is active and is configured as stub/nssa.03e,22dec01,kc Fixed notInService in ospf_mApi_areaRowStatusAccess() - must call ospf_mApi_areaSuspend() to remove all interfaces attached to the area before deleting the area.03d,21dec01,kc Fixed ospfIfAreaId set - need to de-register the interface from the old area and then register to the new area.03c,19dec01,kc Added ospf_mApi_md5KeyIdValidate() to correctly handle md5 authentication configuration for ospfIfTable and ospfVirtIfTable.03b,18dec01,kc Fixed ospf_mApi_walkAreaAggregateTree() to force rowStatus to transition to active if instance is statically created.03a,17dec01,kc Added ospf_xxxRowValidate() routines.02z,15dec01,kc Localized ospf_mApi_protoCheck(). Fixed ospf_mApi_globalParmSet() to correctly determine if dynamic configuration is needed.02y,14dec01,kc Fixed up all ospf_mApi_xxxConfigAccess() routines so that those routines can be used to bring the instance up/down.02x,14dec01,kc Fixed ospf_mApi_initGeneralGroup().02w,14dec01,kc Fixed ospf_mApi_ifInfoGet() - no byte order conversion is needed.02v,13dec01,kc Added support for ospfAreaAggregateEffect configuration in ospf_mApi_areaAggregateHelperSet().02u,12dec01,kc Added missing column validate and object set support to ospf_mApi_areaAggregateRowAccess().02t,12dec01,kc Fixed all ospf_mApi_xxxRowStatusAccess() to allow dynamic reconfiguration only if rowStatus is active.02s,12dec01,kc Fixed ospf_mApi_ifRowAccess(), ospf_mApi_areaRowAccess, ospf_mApi_hostRowAccess() and ospf_mApi_virtIfRowAccess() row validate operations.02r,11dec01,kc Added callout to rsParamsCreateWhileValidateSet() in ospf_mApi_initRsLib().02q,07dec01,kc Fixed ospfAreaSummary object - only support noAreaSummary(1).02p,06dec01,kc Fixed ospf_mApi_xxxHelperSet() to destroy the created instance if the rowStatus value is still RS_undefined.02o,06dec01,kc Fixed column validation for ospfIfAreaId in ospf_mApi_ifRowAccess().02n,29nov01,kc Renamed OSPF_AREA_AGGREGATE_TABLE_LEN define in Area Aggregation compare and create routines to OSPF_AREA_AGGREGATE_INSTANCE_LEN.02m,29nov01,kc Handle mApiOspfAuthType object request in ospf_mApi_areaHelperGet().02l,15nov01,kc Explicitly set ospfIfDemand to falese in ospf_mApi_ifHelperCreate().02k,12nov01,kc Fixed up ospfExtLsdbLimit and ospfExitOverflowInterval in ospf_mApi_globalParmSet()02j,12nov01,kc Fixed up ospf_mApi_ifRowSet() and ospf_mApi_virtIfRowSet() to correctly handle simplePasswd and md5 authKey.02i,09nov01,kc Fixed up ospf_mApi_ifRowSet() to correctly set the ospfIfAdminStat.02h,29oct01,kc Fixed up ospf_mApi_xxxRowStatusAccess() routine to disallow dynamic reconfiguration if final rowStatus value is not active.02g,25oct01,kc Fixed up ospf_mApi_avlTreeWalk() routine.02f,25oct01,kc Changed ospf_mApi_xxxHelperSet routines to set rowStatus to notReady if RS_VALIDATE_REQUEST failed and a row has been created.02e,25oct01,kc Marked the row instance to be dynamically configurable if RS_ACCESS_ROW_VALID passed.02d,24oct01,kc Added explicit typecast when assigning ulong_t to ushort_t.02c,23oct01,kc Modified the way htonl is used - create a temporary variable.02b,21oct01,kc Added ospf_mApi_configurationGet() routine (unsupported for now).02a,20oct01,kc Added Area Aggregation supported routines.01z,18oct01,kc Reworked ospfMapiOidCompare() function.01y,16oct01,kc Removed __WRN_OSPF_MIB__ preproc.01x,15oct01,kc Modified ospf_mApi_xxxRowCreate() to allow node to be allocated if max capacity not reached. No longer preallocate memory pool at init.01w,14oct01,kc Fixed the chicken and problems between ospfIfTable and ospfIfMetricTable, ospfIfTable and ospfAreaTable, ospfAreaTable and ospfStubTable.01v,14oct01,kc Added ospf_mApi_nbrHelperRegister() routine.01u,13oct01,kc ospf_mApi_hostRowCreate() need to get ospf_mApi_ifInfoGet().01t,13oct01,kc Also delete Type-10 Opaque Area in ospf_mApi_areaDelete().01s,13oct01,kc Added internal statistics tracking for various errors.01r,12oct01,kc Added ospf_mApi_ifMetricValidate().01q,10oct01,kc Added support for ospfNbrTable set.01p,10oct01,kc Fixed RS_ACCESS_ROW_VALID implementation for each table.01o,09oct01,kc Fixed ospf_mApi_xxxRowStatusAccess() routines.01n,08oct01,kc Made ospfMapiOidCompare() public.01m,08oct01,kc Fixed ospf_mApi_xxxRowCreate() to handle rowStatus logic correctly.01l,07oct01,kc Need to include ospf_mApi_helper.h before ospf_mib_api.h.01k,06oct01,kc Added ospf_mApi_ifMetricHelperCreate() routine.01j,05oct01,kc Added ospf_mApi_hostHelperCreate() routine. Modified host creation such that if failed to register to area, do not create the host.01i,04oct01,kc Added ospf_mApi_xxxHelperCreate() routines for area, stub area, interface and virtual interface.01h,21sep01,kc Added ospf_mApi_areaConfig() and ospf_mApi_stubStatusGet() routines.01g,20sep01,kc Added ospf_mApi_ifConfig() and ospf_mApi_ifRowSet() routines.01f,14sep01,kc Added ospf_mApi_ifInfoGet() to get netmask, mtu and metric.01e.12sep01,kc Force interface, virtual interface and host interface to register and de-register to/from the area during create/destroy.01d,06sep01,kc Added support for MIB API SET request for all tables.01c,28aug01,kc Added support for MIB API TEST request for all tables.01b,22aug01,kc Added support for MIB API GET and GET NEXT requests for all tables.01a,16aug01,kc Initial file creation.*//*DESCRIPTIONThis module contains various helper routines used to support the ospf_mib_api. Thismodule is specific to RFC1850 MIB and it encapsulates the details for how to access thetabular/scalar objects in the RFC1850 MIB. All method routines in this modules areprivate to the ospf_mib_api and shall not be used by any other applications. Usershall not try to invoke routines in this module from the WindSh.This module assumes that all the tabular objects in the RFC1850 MIB are stored in theAVL trees which are initialized and created by the ospf_mib_api. It uses the RowStatuslibrary that implements the row access logic to determine if a SET request is allowed.All routines in this module do not have any inherent locking requirements for accessingthe tabular objects in the AVL tree. It is assumed that the ospf_mib_api will providesuch locking mechanism.In the absence of the SNMP rowPointer SYNTAX clause in the OSPF MIB, the dynamicconfiguration requirements for some of the table rows have become complicated unless therows are created in the correct order. For example, creating an OSPF Interface thatconnects to a non-backbone OSPF Area when such area is not defined (assuming that theinterface is not created using createAndGo rowStatus enumeration value). In this case.this rowStatus object for the interface will be set to notReady(3). If such OSPF Area islater created, the interface will not automatically be instatiated. Instead, the rowStatusobject for that interface will be set to notInService(2). In order to instantiate theinterface, the rowStatus object for that interface must be explicitly set to active(1).*//* This include is here to get rid of the "empty file" compiler warning */#include <vxWorks.h>#if defined (__OSPF_MIB__)/* VxWorks standard includes */#include <stdio.h>#include <stdlib.h>#include <string.h>#include <ctype.h>#include <semLib.h>#include <lstLib.h>#include <netinet/in.h>#include <netinet/in_var.h>#include <net/if.h>#include <avlLib.h>/* management interface includes */#include "rowStatusLib.h"
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -