diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ipset.c | 1 | ||||
-rw-r--r-- | ipset.h | 2 | ||||
-rw-r--r-- | ipset_ipporthash.c | 7 | ||||
-rw-r--r-- | ipset_ipportiphash.c | 7 | ||||
-rw-r--r-- | ipset_ipportnethash.c | 7 | ||||
-rw-r--r-- | ipset_iptree.c | 7 | ||||
-rw-r--r-- | ipset_iptreemap.c | 7 | ||||
-rw-r--r-- | ipset_macipmap.c | 16 |
9 files changed, 33 insertions, 27 deletions
@@ -1,3 +1,9 @@ +2.4.1 + - macipmap type reported misleading deprecated separator + tokens and printed the old one at listing set elements + (bug reported by Krzysztof Oledzki) + - Warn only once about deprecated separator tokens in + restore mode. 2.4 - Added KBUILD_OUTPUT support (Sven Wegener) @@ -47,6 +47,7 @@ struct ip_set_restore *restore_set = NULL; size_t restore_offset = 0; socklen_t restore_size; unsigned restore_line = 0; +unsigned warn_once = 0; #define TEMPFILE_PATTERN "/ipsetXXXXXX" @@ -185,6 +185,8 @@ 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); +extern unsigned warn_once; + #define BITSPERBYTE (8*sizeof(char)) #define ID2BYTE(id) ((id)/BITSPERBYTE) #define ID2MASK(id) (1 << ((id)%BITSPERBYTE)) diff --git a/ipset_ipporthash.c b/ipset_ipporthash.c index 1b92979..a839bd5 100644 --- a/ipset_ipporthash.c +++ b/ipset_ipporthash.c @@ -198,10 +198,9 @@ adt_parser(unsigned cmd, const char *optarg, void *data) DP("ipporthash: %p %p", optarg, data); - if ((ptr = strchr(tmp, ':')) || (ptr = strchr(tmp, '%'))) - fprintf(stderr, "Warning: please replace old separator character '%s.1' with ','.\n" - "Next release won't support it.\n", - ptr); + if (((ptr = strchr(tmp, ':')) || (ptr = strchr(tmp, '%'))) && ++warn_once == 1) + fprintf(stderr, "Warning: please use ',' separator token between ip,port.\n" + "Next release won't support old separator tokens.\n"); ptr = strsep(&tmp, ":%,"); parse_ip(ptr, &mydata->ip); diff --git a/ipset_ipportiphash.c b/ipset_ipportiphash.c index 0bd2e9f..5cb920d 100644 --- a/ipset_ipportiphash.c +++ b/ipset_ipportiphash.c @@ -198,10 +198,9 @@ adt_parser(unsigned cmd, const char *optarg, void *data) DP("ipportiphash: %p %p", optarg, data); - if ((ptr = strchr(tmp, ':')) || (ptr = strchr(tmp, '%'))) - fprintf(stderr, "Warning: please replace old separator character '%s.1' with ','.\n" - "Next release won't support it.\n", - ptr); + if (((ptr = strchr(tmp, ':')) || (ptr = strchr(tmp, '%'))) && ++warn_once == 1) + fprintf(stderr, "Warning: please use ',' separator token between ip,port,ip.\n" + "Next release won't support old separator tokens.\n"); ptr = strsep(&tmp, ":%,"); parse_ip(ptr, &mydata->ip); diff --git a/ipset_ipportnethash.c b/ipset_ipportnethash.c index 51297ff..4707189 100644 --- a/ipset_ipportnethash.c +++ b/ipset_ipportnethash.c @@ -199,10 +199,9 @@ adt_parser(unsigned cmd, const char *optarg, void *data) DP("ipportnethash: %p %p", optarg, data); - if ((ptr = strchr(tmp, ':')) || (ptr = strchr(tmp, '%'))) - fprintf(stderr, "Warning: please replace old separator character '%s.1' with ','.\n" - "Next release won't support it.\n", - ptr); + if (((ptr = strchr(tmp, ':')) || (ptr = strchr(tmp, '%'))) && ++warn_once == 1) + fprintf(stderr, "Warning: please use ',' separator token between ip,port,net.\n" + "Next release won't support old separator tokens.\n"); ptr = strsep(&tmp, ":%,"); parse_ip(ptr, &mydata->ip); diff --git a/ipset_iptree.c b/ipset_iptree.c index 0c23c99..f77da19 100644 --- a/ipset_iptree.c +++ b/ipset_iptree.c @@ -83,10 +83,9 @@ adt_parser(unsigned cmd, const char *optarg, void *data) DP("iptree: %p %p", optarg, data); - if ((ptr = strchr(tmp, ':')) || (ptr = strchr(tmp, '%'))) - fprintf(stderr, "Warning: please replace old separator character '%s.1' with ','.\n" - "Next release won't support it.\n", - ptr); + if (((ptr = strchr(tmp, ':')) || (ptr = strchr(tmp, '%'))) && ++warn_once == 1) + fprintf(stderr, "Warning: please use ',' separator token between ip,timeout.\n" + "Next release won't support old separator tokens.\n"); ptr = strsep(&tmp, ":%,"); parse_ip(ptr, &mydata->ip); diff --git a/ipset_iptreemap.c b/ipset_iptreemap.c index 141210f..72af5b8 100644 --- a/ipset_iptreemap.c +++ b/ipset_iptreemap.c @@ -76,10 +76,9 @@ adt_parser(unsigned int cmd, const char *optarg, void *data) parse_ipandmask(tmp, &mydata->ip, &mask); mydata->end = mydata->ip | ~mask; } else { - if ((ptr = strchr(tmp, ':')) != NULL) - fprintf(stderr, "Warning: please replace old separator character '%s.1' with ','.\n" - "Next release won't support it.\n", - ptr); + if ((ptr = strchr(tmp, ':')) != NULL && ++warn_once == 1) + fprintf(stderr, "Warning: please use '-' separator token between IP range.\n" + "Next release won't support old separator token.\n"); ptr = strsep(&tmp, "-:"); parse_ip(ptr, &mydata->ip); diff --git a/ipset_macipmap.c b/ipset_macipmap.c index 7345f8b..3a9530c 100644 --- a/ipset_macipmap.c +++ b/ipset_macipmap.c @@ -183,13 +183,15 @@ adt_parser(unsigned cmd, const char *optarg, void *data) char *ptr, *tmp = saved; DP("macipmap: %p %p", optarg, data); - - if ((ptr = strchr(tmp, ':')) || (ptr = strchr(tmp, '%'))) - fprintf(stderr, "Warning: please replace old separator character '%s.1' with ','.\n" - "Next release won't support it.\n", - ptr); - ptr = strsep(&tmp, ":%,"); + ptr = strsep(&tmp, ","); + if (!tmp) { + tmp = saved; + ptr = strsep(&tmp, ":%"); + if (tmp && ++warn_once == 1) + fprintf(stderr, "Warning: please use ',' separator token between ip,mac.\n" + "Next release won't support old separator tokens.\n"); + } parse_ip(ptr, &mydata->ip); if (tmp) @@ -250,7 +252,7 @@ printips_sorted(struct set *set, void *data, size_t len, unsigned options) while (addr <= mysetdata->last_ip) { if (test_bit(IPSET_MACIP_ISSET, (void *)&table[addr - mysetdata->first_ip].flags)) { - printf("%s:", ip_tostring(addr, options)); + printf("%s,", ip_tostring(addr, options)); print_mac(table[addr - mysetdata->first_ip]. ethernet); printf("\n"); |