/*
- * Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
+ * Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
return oxm_pull_match__(b, false, match);
}
+/* Parses the OXM match description in the 'oxm_len' bytes in 'oxm'. Stores
+ * the result in 'match'.
+ *
+ * Fails with an error when encountering unknown OXM headers.
+ *
+ * Returns 0 if successful, otherwise an OpenFlow error code. */
+enum ofperr
+oxm_decode_match(const void *oxm, size_t oxm_len, struct match *match)
+{
+ return nx_pull_raw(oxm, oxm_len, true, match, NULL, NULL);
+}
+
/* Verify an array of OXM TLVs treating value of each TLV as a mask,
* disallowing masks in each TLV and ignoring pre-requisites. */
enum ofperr
nxm_put(b, field, version, &value, &mask, sizeof value);
}
+static void
+nxm_put_128m(struct ofpbuf *b,
+ enum mf_field_id field, enum ofp_version version,
+ const ovs_be128 value, const ovs_be128 mask)
+{
+ nxm_put(b, field, version, &value, &mask, sizeof(value));
+}
+
static void
nxm_put_eth_masked(struct ofpbuf *b,
enum mf_field_id field, enum ofp_version version,
flow->nw_tos & IP_ECN_MASK);
}
- if (!oxm && match->wc.masks.nw_ttl) {
+ if (match->wc.masks.nw_ttl) {
nxm_put_8(b, MFF_IP_TTL, oxm, flow->nw_ttl);
}
int match_len;
int i;
- BUILD_ASSERT_DECL(FLOW_WC_SEQ == 34);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ == 35);
/* Metadata. */
if (match->wc.masks.dp_hash) {
flow->tunnel.ip_src, match->wc.masks.tunnel.ip_src);
nxm_put_32m(b, MFF_TUN_DST, oxm,
flow->tunnel.ip_dst, match->wc.masks.tunnel.ip_dst);
+ nxm_put_ipv6(b, MFF_TUN_IPV6_SRC, oxm,
+ &flow->tunnel.ipv6_src, &match->wc.masks.tunnel.ipv6_src);
+ nxm_put_ipv6(b, MFF_TUN_IPV6_DST, oxm,
+ &flow->tunnel.ipv6_dst, &match->wc.masks.tunnel.ipv6_dst);
nxm_put_16m(b, MFF_TUN_GBP_ID, oxm,
flow->tunnel.gbp_id, match->wc.masks.tunnel.gbp_id);
nxm_put_8m(b, MFF_TUN_GBP_FLAGS, oxm,
htons(match->wc.masks.ct_zone));
nxm_put_32m(b, MFF_CT_MARK, oxm, htonl(flow->ct_mark),
htonl(match->wc.masks.ct_mark));
+ nxm_put_128m(b, MFF_CT_LABEL, oxm, hton128(flow->ct_label),
+ hton128(match->wc.masks.ct_label));
/* OpenFlow 1.1+ Metadata. */
nxm_put_64m(b, MFF_METADATA, oxm,
}
/* Appends to 'b' an struct ofp11_match_header followed by the OXM format that
- * expresses 'cr', plus enough zero bytes to pad the data appended out to a
+ * expresses 'match', plus enough zero bytes to pad the data appended out to a
* multiple of 8.
*
* OXM differs slightly among versions of OpenFlow. Specify the OpenFlow
return match_len;
}
+/* Appends to 'b' the OXM formats that expresses 'match', without header or
+ * padding.
+ *
+ * OXM differs slightly among versions of OpenFlow. Specify the OpenFlow
+ * version in use as 'version'.
+ *
+ * This function can cause 'b''s data to be reallocated. */
+void
+oxm_put_raw(struct ofpbuf *b, const struct match *match,
+ enum ofp_version version)
+{
+ nx_put_raw(b, version, match, 0, 0);
+}
+
/* Appends to 'b' the nx_match format that expresses the tlv corresponding
* to 'id'. If mask is not all-ones then it is also formated as the value
* of the tlv. */