From: Ben Pfaff Date: Mon, 24 Oct 2011 16:23:18 +0000 (-0700) Subject: ofproto-dpif: Fix htons() that should be ntohs(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c573540b89ddf0f4c74f0ebb6d237388d660e8fa;p=openvswitch ofproto-dpif: Fix htons() that should be ntohs(). Not a real bug since htons() and ntohs() do the same thing on all interesting target platforms. Found by sparse. --- diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 4de5a4e6..de600f0a 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -1165,8 +1165,8 @@ stp_process_packet(const struct ofport_dpif *ofport, } /* Trim off padding on payload. */ - if (payload.size > htons(eth->eth_type) + ETH_HEADER_LEN) { - payload.size = htons(eth->eth_type) + ETH_HEADER_LEN; + if (payload.size > ntohs(eth->eth_type) + ETH_HEADER_LEN) { + payload.size = ntohs(eth->eth_type) + ETH_HEADER_LEN; } if (ofpbuf_try_pull(&payload, ETH_HEADER_LEN + LLC_HEADER_LEN)) {