X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;f=parsehosts.c;h=5014ffb8287cb168d2c6b5df709745ddb25eff7d;hb=c38473c17cd984140f177ccb2000089e10444299;hp=b21af786e7d7c87a4dc0d5afb52107f08fe200a0;hpb=cdfd88eb2cfba828e5bfc3f77eba37b3cba286ce;p=svn%2FPrometheus-QoS%2F.git diff --git a/parsehosts.c b/parsehosts.c index b21af78..5014ffb 100644 --- a/parsehosts.c +++ b/parsehosts.c @@ -17,7 +17,7 @@ extern int free_min; extern const int highest_priority; extern char *ip6prefix; -struct IP* find_network_for_ip(char *ipaddr_orig); +void update_network(char *look_for, struct IP* ip); /* implemented in networks.c */ /* This must be object oriented! This looks almost like constructor ;-) */ @@ -40,6 +40,7 @@ void TheIP(char *ipaddr, int is_network) ip->direct = \ ip->traffic = \ ip->pktsup = \ + ip->pps_limit = \ ip->pktsdown = 0; ip->keyword = keywords; ip->v6 = (strchr(ip->addr,':')!=NULL); @@ -235,6 +236,7 @@ void parse_hosts(char *hosts) *ptr=0; ip->max = ip->desired = atoi(ptr+1); } + ip->min = atoi(substring); if(ip->min <= 0) { @@ -242,6 +244,7 @@ void parse_hosts(char *hosts) str, free_min); ip->min = free_min; } + if(ip->max <= ip->min) { ip->fixedprio = TRUE; @@ -250,23 +253,16 @@ void parse_hosts(char *hosts) else { ip->max -= ip->keyword->reserve_max; - if(ip->maxmin) + if(ip->max < ip->min) { - ip->max=ip->min; + ip->max = ip->min; } } + + /* MTU is 1450 bytes = 11600 bits ~= 12 kbit, max is in kb/s */ + ip->pps_limit = ip->max/12; ip->mark = FIRSTIPCLASS+1+class_count++; - - network = find_network_for_ip(ip->addr); - if(network) - { - network->min += ip->min; - network->desired += ip->max; - if(ip->max > network->max) - { - network->max = ip->max; - } - } + update_network(ip->addr, ip); if_exists(group,groups,(group->min == ip->min)) { @@ -300,4 +296,7 @@ void parse_hosts(char *hosts) exit(-1); } done; /* ugly macro end */ +// TheIP("0.0.0.0", TRUE); +// ip->name = "TOTAL"; +// ip->mask = 0; } \ No newline at end of file