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.
+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)
size_t restore_offset = 0;
socklen_t restore_size;
unsigned restore_line = 0;
+unsigned warn_once = 0;
#define TEMPFILE_PATTERN "/ipsetXXXXXX"
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))
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);
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);
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);
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);
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);
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)
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");