]> git.proxmox.com Git - ovs.git/commitdiff
ofp-actions: Update "copy_field" to latest OF1.5 draft.
authorBen Pfaff <blp@nicira.com>
Mon, 24 Nov 2014 20:25:56 +0000 (12:25 -0800)
committerBen Pfaff <blp@nicira.com>
Fri, 5 Dec 2014 23:14:29 +0000 (15:14 -0800)
Since my original prototype, the oxm_id_len field was removed and
replaced by 2 bytes of padding.

ONF-JIRA: EXT-320
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
lib/ofp-actions.c
tests/ofp-actions.at

index 23ca55b26aa63dcfe20ae2f5323b01a32106b486..ced4f2f19120a62d8f122400cdfbb4dd4d029ac0 100644 (file)
@@ -1710,13 +1710,13 @@ struct ofp15_action_copy_field {
     ovs_be16 n_bits;            /* Number of bits to copy. */
     ovs_be16 src_offset;        /* Starting bit offset in source. */
     ovs_be16 dst_offset;        /* Starting bit offset in destination. */
-    ovs_be16 oxm_id_len;        /* Length of oxm_ids. */
+    uint8_t pad[2];
     /* Followed by:
      * - OXM header for source field.
      * - OXM header for destination field.
      * - Padding with 0-bytes to a multiple of 8 bytes.
-     * The "pad" member is the beginning of the above. */
-    uint8_t pad[4];
+     * The "pad2" member is the beginning of the above. */
+    uint8_t pad2[4];
 };
 OFP_ASSERT(sizeof(struct ofp15_action_copy_field) == 16);
 
@@ -1833,7 +1833,6 @@ decode_OFPAT_RAW15_COPY_FIELD(const struct ofp15_action_copy_field *oacf,
 {
     struct ofpact_reg_move *move;
     enum ofperr error;
-    size_t orig_size;
     struct ofpbuf b;
 
     move = ofpact_put_REG_MOVE(ofpacts);
@@ -1843,8 +1842,7 @@ decode_OFPAT_RAW15_COPY_FIELD(const struct ofp15_action_copy_field *oacf,
     move->dst.n_bits = ntohs(oacf->n_bits);
 
     ofpbuf_use_const(&b, oacf, ntohs(oacf->len));
-    ofpbuf_pull(&b, offsetof(struct ofp15_action_copy_field, pad));
-    orig_size = ofpbuf_size(&b);
+    ofpbuf_pull(&b, offsetof(struct ofp15_action_copy_field, pad2));
     error = nx_pull_header(&b, &move->src.field, NULL);
     if (error) {
         return error;
@@ -1853,9 +1851,6 @@ decode_OFPAT_RAW15_COPY_FIELD(const struct ofp15_action_copy_field *oacf,
     if (error) {
         return error;
     }
-    if (orig_size - ofpbuf_size(&b) != ntohs(oacf->oxm_id_len)) {
-        return OFPERR_OFPBAC_BAD_LEN;
-    }
 
     if (!is_all_zeros(ofpbuf_data(&b), ofpbuf_size(&b))) {
         return OFPERR_NXBRC_MUST_BE_ZERO;
@@ -1905,8 +1900,7 @@ encode_REG_MOVE(const struct ofpact_reg_move *move,
         copy->n_bits = htons(move->dst.n_bits);
         copy->src_offset = htons(move->src.ofs);
         copy->dst_offset = htons(move->dst.ofs);
-        copy->oxm_id_len = htons(8);
-        ofpbuf_set_size(out, ofpbuf_size(out) - sizeof copy->pad);
+        ofpbuf_set_size(out, ofpbuf_size(out) - sizeof copy->pad2);
         nx_put_header(out, move->src.field->id, ofp_version, false);
         nx_put_header(out, move->dst.field->id, ofp_version, false);
     } else {
index 876be67e8672fc619b7fd51c7588d373a320a927..5ad8d537fa9e60bda7f6ee8e8c57aa87279a05d1 100644 (file)
@@ -553,7 +553,7 @@ AT_DATA([test-data], [dnl
 0000 0010 fffffffe 04d2 000000000000
 
 # actions=move:NXM_OF_IN_PORT[]->NXM_OF_VLAN_TCI[]
-001c 0018 0010 0000 0000 0008 00000002 00000802 00000000
+001c 0018 0010 0000 0000 0000 00000002 00000802 00000000
 
 # actions=set_field:00:00:00:00:12:34/00:00:00:00:ff:ff->eth_src
 0019 0018 8000090c 000000001234 00000000ffff 00000000