[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131022171314.GL1544@neomailbox.net>
Date: Tue, 22 Oct 2013 19:13:14 +0200
From: Antonio Quartulli <antonio@...hcoding.com>
To: David Laight <David.Laight@...LAB.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
On Tue, Oct 22, 2013 at 01:46:22PM +0100, David Laight wrote:
> > 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.
I decided not to pass the source port because if the user is really interested
in it, it is still possible to get the udp_hdr from the skb and read its value.
> 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.
>
so you suggest to rename rx_hook to something else to warn people about the
change?
If we go for the "no udp port" approach they will get an error any way because
of the mismatching arguments.
Regards,
--
Antonio Quartulli
Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists