From 01ba0d769dc78a05ed61a6267ca99a4a84361962 Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Fri, 12 Aug 2011 11:15:53 -0700 Subject: [PATCH] nx-match: Fix bug in "move" action. 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/nx-match.c b/lib/nx-match.c index ecc284e9..cccf6fe6 100644 --- a/lib/nx-match.c +++ b/lib/nx-match.c @@ -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), -- 2.30.2