Skip to content

Commit

Permalink
datapath-windows: Fixes in packet created for userspace
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Ankur Sharma <[email protected]>
Acked-by: Alin Gabriel Serdean <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
nithinrajub authored and blp committed Oct 21, 2014
1 parent 59e3720 commit befa5b4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions datapath-windows/ovsext/User.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit befa5b4

Please sign in to comment.