[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AE90C24D6B3A694183C094C60CF0A2F6026B739F@saturn3.aculab.com>
Date: Tue, 22 Oct 2013 13:46:22 +0100
From: "David Laight" <David.Laight@...LAB.COM>
To: "Antonio Quartulli" <antonio@...hcoding.com>
Cc: "David S. Miller" <davem@...emloft.net>, <netdev@...r.kernel.org>
Subject: RE: [PATCH net] netpoll: fix rx_hook() interface by passing the skb
> Subject: Re: [PATCH net] netpoll: fix rx_hook() interface by passing the skb
>
> On Tue, Oct 22, 2013 at 10:09:00AM +0100, David Laight wrote:
> > > Subject: [PATCH net] netpoll: fix rx_hook() interface by passing the skb
> > >
> > > Right now skb->data is passed to rx_hook() even if the skb
> > > has not been linearised and without giving rx_hook() a way
> > > to linearise it.
> > >
> > > Change the rx_hook() interface and make it accept the skb
> > > as argument. In this way users implementing rx_hook() can
> > > perform all the needed operations to properly (and safely)
> > > access the skb data.
> > ...
> > > - void (*rx_hook)(struct netpoll *, int, char *, int);
> > > + void (*rx_hook)(struct netpoll *np, struct sk_buff *skb, int offset);
> >
> > You can't do that change without changing the way that hooks are registered
> > so that any existing modules will fail to register their hooks.
>
> There is no hook registration in the kernel tree. All the users are outside.
Looking at __netpoll_rx() I notice that there isn't an skb_pull for the
udp header.
Actually, I think the alignment rules effectively imply that iph->ihl
(the second byte) will always be in the first skb fragment so the
code could sensible do a single skb_pull() that includes the udp header.
I can't remember which value you passed as 'offset' (and my mailer makes
it hard to find), but to ease the code changes the offset of the udp data
would make sense.
In that case you still need to pass the source port.
If you do rx_hook(np, source_port, skb, offset) then if anyone manages to
load an old module (or code that casts the assignement to rx_poll)
at least it won't go 'bang'.
Renaming the structure member will guarantee to generate compile errors.
David
Powered by blists - more mailing lists