[ovs-dev] [PATCH] ofproto-dpif: Fix htons() that should be ntohs().

Justin Pettit jpettit at nicira.com
Mon Oct 24 16:27:54 UTC 2011


Looks good.  Thanks.

--Justin


On Oct 24, 2011, at 9:23 AM, Ben Pfaff wrote:

> 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 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
> index 4de5a4e..de600f0 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)) {
> -- 
> 1.7.4.4
> 




More information about the dev mailing list