diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | ipset.c | 40 | ||||
-rw-r--r-- | ipset.h | 6 | ||||
-rw-r--r-- | ipset_iphash.c | 11 | ||||
-rw-r--r-- | ipset_ipmap.c | 8 | ||||
-rw-r--r-- | ipset_ipporthash.c | 13 | ||||
-rw-r--r-- | ipset_ipportiphash.c | 13 | ||||
-rw-r--r-- | ipset_ipportnethash.c | 13 | ||||
-rw-r--r-- | ipset_iptree.c | 12 | ||||
-rw-r--r-- | ipset_iptreemap.c | 13 | ||||
-rw-r--r-- | ipset_macipmap.c | 12 | ||||
-rw-r--r-- | ipset_nethash.c | 17 | ||||
-rw-r--r-- | ipset_portmap.c | 7 | ||||
-rw-r--r-- | kernel/include/linux/netfilter_ipv4/ip_set_hashes.h | 2 |
15 files changed, 88 insertions, 85 deletions
@@ -1,3 +1,7 @@ +2.4.3 + - Include file <limits.h> was missing from userspace set type + modules. + 2.4.2 - Only kernel part changes, see kernel/ChangeLoh @@ -20,7 +20,7 @@ ifndef V V=0 endif -IPSET_VERSION:=2.4.2 +IPSET_VERSION:=2.4.3 PREFIX:=/usr/local LIBDIR:=$(PREFIX)/lib @@ -7,19 +7,22 @@ * published by the Free Software Foundation. */ -#include <stdio.h> -#include <string.h> -#include <errno.h> -#include <time.h> -#include <stdlib.h> -#include <unistd.h> -#include <sys/stat.h> -#include <sys/wait.h> -#include <arpa/inet.h> -#include <stdarg.h> -#include <netdb.h> -#include <dlfcn.h> -#include <fcntl.h> +#include <stdio.h> /* *printf, perror, sscanf, fdopen */ +#include <string.h> /* mem*, str* */ +#include <errno.h> /* errno, perror */ +#include <time.h> /* time, ctime */ +#include <netdb.h> /* gethostby*, getnetby*, getservby* */ +#include <stdlib.h> /* exit, malloc, free, strtol, getenv, mkstemp */ +#include <unistd.h> /* read, close, fork, exec*, unlink */ +#include <sys/types.h> /* open, wait, socket, *sockopt, umask */ +#include <sys/stat.h> /* open, umask */ +#include <sys/wait.h> /* wait */ +#include <sys/socket.h> /* socket, *sockopt, gethostby*, inet_* */ +#include <netinet/in.h> /* inet_* */ +#include <fcntl.h> /* open */ +#include <arpa/inet.h> /* htonl, inet_* */ +#include <stdarg.h> /* va_* */ +#include <dlfcn.h> /* dlopen */ #include "ipset.h" @@ -510,13 +513,12 @@ char *ipset_strdup(const char *s) return p; } -void ipset_free(void **data) +void ipset_free(void *data) { - if (*data == NULL) + if (data == NULL) return; - free(*data); - *data = NULL; + free(data); } static struct option *merge_options(struct option *oldopts, @@ -1265,7 +1267,7 @@ static int try_save_sets(const char name[IP_SET_MAXNAMELEN]) printf("COMMIT\n"); now = time(NULL); printf("# Completed on %s", ctime(&now)); - ipset_free(&data); + ipset_free(data); return res; } @@ -1847,7 +1849,7 @@ static int try_list_sets(const char name[IP_SET_MAXNAMELEN], while (size != req_size) size += print_set(data + size, options); - ipset_free(&data); + ipset_free(data); return res; } @@ -20,7 +20,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <getopt.h> +#include <getopt.h> /* struct option */ +#include <stdint.h> +#include <sys/types.h> #include <linux/netfilter_ipv4/ip_set.h> @@ -180,7 +182,7 @@ extern int string_to_number(const char *str, unsigned int min, unsigned int max, extern void *ipset_malloc(size_t size); extern char *ipset_strdup(const char *); -extern void ipset_free(void **data); +extern void ipset_free(void *data); extern struct set *set_find_byname(const char *name); extern struct set *set_find_byid(ip_set_id_t id); diff --git a/ipset_iphash.c b/ipset_iphash.c index 9f02081..8110203 100644 --- a/ipset_iphash.c +++ b/ipset_iphash.c @@ -15,15 +15,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <arpa/inet.h> - -#include <linux/netfilter_ipv4/ip_set_iphash.h> +#include <limits.h> /* UINT_MAX */ +#include <stdio.h> /* *printf */ +#include <string.h> /* mem* */ #include "ipset.h" +#include <linux/netfilter_ipv4/ip_set_iphash.h> + #define BUFLEN 30; #define OPT_CREATE_HASHSIZE 0x01U diff --git a/ipset_ipmap.c b/ipset_ipmap.c index f1586bb..f068537 100644 --- a/ipset_ipmap.c +++ b/ipset_ipmap.c @@ -17,13 +17,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <stdio.h> -#include <string.h> -#include <arpa/inet.h> +#include <stdio.h> /* *printf */ +#include <string.h> /* mem* */ -#include <linux/netfilter_ipv4/ip_set_ipmap.h> #include "ipset.h" +#include <linux/netfilter_ipv4/ip_set_ipmap.h> + #define BUFLEN 30; #define OPT_CREATE_FROM 0x01U diff --git a/ipset_ipporthash.c b/ipset_ipporthash.c index a839bd5..be8cd85 100644 --- a/ipset_ipporthash.c +++ b/ipset_ipporthash.c @@ -15,15 +15,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <arpa/inet.h> - -#include <linux/netfilter_ipv4/ip_set_ipporthash.h> +#include <limits.h> /* UINT_MAX */ +#include <stdio.h> /* *printf */ +#include <string.h> /* mem*, str* */ #include "ipset.h" +#include <linux/netfilter_ipv4/ip_set_ipporthash.h> + #define OPT_CREATE_HASHSIZE 0x01U #define OPT_CREATE_PROBES 0x02U #define OPT_CREATE_RESIZE 0x04U @@ -210,7 +209,7 @@ adt_parser(unsigned cmd, const char *optarg, void *data) else exit_error(PARAMETER_PROBLEM, "IP address and port must be specified: ip,port"); - free(saved); + ipset_free(saved); return 1; }; diff --git a/ipset_ipportiphash.c b/ipset_ipportiphash.c index 5cb920d..84d085f 100644 --- a/ipset_ipportiphash.c +++ b/ipset_ipportiphash.c @@ -15,15 +15,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <arpa/inet.h> - -#include <linux/netfilter_ipv4/ip_set_ipportiphash.h> +#include <limits.h> /* UINT_MAX */ +#include <stdio.h> /* *printf */ +#include <string.h> /* mem*, str* */ #include "ipset.h" +#include <linux/netfilter_ipv4/ip_set_ipportiphash.h> + #define OPT_CREATE_HASHSIZE 0x01U #define OPT_CREATE_PROBES 0x02U #define OPT_CREATE_RESIZE 0x04U @@ -216,7 +215,7 @@ adt_parser(unsigned cmd, const char *optarg, void *data) else exit_error(PARAMETER_PROBLEM, "IP address, port and IP address must be specified: ip,port,ip"); - free(saved); + ipset_free(saved); return 1; }; diff --git a/ipset_ipportnethash.c b/ipset_ipportnethash.c index 4707189..83a83fe 100644 --- a/ipset_ipportnethash.c +++ b/ipset_ipportnethash.c @@ -15,15 +15,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <arpa/inet.h> - -#include <linux/netfilter_ipv4/ip_set_ipportnethash.h> +#include <limits.h> /* UINT_MAX */ +#include <stdio.h> /* *printf */ +#include <string.h> /* mem*, str* */ #include "ipset.h" +#include <linux/netfilter_ipv4/ip_set_ipportnethash.h> + #define OPT_CREATE_HASHSIZE 0x01U #define OPT_CREATE_PROBES 0x02U #define OPT_CREATE_RESIZE 0x04U @@ -230,7 +229,7 @@ adt_parser(unsigned cmd, const char *optarg, void *data) mydata->cidr = cidr; parse_ip(ptr, &mydata->ip1); - free(saved); + ipset_free(saved); return 1; }; diff --git a/ipset_iptree.c b/ipset_iptree.c index f77da19..b127c9f 100644 --- a/ipset_iptree.c +++ b/ipset_iptree.c @@ -15,14 +15,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <arpa/inet.h> +#include <limits.h> /* UINT_MAX */ +#include <stdio.h> /* *printf */ +#include <string.h> /* mem* */ -#include <linux/netfilter_ipv4/ip_set_iptree.h> #include "ipset.h" +#include <linux/netfilter_ipv4/ip_set_iptree.h> + #define BUFLEN 30; #define OPT_CREATE_TIMEOUT 0x01U @@ -95,7 +95,7 @@ adt_parser(unsigned cmd, const char *optarg, void *data) else mydata->timeout = 0; - free(saved); + ipset_free(saved); return 1; } diff --git a/ipset_iptreemap.c b/ipset_iptreemap.c index 72af5b8..d1d31bb 100644 --- a/ipset_iptreemap.c +++ b/ipset_iptreemap.c @@ -15,15 +15,14 @@ * Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <arpa/inet.h> - -#include <linux/netfilter_ipv4/ip_set_iptreemap.h> +#include <limits.h> /* UINT_MAX */ +#include <stdio.h> /* *printf */ +#include <string.h> /* mem* */ #include "ipset.h" +#include <linux/netfilter_ipv4/ip_set_iptreemap.h> + #define OPT_CREATE_GC 0x1 static void @@ -89,7 +88,7 @@ adt_parser(unsigned int cmd, const char *optarg, void *data) } } - free(saved); + ipset_free(saved); return 1; } diff --git a/ipset_macipmap.c b/ipset_macipmap.c index 3a9530c..d4b8a06 100644 --- a/ipset_macipmap.c +++ b/ipset_macipmap.c @@ -18,15 +18,15 @@ */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <arpa/inet.h> -#include <linux/if_ether.h> +#include <stdio.h> /* *printf */ +#include <stdlib.h> /* mem* */ +#include <string.h> /* str* */ +#include <net/ethernet.h> /* ETH_ALEN */ -#include <linux/netfilter_ipv4/ip_set_macipmap.h> #include "ipset.h" +#include <linux/netfilter_ipv4/ip_set_macipmap.h> + #define BUFLEN 30; #define OPT_CREATE_FROM 0x01U diff --git a/ipset_nethash.c b/ipset_nethash.c index 3d2e6fe..ff6576f 100644 --- a/ipset_nethash.c +++ b/ipset_nethash.c @@ -15,15 +15,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <arpa/inet.h> - -#include <linux/netfilter_ipv4/ip_set_nethash.h> +#include <limits.h> /* UINT_MAX */ +#include <stdio.h> /* *printf */ +#include <string.h> /* mem*, str* */ #include "ipset.h" +#include <linux/netfilter_ipv4/ip_set_nethash.h> + #define BUFLEN 30; #define OPT_CREATE_HASHSIZE 0x01U @@ -143,7 +142,7 @@ adt_parser(unsigned cmd, const char *optarg, void *data) if (!mydata->ip) exit_error(PARAMETER_PROBLEM, "Zero valued IP address `%s' specified", ptr); - free(saved); + ipset_free(saved); return mydata->ip; }; @@ -277,7 +276,7 @@ net_tostring(struct set *set, ip_set_ip_t ip, unsigned options) static void parse_net(const char *str, ip_set_ip_t *ip) { - char *saved = strdup(str); + char *saved = ipset_strdup(str); char *ptr, *tmp = saved; ip_set_ip_t cidr; @@ -292,7 +291,7 @@ parse_net(const char *str, ip_set_ip_t *ip) "Out of range cidr `%s' specified", str); parse_ip(ptr, ip); - free(saved); + ipset_free(saved); *ip = pack_ip_cidr(*ip, cidr); } diff --git a/ipset_portmap.c b/ipset_portmap.c index d13cdb1..6d35b4c 100644 --- a/ipset_portmap.c +++ b/ipset_portmap.c @@ -16,13 +16,12 @@ */ -#include <stdio.h> -#include <string.h> -#include <arpa/inet.h> +#include <stdio.h> /* *printf */ +#include <string.h> /* mem* */ -#include <linux/netfilter_ipv4/ip_set_portmap.h> #include "ipset.h" +#include <linux/netfilter_ipv4/ip_set_portmap.h> #define BUFLEN 30; diff --git a/kernel/include/linux/netfilter_ipv4/ip_set_hashes.h b/kernel/include/linux/netfilter_ipv4/ip_set_hashes.h index 46512b4..6914a12 100644 --- a/kernel/include/linux/netfilter_ipv4/ip_set_hashes.h +++ b/kernel/include/linux/netfilter_ipv4/ip_set_hashes.h @@ -267,6 +267,8 @@ del_cidr_size(uint8_t *cidr, uint8_t size) } cidr[29] = 0; } +#else +#include <arpa/inet.h> #endif /* __KERNEL */ #ifndef UINT16_MAX |