X-Git-Url: https://git.harvie.cz/?p=svn%2FPrometheus-QoS%2F.git;a=blobdiff_plain;f=prometheus.c;h=71b2a32e13c9a8188cac8dea38a67d22d0736e42;hp=a3619dbea84844729b7b71daaf41b16f3906e8e6;hb=56f6397ec3e60052dce31b6417ff64572b880897;hpb=33c2a33ddc91ec1dbacce09a12d96207a5e6df22 diff --git a/prometheus.c b/prometheus.c index a3619db..71b2a32 100644 --- a/prometheus.c +++ b/prometheus.c @@ -290,7 +290,7 @@ void get_config(char *config_filename) option("hosts",hosts); option("downstream-interfaces-list-filename",downstreamfile); option("upstream-interfaces-list-filename",upstreamfile); - option("macros-filename",upstreamfile); + option("macros-filename",macrosfile); option("ip6-prefix",ip6prefix); option("medium",medium); ioption("hall-of-fame-enable",hall_of_fame); @@ -540,7 +540,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); /*-----------------------------------------------------------------*/ printf("Parsing downstream interfaces list %s ...\n", downstreamfile); /*-----------------------------------------------------------------*/ - parse(upstreamfile) + parse(downstreamfile) { ptr = parse_datafile_line(_); if(ptr) @@ -558,7 +558,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); interface->chain = "POSTROUTING"; interface->idxprefix = "post"; push(interface, interfaces); - printf("Upstream interface %s: medium %s capacity %ld kbps\n", interface->name, medium, interface->speed); + printf("Downstream interface %s: medium %s capacity %ld kbps\n", interface->name, medium, interface->speed); } } done; /* ugly macro end */ @@ -1266,15 +1266,18 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); chain, ip->addr, ip->mask, interface->name, limit_pkts); iptables_save_line(str, ip->v6); - /* classify overlimit packets to separate overlimit class */ - sprintf(str, "-A %s -d %s/%d -o %s -j %s%d", - chain, ip->addr, ip->mask, - interface->name, mark_iptables, OVERLIMIT_CLASS); - iptables_save_line(str, ip->v6); - - sprintf(str, "-A %s -d %s/%d -o %s -j ACCEPT", - chain, ip->addr, ip->mask, interface->name); - iptables_save_line(str, ip->v6); + if(limit_pkts) + { + /* classify overlimit packets to separate overlimit class */ + sprintf(str, "-A %s -d %s/%d -o %s -j %s%d", + chain, ip->addr, ip->mask, + interface->name, mark_iptables, OVERLIMIT_CLASS); + iptables_save_line(str, ip->v6); + + sprintf(str, "-A %s -d %s/%d -o %s -j ACCEPT", + chain, ip->addr, ip->mask, interface->name); + iptables_save_line(str, ip->v6); + } if(ip->min) { @@ -1369,14 +1372,13 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); /* tc handle 1 fw flowid */ sprintf(str,"%s filter add dev %s parent 1:0 protocol ip handle %d fw flowid 1:%d", tc, interface->name, FREE_CLASS, FREE_CLASS); safe_run(str); - - /*-----------------------------------------------------------------*/ - puts("Generating bandwith class for overlimit packets..."); - /*-----------------------------------------------------------------*/ - sprintf(str, "%s class add dev %s parent 1:%d classid 1:%d htb rate %dkbit ceil %dkbit burst %dk prio %d", - tc, interface->name, parent, OVERLIMIT_CLASS, overlimit_min, overlimit_max, burst, lowest_priority); - safe_run(str); } + /*-----------------------------------------------------------------*/ + puts("Generating bandwith class for overlimit packets..."); + /*-----------------------------------------------------------------*/ + sprintf(str, "%s class add dev %s parent 1:%d classid 1:%d htb rate %dkbit ceil %dkbit burst %dk prio %d", + tc, interface->name, parent, OVERLIMIT_CLASS, overlimit_min, overlimit_max, burst, lowest_priority); + safe_run(str); } printf("Total IP count: %d\n", i); run_iptables_restore();