From c573540b89ddf0f4c74f0ebb6d237388d660e8fa Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 24 Oct 2011 09:23:18 -0700 Subject: [PATCH] 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. --- ofproto/ofproto-dpif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)) { -- 2.30.2