summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
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>2008-10-21 22:04:47 +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>2008-10-21 22:04:47 +0000
commitfac5288ad80b7ca2f23d1d5acf6ced98a61fd8eb (patch)
treedd463fdaf37a4daf8dddddd63ccd45daee0ad883
parentb8d6cfc169bf79b72faaab6ef7940798dbfe9328 (diff)
- macipmap type reported misleading deprecated separator
tokens and printed the old one at listing set elements. Token printing was errorneous too. (Bugs reported by Krzysztof Oledzki) - Warn only once about deprecated separator tokens in restore mode.
-rw-r--r--ChangeLog6
-rw-r--r--ipset.c1
-rw-r--r--ipset.h2
-rw-r--r--ipset_ipporthash.c7
-rw-r--r--ipset_ipportiphash.c7
-rw-r--r--ipset_ipportnethash.c7
-rw-r--r--ipset_iptree.c7
-rw-r--r--ipset_iptreemap.c7
-rw-r--r--ipset_macipmap.c16
9 files changed, 33 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index 93b1f01..26bad25 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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)
diff --git a/ipset.c b/ipset.c
index d57318a..4b7d5f9 100644
--- a/ipset.c
+++ b/ipset.c
@@ -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"
diff --git a/ipset.h b/ipset.h
index 3e181c4..12091ba 100644
--- a/ipset.h
+++ b/ipset.h
@@ -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");