From 4c640d3be58b34e3a9633b8beb7d6e83d6786a85 Mon Sep 17 00:00:00 2001
From: Andy Zhou <azhou@nicira.com>
Date: Fri, 30 Aug 2013 13:45:56 -0700
Subject: [PATCH] odp_util: Fix a bug in conversion between flow/mask and flow
 key

From: Guolin Yang <gyang@nicira.com>

In odp_flow_key_from_flow__(), when converting ICMPv6 flow/mask
to flow/mask key, we should always use flow to check for whether
ND informaition is present or not. In mask case, both type and code
field should be masked, otherwise ND fields can be masked.

Signed-off-by: Guolin Yang <gyang@nicira.com>

This patch is an abridged version of the same patch committed on master.
This patch only contains necessary bug fix, but dropped extra protocol
sanity checks.

Signed-off-by: Andy Zhou <azhou@nicira.com>
---
 lib/odp-util.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/odp-util.c b/lib/odp-util.c
index dcd4b6f..967532e 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -2462,8 +2462,8 @@ odp_flow_key_from_flow__(struct ofpbuf *buf, const struct flow *data,
             icmpv6_key->icmpv6_type = ntohs(data->tp_src);
             icmpv6_key->icmpv6_code = ntohs(data->tp_dst);
 
-            if (icmpv6_key->icmpv6_type == ND_NEIGHBOR_SOLICIT
-                    || icmpv6_key->icmpv6_type == ND_NEIGHBOR_ADVERT) {
+            if (flow->tp_dst == htons(ND_NEIGHBOR_SOLICIT)
+                    || flow->tp_src == htons(ND_NEIGHBOR_ADVERT)) {
                 struct ovs_key_nd *nd_key;
 
                 nd_key = nl_msg_put_unspec_uninit(buf, OVS_KEY_ATTR_ND,
-- 
1.7.9.5

