/* Credit: CZFree.Net,Martin Devera,Netdave,Aquarius,Gandalf */\r
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */\r
\r
-/* Modified by: xChaos, 20220607\r
+/* Modified by: xChaos, 20231028\r
ludva, 20080415\r
\r
Prometheus QoS is free software; you can redistribute it and/or\r
#include "cll1-0.6.2.h"\r
#include "ipstruct.h"\r
\r
-const char *version = "1.0.0-d";\r
+const char *version = "1.0.1";\r
\r
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */\r
/* Versions: 0.9.0 is development release, 1.0 will be "stable" */\r
char *final_chain = "DROP"; /* REJECT would be better, but it is impossible in mangle */\r
char *mark = "MARK";\r
char *mark_iptables = "MARK --set-mark ";\r
-int dry_run = FALSE; /* preview - use puts() instead of system() */\r
+int dry_run = FALSE; /* preview commands - use puts() instead of system() */\r
+int skip_stats = FALSE; /* skip generating statistics */\r
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]";\r
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";\r
FILE *iptables_file = NULL;\r
}\r
}\r
\r
-\r
/* ====== iptables indexes are used to reduce complexity to log8(N) ===== */\r
\r
char *index_id(char *ip, int bitmask);\r
argument("-s") { run=TRUE; just_preview=TRUE; start_shaping=TRUE; }\r
argument("-r") { run=TRUE; }\r
argument("-n") { run=TRUE; nodelay=TRUE; }\r
+ argument("-b") { run=TRUE; nodelay=TRUE; skip_stats=TRUE; }\r
argument("-a") { run=TRUE; just_networks=TRUE; }\r
argument("-l") { just_logs=TRUE; }\r
argument("-m") { just_logs=TRUE; }\r
interface->chain = "FORWARD";\r
interface->idxprefix = "forw";\r
push(interface, interfaces);\r
- printf("Upstream interface %s: medium %s capacity %ld kbps\n", interface->name, medium, interface->speed);\r
+ printf("Upstream interface %s: medium %s capacity %Ld kbps\n", interface->name, medium, interface->speed);\r
}\r
}\r
done; /* ugly macro end */\r
interface->chain = "POSTROUTING";\r
interface->idxprefix = "post";\r
push(interface, interfaces);\r
- printf("Downstream interface %s: medium %s capacity %ld kbps\n", interface->name, medium, interface->speed);\r
+ printf("Downstream interface %s: medium %s capacity %Ld kbps\n", interface->name, medium, interface->speed);\r
}\r
}\r
done; /* ugly macro end */\r
hosts = althosts;\r
}\r
\r
- if(just_flush<9)\r
+ if(just_flush<9 && !skip_stats)\r
{\r
/*-----------------------------------------------------------------*/\r
puts("Parsing iptables verbose output ...");\r
agreg = (int)((float)(avg_mbps_down+1)/min_mbps+.5);\r
ip->max /= agreg;\r
ip->pps_limit /= agreg;\r
- printf("Download aggregation 1:%d for %s (min: %lu Mbps avg: %ld Mbps)\n", agreg, ip->name, min_mbps, avg_mbps_down);\r
+ printf("Download aggregation 1:%d for %s (min: %d Mbps avg: %ld Mbps)\n", agreg, ip->name, min_mbps, avg_mbps_down);\r
}\r
else\r
{\r
unshape_this_ip = 0;\r
agreg = (int)((float)(avg_mbps_up+1)/min_mbps+.5);\r
ip->max /= agreg;\r
- printf("Upload aggregation 1:%d for %s: (min: %lu Mbps avg: %ld Mbps)\n", agreg, ip->name, min_mbps, avg_mbps_up);\r
+ printf("Upload aggregation 1:%d for %s: (min: %d Mbps avg: %ld Mbps)\n", agreg, ip->name, min_mbps, avg_mbps_up);\r
}\r
else\r
{\r
json_traffic=json_preview;\r
}\r
\r
- if(!dry_run && !just_flush)\r
+ if(!dry_run && !just_flush && !skip_stats)\r
{\r
/*-----------------------------------------------------------------*/\r
printf("Writing json traffic overview %s ... ", json_traffic);\r