From: Simon Horman <horms@verge.net.au>
Date: Thu, 9 Aug 2012 08:49:23 +0000 (+0900)
Subject: ofp-util: Use 32bit port for Open Flow 1.1 & 1.2 Port Mod Request
X-Git-Tag: sliver-openvswitch-1.8.90-0~48^2~66
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=026a517999746f5578d8a3031e3df411b37096d2;p=sliver-openvswitch.git

ofp-util: Use 32bit port for Open Flow 1.1 & 1.2 Port Mod Request

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>
---

diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index edcc1636d..e8ba0b061 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -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);