X-Git-Url: https://git.harvie.cz/?p=svn%2FPrometheus-QoS%2F.git;a=blobdiff_plain;f=prometheus.c;h=71b2a32e13c9a8188cac8dea38a67d22d0736e42;hp=d25ca51aa89b3baa0e9b62c193a56b141c937956;hb=56f6397ec3e60052dce31b6417ff64572b880897;hpb=9f552e96b7c3ed1b5af6578252c0154491132a10 diff --git a/prometheus.c b/prometheus.c index d25ca51..71b2a32 100644 --- a/prometheus.c +++ b/prometheus.c @@ -2,7 +2,7 @@ /* Prometheus QoS - you can "steal fire" from your ISP */ /* "fair-per-IP" quality of service (QoS) utility */ /* requires Linux 2.4.x or 2.6.x with HTB support */ -/* Copyright(C) 2005-2015 Michael Polak, Arachne Aerospace */ +/* Copyright(C) 2005-2017 Michael Polak, Arachne Aerospace */ /* iptables-restore support Copyright(C) 2007-2008 ludva */ /* Credit: CZFree.Net,Martin Devera,Netdave,Aquarius,Gandalf */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ @@ -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); @@ -471,7 +471,7 @@ program printf("\n\ Prometheus QoS - \"fair-per-IP\" Quality of Service setup utility.\n\ -Version %s - Copyright (C)2005-2015 Michael Polak, Arachne Labs\n\ +Version %s - Copyright (C)2005-2017 Michael Polak, Arachne Labs\n\ iptables-restore & burst tunning & classify modification by Ludva\n\ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); @@ -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();