X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;f=prometheus.c;h=503bbac068ccc51ae089671cb4709c7b50f9b319;hb=b1a5c8838af8aab2c376bec78cc8a736a9f9c101;hp=48384a6a16fa639279e85ef70a0e50f51ce06364;hpb=d7357b63c9942c72481993bdb9632861c1d83a55;p=svn%2FPrometheus-QoS%2F.git diff --git a/prometheus.c b/prometheus.c index 48384a6..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,6 +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\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 */ @@ -562,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) @@ -619,6 +621,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); exit(-1); } iptables_save_line(iptablespreamble, TRUE); + iptables_save_line(ip6preamble, TRUE); } run_iptables_restore(); @@ -628,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); @@ -643,6 +645,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); { ip6tables_file=fopen(ip6tablesfile,"w"); iptables_save_line(iptablespreamble, TRUE); + iptables_save_line(ip6preamble, TRUE); } if(qos_free_zone && *qos_free_zone!='0') /* this is currently supported only for IPv4 */ @@ -1046,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) { @@ -1054,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 */