[ovs-dev] [PATCH 02/38] ofp-util: Use 32bit port for Open Flow 1.1 & 1.2 Port Mod Request

Simon Horman horms at verge.net.au
Thu Aug 9 08:49:23 UTC 2012


When encoding Open Flow 1.1 & 1.2 Port Mod Request messages
the port number should be converted to 32bits using
ofputil_port_to_ofp11() rather than htonl(). This ensures
that port numbers in the reserved range are translated correctly.

Signed-off-by: Simon Horman <horms at verge.net.au>

---

v11
* Initial post
---
 lib/ofp-util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 7f67923..6617274 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -2827,7 +2827,7 @@ ofputil_encode_port_mod(const struct ofputil_port_mod *pm,
 
         b = ofpraw_alloc(OFPRAW_OFPT11_PORT_MOD, ofp_version, 0);
         opm = ofpbuf_put_zeros(b, sizeof *opm);
-        opm->port_no = htonl(pm->port_no);
+        opm->port_no = ofputil_port_to_ofp11(pm->port_no);
         memcpy(opm->hw_addr, pm->hw_addr, ETH_ADDR_LEN);
         opm->config = htonl(pm->config & OFPPC11_ALL);
         opm->mask = htonl(pm->mask & OFPPC11_ALL);
-- 
1.7.10.2.484.gcd07cc5




More information about the dev mailing list