diff options
author | Nithin Raju <nithin@vmware.com> | 2016-06-17 10:51:52 -0700 |
---|---|---|
committer | Gurucharan Shetty <guru@ovn.org> | 2016-06-17 14:16:41 -0700 |
commit | 885b8265d682a9736bb0db98c48a811bfd9de6cf (patch) | |
tree | f01fdd9a5f20e5690dde0702635d2c900f43f44b /datapath-windows/ovsext/Actions.c | |
parent | f69f713bb032e8c31c05477f32e92f0f235a30e2 (diff) | |
download | openvswitch-885b8265d682a9736bb0db98c48a811bfd9de6cf.tar.gz |
datapath-windows: use ip proto for tunnel port lookup
In Actions.c, based on the IP Protocol type and L4 port of
the outer packet, we lookup the tunnel port. The function
that made this happen took the tunnel type as an argument.
Semantically, is is better to pass the IP protocol type and
let the lookup code map IP protocol type to tunnel type.
In the vport add code, we make sure that we block tunnel
port addition if there's already a tunnel port that uses
the same IP protocol type and L4 port number.
Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Yin Lin <linyi@vmware.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Diffstat (limited to 'datapath-windows/ovsext/Actions.c')
-rw-r--r-- | datapath-windows/ovsext/Actions.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/datapath-windows/ovsext/Actions.c b/datapath-windows/ovsext/Actions.c index 72ebc040c..7ac6bb711 100644 --- a/datapath-windows/ovsext/Actions.c +++ b/datapath-windows/ovsext/Actions.c @@ -215,32 +215,32 @@ OvsDetectTunnelRxPkt(OvsForwardingContext *ovsFwdCtx, /* XXX: we should also check for the length of the UDP payload to pick * packets only if they are at least VXLAN header size. */ + + /* + * For some of the tunnel types such as GRE, the dstPort is not applicable + * since GRE does not have a L4 port. We use '0' for convenience. + */ if (!flowKey->ipKey.nwFrag) { UINT16 dstPort = htons(flowKey->ipKey.l4.tpDst); - switch (flowKey->ipKey.nwProto) { - case IPPROTO_GRE: - tunnelVport = OvsFindTunnelVportByPortType(ovsFwdCtx->switchContext, - OVS_VPORT_TYPE_GRE); - if (tunnelVport) { - ovsActionStats.rxGre++; - } - break; - case IPPROTO_TCP: - tunnelVport = OvsFindTunnelVportByDstPort(ovsFwdCtx->switchContext, - dstPort, - OVS_VPORT_TYPE_STT); - if (tunnelVport) { + + ASSERT(flowKey->ipKey.nwProto != IPPROTO_GRE || dstPort == 0); + + tunnelVport = + OvsFindTunnelVportByDstPortAndNWProto(ovsFwdCtx->switchContext, + dstPort, + flowKey->ipKey.nwProto); + if (tunnelVport) { + switch(tunnelVport->ovsType) { + case OVS_VPORT_TYPE_STT: ovsActionStats.rxStt++; - } - break; - case IPPROTO_UDP: - tunnelVport = OvsFindTunnelVportByDstPort(ovsFwdCtx->switchContext, - dstPort, - OVS_VPORT_TYPE_VXLAN); - if (tunnelVport) { + break; + case OVS_VPORT_TYPE_VXLAN: ovsActionStats.rxVxlan++; + break; + case OVS_VPORT_TYPE_GRE: + ovsActionStats.rxGre++; + break; } - break; } } |