diff options
author | Alin Serdean <aserdean@cloudbasesolutions.com> | 2016-10-27 23:48:54 +0000 |
---|---|---|
committer | Gurucharan Shetty <guru@ovn.org> | 2016-11-29 10:36:49 -0800 |
commit | fb7c468b5c2f87f434edcec150498cc50b17b6a5 (patch) | |
tree | 97351ce8fdb2f47f0de86996c2e35941ee87116c | |
parent | a9ba22b7890650cca7c7364f626ca488d6c910e9 (diff) | |
download | openvswitch-fb7c468b5c2f87f434edcec150498cc50b17b6a5.tar.gz |
datapath-windows: pop buffer from packet / pop_vlan bug
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@cloudbasesolutions.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
-rw-r--r-- | datapath-windows/ovsext/Actions.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/datapath-windows/ovsext/Actions.c b/datapath-windows/ovsext/Actions.c index f46309ad7..9a58fbdbc 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) { |