netdev
[Top] [All Lists]

Re: PPP-over-L2TP kernel support, patch for review

To: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Subject: Re: PPP-over-L2TP kernel support, patch for review
From: Martijn van Oosterhout <kleptog@xxxxxxxxx>
Date: Wed, 8 Sep 2004 19:04:55 +1000
Cc: davem@xxxxxxxxxxxxx, jchapman@xxxxxxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <20040908084630.GA23117@xxxxxxxxxxxxxxxxxxx>
References: <20040908073238.GB18285@xxxxxxxxx> <E1C4xe9-0005xL-00@xxxxxxxxxxxxxxxxxxxxxxxx> <20040908083828.GE18285@xxxxxxxxx> <20040908084630.GA23117@xxxxxxxxxxxxxxxxxxx>
Reply-to: Martijn van Oosterhout <kleptog@xxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mutt/1.3.28i
On Wed, Sep 08, 2004 at 06:46:30PM +1000, Herbert Xu wrote:
> It can break because people often initialise the size of the
> address by doing sizeof(struct sockaddr_pppox).  For example,
> you'll see exactly this breakage in pppoe_getname in
> drivers/net/pppoe.c.

/me looks... *BLINK* Ugh, getname takes a length argument but it's
write only.

So, hypothetically, if I get passed a file descriptor through a UNIX
domain socket and do a getname on it, there is no way to guarentee that
it won't go past the buffer I've allocated. Who came up with this lame
API?

> IMHO this union was a silly idea to begin with.  Let's not prolong
> its life any further.

Well, I guess I'll have to agree to that. So, lets say we create two
new types, one for each version of the union, sockaddr_pppox_pppoe and
sockaddr_pppox_pppol2tp. Deprecate the current sockaddr_pppox
altogether (can't get rid of it now). Possibly create a new
sockaddr_pppox_generic for use in the actual pppox.c file. Sprinkle
some typecasts around to make the compiler happy and voila!

Then future userspace programs can use the structure appropriate for
them. Does removing the union change the alignment on any
architechture? Or will the dummy union have to stay in perpituity?

Seems fairly straight forward... I'll see if I have time to whip
something up...
-- 
Martijn van Oosterhout   <kleptog@xxxxxxxxx>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment: pgpF9Mfe5ZW6Z.pgp
Description: PGP signature

<Prev in Thread] Current Thread [Next in Thread>