ofp-util: Use 32bit port for Open Flow 1.1 & 1.2 Port Mod Request
authorSimon Horman <horms@verge.net.au>
Thu, 9 Aug 2012 08:49:23 +0000 (17:49 +0900)
committerBen Pfaff <blp@nicira.com>
Thu, 9 Aug 2012 23:27:54 +0000 (16:27 -0700)
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@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/ofp-util.c

index edcc1636d30a88cb59d3b7b60c7cc50675e920fc..e8ba0b061667b1e658fbeca5971808d940c49bb6 100644 (file)
@@ -2851,7 +2851,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);