Subject: Re: Endianness problem with u32 classifier hash masks

From: Radu Rendec <[email-masked]>
Date: Wed, 07 Nov 2007 15:55:31 +0200

On Wed, 2007-11-07 at 08:42 -0500, jamal wrote:
> On Wed, 2007-07-11 at 01:22 -0800, David Miller wrote:
> 
> > @@ -615,7 +615,7 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle,
> >  	n->handle = handle;
> >  {
> >  	u8 i = 0;
> > -	u32 mask = s->hmask;
> > +	u32 mask = ntohl(s->hmask);
> 
> 
> Is this line needed? Radu?

Yup. Without it, the number of bits to shift would be computed on the
network ordered mask. The shift in u32_hash_fold() is done on a host
ordered u32 (obtained from applying the mask on the packet data).

Shifting the host ordered u32 with number of bits obtained from network
ordered mask would most probably break things.

I've just compiled the kernel from a fresh clone of Dave's tree (u32
patch included) and I'm about to test it.

Dave, thanks a lot for adding the patch to your tree. But I guess you
didn't test it. I'll get back to you in max 1 hour and tell you the
results.

If everything goes well, then I'll move on to testing the ffs() patch.

Cheers,

Radu