summaryrefslogtreecommitdiff
path: root/datapath-windows/ovsext/Netlink
diff options
context:
space:
mode:
authorNithin Raju <nithin@vmware.com>2016-05-19 15:31:49 -0700
committerJoe Stringer <joe@ovn.org>2016-05-25 10:25:24 -0700
commit7e98ed23669f423daca1bc4731bbd467cee726e2 (patch)
tree0bc7257e5b2cb3d70909f49cb89ffd066a9cf85f /datapath-windows/ovsext/Netlink
parent57b99edd7eb351c76e3785effbf8463437202abf (diff)
downloadopenvswitch-7e98ed23669f423daca1bc4731bbd467cee726e2.tar.gz
datapath-windows: o/p buffer must fit NL error message
OVS_IOCTL_WRITE and OVS_IOCTL_TRANSACT can generate a netlink error that is represented by a OVS_MESSAGE_ERROR struct. We want to make sure at the entry point of the ioctl processing that the output buffer is big enough to hold the error message. We were earlier checking for struct OVS_MESSAGE which is smaller. Since we are ensuring that output buffer can fit OVS_MESSAGE_ERROR at the top of the ioctl function, there's no need to check for that later. Signed-off-by: Nithin Raju <nithin@vmware.com> Acked-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com> Signed-off-by: Joe Stringer <joe@ovn.org>
Diffstat (limited to 'datapath-windows/ovsext/Netlink')
-rw-r--r--datapath-windows/ovsext/Netlink/Netlink.c11
-rw-r--r--datapath-windows/ovsext/Netlink/Netlink.h1
2 files changed, 2 insertions, 10 deletions
diff --git a/datapath-windows/ovsext/Netlink/Netlink.c b/datapath-windows/ovsext/Netlink/Netlink.c
index dc1e78c60..1eec320e2 100644
--- a/datapath-windows/ovsext/Netlink/Netlink.c
+++ b/datapath-windows/ovsext/Netlink/Netlink.c
@@ -109,17 +109,12 @@ NlFillNlHdr(PNL_BUFFER nlBuf, UINT16 nlmsgType,
*/
VOID
NlBuildErrorMsg(POVS_MESSAGE msgIn, POVS_MESSAGE_ERROR msgError,
- UINT32 msgErrorLen,
- UINT errorCode, UINT32 *msgLen)
+ UINT errorCode, UINT32 *replyLen)
{
NL_BUFFER nlBuffer;
ASSERT(errorCode != NL_ERROR_PENDING);
- if ((msgError == NULL) || (msgErrorLen < sizeof *msgError)) {
- return;
- }
-
NlBufInit(&nlBuffer, (PCHAR)msgError, sizeof *msgError);
NlFillNlHdr(&nlBuffer, NLMSG_ERROR, 0,
msgIn->nlMsg.nlmsgSeq, msgIn->nlMsg.nlmsgPid);
@@ -128,9 +123,7 @@ NlBuildErrorMsg(POVS_MESSAGE msgIn, POVS_MESSAGE_ERROR msgError,
msgError->errorMsg.nlMsg = msgIn->nlMsg;
msgError->nlMsg.nlmsgLen = sizeof(OVS_MESSAGE_ERROR);
- if (NULL != msgLen) {
- *msgLen = msgError->nlMsg.nlmsgLen;
- }
+ *replyLen = msgError->nlMsg.nlmsgLen;
}
/*
diff --git a/datapath-windows/ovsext/Netlink/Netlink.h b/datapath-windows/ovsext/Netlink/Netlink.h
index 63164c716..b1b3bed51 100644
--- a/datapath-windows/ovsext/Netlink/Netlink.h
+++ b/datapath-windows/ovsext/Netlink/Netlink.h
@@ -96,7 +96,6 @@ BOOLEAN NlFillNlHdr(PNL_BUFFER nlBuf,
UINT32 nlmsgSeq, UINT32 nlmsgPid);
VOID NlBuildErrorMsg(POVS_MESSAGE msgIn, POVS_MESSAGE_ERROR msgError,
- UINT32 msgErrorLen,
UINT errorCode, UINT32 *msgLen);
/* Netlink message accessing the payload */