Em Sun, Aug 07, 2005 at 08:58:34AM +0200, Harald Welte escreveu:
> On Sat, Aug 06, 2005 at 06:34:40PM -0300, Arnaldo Carvalho de Melo wrote:
> > On 8/6/05, Harald Welte <[EMAIL PROTECTED]> wrote:
> > > Hi Arnaldo!
> > > 
> > > The protocol header files in <linux/foo.h> are usually structured in a
> > > way to be included by userspace code.  The top section consists of
> > > general protocol structure definitions, typedefs, enums - followed by an
> > > #ifdef __KERNEL__ section.
> > > 
> > > Currently <linux/dccp.h> doesn't follow that convention and can
> > > therefore not be used from userspace.  However, e.g. iptables'
> > > libipt_dccp.c actually needs various definitions.
> > > 
> > > Below is a proposed patch to clean up dccp.h.  Please review and
> > > consider applying it.  Thanks!
> > > 
> > > [the iptables ipt_dccp patch applies cleanly on top of this - but not
> > >  the other way around]
> > 
> > OK, I'm applying both patches, just had to add an include for linux/in.h 
> > that
> > was missing, thanks!
> 
> you cannot include linux/in.h from the top of the file, I think I tried
> that and ran into problems (the definitions collide with glibc
> definitions e.g. of sockaddr_in, etc.)
> 
> So if possible, move that include down to the __KERNEL__ section.  At
> least this way iptables libipt_dccp.c compiles.

Oh my, OK, I should be more careful about making sure kernel headers are
usable by userland programs ;-\ Nah, I'll fix that properly by just not
including linux/in.h at all and fixing sockaddr_dccp, take a look:


diff --git a/include/linux/dccp.h b/include/linux/dccp.h
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -1,14 +1,17 @@
 #ifndef _LINUX_DCCP_H
 #define _LINUX_DCCP_H
 
-#include <linux/in.h>
 #include <linux/types.h>
 #include <asm/byteorder.h>
 
-/* FIXME: this is utterly wrong */
+/* Structure describing an Internet (DCCP) socket address. */
 struct sockaddr_dccp {
-       struct sockaddr_in      in;
-       unsigned int            service;
+       sa_family_t             sdccp_family;   /* Address family   */
+       unsigned short int      sdccp_port;     /* Port number      */
+       struct in_addr          sdccp_addr;     /* Internet address */
+       unsigned int            sdccp_service;  /* Service          */
+       /* Pad to size of `struct sockaddr': 16 bytes . */
+       unsignd int             sdccp_pad;
 };
 
 /**



 Better? :-)

- Arnaldo
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to