diff --git a/datapath-windows/ovsext/Actions.c b/datapath-windows/ovsext/Actions.c index 23de67e537e..408b9be2a40 100644 --- a/datapath-windows/ovsext/Actions.c +++ b/datapath-windows/ovsext/Actions.c @@ -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; } } diff --git a/datapath-windows/ovsext/Netlink/NetlinkError.h b/datapath-windows/ovsext/Netlink/NetlinkError.h index c41414c0526..827fa8cc6a4 100644 --- a/datapath-windows/ovsext/Netlink/NetlinkError.h +++ b/datapath-windows/ovsext/Netlink/NetlinkError.h @@ -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; +} diff --git a/datapath-windows/ovsext/User.c b/datapath-windows/ovsext/User.c index 8400b83bcc8..f24c4e3f167 100644 --- a/datapath-windows/ovsext/User.c +++ b/datapath-windows/ovsext/User.c @@ -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); @@ -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: @@ -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) {