📄 ospf_mib_helper_update.c
字号:
mApiRequest_t *pRequest ){ mApiOspfTrueValue_t up; mApiOspfStub_t *pMibStub; BOOL delete_stub; switch( pMibArea->ospfImportAsExtern ) { case EmApiOspfImportAsExtern_importExternal: /* check if this area is previously configured as stub */ if ( (pOspfArea->flags._bit.stub == TRUE) || (pOspfArea->flags._bit.nssa == TRUE) ) { up = EmApiOspf_false; /* tell 'em to bring interfaces down */ if (mApi2Ospf_reinitIf( pMibArea, up ) == ERROR ) { /* SPR#86385 - return SNMPv2 commit failed error. */ OSPF_MIB_ERROR_SET( pRequest, MAPI_COMMIT_FAILED, mApiOspfImportAsExtern ); mApiOspfError(("mApi2Ospf_updateArea:mApi2Ospf_reinitIf failed\n")); return ERROR; } if ( pOspfArea->flags._bit.stub == TRUE) pOspfArea->flags._bit.stub = FALSE; else if ( pOspfArea->flags._bit.nssa == TRUE ) pOspfArea->flags._bit.nssa = TRUE; /* reset the stub default bit */ pOspfArea->flags._bit.stub_default = FALSE; /* SPR#86625 - explicitly reset the stub default cost */ pOspfArea->stub_default_cost = 0; /* SPR#78381- explicitly reset the inject default route bool flag. * SPR#86319 - the variable ospfAreaSummary controls the import of * summary LSAs into stub areas. It has no effect on other areas. * Set it to false for non-stub area. */ pOspfArea->inject_summary_lsa_into_stub_area = FALSE; /* this area is previously configured as stub/nssa. Tell 'em to remove * the stub */ delete_stub = TRUE; if ( ospf_dynamic_reinit_area( pOspfArea, delete_stub) == ERROR ) { /* SPR#86385 - return SNMPv2 commit failed error. */ OSPF_MIB_ERROR_SET( pRequest, MAPI_COMMIT_FAILED, mApiOspfImportAsExtern ); mApiOspfError(("mApi2Ospf_updateArea:reinit area failed\n")); return ERROR; } /* now bring up all the interfaces again */ up = EmApiOspf_true; if (mApi2Ospf_reinitIf( pMibArea, up ) == ERROR ) { /* SPR#86385 - return SNMPv2 commit failed error. */ OSPF_MIB_ERROR_SET( pRequest, MAPI_COMMIT_FAILED, mApiOspfImportAsExtern ); mApiOspfError(("mApi2Ospf_updateArea:mApi2Ospf_reinitIf failed\n")); return ERROR; } } break; case EmApiOspfImportAsExtern_importNoExternal: case EmApiOspfImportAsExtern_importNssa: /* SPR#86135 - area needs to be configured as stub/nssa. Check if this * area is previously configured to import AS External. If it is already * a stub area, simply check if the stub metric value has changed and * leave everything else alone. If area is not already a stub/nssa * and it needs to be configured as stub/nssa, set the stub/nssa * bit field and configure its metric value, if any */ if ( (pOspfArea->flags._bit.stub == TRUE) || (pOspfArea->flags._bit.nssa == TRUE) ) { /* Area is already a stub */ switch( pMibArea->ospfAreaSummary ) { case EmApiOspfAreaSummary_noAreaSummary: /* if stub area is current configure to send summary * lsa, and it is now no longer do so, age out the * summary lsa that this router previously advertised. */ if ( pOspfArea->inject_summary_lsa_into_stub_area == TRUE ) { /* SPR#86625 - age out the default summary lsa that * this router previously advertised for the stub area */ ospf_dynamic_send_default_summary_lsa( pOspfArea, TRUE ); /* this can only be set after we set out max age for * the default summary lsa that we have previously * advertised. */ pOspfArea->inject_summary_lsa_into_stub_area = FALSE; } break; case EmApiOspfAreaSummary_sendAreaSummary: if ( pOspfArea->inject_summary_lsa_into_stub_area == FALSE ) { /* SPR#86625 - stub area is currently configured not * to send summary lsa and it is now configure to do so, * originate a default summary lsa immediately */ pOspfArea->inject_summary_lsa_into_stub_area = TRUE; /* determine the proper stub default cost to use */ pMibStub = (mApiOspfStub_t *)pMibArea->pSpfStub; if ( pMibStub == NULL ) { /* no stub default cost is currently defined. * Use the mib api predefined default stub metric value */ if ( pOspfArea->stub_default_cost != pMibArea->defaultStubMetric ) pOspfArea->stub_default_cost = pMibArea->defaultStubMetric; } else { /* the stubDefaultCost defined by the ospfStubMetric is configured * valid only if the rowStatus object is set to active. If stub * rowStatus is not active, apply the predefined mib api * default metric. */ if ( pMibStub->ospfStubStatus != EmApiOspfRowStatus_active ) pOspfArea->stub_default_cost = pMibArea->defaultStubMetric; else { if ( pOspfArea->stub_default_cost != pMibStub->ospfStubMetric ) pOspfArea->stub_default_cost = pMibStub->ospfStubMetric; } } /* SPR#86625 - originate a new default summary lsa * into the stub area */ ospf_dynamic_send_default_summary_lsa( pOspfArea, FALSE ); } else { /* SPR#86625 - stub area is already configured to send summary * lsa. We may be here because the corresponding row in the * ospfStubTable has been deleted. In that case, the previous * stubDefaultCost is no longer valid. Reset the stubDefaultCost * to default and send a new default summary lsa for the changes. */ pMibStub = (mApiOspfStub_t *)pMibArea->pSpfStub; if ( (pMibStub == NULL) && (pOspfArea->stub_default_cost != pMibArea->defaultStubMetric) ) { pOspfArea->stub_default_cost = pMibArea->defaultStubMetric; ospf_dynamic_send_default_summary_lsa( pOspfArea, FALSE ); } } break; default: return ERROR; } } else { /* Area is previously not a stub/nssa and it must now be configured * as stub/nssa */ up = EmApiOspf_false; /* tell 'em to bring interfaces down */ if (mApi2Ospf_reinitIf( pMibArea, up ) == ERROR ) { /* SPR#86385 - return SNMPv2 commit failed error. */ OSPF_MIB_ERROR_SET( pRequest, MAPI_COMMIT_FAILED, mApiOspfImportAsExtern ); mApiOspfError(("mApi2Ospf_updateArea:mApi2Ospf_reinitIf failed\n")); return ERROR; } /* tell 'em that this area previously not configured as stub */ delete_stub = FALSE; /* SPR#86135 - area is now configured as stub. Configure the stub * metric value if any. If there is no stub metric value defined * in the ospfStubTable, use the default stub metric value. */ if ( pMibArea->ospfImportAsExtern == EmApiOspfImportAsExtern_importNssa ) pOspfArea->flags._bit.nssa = TRUE; else { pOspfArea->flags._bit.stub = TRUE; pOspfArea->flags._bit.stub_default = TRUE; } pMibStub = (mApiOspfStub_t *)pMibArea->pSpfStub; if ( pMibStub == NULL ) pOspfArea->stub_default_cost = pMibArea->defaultStubMetric; else pOspfArea->stub_default_cost = pMibStub->ospfStubMetric; /* SPR 78381:also update the ospfAreaSummary option */ switch( pMibArea->ospfAreaSummary ) { /* SPR#86319 - for noAreaSummary, the router will neither originate * nor propagate summary LSAs into the stub area. It will rely * entirely on its default route. */ case EmApiOspfAreaSummary_noAreaSummary: pOspfArea->inject_summary_lsa_into_stub_area = FALSE; break; /* SPR#86319 - for sendAreaSummary, the router will both summarize * and propagate summary LSAs into the stub area. */ case EmApiOspfAreaSummary_sendAreaSummary: pOspfArea->inject_summary_lsa_into_stub_area = TRUE; break; } if ( ospf_dynamic_reinit_area( pOspfArea, delete_stub ) == ERROR ) { /* SPR#86385 - return SNMPv2 commit failed error. */ OSPF_MIB_ERROR_SET( pRequest, MAPI_COMMIT_FAILED, mApiOspfImportAsExtern ); mApiOspfError(("mApi2Ospf_updateArea:reinit area failed\n")); return ERROR; } /* now bring up the interface again */ up = EmApiOspf_true; if (mApi2Ospf_reinitIf( pMibArea, up ) == ERROR ) { /* SPR#86385 - return SNMPv2 commit failed error. */ OSPF_MIB_ERROR_SET( pRequest, MAPI_COMMIT_FAILED, mApiOspfImportAsExtern ); mApiOspfError(("mApi2Ospf_updateArea:mApi2Ospf_reinitIf failed\n")); return ERROR; } } break; } mApiOspfPrintf(("mApi2Ospf_updateArea:completed\n")); return OK;}/***************************************************************************************** mApi2Ospf_createArea - instantiates an OSPF Area** This routine instantiates an OSPF Area. The instance will be created and added* to the ospf.sptr_area_list and an attempt will be made to bring up such area* immediately. If the area is failed to be created for any reason, it will be destroyed* and an error will be returned.** RETURNS: OK or ERROR** NOMANUAL*/LOCAL STATUS mApi2Ospf_createArea( mApiOspfArea_t *pMibArea ){ OSPF_AREA_ENTRY *pOspfArea; OSPF_ADDRESS_RANGE_LIST_ENTRY *pOspfAddrRange; mApiOspfStub_t *pMibStub; mApiOspfAreaAggregate_t *pMibAreaAg; mApiOspfClient_t *pAttachedClient; size_t size; /* allocate an OSPF Area instance from ospf memory pool */ /* SPR 81808 */ pOspfArea = (OSPF_AREA_ENTRY *)table_malloc(1, sizeof(OSPF_AREA_ENTRY) ); if ( pOspfArea == NULL ) { mApiOspfError(("mApi2Ospf_createArea:ospf memory pool allocation failed!\n")); return ERROR; } /* fill in the OSPF_AREA_ENTRY structure */ memset( pOspfArea, 0, sizeof(OSPF_AREA_ENTRY) ); pOspfArea->area_id = pMibArea->ospfAreaId; pMibStub = (mApiOspfStub_t *)pMibArea->pSpfStub; switch( pMibArea->ospfImportAsExtern ) { case EmApiOspfImportAsExtern_importExternal: break; case EmApiOspfImportAsExtern_importNoExternal: /* Area does not support importing AS external link-state advertisement. * This area is a stub area */ pOspfArea->flags._bit.stub = TRUE; break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -