From: Nithin Raju Date: Sat, 18 Oct 2014 18:39:37 +0000 (-0700) Subject: datapath-windows: Fixes in packet created for userspace X-Git-Tag: v2.4.0~1148 X-Git-Url: http://git.cascardo.eti.br/?a=commitdiff_plain;h=befa5b43fa1005c8895f09f14c49e8ad34e32af6;p=cascardo%2Fovs.git datapath-windows: Fixes in packet created for userspace A couple of miscellaneous fixes in code that creates a packet for userspace as well as when we copy the packet to memory specified by userspace. Signed-off-by: Nithin Raju Acked-by: Ankur Sharma Acked-by: Alin Gabriel Serdean Signed-off-by: Ben Pfaff --- diff --git a/datapath-windows/ovsext/User.c b/datapath-windows/ovsext/User.c index a4c736b27..329b964b0 100644 --- a/datapath-windows/ovsext/User.c +++ b/datapath-windows/ovsext/User.c @@ -205,7 +205,7 @@ OvsReadDpIoctl(PFILE_OBJECT fileObject, *ptr = sum; ovsUserStats.l4Csum++; } else { - RtlCopyMemory(outputBuffer, &elem->packet, len); + RtlCopyMemory(outputBuffer, &elem->packet.data, len); } *replyLen = len; @@ -892,14 +892,14 @@ OvsCreateQueueNlPacket(PVOID userData, UINT32 pid; UINT32 nlMsgSize; NL_BUFFER nlBuf; + PNL_MSG_HDR nlMsg; /* XXX pass vport in the stack rather than portNo */ POVS_VPORT_ENTRY vport = OvsFindVportByPortNo(gOvsSwitchContext, inPort); if (vport == NULL){ - /* Should never happen as dispatch lock is held */ - ASSERT(vport); + /* No vport is not fatal. */ return NULL; } @@ -1028,6 +1028,12 @@ OvsCreateQueueNlPacket(PVOID userData, elem->hdrInfo.l4Offset += VLAN_TAG_SIZE; ovsUserStats.vlanInsert++; } + + nlMsg = (PNL_MSG_HDR)NlBufAt(&nlBuf, 0, 0); + nlMsg->nlmsgLen = NlBufSize(&nlBuf); + /* 'totalLen' should be size of valid data. */ + elem->packet.totalLen = nlMsg->nlmsgLen; + return elem; fail: OvsFreeMemory(elem);