X-Git-Url: https://git.harvie.cz/?p=svn%2FPrometheus-QoS%2F.git;a=blobdiff_plain;f=prometheus.c;h=20a7603d7b4f7f776d96ca48a5a366c5792ccb72;hp=62ebbc8b3e2fa8eb94eeea1684096f9f0905d668;hb=ca6f7e80f4ce05259df01ec965beb7a4907b8540;hpb=0b9c3c198771800cc6c5fbacfc0272549626bcfd diff --git a/prometheus.c b/prometheus.c index 62ebbc8..20a7603 100644 --- a/prometheus.c +++ b/prometheus.c @@ -83,6 +83,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 */ @@ -137,7 +138,7 @@ struct Keyword *keyword, *defaultkeyword=NULL, *keywords=NULL; void help(void); /* implemented in help.c */ -void get_traffic_statistics(const char *whichiptables); +void get_traffic_statistics(const char *whichiptables, int ipv6); /* implemented in parseiptables.c */ void parse_ip_log(int argc, char **argv); @@ -537,13 +538,13 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); /*-----------------------------------------------------------------*/ puts("Parsing iptables verbose output ..."); /*-----------------------------------------------------------------*/ - get_traffic_statistics(iptables); + get_traffic_statistics(iptables, FALSE); if(ip6prefix) { /*-----------------------------------------------------------------*/ puts("Parsing ip6tables verbose output ..."); /*-----------------------------------------------------------------*/ - get_traffic_statistics(ip6tables); + get_traffic_statistics(ip6tables, TRUE); } } @@ -619,6 +620,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 +630,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 +644,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 +1048,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 +1056,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 */