X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fconf.c;h=1b0ac641fceda969305e347da768cd27eff6a6b8;hb=551cd19406a560d0d206bff5b4e9da064ec222b6;hp=4108d8ba2c648c9736954ef2f607e78c1117330d;hpb=e9043e17c76f92b787c9ecdaf1a2ae7916f690a6;p=tinc diff --git a/src/conf.c b/src/conf.c index 4108d8ba..1b0ac641 100644 --- a/src/conf.c +++ b/src/conf.c @@ -218,9 +218,9 @@ bool get_config_subnet(const config_t *cfg, subnet_t ** result) { /* Teach newbies what subnets are... */ if(((subnet.type == SUBNET_IPV4) - && !maskcheck(&subnet.net.ipv4.address, subnet.net.ipv4.prefixlength, sizeof(ipv4_t))) + && !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(ipv6_t)))) { + && !maskcheck(&subnet.net.ipv6.address, subnet.net.ipv6.prefixlength, sizeof subnet.net.ipv6.address))) { logger(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; @@ -328,6 +328,11 @@ int read_config_file(splay_tree_t *config_tree, const char *fname) { buffer = xmalloc(bufsize); for(;;) { + if(feof(fp)) { + err = 0; + break; + } + line = readline(fp, &buffer, &bufsize); if(!line) { @@ -335,11 +340,6 @@ int read_config_file(splay_tree_t *config_tree, const char *fname) { break; } - if(feof(fp)) { - err = 0; - break; - } - lineno++; if(!*line || *line == '#')