]> git.ipfire.org Git - thirdparty/ipset.git/commitdiff
2.4.3
author/C=EU/ST=EU/CN=Jozsef Kadlecsik/emailAddress=kadlec@blackhole.kfki.hu </C=EU/ST=EU/CN=Jozsef Kadlecsik/emailAddress=kadlec@blackhole.kfki.hu>
Sat, 25 Oct 2008 12:50:34 +0000 (12:50 +0000)
committer/C=EU/ST=EU/CN=Jozsef Kadlecsik/emailAddress=kadlec@blackhole.kfki.hu </C=EU/ST=EU/CN=Jozsef Kadlecsik/emailAddress=kadlec@blackhole.kfki.hu>
Sat, 25 Oct 2008 12:50:34 +0000 (12:50 +0000)
  - Include file <limits.h> was missing from userspace set type
    modules.

15 files changed:
ChangeLog
Makefile
ipset.c
ipset.h
ipset_iphash.c
ipset_ipmap.c
ipset_ipporthash.c
ipset_ipportiphash.c
ipset_ipportnethash.c
ipset_iptree.c
ipset_iptreemap.c
ipset_macipmap.c
ipset_nethash.c
ipset_portmap.c
kernel/include/linux/netfilter_ipv4/ip_set_hashes.h

index 278a4a09cfcf275db8f9908c2dbacca3885deb83..613b09e5caf843cc1825888163cbedab64cc13e7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
 
index 37a241e1b7b6b54aedbfca48c00e4c5282a3d5b2..7dfd819dfc1091b488949040552097adda3b984b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/ipset.c b/ipset.c
index 4b7d5f99e407503c61fde82549d8f27ff8f0ee55..8b906aaf9a6ba8b2de24a0ce5d79539ecc31e439 100644 (file)
--- a/ipset.c
+++ b/ipset.c
@@ -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;
 }
 
diff --git a/ipset.h b/ipset.h
index 12091bade6bd40bc499f3640660a52b8f908a0c4..1c8b0c19e31e7bb69817c9ab543c4dbdc4d22e4a 100644 (file)
--- a/ipset.h
+++ b/ipset.h
@@ -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);
index 9f0208120388a7241dca4892d38985c463757789..811020370da95ab7182ef69bdeaa03748d7151a8 100644 (file)
  * 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
index f1586bb51caef9fe5f1a0e0902c1fc879017475e..f068537f40a67be2d63b562c276c5611ec5f9009 100644 (file)
  * 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
index a839bd5d9132be09acf507553d97df6e5beb8ea4..be8cd85863dae54f2611f7fd2c218488efe1ba8e 100644 (file)
  * 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;       
 };
 
index 5cb920d48b72c3939d7dac78bf648e46bfc41a84..84d085f3084b2f9c9c3705b47c8f34e8d6f4fcd5 100644 (file)
  * 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;       
 };
 
index 470718971fa12004a0ea9523679ee7e9cc72dce1..83a83fe444933e15e42065283e7d16919fff371e 100644 (file)
  * 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;       
 };
 
index f77da19a54531fd07e13a284942887819b9cf736..b127c9fb4627d1c74cb78d400d457872e69d5e09 100644 (file)
  * 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;       
 }
 
index 72af5b8b01d9955762a67ca698d3fcf2d9f52932..d1d31bbcfb07c34dff0081fe521962983793b51d 100644 (file)
  * 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;
 }
index 3a9530c6d0ee0fd601475379dde469a59dcd840e..d4b8a06374e9b68020b0b653d2a955fbae5beaba 100644 (file)
  */
 
 
-#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
index 3d2e6feb29825e952af1002425a5ba5d6c654fc5..ff6576f8a9bb474635700c461d9f7af126928ef9 100644 (file)
  * 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);
 }
index d13cdb163674b53875e7c7cf2bfd5a0af17399b4..6d35b4c68b44183a6ee336551ffc460c95fdb0be 100644 (file)
  */
 
 
-#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;
 
index 46512b433e631d2d4ac63c55356d2970e7130209..6914a120a673506e069d86f8644ea18bad838104 100644 (file)
@@ -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