X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fconf.c;h=4fcf82ded9c5125939fea31a6b486fc7bbe853d7;hb=b7792fa9d0d742f05175ff9c01d651ad76d525cc;hp=a33bdfea3b0b0624ef5681e79924582e20568b2b;hpb=f1baecb98b5cd78356acc590cea9c79d36d81be3;p=tinc diff --git a/src/conf.c b/src/conf.c index a33bdfea..4fcf82de 100644 --- a/src/conf.c +++ b/src/conf.c @@ -206,20 +206,14 @@ bool get_config_subnet(const config_t *cfg, subnet_t **result) { return false; } - /* Teach newbies what subnets are... */ - - if(((subnet.type == SUBNET_IPV4) - && !maskcheck(&subnet.net.ipv4.address, subnet.net.ipv4.prefixlength, sizeof(subnet.net.ipv4.address))) - || ((subnet.type == SUBNET_IPV6) - && !maskcheck(&subnet.net.ipv6.address, subnet.net.ipv6.prefixlength, sizeof(subnet.net.ipv6.address)))) { - logger(DEBUG_ALWAYS, LOG_ERR, "Network address and prefix length do not match for configuration variable %s in %s line %d", - cfg->variable, cfg->file, cfg->line); - return false; + if (subnetcheck(subnet)) { + *(*result = new_subnet()) = subnet; + return true; } - *(*result = new_subnet()) = subnet; - - return true; + logger(DEBUG_ALWAYS, LOG_ERR, "Network address and prefix length do not match for configuration variable %s in %s line %d", + cfg->variable, cfg->file, cfg->line); + return false; } /*