[ovs-dev] [PATCH] datapath-windows: pop buffer from packet / pop_vlan bug

Sairam Venugopal vsairam at vmware.com
Tue Nov 29 18:21:34 UTC 2016


Looks like my previous Acked-by was missed out. Resending this.

Acked-by: Sairam Venugopal <vsairam at vmware.com>


On 10/27/16, 4:48 PM, "Alin Serdean" <aserdean at cloudbasesolutions.com>
wrote:

>Switch too memmove(RtlMoveMemory) instead of copy and predefined allocated
>buffer.
>
>Currently if we receive a pop_vlan action, and the vlan tag is inside the
>Ethernet frame(not in the net buffer list information) we change the frame
>without checking if the it was a vlan tagged or not.
>
>This patch checks if it a vlan tagged frame and makes the action a
>non-operation.
>
>
>Signed-off-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
>---
>this patch is intended for 2.6 as well
>---
> datapath-windows/ovsext/Actions.c | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
>diff --git a/datapath-windows/ovsext/Actions.c
>b/datapath-windows/ovsext/Actions.c
>index f46309a..9a58fbd 100644
>--- a/datapath-windows/ovsext/Actions.c
>+++ b/datapath-windows/ovsext/Actions.c
>@@ -1079,9 +1079,6 @@ OvsPopFieldInPacketBuf(OvsForwardingContext
>*ovsFwdCtx,
>     UINT32 packetLen, mdlLen;
>     PNET_BUFFER_LIST newNbl;
>     NDIS_STATUS status;
>-    PUINT8 tempBuffer[ETH_HEADER_LENGTH];
>-
>-    ASSERT(shiftOffset > ETH_ADDR_LENGTH);
> 
>     newNbl = OvsPartialCopyNBL(ovsFwdCtx->switchContext,
>ovsFwdCtx->curNbl,
>                                0, 0, TRUE /* copy NBL info */);
>@@ -1118,8 +1115,16 @@ OvsPopFieldInPacketBuf(OvsForwardingContext
>*ovsFwdCtx,
>         return NDIS_STATUS_FAILURE;
>     }
>     bufferStart += NET_BUFFER_CURRENT_MDL_OFFSET(curNb);
>-    RtlCopyMemory(tempBuffer, bufferStart, shiftOffset);
>-    RtlCopyMemory(bufferStart + shiftLength, tempBuffer, shiftOffset);
>+    /* XXX At the momemnt !bufferData means it should be treated as
>VLAN. We
>+     * should split the function and refactor. */
>+    if (!bufferData) {
>+        EthHdr *ethHdr = (EthHdr *)bufferStart;
>+        /* If the frame is not VLAN make it a no op */
>+        if (ethHdr->Type != ETH_TYPE_802_1PQ_NBO) {
>+            return NDIS_STATUS_SUCCESS;
>+        }
>+    }
>+    RtlMoveMemory(bufferStart + shiftLength, bufferStart, shiftOffset);
>     NdisAdvanceNetBufferDataStart(curNb, shiftLength, FALSE, NULL);
> 
>     if (bufferData) {
>-- 
>2.9.2.windows.1
>_______________________________________________
>dev mailing list
>dev at openvswitch.org
>https://urldefense.proofpoint.com/v2/url?u=http-3A__openvswitch.org_mailma
>n_listinfo_dev&d=CwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Dc
>ruz40PROJ40ROzSpxyQSLw6fcrOWpJgEcEmNR3JEQ&m=HblfY6XT1rD61UBQ5NSkOwYlhBq1Me
>cvuKrde4eEF2M&s=BBOF5TgehYe54YgPAl-EyK-CBXrn8o9ri_jhAhqN8kw&e= 



More information about the dev mailing list