nx-match: Fix bug in "move" action.
authorEthan Jackson <ethan@nicira.com>
Fri, 12 Aug 2011 18:15:53 +0000 (11:15 -0700)
committerEthan Jackson <ethan@nicira.com>
Fri, 12 Aug 2011 22:05:41 +0000 (15:05 -0700)
This patch fixes a bug introduced in Commit 43edca57 "nx-match: New
helpers.", which caused the "move" action to improperly handle bit
ranges.

lib/nx-match.c

index ecc284e945b7f37e3ca9a482abb7c1df5a96583f..cccf6fe671c6c644f8994b9da4d40376e237d216 100644 (file)
@@ -1471,7 +1471,7 @@ nxm_execute_reg_move(const struct nx_action_reg_move *action,
     /* Get the interesting bits of the source field. */
     const struct nxm_field *src = nxm_field_lookup(ntohl(action->src));
     int src_ofs = ntohs(action->src_ofs);
-    uint64_t src_data = nxm_read_field(src, flow) & (mask << src_ofs);
+    uint64_t src_data = (nxm_read_field(src, flow) >> src_ofs) & mask;
 
     nxm_reg_load(action->dst,
                  nxm_encode_ofs_nbits(ntohs(action->dst_ofs), n_bits),