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
/me looks... *BLINK* Ugh, getname takes a length argument but it's
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
> 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
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.
Description: PGP signature