secchan: Fix in-band ODP->OFP port translation.
authorBen Pfaff <blp@nicira.com>
Fri, 13 Mar 2009 23:52:37 +0000 (16:52 -0700)
committerBen Pfaff <blp@nicira.com>
Sat, 14 Mar 2009 00:05:46 +0000 (17:05 -0700)
The in-band and fail-open code uses ODP port numbers internally, but
ofproto_add_flow() takes OpenFlow actions and thus needs to receive
OpenFlow port numbers.

This should fix a problem with in-band control.

secchan/fail-open.c
secchan/in-band.c

index 4a024f9a47c258278dd873f513d9cf94fc39ca84..619b6f46d102fc66a8a55330fc5f1f2160a46096 100644 (file)
@@ -37,6 +37,7 @@
 #include <stdlib.h>
 #include "flow.h"
 #include "mac-learning.h"
+#include "odp-util.h"
 #include "ofproto.h"
 #include "rconn.h"
 #include "status.h"
@@ -118,7 +119,7 @@ fail_open_handle_flow_miss(struct fail_open *fo, struct ofproto *ofproto,
         ofproto_add_flow(ofproto, flow, 0, UINT16_MAX, NULL, 0, NULL, -1);
     } else if (out_port != FLOOD) {
         /* The output port is known, so add a new flow. */
-        action.output.port = htons(out_port);
+        action.output.port = htons(odp_port_to_ofp_port(out_port));
         ofproto_add_flow(ofproto, flow, 0, UINT16_MAX,
                          &action, 1, payload, -1);
     } else {
index c3a7c954f83d325b2c1cc6110999082d1599eef5..b377f2e38b0e9fc45a64b74215fd87e9ae6a3256 100644 (file)
@@ -42,6 +42,7 @@
 #include "flow.h"
 #include "mac-learning.h"
 #include "netdev.h"
+#include "odp-util.h"
 #include "ofp-print.h"
 #include "ofproto.h"
 #include "ofpbuf.h"
@@ -191,7 +192,7 @@ in_band_handle_flow_miss(struct in_band *in_band, struct ofproto *ofproto,
         ofproto_add_flow(ofproto, flow, 0, UINT16_MAX, NULL, 0, NULL, -1);
     } else if (out_port != FLOOD) {
         /* The output port is known, so add a new flow. */
-        action.output.port = htons(out_port);
+        action.output.port = htons(odp_port_to_ofp_port(out_port));
         ofproto_add_flow(ofproto, flow, 0, UINT16_MAX,
                          &action, 1, payload, -1);
     } else {