Acked-by: Alin Gabriel Serdean <aserd...@cloudbasesolutions.com>



-----Mesaj original-----
De la: dev [mailto:dev-boun...@openvswitch.org] În numele Nithin Raju
Trimis: Saturday, October 18, 2014 9:40 PM
Către: dev@openvswitch.org
Subiect: [ovs-dev] [PATCH 3/4 v2] 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 <nit...@vmware.com>
Acked-by: Ankur Sharma <ankursha...@vmware.com>
---
 datapath-windows/ovsext/User.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/datapath-windows/ovsext/User.c b/datapath-windows/ovsext/User.c 
index a8128bc..2811092 100644
--- a/datapath-windows/ovsext/User.c
+++ b/datapath-windows/ovsext/User.c
@@ -239,7 +239,7 @@ OvsReadDpIoctl(PFILE_OBJECT fileObject,
             *ptr = sum;
             ovsUserStats.l4Csum++;
         } else {
-            RtlCopyMemory(outputBuffer, &elem->packet, len);
+            RtlCopyMemory(outputBuffer, &elem->packet.data, len);
         }
 
         *replyLen = len;
@@ -928,14 +928,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;
     }
 
@@ -1064,6 +1064,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);
--
1.7.4.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to