remaining libnetfilter_conntrack issues
Hi Pablo!
I've started to write a new ulogd2 plugin against the new libnetfilter_conntrack, and found a number of issues, mostly related to header files:
1) why do we need 'asm/types.h'? this is unacceptable
2) why do we need 'linux/if.h'?
3) libnetfilter_conntrack needs to be split into two parts:
a) what is visible to application programs
b) what is visible to extensions
4) if we do '3', we can get rid of the ugly "linux_list.h" include
5) we'd ideally get rid of the ip_conntrack.h include, too
6) we should ship a copy of both nfnetlink.h and nfnetlink_conntrack.h with the library this way userspace programs can be built without any
nfnetlink-enabled kernel headers installed.
I think everything but '5' should be fairly trivial to do. Which definitions do we really need from ip_conntrack.h? The status bits? Then we should also ship a copy of only those status bit definitions with the library.
All copies should be performed during the 'distrib' stage, i.e. every time we make a release we tell the automake/autoconf system where to take a current copy of those headers from. They would not be present in svn.
Cheers,
Signature · 5 lines
- Harald Welte <[email protected]> http://netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie
Quoted 5 lines · Harald Welte
Hi Pablo!
I've started to write a new ulogd2 plugin against the new
libnetfilter_conntrack, and found a number of issues, mostly related to header files:
Another comment:
7) we put the definition of the 'nfct_handle' into a private header file. this is good practise for encapsulation, since it prevents the application from making any assumptions about its size and/or contents.
Thanks for your consideration,
Harald
Signature · 5 lines
- Harald Welte <[email protected]> http://netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie
Quoted 2 lines · Harald Welte
[..]
Another comment:
8) IPv6 addresses are 128bit, not 64!
Signature · 5 lines
- Harald Welte <[email protected]> http://netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie
Hi Harald!
Quoted 6 lines · Harald Welte
I've started to write a new ulogd2 plugin against the new
libnetfilter_conntrack, and found a number of issues, mostly related to header files:1) why do we need '
asm/types.h'? this is unacceptable
2) why do we need 'linux/if.h'?
I just killed those. I'm not aware of having added those by myself, my guess is that they are remains of the primitive libctnetlink.
Quoted 4 lines
3)
libnetfilter_conntrackneeds to be split into two parts:
a) what is visible to application programs
b) what is visible to extensions
4) if we do '3', we can get rid of the ugly "linux_list.h" include
OK, now we have libnetfilter_conntrack.h and libnetfilter_conntrack_extensions.h, have a look at the patch below. I'm going to commit it asap.
Quoted 1 line
5) we'd ideally get rid of the
ip_conntrack.hinclude, too
I just did it, we just need the status bits. So I just took them from ip_conntrack.h
Quoted 8 lines
6) we should ship a copy of both
nfnetlink.handnfnetlink_conntrack.hwith the library this way userspace programs can be built without any
nfnetlink-enabled kernel headers installed.All copies should be performed during the 'distrib' stage, i.e. every time we make a release we tell the automake/autoconf system where to take a current copy of those headers from. They would not be present in svn.
OK, so we could just do it in autogen.sh, that would be quite straight forward. fine with it?
Quoted 4 lines
7) we put the definition of the '
nfct_handle' into a private header file. this is good practise for encapsulation, since it prevents the application from making any assumptions about its size and/or contents.
Done
Quoted 1 line
8) IPv6 addresses are 128bit, not 64!
Aiee, fixed as well.
I think we can release the first 1.0 version of conntrack this week, together with the first release of libnetfilter_conntrack. As soon as I finish the test for the expectation part of libnetfilter_conntrack (see utils) and fix some remaining problems reported on netfilter-devel. Then, I'll have a look back at your previous email detailing how to do releases, I didn't have time to do it up to now.
cheers,
Pablo
libnetfilter_conntrack_sctp.c +1 -0
@@ -14,6 +14,7 @@#include <netinet/in.h> /* For htons */ #include <linux/netfilter/nfnetlink_conntrack.h> #include <libnetfilter_conntrack/libnetfilter_conntrack.h> +#include <libnetfilter_conntrack/libnetfilter_conntrack_extensions.h> void parse_proto (struct nfattr *cda[],struct nfct_tuple *tuple) {
libnetfilter_conntrack_tcp.c +1 -0
@@ -14,6 +14,7 @@#include <netinet/in.h> /* For htons */ #include <linux/netfilter/nfnetlink_conntrack.h> #include <libnetfilter_conntrack/libnetfilter_conntrack.h> +#include <libnetfilter_conntrack/libnetfilter_conntrack_extensions.h> static const char *states[] = {"NONE" ,
libnetfilter_conntrack_icmp.c +1 -0
@@ -14,6 +14,7 @@#include <netinet/in.h> /* For htons */ #include <linux/netfilter/nfnetlink_conntrack.h> #include <libnetfilter_conntrack/libnetfilter_conntrack.h> +#include <libnetfilter_conntrack/libnetfilter_conntrack_extensions.h> void parse_proto (struct nfattr *cda[],struct nfct_tuple *tuple) {
libnetfilter_conntrack_udp.c +1 -0
@@ -14,6 +14,7 @@#include <netinet/in.h> /* For htons */ #include <linux/netfilter/nfnetlink_conntrack.h> #include <libnetfilter_conntrack/libnetfilter_conntrack.h> +#include <libnetfilter_conntrack/libnetfilter_conntrack_extensions.h> void parse_proto (struct nfattr *cda[],struct nfct_tuple *tuple) {
libnetfilter_conntrack/libnetfilter_conntrack_extensions.h +28 -0
@@ -0,0 +1,28 @@ +/* +* (C) 2005 by Pablo Neira Ayuso <[email protected]> +* +* This software may be used and distributed according to the terms +* of the GNU General Public License, incorporated herein by reference. +*/ + +#ifndef _LIBNETFILTER_CONNTRACK_EXTENSIONS_H_ +#define _LIBNETFILTER_CONNTRACK_EXTENSIONS_H_ + +#include "linux_list.h" + +struct nfct_proto { +struct list_head head; + +char *name; +u_int8_t protonum; +char *version; + +void (*parse_proto)(struct nfattr **,struct nfct_tuple *); +void (*parse_protoinfo)(struct nfattr **,struct nfct_conntrack *); +int (*print_protoinfo)(char *,union nfct_protoinfo *); +int (*print_proto)(char *,struct nfct_tuple *); +}; + +extern void nfct_register_proto (struct nfct_proto *h); + +#endif
libnetfilter_conntrack/libnetfilter_conntrack.h +53 -25
111 lines not on this page · raw message
libnetfilter_conntrack.c +8 -0
@@ -17,6 +17,7 @@#include "linux_list.h" #include <libnfnetlink/libnfnetlink.h> #include <libnetfilter_conntrack/libnetfilter_conntrack.h> +#include <libnetfilter_conntrack/libnetfilter_conntrack_extensions.h> #define NFCT_BUFSIZE 4096
@@ -26,6 +27,13 @@ ((unsigned char *)&addr)[2 ], \ ((unsigned char *)&addr)[3 ] +/* Harald says: "better for encapsulation" ;) */ +struct nfct_handle { +struct nfnl_handle nfnlh; +nfct_callback callback;/* user callback */ +nfct_handler handler;/* netlink handler */ +}; +static char *lib_dir =LIBNETFILTER_CONNTRACK_DIR ;static LIST_HEAD (proto_list);static char *proto2str[IPPROTO_MAX ] = {
Hi Pablo!
Quoted 8 lines · Pablo Neira
Quoted 5 lines · Harald Welte
I've started to write a new ulogd2 plugin against the new
libnetfilter_conntrack, and found a number of issues, mostly related to header files:
1) why do we need 'asm/types.h'? this is unacceptable
2) why do we need 'linux/if.h'?I just killed those.
thanks.
Quoted 2 lines
I'm not aware of having added those by myself, my guess is that they are remains of the primitive libctnetlink.
yes, probably of the very old one.
Quoted 7 lines
Quoted 4 lines
3)
libnetfilter_conntrackneeds to be split into two parts:
a) what is visible to application programs
b) what is visible to extensions
4) if we do '3', we can get rid of the ugly "linux_list.h" includeOK, now we have
libnetfilter_conntrack.handlibnetfilter_conntrack_extensions.h, have a look at the patch below. I'm going to commit it asap.
looks fine, thanks.
Quoted 3 lines
Quoted 1 line
5) we'd ideally get rid of the
ip_conntrack.hinclude, tooI just did it, we just need the status bits. So I just took them from
ip_conntrack.h
ok. Ideally (even in future kernel releases), we should have this information in a dedicated 'include file for userspace apps'.
Quoted 9 lines
Quoted 7 lines
6) we should ship a copy of both
nfnetlink.handnfnetlink_conntrack.hwith the library this way userspace programs can be built without any
nfnetlink-enabled kernel headers installed.
All copies should be performed during the 'distrib' stage, i.e. every time we make a release we tell the automake/autoconf system where to
take a current copy of those headers from. They would not be present in svn.OK, so we could just do it in
autogen.sh, that would be quite straight forward. fine with it?
yes, is fine, even though having it at 'make distrib' stage would be more intuitive.
Quoted 6 lines
Quoted 4 lines
7) we put the definition of the '
nfct_handle' into a private header file. this is good practise for encapsulation, since it prevents the application from making any assumptions about its size and/or contents.Done
great.
Quoted 3 lines
Quoted 1 line
8) IPv6 addresses are 128bit, not 64!
Aiee, fixed as well.
;) I hope this saves us from having to break the library/applicaiton ABI when nf_conntrack gets nfnetlink_conntrack support.
Quoted 2 lines
I think we can release the first 1.0 version of conntrack this week, together with the first release of
libnetfilter_conntrack.
Yes, although I think it's fine if we still do some more review. There's no reason to hurry with a 1.0 release as long as 2.6.14 has not been released yet. So I would still be happy if the 1.0 release happens on the day of the 2.6.14 release ;)
Signature · 5 lines
- Harald Welte <[email protected]> http://netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie
Quoted 7 lines · Harald Welte
Quoted 2 lines
I think we can release the first 1.0 version of conntrack this week, together with the first release of
libnetfilter_conntrack.Yes, although I think it's fine if we still do some more review. There's no reason to hurry with a 1.0 release as long as 2.6.14 has not been released yet. So I would still be happy if the 1.0 release happens on the day of the 2.6.14 release ;)
Oh, I just noticed now that 2.6.14 has been released. I've been incredibly busy with data protection, privacy and ePassport related issues (including tv interviews) for the last couple of days, sorry ;)
Signature · 5 lines
- Harald Welte <[email protected]> http://netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie