diff options
author | /C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org> | 2008-01-17 17:36:32 +0000 |
---|---|---|
committer | /C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org> | 2008-01-17 17:36:32 +0000 |
commit | 001805d9998229534264758432c06295614f8e2a (patch) | |
tree | 03a09d8acb26a72161ad05a35866931eeca2021a | |
parent | bdbacf04ce2e2d7ddfc7027d08e1290e7d3dc788 (diff) | |
download | conntrack-tools-001805d9998229534264758432c06295614f8e2a.tar.gz conntrack-tools-001805d9998229534264758432c06295614f8e2a.zip |
Max Kellermann <max@duempel.org>:
import only required C headers and put local headers on top to check
38 files changed, 85 insertions, 112 deletions
@@ -81,6 +81,7 @@ o fix harmless error condition o add buffer_destroy() to buffer.c o fix memory leaks in several error output paths o use size_t for buffer sizes +o import only required C headers and put local headers on top to check version 0.9.5 (2007/07/29) ------------------------------ diff --git a/extensions/libct_proto_icmp.c b/extensions/libct_proto_icmp.c index 7c59072..f81c3b4 100644 --- a/extensions/libct_proto_icmp.c +++ b/extensions/libct_proto_icmp.c @@ -8,6 +8,9 @@ * (at your option) any later version. * */ + +#include "conntrack.h" + #include <stdio.h> #include <getopt.h> #include <stdlib.h> @@ -15,7 +18,6 @@ #include <netinet/ip_icmp.h> #include <libnetfilter_conntrack/libnetfilter_conntrack.h> #include <libnetfilter_conntrack/libnetfilter_conntrack_icmp.h> -#include "conntrack.h" static struct option opts[] = { {"icmp-type", 1, 0, '1'}, diff --git a/extensions/libct_proto_udp.c b/extensions/libct_proto_udp.c index 267e3d6..a72f9cf 100644 --- a/extensions/libct_proto_udp.c +++ b/extensions/libct_proto_udp.c @@ -10,7 +10,6 @@ #include <stdio.h> #include <getopt.h> #include <stdlib.h> -#include <string.h> #include <netinet/in.h> /* For htons */ #include <libnetfilter_conntrack/libnetfilter_conntrack.h> #include <libnetfilter_conntrack/libnetfilter_conntrack_udp.h> diff --git a/include/alarm.h b/include/alarm.h index 338968a..532084a 100644 --- a/include/alarm.h +++ b/include/alarm.h @@ -3,6 +3,8 @@ #include "linux_list.h" +#include <sys/time.h> + struct alarm_list { struct list_head head; struct timeval tv; diff --git a/include/cache.h b/include/cache.h index 0743d3f..a2b2005 100644 --- a/include/cache.h +++ b/include/cache.h @@ -3,7 +3,6 @@ #include <stdint.h> #include <stddef.h> -#include <time.h> /* cache features */ enum { diff --git a/include/conntrack.h b/include/conntrack.h index d6b6150..63facf4 100644 --- a/include/conntrack.h +++ b/include/conntrack.h @@ -2,7 +2,6 @@ #define _CONNTRACK_H #include "linux_list.h" -#include <getopt.h> #include <stdint.h> #include <libnetfilter_conntrack/libnetfilter_conntrack.h> diff --git a/include/conntrackd.h b/include/conntrackd.h index bb4b183..c16d3d7 100644 --- a/include/conntrackd.h +++ b/include/conntrackd.h @@ -6,14 +6,7 @@ #include <stdint.h> #include <stdio.h> -#include <libnetfilter_conntrack/libnetfilter_conntrack.h> -#include "cache.h" -#include "buffer.h" -#include "debug.h" -#include <signal.h> -#include "state_helper.h" -#include "linux_list.h" -#include <libnetfilter_conntrack/libnetfilter_conntrack_tcp.h> +#include <libnetfilter_conntrack/libnetfilter_conntrack.h> #include <syslog.h> /* UNIX facilities */ diff --git a/include/ignore.h b/include/ignore.h index f1c2846..efb375d 100644 --- a/include/ignore.h +++ b/include/ignore.h @@ -3,6 +3,8 @@ #include <stdint.h> +struct nf_conntrack; + struct ignore_pool { struct hashtable *h; }; diff --git a/include/linux_list.h b/include/linux_list.h index b84b1c4..de182a4 100644 --- a/include/linux_list.h +++ b/include/linux_list.h @@ -1,6 +1,8 @@ #ifndef _LINUX_LIST_H #define _LINUX_LIST_H +#include <stddef.h> + #undef offsetof #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) diff --git a/include/local.h b/include/local.h index aae73a7..be77d35 100644 --- a/include/local.h +++ b/include/local.h @@ -1,8 +1,6 @@ #ifndef _LOCAL_SOCKET_H_ #define _LOCAL_SOCKET_H_ -#include <sys/un.h> - #ifndef UNIX_PATH_MAX #define UNIX_PATH_MAX 108 #endif diff --git a/include/network.h b/include/network.h index f9976dd..6dfd79d 100644 --- a/include/network.h +++ b/include/network.h @@ -3,6 +3,8 @@ #include <stdint.h> +struct nf_conntrack; + struct nethdr { uint16_t flags; uint16_t len; diff --git a/include/queue.h b/include/queue.h index ab04d62..9a5d7b8 100644 --- a/include/queue.h +++ b/include/queue.h @@ -1,9 +1,6 @@ #ifndef _QUEUE_H_ #define _QUEUE_H_ -#include <stdlib.h> -#include <errno.h> -#include <string.h> #include "linux_list.h" struct queue { diff --git a/src/alarm.c b/src/alarm.c index d00e281..576839a 100644 --- a/src/alarm.c +++ b/src/alarm.c @@ -16,14 +16,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <stdlib.h> -#include <sys/time.h> -#include "linux_list.h" -#include "conntrackd.h" #include "alarm.h" -#include "jhash.h" -#include <time.h> -#include <errno.h> static LIST_HEAD(alarm_list); diff --git a/src/buffer.c b/src/buffer.c index 389dd38..739174a 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -15,10 +15,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include "buffer.h" + #include <stdlib.h> #include <string.h> #include <errno.h> -#include "buffer.h" struct buffer *buffer_create(size_t size) { diff --git a/src/cache.c b/src/cache.c index dcb0123..2f0e57a 100644 --- a/src/cache.c +++ b/src/cache.c @@ -16,14 +16,16 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "cache.h" #include "jhash.h" #include "hash.h" +#include "us-conntrack.h" #include "conntrackd.h" + #include <libnetfilter_conntrack/libnetfilter_conntrack.h> #include <errno.h> -#include "us-conntrack.h" -#include "cache.h" #include <stdlib.h> +#include <string.h> static uint32_t hash(const void *data, struct hashtable *table) { diff --git a/src/cache_iterators.c b/src/cache_iterators.c index 4fdb920..bf70dd1 100644 --- a/src/cache_iterators.c +++ b/src/cache_iterators.c @@ -17,14 +17,15 @@ */ #include "cache.h" -#include "jhash.h" #include "hash.h" #include "log.h" #include "conntrackd.h" #include "netlink.h" +#include "us-conntrack.h" + #include <libnetfilter_conntrack/libnetfilter_conntrack.h> #include <errno.h> -#include "us-conntrack.h" +#include <string.h> struct __dump_container { int fd; diff --git a/src/cache_lifetime.c b/src/cache_lifetime.c index 26496d2..ad3416a 100644 --- a/src/cache_lifetime.c +++ b/src/cache_lifetime.c @@ -17,10 +17,8 @@ */ #include <stdio.h> -#include "conntrackd.h" #include "us-conntrack.h" #include "cache.h" -#include "alarm.h" #include <sys/time.h> #include <time.h> diff --git a/src/cache_timer.c b/src/cache_timer.c index 53ed703..0fbba14 100644 --- a/src/cache_timer.c +++ b/src/cache_timer.c @@ -16,12 +16,13 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <stdio.h> -#include <sys/time.h> +#include "cache.h" #include "conntrackd.h" #include "us-conntrack.h" -#include "cache.h" #include "alarm.h" +#include "debug.h" + +#include <stdio.h> static void timeout(struct alarm_list *a, void *data) { diff --git a/src/cache_wt.c b/src/cache_wt.c index 9d0af0b..8ff8fae 100644 --- a/src/cache_wt.c +++ b/src/cache_wt.c @@ -16,11 +16,11 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "cache.h" #include "netlink.h" -#include <stdio.h> -#include "conntrackd.h" #include "us-conntrack.h" -#include "cache.h" + +#include <string.h> static void add_update(struct us_conntrack *u) { diff --git a/src/conntrack.c b/src/conntrack.c index 7918b3f..5f0cb1a 100644 --- a/src/conntrack.c +++ b/src/conntrack.c @@ -33,9 +33,10 @@ * Ported to the new libnetfilter_conntrack API * */ + +#include "conntrack.h" + #include <stdio.h> -#include <sys/wait.h> -#include <stdlib.h> #include <getopt.h> #include <stdlib.h> #include <stdarg.h> @@ -43,22 +44,15 @@ #include <unistd.h> #include <netinet/in.h> #include <sys/types.h> -#include <sys/stat.h> #include <sys/socket.h> #include <sys/time.h> #include <time.h> #ifdef HAVE_ARPA_INET_H #include <arpa/inet.h> #endif -#include <fcntl.h> -#include <dlfcn.h> #include <signal.h> #include <string.h> -#include "linux_list.h" -#include "conntrack.h" #include <libnetfilter_conntrack/libnetfilter_conntrack.h> -#include <libnetfilter_conntrack/libnetfilter_conntrack_ipv4.h> -#include <libnetfilter_conntrack/libnetfilter_conntrack_ipv6.h> static const char cmdflags[NUMBER_OF_CMD] = {'L','I','U','D','G','F','E','V','h','L','I','D','G','F','E'}; @@ -18,14 +18,12 @@ * Description: generic hash table implementation */ -#include <stdio.h> +#include "hash.h" +#include "slist.h" + #include <errno.h> #include <stdlib.h> -#include <sys/types.h> #include <string.h> -#include "slist.h" -#include "hash.h" - struct hashtable_node *hashtable_alloc_node(int datasize, void *data) { diff --git a/src/ignore_pool.c b/src/ignore_pool.c index 5889398..c77a55b 100644 --- a/src/ignore_pool.c +++ b/src/ignore_pool.c @@ -16,14 +16,15 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "ignore.h" #include "jhash.h" #include "hash.h" #include "conntrackd.h" -#include "ignore.h" #include "log.h" -#include <libnetfilter_conntrack/libnetfilter_conntrack.h> +#include <libnetfilter_conntrack/libnetfilter_conntrack.h> #include <stdlib.h> +#include <string.h> /* XXX: These should be configurable */ #define IGNORE_POOL_SIZE 128 diff --git a/src/local.c b/src/local.c index d861e12..f0aba1c 100644 --- a/src/local.c +++ b/src/local.c @@ -18,12 +18,13 @@ * Description: UNIX sockets library */ +#include "local.h" + #include <stdio.h> #include <unistd.h> +#include <string.h> #include <arpa/inet.h> -#include <errno.h> - -#include "local.h" +#include <sys/un.h> int local_server_create(struct local_conf *conf) { @@ -19,16 +19,14 @@ */ #include "log.h" -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> +#include "buffer.h" +#include "conntrackd.h" + #include <time.h> #include <stdarg.h> #include <string.h> #include <errno.h> #include <unistd.h> -#include "buffer.h" -#include "conntrackd.h" int init_log(void) { @@ -16,17 +16,17 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <stdlib.h> #include "conntrackd.h" #include "log.h" + #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/utsname.h> #include <linux/capability.h> -#include <errno.h> -#include "hash.h" -#include "jhash.h" +#include <string.h> +#include <stdlib.h> +#include <unistd.h> #undef _POSIX_SOURCE #include <sys/capability.h> diff --git a/src/mcast.c b/src/mcast.c index 9684b61..77aa35c 100644 --- a/src/mcast.c +++ b/src/mcast.c @@ -17,19 +17,17 @@ * * Description: multicast socket library */ + +#include "mcast.h" +#include "debug.h" + #include <stdio.h> #include <stdlib.h> -#include <unistd.h> #include <arpa/inet.h> -#include <fcntl.h> -#include <errno.h> -#include <sys/time.h> #include <unistd.h> #include <string.h> #include <sys/ioctl.h> #include <net/if.h> -#include "mcast.h" -#include "debug.h" struct mcast_sock *mcast_server_create(struct mcast_conf *conf) { diff --git a/src/netlink.c b/src/netlink.c index 388407a..0457e8a 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -21,13 +21,7 @@ #include "traffic_stats.h" #include "ignore.h" #include "log.h" -#include <libnfnetlink/libnfnetlink.h> -#include <libnetfilter_conntrack/libnetfilter_conntrack.h> -#include <errno.h> -#include "us-conntrack.h" -#include <signal.h> -#include <stdlib.h> -#include "network.h" +#include "debug.h" int ignore_conntrack(struct nf_conntrack *ct) { diff --git a/src/network.c b/src/network.c index 939e94b..7c7a08a 100644 --- a/src/network.c +++ b/src/network.c @@ -18,11 +18,12 @@ #include "conntrackd.h" #include "network.h" -#include "us-conntrack.h" -#include "sync.h" #include "log.h" +#include "debug.h" #include <stdlib.h> +#include <time.h> +#include <string.h> static unsigned int seq_set, cur_seq; diff --git a/src/parse.c b/src/parse.c index a248b47..5bc71ef 100644 --- a/src/parse.c +++ b/src/parse.c @@ -16,10 +16,10 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <string.h> -#include <libnetfilter_conntrack/libnetfilter_conntrack.h> #include "network.h" +#include <libnetfilter_conntrack/libnetfilter_conntrack.h> + static void parse_u8(struct nf_conntrack *ct, int attr, void *data) { uint8_t *value = (uint8_t *) data; diff --git a/src/queue.c b/src/queue.c index a721760..7b20e83 100644 --- a/src/queue.c +++ b/src/queue.c @@ -18,6 +18,10 @@ #include "queue.h" +#include <errno.h> +#include <stdlib.h> +#include <string.h> + struct queue *queue_create(size_t max_size) { struct queue *b; diff --git a/src/read_config_lex.l b/src/read_config_lex.l index 6211fee..65df1e7 100644 --- a/src/read_config_lex.l +++ b/src/read_config_lex.l @@ -20,7 +20,6 @@ */ #include "read_config_yy.h" -#include "conntrackd.h" %} %option yylineno diff --git a/src/read_config_yy.y b/src/read_config_yy.y index 82131d7..531b1fe 100644 --- a/src/read_config_yy.y +++ b/src/read_config_yy.y @@ -26,6 +26,7 @@ #include "conntrackd.h" #include "ignore.h" #include <syslog.h> +#include <libnetfilter_conntrack/libnetfilter_conntrack_tcp.h> extern struct state_replication_helper tcp_state_helper; @@ -23,16 +23,13 @@ #include "ignore.h" #include "log.h" #include "alarm.h" -#include <libnetfilter_conntrack/libnetfilter_conntrack.h> + #include <errno.h> -#include "us-conntrack.h" #include <signal.h> #include <stdlib.h> #include <unistd.h> -#include <sys/types.h> #include <sys/wait.h> -#include <sys/time.h> -#include <time.h> +#include <string.h> void killer(int foo) { diff --git a/src/stats-mode.c b/src/stats-mode.c index 0c42d95..0ecb2b0 100644 --- a/src/stats-mode.c +++ b/src/stats-mode.c @@ -18,16 +18,15 @@ #include "netlink.h" #include "traffic_stats.h" -#include <stdlib.h> +#include "buffer.h" +#include "debug.h" #include "cache.h" #include "log.h" #include "conntrackd.h" -#include <libnfnetlink/libnfnetlink.h> -#include <libnetfilter_conntrack/libnetfilter_conntrack.h> + #include <errno.h> -#include "us-conntrack.h" -#include <signal.h> -#include <sys/select.h> +#include <string.h> +#include <stdlib.h> static int init_stats(void) { diff --git a/src/sync-alarm.c b/src/sync-alarm.c index 05ddf81..6ee306e 100644 --- a/src/sync-alarm.c +++ b/src/sync-alarm.c @@ -21,8 +21,11 @@ #include "network.h" #include "us-conntrack.h" #include "alarm.h" +#include "cache.h" +#include "debug.h" #include <stdlib.h> +#include <string.h> static void refresher(struct alarm_list *a, void *data) { diff --git a/src/sync-ftfw.c b/src/sync-ftfw.c index f0b3262..f6d2ed3 100644 --- a/src/sync-ftfw.c +++ b/src/sync-ftfw.c @@ -16,18 +16,17 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <errno.h> #include "conntrackd.h" #include "sync.h" -#include "linux_list.h" #include "us-conntrack.h" #include "queue.h" #include "debug.h" #include "network.h" #include "alarm.h" #include "log.h" -#include <libnfnetlink/libnfnetlink.h> -#include <libnetfilter_conntrack/libnetfilter_conntrack.h> +#include "cache.h" + +#include <string.h> #if 0 #define dp printf diff --git a/src/sync-mode.c b/src/sync-mode.c index 1632019..0a0fcc2 100644 --- a/src/sync-mode.c +++ b/src/sync-mode.c @@ -16,22 +16,22 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "sync.h" #include "netlink.h" #include "traffic_stats.h" #include "log.h" -#include <stdlib.h> +#include "state_helper.h" #include "cache.h" #include "conntrackd.h" -#include <libnfnetlink/libnfnetlink.h> -#include <libnetfilter_conntrack/libnetfilter_conntrack.h> -#include <errno.h> #include "us-conntrack.h" -#include <signal.h> -#include <sys/select.h> -#include "sync.h" #include "network.h" #include "debug.h" + +#include <errno.h> #include <unistd.h> +#include <time.h> +#include <string.h> +#include <stdlib.h> static void do_mcast_handler_step(struct nethdr *net) { diff --git a/src/traffic_stats.c b/src/traffic_stats.c index 93511ce..9e40d53 100644 --- a/src/traffic_stats.c +++ b/src/traffic_stats.c @@ -17,14 +17,7 @@ */ #include "traffic_stats.h" -#include "cache.h" -#include "hash.h" #include "conntrackd.h" -#include <libnfnetlink/libnfnetlink.h> -#include <libnetfilter_conntrack/libnetfilter_conntrack.h> -#include <errno.h> -#include "us-conntrack.h" -#include <signal.h> void update_traffic_stats(struct nf_conntrack *ct) { |