From aaf59d93b1cae72ecabf73b21cf4d41c65f1e89b Mon Sep 17 00:00:00 2001
From: Andy Zhou <azhou@nicira.com>
Date: Tue, 9 Jul 2013 15:46:44 -0700
Subject: [PATCH] review comment


Signed-off-by: Andy Zhou <azhou@nicira.com>
---
 datapath/flow.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/datapath/flow.c b/datapath/flow.c
index a756a15..a316167 100644
--- a/datapath/flow.c
+++ b/datapath/flow.c
@@ -1696,12 +1696,16 @@ int ovs_flow_to_nlattrs(const struct sw_flow_key *swkey,
 	    ipv4_tun_to_nlattr(skb, &swkey->tun_key, &output->tun_key))
 		goto nla_put_failure;
 
-	{
+	if (swkey->phy.in_port == DP_MAX_PORTS) {
+		if ((swkey != output) && (output->phy.in_port == 0xffff))
+			if (nla_put_u32(skb, OVS_KEY_ATTR_IN_PORT, 0xffffffff))
+				goto nla_put_failure;
+	} else {
 		u16 upper_u16;
 		upper_u16 = (swkey == output) ? 0 : 0xffff;
 
 		if (nla_put_u32(skb, OVS_KEY_ATTR_IN_PORT,
-					(upper_u16 << 16) | output->phy.in_port))
+				(upper_u16 << 16) | output->phy.in_port))
 			goto nla_put_failure;
 	}
 
@@ -1733,10 +1737,12 @@ int ovs_flow_to_nlattrs(const struct sw_flow_key *swkey,
 		/*
 		 * Ethertype 802.2 is represented in the netlink with omitted
 		 * OVS_KEY_ATTR_ETHERTYPE in the flow key attribute, and
-		 * 0xffff in the mask attribute.
+		 * 0xffff in the mask attribute.  Ethertype can also
+		 * be wildcarded.
 		 */
-		if (swkey != output)
-			if (nla_put_be16(skb, OVS_KEY_ATTR_ETHERTYPE, htons(0xffff)))
+		if (swkey != output && output->eth.type)
+			if (nla_put_be16(skb, OVS_KEY_ATTR_ETHERTYPE,
+						output->eth.type))
 				goto nla_put_failure;
 		goto unencap;
 	}
-- 
1.7.9.5

