index 5ba018e1c28b87fb419d660ba10c271e0f07ff26..d9ee3193a163d8e38ff715ff9b8f1a77ea535625 100755 (executable)
netapip_freeTransInfo(pTransInfo);
return -1;
}
- appId |= (policyId<<8);
+ appId |= (policyId <<8);
/* fire off config message */
retValue = nwal_setSecPolicy (((NETAPI_GLOBAL_T*) (n->global))->nwal_context.nwalInstHandle,
if(retValue != nwal_OK)
{
*perr = NETAPI_ERR_NWAL_ERR0;
+ printf("netapi_secAddPolicy: error returned: %d\n", retValue);
netapi_Log ("netapi sec - ERROR: nwal_setPolicy returned Error Code %d\n",
retValue);
netapip_freeTransInfo(pTransInfo);
NETAPI_HANDLE_T * n = (NETAPI_HANDLE_T *) h;
void * handle_inflow;
void * handle_sideband;
- int tunnelId = (handle >> NETAPI_NETCP_MATCH_ID_SHIFT) & NETAPI_NETCP_MATCH_ID_MASK;
+ int tunnelId = (handle >> NETAPI_NETCP_MATCH_ID_SHIFT) &0xffff;
int have_to_wait = 1;
handle_inflow = netapip_netcpCfgGetSaHandles(&netapi_get_global()->nwal_context,
tunnelId, &handle_sideband);
pSaStats->validParams |= NETAPI_SIDEBAND_DATA_MODE_STAT_VALID;
}
}
+
+
+/**********************************************************************************
+ * FUNCTION PURPOSE: API to API to retrieve local channel context information
+ **********************************************************************************
+ * DESCRIPTION: API to retrieve API to retrieve local channel context information
+ *********************************************************************************/
+void netapi_secGetChanCtxInfo(NETAPI_T h,
+ NETCP_CFG_APP_ID_T appId,
+ nwalChanCxtInfo_t* pInfo)
+{
+
+ NETAPI_HANDLE_T * n = (NETAPI_HANDLE_T *) h;
+ void * handle_inflow;
+ void * handle_sideband = NULL;
+ void * handle_policy=NULL;
+ nwalChanCxtInfo_t info;
+ uint32_t stage = 0;
+ int policyId;
+ int tunnelId;
+
+ if(!pInfo)
+ return;
+ memset(pInfo, 0, sizeof(nwalChanCxtInfo_t));
+
+ stage = netapi_cfgGetMatchStage(appId);
+ netapi_Log("netapi_secGetChanCtxInfo: app id: 0x%x, stage: 0x%x\n", appId, stage);
+
+
+ switch (stage)
+ {
+ case 1:
+ /* this is for SA, need SA and OUTER IP handle */
+ tunnelId = netapi_cfgGetMatchId(appId);
+ handle_inflow = netapip_netcpCfgGetSaHandles(&netapi_get_global()->nwal_context,
+ tunnelId, &handle_sideband);
+ if(handle_inflow)
+ {
+ nwal_getChanCxtInfo(&netapi_get_global()->nwal_context,
+ handle_inflow,
+ pInfo);
+ netapi_Log("netapi_secGetChanCtxInfo: outerIP: 0x%x, SA chan handle: 0x%x, bitmap: 0x%x\n",
+ pInfo->paOuterIpHandle, pInfo->saChanHandle, pInfo->validBitMap);
+ }
+ break;
+ case 2:
+ /* this is for policy, need SA inner IP */
+ policyId = netapi_cfgGetMatchId(appId);
+ handle_policy = netapip_netcpCfgGetPolicy(&netapi_get_global()->nwal_context,
+ policyId);
+ if (handle_policy)
+ {
+ nwal_getChanCxtInfo(&netapi_get_global()->nwal_context,
+ handle_policy,
+ pInfo);
+ netapi_Log("netapi_secGetChanCtxInfo: innerIP: 0x%x, bitmap: 0x%x\n",
+ pInfo->paInnerIpHandle, pInfo->validBitMap);
+ }
+ break;
+ default:
+ netapi_Log("netapi_secGetChanCtxInfo:Invalid APPID provided\n");
+ break;
+ }
+ return;
+}