diff options
author | Nithin Raju <nithin@vmware.com> | 2015-09-23 09:15:32 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2015-09-29 22:42:05 -0700 |
commit | 8fd3ded1cca6b1bec0ce54eeae294e3eeded2d8b (patch) | |
tree | 851f7048867b7edc397ac1d737b4d5dc587ea91f /datapath-windows/ovsext/Datapath.c | |
parent | 121daded51b9798fe3722824b27a05c16806cbd1 (diff) | |
download | openvswitch-8fd3ded1cca6b1bec0ce54eeae294e3eeded2d8b.tar.gz |
datapath-windows: return netlink error for read operation
The kernel datapath returns a NL error message upon any errors
during read operations, and returns STATUS_SUCCESS as the return
code. We reply on the input NL request to get the family ID, and the
PID. However, when the request is of type OVS_CTRL_CMD_EVENT_NOTIFY
and OVS_CTRL_CMD_READ_NOTIFY, there's no input buffer associated
with the request. So, we use a temporary input buffer to be able to
call the Netlink APIs for constructing the output NL error message.
Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'datapath-windows/ovsext/Datapath.c')
-rw-r--r-- | datapath-windows/ovsext/Datapath.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/datapath-windows/ovsext/Datapath.c b/datapath-windows/ovsext/Datapath.c index 1e166041d..b3dbd7164 100644 --- a/datapath-windows/ovsext/Datapath.c +++ b/datapath-windows/ovsext/Datapath.c @@ -1020,10 +1020,24 @@ InvokeNetlinkCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx, if (status != STATUS_SUCCESS && status != STATUS_PENDING) { if (usrParamsCtx->devOp != OVS_WRITE_DEV_OP && *replyLen == 0) { NL_ERROR nlError = NlMapStatusToNlErr(status); - POVS_MESSAGE msgIn = (POVS_MESSAGE)usrParamsCtx->inputBuffer; + OVS_MESSAGE msgInTmp = { 0 }; + POVS_MESSAGE msgIn = NULL; POVS_MESSAGE_ERROR msgError = (POVS_MESSAGE_ERROR) usrParamsCtx->outputBuffer; + if (usrParamsCtx->ovsMsg->genlMsg.cmd == OVS_CTRL_CMD_EVENT_NOTIFY || + usrParamsCtx->ovsMsg->genlMsg.cmd == OVS_CTRL_CMD_READ_NOTIFY) { + /* There's no input buffer associated with such requests. */ + NL_BUFFER nlBuffer; + msgIn = &msgInTmp; + NlBufInit(&nlBuffer, (PCHAR)msgIn, sizeof *msgIn); + NlFillNlHdr(&nlBuffer, nlFamilyOps->id, 0, 0, + usrParamsCtx->ovsInstance->pid); + } else { + msgIn = (POVS_MESSAGE)usrParamsCtx->inputBuffer; + } + + ASSERT(msgIn); ASSERT(msgError); NlBuildErrorMsg(msgIn, msgError, nlError); *replyLen = msgError->nlMsg.nlmsgLen; |