From 026a517999746f5578d8a3031e3df411b37096d2 Mon Sep 17 00:00:00 2001 From: Simon Horman Date: Thu, 9 Aug 2012 17:49:23 +0900 Subject: [PATCH] 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 --- 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 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); -- 2.43.0