igmpproxy: fix creation of firewall rules
[openwrt/openwrt.git] / package / network / services / igmpproxy / patches / 200-allow_wildcard_addr.patch
1 --- a/src/config.c
2 +++ b/src/config.c
3 @@ -357,15 +357,18 @@ struct SubnetList *parseSubnetAddress(ch
4 tmpStr = strtok(NULL, "/");
5 if(tmpStr != NULL) {
6 int bitcnt = atoi(tmpStr);
7 - if(bitcnt <= 0 || bitcnt > 32) {
8 + if(bitcnt < 0 || bitcnt > 32) {
9 my_log(LOG_WARNING, 0, "The bits part of the address is invalid : %d.",tmpStr);
10 return NULL;
11 }
12
13 - mask <<= (32 - bitcnt);
14 + if (bitcnt == 0)
15 + mask = 0;
16 + else
17 + mask <<= (32 - bitcnt);
18 }
19
20 - if(addr == -1 || addr == 0) {
21 + if(addr == -1) {
22 my_log(LOG_WARNING, 0, "Unable to parse address token '%s'.", addrstr);
23 return NULL;
24 }