Acked-by: Sairam Venugopal <vsai...@vmware.com>
On 5/17/16, 10:15 AM, "Nithin Raju" <nit...@vmware.com> wrote: >While testing DFW and recirc code it was found that userspace >was calling into packet execute with the tunnel key and the >vport added as part of the execute structure. We were not passing >this along to the code that executes actions. The right thing is >to contruct the key based on all of the attributes sent down from >userspace. > >Signed-off-by: Nithin Raju <nit...@vmware.com> >--- > datapath-windows/ovsext/User.c | 32 ++++++++++++++++++++++++++++++-- > 1 file changed, 30 insertions(+), 2 deletions(-) > >diff --git a/datapath-windows/ovsext/User.c >b/datapath-windows/ovsext/User.c >index 3b3f662..2312940 100644 >--- a/datapath-windows/ovsext/User.c >+++ b/datapath-windows/ovsext/User.c >@@ -51,6 +51,8 @@ static VOID _MapNlAttrToOvsPktExec(PNL_MSG_HDR >nlMsgHdr, PNL_ATTR *nlAttrs, > OvsPacketExecute *execute); > extern NL_POLICY nlFlowKeyPolicy[]; > extern UINT32 nlFlowKeyPolicyLen; >+extern NL_POLICY nlFlowTunnelKeyPolicy[]; >+extern UINT32 nlFlowTunnelKeyPolicyLen; > > static __inline VOID > OvsAcquirePidHashLock() >@@ -375,6 +377,7 @@ _MapNlAttrToOvsPktExec(PNL_MSG_HDR nlMsgHdr, PNL_ATTR >*nlAttrs, > execute->actions = NlAttrGet(nlAttrs[OVS_PACKET_ATTR_ACTIONS]); > execute->actionsLen = >NlAttrGetSize(nlAttrs[OVS_PACKET_ATTR_ACTIONS]); > >+ ASSERT(keyAttrs[OVS_KEY_ATTR_IN_PORT]); > execute->inPort = NlAttrGetU32(keyAttrs[OVS_KEY_ATTR_IN_PORT]); > execute->keyAttrs = keyAttrs; > } >@@ -391,6 +394,8 @@ OvsExecuteDpIoctl(OvsPacketExecute *execute) > OvsFlowKey key = { 0 }; > OVS_PACKET_HDR_INFO layers = { 0 }; > POVS_VPORT_ENTRY vport = NULL; >+ PNL_ATTR tunnelAttrs[__OVS_TUNNEL_KEY_ATTR_MAX]; >+ OvsFlowKey tempTunKey = {0}; > > if (execute->packetLen == 0) { > status = STATUS_INVALID_PARAMETER; >@@ -428,8 +433,31 @@ OvsExecuteDpIoctl(OvsPacketExecute *execute) > goto dropit; > } > >- ndisStatus = OvsExtractFlow(pNbl, fwdDetail->SourcePortId, &key, >&layers, >- NULL); >+ if (execute->keyAttrs[OVS_KEY_ATTR_TUNNEL]) { >+ UINT32 tunnelKeyAttrOffset; >+ >+ tunnelKeyAttrOffset = (UINT32)((PCHAR) >+ (execute->keyAttrs[OVS_KEY_ATTR_TUNNEL]) >+ - (PCHAR)execute->nlMsgHdr); >+ >+ /* Get tunnel keys attributes */ >+ if ((NlAttrParseNested(execute->nlMsgHdr, tunnelKeyAttrOffset, >+ >NlAttrLen(execute->keyAttrs[OVS_KEY_ATTR_TUNNEL]), >+ nlFlowTunnelKeyPolicy, >nlFlowTunnelKeyPolicyLen, >+ tunnelAttrs, ARRAY_SIZE(tunnelAttrs))) >+ != TRUE) { >+ OVS_LOG_ERROR("Tunnel key Attr Parsing failed for msg: %p", >+ execute->nlMsgHdr); >+ status = STATUS_INVALID_PARAMETER; >+ goto dropit; >+ } >+ >+ MapTunAttrToFlowPut(execute->keyAttrs, tunnelAttrs, &tempTunKey); >+ } >+ >+ ndisStatus = OvsExtractFlow(pNbl, execute->inPort, &key, &layers, >+ tempTunKey.tunKey.dst == 0 ? NULL : >&tempTunKey.tunKey); >+ > if (ndisStatus == NDIS_STATUS_SUCCESS) { > NdisAcquireRWLockRead(gOvsSwitchContext->dispatchLock, >&lockState, 0); > ndisStatus = OvsActionsExecute(gOvsSwitchContext, NULL, pNbl, >-- >2.7.1.windows.1 > >_______________________________________________ >dev mailing list >dev@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=mE4pOA9uAtGpEoievwTcJydab3Jw-7 >6Vpblw52FhsEg&s=fEjTj2Ex5CHB7kiq7yCe0M4z6DRiCQcuYW4IwwStBiw&e= _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev