Re: [PATCH] reorganize include/linux/dccp.h
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 intservice; + sa_family_t sdccp_family; /* Address family */ + unsigned short int sdccp_port; /* Port number */ + struct in_addr sdccp_addr; /* Internet address */ + unsigned intsdccp_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
Re: [PATCH] reorganize include/linux/dccp.h
On Sun, Aug 07, 2005 at 04:13:16AM -0300, Arnaldo Carvalho de Melo wrote: 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: ok, seems fine with me. Will you have some time to test the iptables dccp match? If not, do you have any DCCP test programs (just establishing a session, ..)? This would help me with testing... Cheers, Harald -- - Harald Welte [EMAIL PROTECTED] http://gnumonks.org/ Privacy in residential applications is a desirable marketing option. (ETSI EN 300 175-7 Ch. A6) pgpRfJA50ihL7.pgp Description: PGP signature
Re: [PATCH] reorganize include/linux/dccp.h
Em Sun, Aug 07, 2005 at 04:59:27PM +0200, Harald Welte escreveu: On Sun, Aug 07, 2005 at 04:13:16AM -0300, Arnaldo Carvalho de Melo wrote: 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: ok, seems fine with me. Will you have some time to test the iptables dccp match? If not, do you have any DCCP test programs (just establishing a session, ..)? This would help me with testing... http://oops.merseine.nu:81/dccp/ttcp.dccp.patch http://oops.merseine.nu:81/dccp/libdnet-20050421.tar.bz2 http://oops.merseine.nu:81/dccp/libdnet-20050421.dccp.patch - 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
Re: [PATCH] reorganize include/linux/dccp.h
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! - 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