ofproto-dpif: Fix htons() that should be ntohs().
authorBen Pfaff <blp@nicira.com>
Mon, 24 Oct 2011 16:23:18 +0000 (09:23 -0700)
committerBen Pfaff <blp@nicira.com>
Mon, 24 Oct 2011 16:23:18 +0000 (09:23 -0700)
Not a real bug since htons() and ntohs() do the same thing on all
interesting target platforms.

Found by sparse.

ofproto/ofproto-dpif.c

index 4de5a4e63f68c9e737bf77fec560721d5150a971..de600f0a170ec9005fd0cd7c1cbd550dae00fa63 100644 (file)
@@ -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)) {