- if(subnet->type == SUBNET_IPV4)
- if((subnet->net.ipv4.address & subnet->net.ipv4.mask) != subnet->net.ipv4.address)
- {
- syslog(LOG_ERR, _("Network address and mask length do not match for configuration variable %s in %s line %d"),
- cfg->variable, cfg->file, cfg->line);
- free(subnet);
- return 0;
- }
+ if(((subnet->type == SUBNET_IPV4) && maskcheck((char *)&subnet->net.ipv4.address, subnet->net.ipv4.masklength, sizeof(ipv4_t)))
+ || ((subnet->type == SUBNET_IPV6) && maskcheck((char *)&subnet->net.ipv6.address, subnet->net.ipv6.masklength, sizeof(ipv6_t))))
+ {
+ syslog(LOG_ERR, _("Network address and mask length do not match for configuration variable %s in %s line %d"),
+ cfg->variable, cfg->file, cfg->line);
+ free(subnet);
+ return 0;
+ }