diff --git a/doc/changelog.txt b/doc/changelog.txt index 085640b..01d72f2 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -1,6 +1,7 @@ HEAD ==== +- ipset: update to 4.2 Xtables-addons 1.22 (January 22 2009) diff --git a/extensions/ipset/ip_set_ipportnethash.c b/extensions/ipset/ip_set_ipportnethash.c index a66b1c2..e9900b1 100644 --- a/extensions/ipset/ip_set_ipportnethash.c +++ b/extensions/ipset/ip_set_ipportnethash.c @@ -185,7 +185,6 @@ ipportnethash_add(struct ip_set *set, if (ret == 0) { if (!map->nets[cidr-1]++) add_cidr_size(map->cidr, cidr); - map->elements++; } return ret; } diff --git a/extensions/ipset/ip_set_nethash.c b/extensions/ipset/ip_set_nethash.c index 96314a7..990b5d7 100644 --- a/extensions/ipset/ip_set_nethash.c +++ b/extensions/ipset/ip_set_nethash.c @@ -136,7 +136,6 @@ nethash_add(struct ip_set *set, ip_set_ip_t ip, uint8_t cidr) if (ret == 0) { if (!map->nets[cidr-1]++) add_cidr_size(map->cidr, cidr); - map->elements++; } return ret; diff --git a/extensions/ipset/ipset.c b/extensions/ipset/ipset.c index 98a6ca5..031ef15 100644 --- a/extensions/ipset/ipset.c +++ b/extensions/ipset/ipset.c @@ -30,7 +30,7 @@ #define PROC_SYS_MODPROBE "/proc/sys/kernel/modprobe" #endif -#define IPSET_VERSION "4.1" +#define IPSET_VERSION "4.2" char program_name[] = "ipset"; char program_version[] = IPSET_VERSION; diff --git a/extensions/ipset/ipset_iphash.c b/extensions/ipset/ipset_iphash.c index dfaf23d..feb089b 100644 --- a/extensions/ipset/ipset_iphash.c +++ b/extensions/ipset/ipset_iphash.c @@ -200,8 +200,7 @@ iphash_printips(struct set *set UNUSED, void *data, u_int32_t len, while (offset < len) { ip = data + offset; - if (*ip) - printf("%s\n", ip_tostring(*ip, options)); + printf("%s\n", ip_tostring(*ip, options)); offset += IPSET_VALIGN(sizeof(ip_set_ip_t), dont_align); } } @@ -230,9 +229,7 @@ iphash_saveips(struct set *set UNUSED, void *data, u_int32_t len, while (offset < len) { ip = data + offset; - if (*ip) - printf("-A %s %s\n", set->name, - ip_tostring(*ip, options)); + printf("-A %s %s\n", set->name, ip_tostring(*ip, options)); offset += IPSET_VALIGN(sizeof(ip_set_ip_t), dont_align); } } diff --git a/extensions/ipset/ipset_ipporthash.c b/extensions/ipset/ipset_ipporthash.c index 439b475..f03f36c 100644 --- a/extensions/ipset/ipset_ipporthash.c +++ b/extensions/ipset/ipset_ipporthash.c @@ -259,13 +259,11 @@ ipporthash_printips(struct set *set, void *data, u_int32_t len, while (offset < len) { ipptr = data + offset; - if (*ipptr) { - ip = (*ipptr>>16) + mysetdata->first_ip; - port = (uint16_t) *ipptr; - printf("%s,%s\n", - ip_tostring(ip, options), - port_tostring(port, options)); - } + ip = (*ipptr>>16) + mysetdata->first_ip; + port = (uint16_t) *ipptr; + printf("%s,%s\n", + ip_tostring(ip, options), + port_tostring(port, options)); offset += IPSET_VALIGN(sizeof(ip_set_ip_t), dont_align); } } @@ -296,13 +294,11 @@ ipporthash_saveips(struct set *set, void *data, u_int32_t len, while (offset < len) { ipptr = data + offset; - if (*ipptr) { - ip = (*ipptr>>16) + mysetdata->first_ip; - port = (uint16_t) *ipptr; - printf("-A %s %s,%s\n", set->name, - ip_tostring(ip, options), - port_tostring(port, options)); - } + ip = (*ipptr>>16) + mysetdata->first_ip; + port = (uint16_t) *ipptr; + printf("-A %s %s,%s\n", set->name, + ip_tostring(ip, options), + port_tostring(port, options)); offset += IPSET_VALIGN(sizeof(ip_set_ip_t), dont_align); } } diff --git a/extensions/ipset/ipset_ipportiphash.c b/extensions/ipset/ipset_ipportiphash.c index 5d766e7..73739bf 100644 --- a/extensions/ipset/ipset_ipportiphash.c +++ b/extensions/ipset/ipset_ipportiphash.c @@ -265,15 +265,13 @@ ipportiphash_printips(struct set *set, void *data, u_int32_t len, while (offset < len) { ipptr = data + offset; - if (ipptr->ip && ipptr->ip1) { - ip = (ipptr->ip>>16) + mysetdata->first_ip; - port = (uint16_t) ipptr->ip; - printf("%s,%s,", - ip_tostring(ip, options), - port_tostring(port, options)); - printf("%s\n", - ip_tostring(ipptr->ip1, options)); - } + ip = (ipptr->ip>>16) + mysetdata->first_ip; + port = (uint16_t) ipptr->ip; + printf("%s,%s,", + ip_tostring(ip, options), + port_tostring(port, options)); + printf("%s\n", + ip_tostring(ipptr->ip1, options)); offset += IPSET_VALIGN(sizeof(struct ipportip), dont_align); } } @@ -305,15 +303,13 @@ ipportiphash_saveips(struct set *set, void *data, u_int32_t len, while (offset < len) { ipptr = data + offset; - if (ipptr->ip && ipptr->ip1) { - ip = (ipptr->ip>>16) + mysetdata->first_ip; - port = (uint16_t) ipptr->ip; - printf("-A %s %s,%s,", set->name, - ip_tostring(ip, options), - port_tostring(port, options)); - printf("%s\n", - ip_tostring(ipptr->ip1, options)); - } + ip = (ipptr->ip>>16) + mysetdata->first_ip; + port = (uint16_t) ipptr->ip; + printf("-A %s %s,%s,", set->name, + ip_tostring(ip, options), + port_tostring(port, options)); + printf("%s\n", + ip_tostring(ipptr->ip1, options)); offset += IPSET_VALIGN(sizeof(struct ipportip), dont_align); } } diff --git a/extensions/ipset/ipset_ipportnethash.c b/extensions/ipset/ipset_ipportnethash.c index 3c9025b..036719e 100644 --- a/extensions/ipset/ipset_ipportnethash.c +++ b/extensions/ipset/ipset_ipportnethash.c @@ -330,15 +330,13 @@ ipportnethash_printips(struct set *set, void *data, u_int32_t len, while (offset < len) { ipptr = data + offset; - if (ipptr->ip || ipptr->ip1) { - ip = (ipptr->ip>>16) + mysetdata->first_ip; - port = (uint16_t) ipptr->ip; - printf("%s,%s,", - ip_tostring(ip, options), - port_tostring(port, options)); - printf("%s\n", - unpack_ip_tostring(ipptr->ip1, options)); - } + ip = (ipptr->ip>>16) + mysetdata->first_ip; + port = (uint16_t) ipptr->ip; + printf("%s,%s,", + ip_tostring(ip, options), + port_tostring(port, options)); + printf("%s\n", + unpack_ip_tostring(ipptr->ip1, options)); offset += IPSET_VALIGN(sizeof(struct ipportip), dont_align); } } @@ -370,15 +368,13 @@ ipportnethash_saveips(struct set *set, void *data, u_int32_t len, while (offset < len) { ipptr = data + offset; - if (ipptr) { - ip = (ipptr->ip>>16) + mysetdata->first_ip; - port = (uint16_t) ipptr->ip; - printf("-A %s %s,%s,", set->name, - ip_tostring(ip, options), - port_tostring(port, options)); - printf("%s\n", - unpack_ip_tostring(ipptr->ip, options)); - } + ip = (ipptr->ip>>16) + mysetdata->first_ip; + port = (uint16_t) ipptr->ip; + printf("-A %s %s,%s,", set->name, + ip_tostring(ip, options), + port_tostring(port, options)); + printf("%s\n", + unpack_ip_tostring(ipptr->ip, options)); offset += IPSET_VALIGN(sizeof(struct ipportip), dont_align); } } diff --git a/extensions/ipset/ipset_nethash.c b/extensions/ipset/ipset_nethash.c index 24db355..4f6f156 100644 --- a/extensions/ipset/ipset_nethash.c +++ b/extensions/ipset/ipset_nethash.c @@ -232,8 +232,7 @@ nethash_printips(struct set *set UNUSED, void *data, u_int32_t len, while (offset < len) { ip = data + offset; - if (*ip) - printf("%s\n", unpack_ip_tostring(*ip, options)); + printf("%s\n", unpack_ip_tostring(*ip, options)); offset += IPSET_VALIGN(sizeof(ip_set_ip_t), dont_align); } } @@ -258,9 +257,8 @@ nethash_saveips(struct set *set UNUSED, void *data, u_int32_t len, while (offset < len) { ip = data + offset; - if (*ip) - printf("-A %s %s\n", set->name, - unpack_ip_tostring(*ip, options)); + printf("-A %s %s\n", set->name, + unpack_ip_tostring(*ip, options)); offset += IPSET_VALIGN(sizeof(ip_set_ip_t), dont_align); } }