flow: Properly translate port numbers in flow_from_match().
authorBen Pfaff <blp@nicira.com>
Fri, 6 Mar 2009 21:30:09 +0000 (13:30 -0800)
committerBen Pfaff <blp@nicira.com>
Fri, 6 Mar 2009 21:30:09 +0000 (13:30 -0800)
The OpenFlow and datapath port numbers for the local port are different.
We were translating them in one direction (in flow_to_match()) but not
in the other (in flow_from_match()).

This fixes a performance problem (we were setting up the wrong flow).

lib/flow.c

index 5e8250ccc13e3a9e1239dbf32efd1183c1ec282c..5e3898f252a75b96d12b001ee39025e5d631b231 100644 (file)
@@ -230,7 +230,8 @@ flow_from_match(flow_t *flow, uint32_t *wildcards,
     }
     flow->nw_src = match->nw_src;
     flow->nw_dst = match->nw_dst;
-    flow->in_port = ntohs(match->in_port);
+    flow->in_port = (match->in_port == htons(OFPP_LOCAL) ? ODPP_LOCAL
+                     : ntohs(match->in_port));
     flow->dl_vlan = match->dl_vlan;
     flow->dl_type = match->dl_type;
     flow->tp_src = match->tp_src;