From: Simon Horman 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-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=026a517999746f5578d8a3031e3df411b37096d2;p=openvswitch 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 Signed-off-by: Ben Pfaff --- diff --git a/lib/ofp-util.c b/lib/ofp-util.c index edcc1636..e8ba0b06 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);