[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1280789717.5914.1.camel@achroite.uk.solarflarecom.com>
Date: Mon, 02 Aug 2010 23:55:17 +0100
From: Ben Hutchings <bhutchings@...arflare.com>
To: Stephen Hemminger <shemminger@...tta.com>
Cc: Changli Gao <xiaosuo@...il.com>,
David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH 4/4] u32: use get_unaligned_be32
On Mon, 2010-08-02 at 15:45 -0700, Stephen Hemminger wrote:
> On Tue, 3 Aug 2010 06:34:59 +0800
> Changli Gao <xiaosuo@...il.com> wrote:
>
> > On Tue, Aug 3, 2010 at 6:00 AM, Stephen Hemminger <shemminger@...tta.com> wrote:
> > > U32 classifier reads data from packet at a offset passed in from
> > > user space. The offset should be aligned, but it is unsafe practice
> > > to depend on values from userspace.
> > >
> > > Signed-off-by: Stephen Hemminger <shemminger@...tta.com>
> > >
> > > --- a/net/sched/cls_u32.c 2010-08-01 11:21:06.945820852 -0700
> > > +++ b/net/sched/cls_u32.c 2010-08-01 11:24:55.257793848 -0700
> > > @@ -41,6 +41,7 @@
> > > #include <net/netlink.h>
> > > #include <net/act_api.h>
> > > #include <net/pkt_cls.h>
> > > +#include <asm/unaligned.h>
> > >
> > > struct tc_u_knode
> > > {
> > > @@ -140,7 +141,7 @@ next_knode:
> > > data = skb_header_pointer(skb, toff, 4, &_data);
> > > if (!data)
> > > goto out;
> > > - if ((*data ^ key->val) & key->mask) {
> > > + if ((get_unaligned_be32(data) ^ key->val) & key->mask) {
> >
> > be32()? I think it may break configuration.
>
> The data pointer is be32 * already.
But get_unaligned_be32() converts to native byte order.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
--
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