summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Gross <jesse@nicira.com>2011-09-08 15:32:24 -0700
committerJesse Gross <jesse@nicira.com>2011-09-08 16:14:02 -0700
commit21fe5db0c9a8e92bbfce42da89ce20b826216fa1 (patch)
tree0ee014dfd5bef4f8858b1fcebe0c46d4800e3919
parenta876eb5a8bf568a25ee1101bb04ee65bcee56161 (diff)
downloadopenvswitch-21fe5db0c9a8e92bbfce42da89ce20b826216fa1.tar.gz
datapath: Calculate flow hash after extracting metadata.
When we execute a packet from userspace we first extract the header fields from the packet and then add supplied metadata. However, we compute the hash of the packet in between these two steps despite the fact that the metadata can affect the hash. This can lead to two separate hashes for packets of the same flow. Found by code inspection, not an actual real-world problem. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
-rw-r--r--datapath/datapath.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/datapath/datapath.c b/datapath/datapath.c
index a964c27f4..2f30bdcf8 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -691,7 +691,6 @@ static int odp_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
err = flow_extract(packet, -1, &flow->key, &key_len, &is_frag);
if (err)
goto err_flow_put;
- flow->tbl_node.hash = flow_hash(&flow->key, key_len);
err = flow_metadata_from_nlattrs(&flow->key.eth.in_port,
&flow->key.eth.tun_id,
@@ -699,6 +698,8 @@ static int odp_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
if (err)
goto err_flow_put;
+ flow->tbl_node.hash = flow_hash(&flow->key, key_len);
+
acts = flow_actions_alloc(a[ODP_PACKET_ATTR_ACTIONS]);
err = PTR_ERR(acts);
if (IS_ERR(acts))