From: xchaos Date: Thu, 24 Jan 2013 11:28:30 +0000 (+0000) Subject: hopefuly final IPv6 bugfix X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=14e28c6f75dba715fac299d909fdad50bfcf192d;p=svn%2FPrometheus-QoS%2F.git hopefuly final IPv6 bugfix git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@215 251d49ef-1d17-4917-a970-b30cf55b089b --- diff --git a/parsehosts.c b/parsehosts.c index d37a716..cbd2d48 100644 --- a/parsehosts.c +++ b/parsehosts.c @@ -41,10 +41,13 @@ void TheIP(char *ipaddr) ip->keyword = keywords; ip->v6 = (strchr(ip->addr,':')!=NULL); push(ip,ips); + ip_count++; } +struct IP *lastIP6; + /* == This function strips extra characters after IPv4 address and stores it = */ -void parse_ip(char *str) +parse_ip(char *str) { char *ptr, *ipaddr, *ip6range = NULL, *ipname = NULL, *lmsid = NULL; @@ -104,11 +107,16 @@ void parse_ip(char *str) TheIP(ip6range); } ip->name = ip6range; - ip->sharing = ipname; + ip->keyword = defaultkeyword; /* settings for default keyword */ if(lmsid) { ip->lmsid = atoi(lmsid); } + lastIP6 = ip; + } + else + { + lastIP6 = NULL; } if_exists(ip, ips, eq(ip->addr,ipaddr)); @@ -147,9 +155,12 @@ void parse_hosts(char *hosts) { substring += 8; /* "sharing-" */ parse_ip(str); - ip_count++; ip->sharing = substring; ip->keyword = defaultkeyword; /* settings for default keyword */ + if(lastIP6) + { + lastIP6->sharing = substring; + } while(*substring and *substring != '\n') { substring++; @@ -163,7 +174,6 @@ void parse_hosts(char *hosts) if_exists(keyword,keywords,(substring=strstr(str,keyword->key))) { parse_ip(str); - ip_count++; ip->keyword = keyword; keyword->ip_count++; ip->prio = keyword->default_prio; diff --git a/prometheus.c b/prometheus.c index fb8fa4a..b5f610b 100644 --- a/prometheus.c +++ b/prometheus.c @@ -1049,7 +1049,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); printf("%-22s %-15s mark\n","name","ip"); #endif - printf("Writing %s ", classmap); + printf("Writing %s", classmap); f = fopen(classmap, "w"); if(f < 0) {