X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;f=prometheus.c;h=503bbac068ccc51ae089671cb4709c7b50f9b319;hb=b1a5c8838af8aab2c376bec78cc8a736a9f9c101;hp=1f2910feea9e137b74435711488e761bd9219b9c;hpb=e36b49c7652e11488c5945113f8c62146a279578;p=svn%2FPrometheus-QoS%2F.git diff --git a/prometheus.c b/prometheus.c index 1f2910f..503bbac 100644 --- a/prometheus.c +++ b/prometheus.c @@ -1,5 +1,6 @@ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -/* Prometheus QoS - you can "steal fire" from your ISP *//* "fair-per-IP" quality of service (QoS) utility */ +/* 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-2013 Michael Polak, Arachne Aerospace */ /* iptables-restore support Copyright(C) 2007-2008 ludva */ @@ -83,7 +84,7 @@ char *mark = "MARK"; char *mark_iptables = "MARK --set-mark "; int dry_run = FALSE; /* preview - use puts() instead of system() */ char *iptablespreamble = "*mangle\n:PREROUTING ACCEPT [0:0]\n:POSTROUTING ACCEPT [0:0]\n:INPUT ACCEPT [0:0]\n:OUTPUT ACCEPT [0:0]\n:FORWARD ACCEPT [0:0]"; -char *ip6preamble = "-A FORWARD -p ipv6-icmp -j ACCEPT\n-A POSTROUTING -p ipv6-icmp -j ACCEPT"; +char *ip6preamble = "-A FORWARD -p ipv6-icmp -j ACCEPT\n-A POSTROUTING -p ipv6-icmp -j ACCEPT\n-A FORWARD -s fe80::/10 -j ACCEPT\n-A FORWARD -d ff00::/8 -j ACCEPT\n-A POSTROUTING -s fe80::/10 -j ACCEPT\n-A POSTROUTING -d ff00::/8 -j ACCEPT"; FILE *iptables_file = NULL; FILE *ip6tables_file = NULL; int enable_credit = TRUE; /* enable credit file */ @@ -563,12 +564,12 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); /*-----------------------------------------------------------------*/ for_each(ip,ips) if(ip->sharing) { - for_each(sharedip,ips) if(eq(sharedip->name,ip->sharing)) + for_each(sharedip,ips) if(eq(sharedip->name, ip->sharing)) { - sharedip->traffic+=ip->traffic; - ip->traffic=0; - ip->mark=sharedip->mark; - ip->lmsid=sharedip->lmsid; + sharedip->traffic += ip->traffic; + ip->traffic = 0; + ip->mark = sharedip->mark; + ip->lmsid = sharedip->lmsid; break; } if(not sharedip) @@ -630,8 +631,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); { perror(cmdlog); exit(-1); - } - + } sprintf(str,"%s qdisc del dev %s root 2>/dev/null",tc,lan); safe_run(str); @@ -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) { @@ -1057,7 +1057,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); } /*-----------------------------------------------------------------*/ - puts(" + generating iptables and tc classes ... "); + printf(" + generating iptables and tc classes ... "); /*-----------------------------------------------------------------*/ for_each(ip, ips) if(ip->mark > 0) /* works only for IPv4 so far */