summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlin Serdean <aserdean@cloudbasesolutions.com>2016-03-31 09:16:52 +0000
committerBen Pfaff <blp@ovn.org>2016-03-31 08:19:07 -0700
commitfdb876e405c797d789a38f06ad90f8402155f7b6 (patch)
tree032ca0a214a7ce5816c7bf7ab9174ddf00fcfe51
parent7159d9c53d30cdad62ecca481009281983a615a9 (diff)
downloadopenvswitch-fdb876e405c797d789a38f06ad90f8402155f7b6.tar.gz
datapath-windows: Add OVS_KEY_ATTR_ICMP support
Revisit the mapping of an IPv4 key to netlink key and add the according transformation. Also add support for OVS_KEY_ATTR_ICMP to the windows datapath. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
-rw-r--r--datapath-windows/ovsext/Flow.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/datapath-windows/ovsext/Flow.c b/datapath-windows/ovsext/Flow.c
index b9623b11d..c079540b1 100644
--- a/datapath-windows/ovsext/Flow.c
+++ b/datapath-windows/ovsext/Flow.c
@@ -1066,9 +1066,8 @@ _MapFlowIpv4KeyToNlKey(PNL_BUFFER nlBuf, IpKey *ipv4FlowPutKey)
case IPPROTO_ICMP: {
struct ovs_key_icmp icmpKey;
- /* XXX: revisit to see if htons is needed */
- icmpKey.icmp_type = (__u8)(ipv4FlowPutKey->l4.tpSrc);
- icmpKey.icmp_code = (__u8)(ipv4FlowPutKey->l4.tpDst);
+ icmpKey.icmp_type = (__u8)ntohs(ipv4FlowPutKey->l4.tpSrc);
+ icmpKey.icmp_code = (__u8)ntohs(ipv4FlowPutKey->l4.tpDst);
if (!NlMsgPutTailUnspec(nlBuf, OVS_KEY_ATTR_ICMP,
(PCHAR)(&icmpKey),
@@ -1452,6 +1451,13 @@ _MapKeyAttrToFlowPut(PNL_ATTR *keyAttrs,
ipv4FlowPutKey->l4.tpDst = sctpKey->sctp_dst;
}
+ if (keyAttrs[OVS_KEY_ATTR_ICMP]) {
+ const struct ovs_key_icmp *icmpKey;
+ icmpKey = NlAttrGet(keyAttrs[OVS_KEY_ATTR_ICMP]);
+ ipv4FlowPutKey->l4.tpSrc = htons(icmpKey->icmp_type);
+ ipv4FlowPutKey->l4.tpDst = htons(icmpKey->icmp_code);
+ }
+
destKey->l2.keyLen += OVS_IP_KEY_SIZE;
}
break;