lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 4 Oct 2012 10:06:24 -0700
From:	Jesse Gross <jesse@...ira.com>
To:	Stephen Hemminger <shemminger@...tta.com>
Cc:	davem@...emloft.net, netdev@...r.kernel.org
Subject: Re: [RFC] vxlan: use ether header as fallback hash

On Thu, Oct 4, 2012 at 9:43 AM, Stephen Hemminger <shemminger@...tta.com> wrote:
> On Thu, 4 Oct 2012 09:27:14 -0700
> Jesse Gross <jesse@...ira.com> wrote:
>
>> On Wed, Oct 3, 2012 at 9:39 PM, Stephen Hemminger <shemminger@...tta.com> wrote:
>> > VXLAN bases source UDP port based on flow to help the
>> > receiver to be able to load balance based on outer header
>> > contents.
>> >
>> > This patches changes the algorithm to better handle packets
>> > that can not be categorized by the rxhash() function.
>> > It adds a fallback to use jhash on the Ether header.
>> >
>> > It also fixes a bug where the old code could assign 0 as a port
>> > value.
>> >
>> >
>> > Signed-off-by: Stephen Hemminger <shemminger@...tta.com>
>> >
>> > ---
>> > RFC for now, compile tested only
>> >
>> > --- a/drivers/net/vxlan.c       2012-10-03 21:25:43.747968165 -0700
>> > +++ b/drivers/net/vxlan.c       2012-10-03 21:36:10.213805422 -0700
>> > @@ -622,12 +622,30 @@ static inline u8 vxlan_ecn_encap(u8 tos,
>> >         return INET_ECN_encapsulate(tos, inner);
>> >  }
>> >
>> > +/* Compute hash to use for source port
>> > + *   first choice to use L4 flow hash since it will spread
>> > + *     better and maybe available from hardware
>> > + *   secondary choice is to use jhash on the Ethernet header
>> > + * Always returns non-zero value
>> > + */
>> > +static u16 vxlan_flow_hash(struct sk_buff *skb)
>> > +{
>> > +       u16 hash = skb_get_rxhash(skb);
>> > +
>> > +       if (!hash)
>> > +               hash = jhash(skb->data, 3, skb->protocol);
>>
>> Shouldn't this be jhash2 for words?
>
> No. for a couple of reasons. First, the ethernet header may not be aligned.
> Second we want to get source/destination and type.  The source/destination
> is 12 bytes (3 words) and the ether type is already in skb->protocol.

OK, it might not be aligned but jhash takes it's length as the number
of bytes, not words.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ