From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hans Schillstrom Subject: Re: [PATCH] netfilter: xt_HMARK: endian bugs Date: Mon, 14 May 2012 18:09:16 +0200 Message-ID: <201205141809.18174.hans.schillstrom@ericsson.com> References: <1337002943-16374-1-git-send-email-hans.schillstrom@ericsson.com> <1337009079.8512.535.camel@edumazet-glaptop> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Cc: Jan Engelhardt , Pablo Neira Ayuso , "kaber@trash.net" , "jengelh@medozas.de" , "netfilter-devel@vger.kernel.org" , "netdev@vger.kernel.org" , "dan.carpenter@oracle.com" , "hans@schillstrom.com" To: Eric Dumazet Return-path: Received: from mailgw1.ericsson.se ([193.180.251.45]:53181 "EHLO mailgw1.ericsson.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755433Ab2ENQJV (ORCPT ); Mon, 14 May 2012 12:09:21 -0400 In-Reply-To: <1337009079.8512.535.camel@edumazet-glaptop> Content-Disposition: inline Sender: netfilter-devel-owner@vger.kernel.org List-ID: On Monday 14 May 2012 17:24:39 Eric Dumazet wrote: > On Mon, 2012-05-14 at 17:05 +0200, Jan Engelhardt wrote: > > On Monday 2012-05-14 16:40, Pablo Neira Ayuso wrote: > > > > >> - if (t->uports.p16.dst < t->uports.p16.src) > > >> + if (ntohs(t->uports.p16.dst) < ntohs(t->uports.p16.src)) > > > > > >Do we really need this to make sparse happy? > > > > You need it to make *maths* happy. > > > > Consider > > > > 384 < 65407 > > > > but > > > > ntohs(384) > ntohs(65407) > > <=> 32769 > 32767 > > -- > > Doesnt matter at all in this context. This context can contain both le & be machines, so at least in hmark it make sense > Take a look at > > void __skb_get_rxhash(struct sk_buff *skb) > > if ((__force u16)keys.port16[1] < (__force u16)keys.port16[0]) > swap(...) > > -- Regards Hans Schillstrom