Skip to content

Commit

Permalink
datapath-windows: Action not supported error handling
Browse files Browse the repository at this point in the history
Added changes to support error handling for non supported actions.
Added changes in packet execute for sending transactional errors.

Signed-off-by: Ankur Sharma <[email protected]>
Acked-by: Nithin Raju <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
ankursh authored and blp committed Oct 16, 2014
1 parent efa753a commit 7c5d9f1
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 18 deletions.
4 changes: 1 addition & 3 deletions datapath-windows/ovsext/Actions.c
Original file line number Diff line number Diff line change
Expand Up @@ -1526,10 +1526,8 @@ OvsActionsExecute(POVS_SWITCH_CONTEXT switchContext,
break;
}
case OVS_ACTION_ATTR_SAMPLE:
break;
case OVS_ACTION_ATTR_UNSPEC:
case __OVS_ACTION_ATTR_MAX:
default:
status = NDIS_STATUS_NOT_SUPPORTED;
break;
}
}
Expand Down
17 changes: 17 additions & 0 deletions datapath-windows/ovsext/Netlink/NetlinkError.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,20 @@ typedef enum _NL_ERROR_
/*the operation would block */
NL_ERROR_WOULDBLOCK = ((ULONG)-140),
} NL_ERROR;

static __inline
NlMapStatusToNlErr(NTSTATUS status)
{
NL_ERROR ret = NL_ERROR_SUCCESS;

switch (status)
{
case STATUS_NOT_SUPPORTED:
ret = NL_ERROR_NOTSUPP;
break;
default:
break;
}

return ret;
}
38 changes: 23 additions & 15 deletions datapath-windows/ovsext/User.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ OvsNlExecuteCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,

status = OvsExecuteDpIoctl(&execute);

/* Default reply that we want to send */
if (status == STATUS_SUCCESS) {
NlBufInit(&nlBuf, usrParamsCtx->outputBuffer,
usrParamsCtx->outputLength);
Expand All @@ -382,20 +383,23 @@ OvsNlExecuteCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
if (status == STATUS_SUCCESS) {
*replyLen = msgOut->nlMsg.nlmsgLen;
}
}

/* As of now there are no transactional errors in the implementation.
* Once we have them then we need to map status to correct
* nlError value, so that below mentioned code gets hit. */
if ((nlError != NL_ERROR_SUCCESS) &&
(usrParamsCtx->outputBuffer)) {

POVS_MESSAGE_ERROR msgError = (POVS_MESSAGE_ERROR)
usrParamsCtx->outputBuffer;
BuildErrorMsg(msgIn, msgError, nlError);
*replyLen = msgError->nlMsg.nlmsgLen;
status = STATUS_SUCCESS;
goto done;
} else {
/* Map NTSTATUS to NL_ERROR */
nlError = NlMapStatusToNlErr(status);

/* As of now there are no transactional errors in the implementation.
* Once we have them then we need to map status to correct
* nlError value, so that below mentioned code gets hit. */
if ((nlError != NL_ERROR_SUCCESS) &&
(usrParamsCtx->outputBuffer)) {

POVS_MESSAGE_ERROR msgError = (POVS_MESSAGE_ERROR)
usrParamsCtx->outputBuffer;
BuildErrorMsg(msgIn, msgError, nlError);
*replyLen = msgError->nlMsg.nlmsgLen;
status = STATUS_SUCCESS;
goto done;
}
}

done:
Expand Down Expand Up @@ -487,7 +491,11 @@ OvsExecuteDpIoctl(OvsPacketExecute *execute)
NdisReleaseRWLock(gOvsSwitchContext->dispatchLock, &lockState);
}
if (ndisStatus != NDIS_STATUS_SUCCESS) {
status = STATUS_UNSUCCESSFUL;
if (ndisStatus == NDIS_STATUS_NOT_SUPPORTED) {
status = STATUS_NOT_SUPPORTED;
} else {
status = STATUS_UNSUCCESSFUL;
}
}

if (pNbl) {
Expand Down

0 comments on commit 7c5d9f1

Please sign in to comment.