-b Boot mode master git-svn
authorxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Sat, 28 Oct 2023 12:58:51 +0000 (12:58 +0000)
committerxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Sat, 28 Oct 2023 12:58:51 +0000 (12:58 +0000)
git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@281 251d49ef-1d17-4917-a970-b30cf55b089b

help.c
htmlandlogs.c
ipstruct.h
json.c
parsehosts.c
prometheus.c

diff --git a/help.c b/help.c
index 868f0e69342ee4eb1236e3daca74d9b17a9d198a..049b156063a5773ba0dab8d420f53d081e372b47 100644 (file)
--- a/help.c
+++ b/help.c
@@ -1,4 +1,4 @@
-/* Modified by: xChaos, 20131029 */
+/* Modified by: xChaos, 20231028 */
 
 #include "cll1-0.6.2.h"
 
@@ -9,6 +9,7 @@ void help(void)
  puts("Command line switches:\n\
 \n\
 -d   Dry run (preview tc and iptables commands on stdout)\n\
+-b   Boot run (no to gather and write data transfer statistics)\n\
 -r   Run (reset all statistics and start shaping - daily usage)\n\
 -p   just generate Preview of data transfer statistics and exit (after -r)\n\
 -s   Start shaping FUP limits (keeps data transfer stat like -p) (after -r)\n\
index 798544db52b6e0480dbe4166625c5cb3228057fb..431d044bf3d36fb53ada3ae48340152c5744c613 100644 (file)
@@ -18,7 +18,7 @@ extern int dry_run;
 extern int qos_proxy;\r
 extern char *title;\r
 extern char *log_url;\r
-extern int found_lmsid;\r
+extern int found_code;\r
 extern char *lms_url;\r
 extern char *log_dir;\r
 extern char *ip6prefix;\r
@@ -42,9 +42,9 @@ void append_log(struct IP *self) /*using global variables*/
  f = fopen(str, "a");\r
  if(f > 0)\r
  {\r
-  fprintf(f, "%ld\t%s\t%Lu\t%Lu\t%Lu\t%Lu\t%d\t%d\t%d\t%d\t%s",\r
+  fprintf(f, "%ld\t%s\t%Lu\t%Lu\t%Lu\t%Lu\t%d\t%d\t%d\t%s\t%s",\r
              time(NULL), self->name, self->traffic, self->direct, self->proxy,\r
-             self->upload, self->min, self->max, self->desired, self->lmsid, d); /* d = date*/\r
+             self->upload, self->min, self->max, self->desired, self->code, d); /* d = date*/\r
   fclose(f);\r
  }\r
  else\r
@@ -125,7 +125,7 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
  i=0;\r
  if(f > 0)\r
  {\r
-  unsigned long long total_traffic=0, total_direct=0, total_proxy=0, total_upload=0, tmp_sum = 0;\r
+  unsigned long long total_traffic = 1 /* prevent divide by zero */ , total_direct=0, total_proxy=0, total_upload=0, tmp_sum = 0;\r
   unsigned long long total_pktup = 0, total_pktdown = 0;\r
   int active_classes = 0;\r
 //  int colspan = 14;\r
@@ -133,7 +133,7 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
   int agreg_count = 0, limit_count = 0, prio_count = 0;\r
   int popup_button = 0;\r
   /* IPv6 vs. IPv4 stats */\r
-  unsigned long long pkts4 =0, pkts6 = 0, bytes4 = 0, bytes6 = 0;\r
+  unsigned long long pkts4 = 1, pkts6 = 1 /*prevent divide by zero */, bytes4 = 0, bytes6 = 0;\r
   int count4 = 0, count6 = 0;\r
   int mpkts;\r
   double perc6;\r
@@ -255,15 +255,15 @@ style=\"cursor: pointer;\">+%d</a>]</span>",
    fputs("</td>\n",f);\r
    /* ----------------------------------------------- */\r
 \r
-   if(found_lmsid)\r
+   if(found_code)\r
    {\r
     fputs("<td style=\"text-align: right\">",f);\r
-    if(ip->lmsid > 0)\r
+    if(ip->code[0])\r
     {\r
-     fprintf(f, "<a class=\"blue\" target=\"_blank\" href=\"%s%d\">%04d</a>\n",\r
-                lms_url, ip->lmsid, ip->lmsid);\r
+     fprintf(f, "<a class=\"blue\" target=\"_blank\" href=\"%s%s\">%s</a>\n",\r
+                lms_url, ip->code, ip->code);\r
     }\r
-    else if(ip->lmsid == 0)\r
+    else if(ip->code[0] == 0)\r
     {\r
      fputs("------",f);\r
     }\r
index 3b807474df260cd6cd79edaec83591d959718c00..17635ffaab56c102c38c19fdd8f7b2ecb77ce905 100644 (file)
@@ -15,7 +15,7 @@ struct IP
  int aggregated;\r
  int fixedprio;\r
  int group;\r
int lmsid;\r
char *code;\r
  int pps_limit;\r
  unsigned long long direct;\r
  unsigned long long proxy;\r
diff --git a/json.c b/json.c
index c04a568f955c2995388352cb21c98a2130e7090b..f09f91695f1d0f3b148c234976b2a21ec1a9dd92 100644 (file)
--- a/json.c
+++ b/json.c
@@ -15,7 +15,7 @@ void write_json_traffic(char *json)
 \r
    for_each(ip, ips)\r
    {\r
-    if(      ip->lmsid > 0 \r
+    if(      ip->code[0] > 0 \r
         and (ip->traffic or ip->direct or ip->proxy or ip->upload))\r
     {\r
      if(jsoncount)\r
@@ -23,10 +23,10 @@ void write_json_traffic(char *json)
       fprintf(f, ",\n");\r
      }\r
      fprintf(f, \r
-             " \"%s\":{ \"lms\": %d, \"ip\":\"%s\", \"total\":%Lu, \"down\":%Lu, \\r
+             " \"%s\":{ \"code\": %s, \"ip\":\"%s\", \"total\":%Lu, \"down\":%Lu, \\r
              \"proxy\":%Lu, \"up\":%Lu, \"min\":%d, \"max\":%d, \"limit\":%d, \\r
              \"pktsup\":%Lu, \"pktsdown\":%Lu, \"realquota\":%Lu, \"credit\":%Lu, \"dailyquota\":%ld }",\r
-             ip->name, ip->lmsid, ip->addr, ip->traffic, ip->direct, ip->proxy, \r
+             ip->name, ip->code, ip->addr, ip->traffic, ip->direct, ip->proxy, \r
              ip->upload, ip->min, ip->desired, ip->max, ip->pktsup, ip->pktsdown,\r
              ip->realquota, ip->credit, (ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20)));\r
      jsoncount++;\r
index f356f165b76b9d21fcc36b3382e0aaf7d0eac947..cc2548f909dc040f04b82002bc5c2f38cb9abb09 100644 (file)
@@ -13,7 +13,7 @@ extern struct Keyword *keyword, *defaultkeyword, *keywords;
 extern struct Macro *macro, *macros;\r
 extern int class_count;\r
 extern int ip_count;\r
-extern int found_lmsid;\r
+extern int found_code;\r
 extern int free_min;\r
 extern const int highest_priority;\r
 extern char *ip6prefix;\r
@@ -29,7 +29,7 @@ void TheIP(char *ipaddr, int is_network)
  ip->addr         = ipaddr;\r
  ip->sharing      = NULL;\r
  ip->prio         = highest_priority+1;\r
- ip->lmsid        = -1;\r
+ ip->code         = "-----";\r
  ip->fixedprio    = \\r
  ip->aggregated   = \\r
  ip->mark         = \\r
@@ -74,7 +74,7 @@ struct IP *lastIP6range, *lastIP6uplink;
 void parse_and_append_ip(char *str, struct IP *listhead)\r
 {\r
  char *ptr, *ipaddr, *nextip6, *ip6buf; \r
- char *ip6uplink = NULL, *ip6range = NULL, *ipname = NULL, *lmsid = NULL;\r
+ char *ip6uplink = NULL, *ip6range = NULL, *ipname = NULL, *code = NULL;\r
 \r
  if(ip6prefix) /* Try this only if IPv6 subsystem is active... */\r
  {\r
@@ -105,7 +105,7 @@ void parse_and_append_ip(char *str, struct IP *listhead)
  ptr = strchr(str, '{');\r
  if(ptr)\r
  {\r
-  lmsid = ++ptr;\r
+  code = ++ptr;\r
   while(*ptr and *ptr != '}')\r
   {\r
    ptr++;\r
@@ -144,9 +144,9 @@ void parse_and_append_ip(char *str, struct IP *listhead)
   }\r
   ip->name = ip6range;\r
   ip->keyword = defaultkeyword; /* settings for default keyword */\r
-  if(lmsid)\r
+  if(code)\r
   {\r
-   ip->lmsid = atoi(lmsid);\r
+   ip->code = code;\r
   }\r
   lastIP6range = ip;\r
  }\r
@@ -163,9 +163,9 @@ void parse_and_append_ip(char *str, struct IP *listhead)
   TheIP(ip6uplink, FALSE); /* always new IP - more IPs in single uplink network */\r
   ip->name = ip6uplink;\r
   ip->keyword = defaultkeyword; /* settings for default keyword */\r
-  if(lmsid)\r
+  if(code)\r
   {\r
-   ip->lmsid = atoi(lmsid);\r
+   ip->code = code;\r
   }\r
   lastIP6uplink = ip;\r
  }\r
@@ -180,10 +180,10 @@ void parse_and_append_ip(char *str, struct IP *listhead)
   TheIP(ipaddr, (listhead==networks));\r
  }\r
  ip->name = ipname;\r
- if(lmsid)\r
+ if(code)\r
  {\r
-  ip->lmsid = atoi(lmsid);\r
-  found_lmsid = TRUE;\r
+  ip->code = code;\r
+  found_code = TRUE;\r
  }\r
 }\r
 \r
@@ -375,14 +375,17 @@ void parse_hosts(char *hosts)
       }\r
      }\r
 \r
-     /* avg MTU bytes * 8 >> 10 = in bits, max is in kb/s  */\r
-     pktratio = (ip->keyword->allowed_avgmtu*8) >> 10;\r
-     if(pktratio > 0)\r
+     if(ip->keyword->allowed_avgmtu)\r
      {\r
-      ip->pps_limit = ip->max/pktratio;\r
-      if(ip->pps_limit > 10000) /* this limit seems to be hardcoded in iptables */\r
+      /* avg MTU bytes * 8 >> 10 = in bits, max is in kb/s  */\r
+      pktratio = (ip->keyword->allowed_avgmtu*8) >> 10;\r
+      if(pktratio > 0)\r
       {\r
-       ip->pps_limit = 0; /* do not apply packet limits */\r
+       ip->pps_limit = ip->max/pktratio;\r
+       if(ip->pps_limit > 10000) /* this limit seems to be hardcoded in iptables */\r
+       {\r
+        ip->pps_limit = 0; /* do not apply packet limits */\r
+       }\r
       }\r
      }\r
 \r
index 4cc02a02543b8c2c23c1070fcb09a3b6807362da..8aacb50830c759fecc469588393d4d4cf98b0761 100644 (file)
@@ -7,7 +7,7 @@
 /* Credit: CZFree.Net,Martin Devera,Netdave,Aquarius,Gandalf  */\r
 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */\r
 \r
-/* Modified by: xChaos, 20200107\r
+/* Modified by: xChaos, 20231028\r
                  ludva, 20080415\r
  \r
    Prometheus QoS is free software; you can redistribute it and/or\r
@@ -29,7 +29,7 @@
 #include "cll1-0.6.2.h"\r
 #include "ipstruct.h"\r
 \r
-const char *version = "1.0.0-a";\r
+const char *version = "1.0.1";\r
 \r
 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */\r
 /* Versions: 0.9.0 is development release, 1.0 will be "stable"    */\r
@@ -87,7 +87,8 @@ int        filter_type = 1; /*1 mark, 2 classify*/
 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
@@ -105,7 +106,7 @@ char    *qos_free_zone = NULL; /* QoS free zone */
 char *qos_free_dst_ipset = NULL; /* QoS free zone - dst match ipset name, must be prepared outside prometheus */\r
 char *qos_free_src_ipset = NULL; /* QoS free zone - src match ipset name, must be prepared outside prometheus */\r
 /* int          qos_proxy = TRUE; include proxy port to QoS */\r
-int        found_lmsid = FALSE; /* show links to users in LMS information system */\r
+int         found_code = FALSE; /* show links to users in LMS information system */\r
 int     include_upload = TRUE; /* upload+download=total traffic */\r
 /* char         *proxy_ip = "192.168.1.1/32";  our IP with proxy port */\r
 /* int         proxy_port = 3128; proxy port number */\r
@@ -118,7 +119,8 @@ int      overlimit_max = 512; /* maximum allowed bandwidth for all undefined hos
 int     qos_free_delay = 0; /* seconds to sleep before applying new QoS rules */\r
 int     digital_divide = 2; /* controls digital divide weirdness ratio, 1...3 */ \r
 int        max_nesting = 5; /* /include/uapi/linux/pkt_sched.h: #define TC_HTB_MAXDEPTH 8 [... - 3 parent classes] */\r
-int            htb_r2q = 256; /* should work for leaf values 512 kbps to 8 Mbps */\r
+//obsolete: int            htb_r2q = 256; /* should work for leaf values 512 kbps to 8 Mbps */\r
+int        htb_quantum = 1514; /* MTU + ethernet header */\r
 int              burst = 8; /* HTB burst (in kbits) */\r
 int         burst_main = 64;\r
 int        burst_group = 32;\r
@@ -187,7 +189,6 @@ const char *tr_odd_even(void)
  }\r
 }\r
 \r
-\r
 /* ====== iptables indexes are used to reduce complexity to log8(N) ===== */\r
 \r
 char *index_id(char *ip, int bitmask);\r
@@ -333,7 +334,7 @@ void get_config(char *config_filename)
   ioption("htb-burst-main",burst_main);\r
   ioption("htb-burst-group",burst_group);\r
   ioption("htb-nesting-limit",max_nesting);\r
-  ioption("htb-r2q",htb_r2q);\r
+  ioption("htb-quantum",htb_quantum);\r
   ioption("magic-include-upload",include_upload);\r
   ioption("magic-treshold",magic_treshold);  \r
   option("filter-type", cnf);  \r
@@ -374,7 +375,7 @@ void get_config(char *config_filename)
 }\r
 \r
  \r
-/* ========== This function executes, logs OR ALSO prints command ========== */\r
+/* ========== This function executes, logs or also prints command ========== */\r
 \r
 void safe_run(char *cmd)\r
 {\r
@@ -503,6 +504,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
   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
@@ -545,7 +547,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
    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
@@ -571,7 +573,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
    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
@@ -592,7 +594,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
   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
@@ -662,7 +664,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
   {\r
    for_each(ip, ips) if(eq(technology->filename, ip->technology_str))\r
    {\r
-    fprintf(f,"%d,%s,%d\n", ip->lmsid, ip->ruian_id_str, ip->max);\r
+    fprintf(f,"%s,%s,%d\n", ip->code, ip->ruian_id_str, ip->max);\r
    }\r
    fclose(f);\r
   }\r
@@ -683,7 +685,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
    sharedip->traffic_up += ip->upload;\r
    ip->traffic = 0;\r
    ip->mark = sharedip->mark; \r
-   ip->lmsid = sharedip->lmsid;\r
+   ip->code = sharedip->code;\r
    ip->pps_limit = sharedip->pps_limit; /* no other way to do this */\r
 \r
    /* Ugly hack: append IPv4 addresses of sharedip to IPv6 uplinks */\r
@@ -781,6 +783,15 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
    iptables_save_line(ip6preamble, IPv6);\r
   }\r
 \r
+  /* this doesn't seem to be way to go... about 2/3 of all packets have ACK flag set\r
+     maybe with --length 40:100 it would make some sense, but not enought \r
+  for_each(interface, interfaces)\r
+  {\r
+   sprintf(str,"-A %s -m tcp -p tcp --tcp-flags ACK ACK -o %s -j ACCEPT", interface->chain, interface->name);\r
+   iptables_save_line(str, IPv4);\r
+  }\r
+  */\r
+\r
   if(qos_free_zone && *qos_free_zone != '0') /* this is currently supported only for IPv4 */\r
   {\r
    for_each(interface, interfaces)\r
@@ -979,16 +990,16 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
 \r
   for_each(interface, interfaces)\r
   {\r
-   sprintf(str, "%s qdisc add dev %s root handle 1: htb r2q %d default 1",\r
-                tc, interface->name, htb_r2q);\r
+   sprintf(str, "%s qdisc add dev %s root handle 1: htb default 1",\r
+                tc, interface->name);\r
    safe_run(str);\r
 \r
-   sprintf(str, "%s class add dev %s parent 1: classid 1:2 htb rate %s ceil %s burst %dk prio %d",\r
-                tc, interface->name, medium, medium, burst_main, highest_priority);\r
+   sprintf(str, "%s class add dev %s parent 1: classid 1:2 htb rate %s ceil %s burst %dk prio %d quantum %d",\r
+                tc, interface->name, medium, medium, burst_main, highest_priority, htb_quantum);\r
    safe_run(str);\r
 \r
-   sprintf(str, "%s class add dev %s parent 1:2 classid 1:1 htb rate %Ldkbit ceil %Ldkbit burst %dk prio %d",\r
-                tc, interface->name, interface->speed, interface->speed, burst_main, highest_priority);\r
+   sprintf(str, "%s class add dev %s parent 1:2 classid 1:1 htb rate %Ldkbit ceil %Ldkbit burst %dk prio %d quantum %d",\r
+                tc, interface->name, interface->speed, interface->speed, burst_main, highest_priority, htb_quantum);\r
    safe_run(str);\r
   }\r
  }\r
@@ -1015,8 +1026,8 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
   {\r
    if(!just_preview)\r
    {\r
-    sprintf(str, "%s class add dev %s parent 1:%d classid 1:%d htb rate %Ldkbit ceil %Ldkbit burst %dk prio %d #down desired %d", \r
-                  tc, interface->name, parent, group->id, rate, max, burst_group, highest_priority+1, group->desired);\r
+    sprintf(str, "%s class add dev %s parent 1:%d classid 1:%d htb rate %Ldkbit ceil %Ldkbit burst %dk prio %d quantum %d #down desired %d", \r
+                  tc, interface->name, parent, group->id, rate, max, burst_group, highest_priority+1, htb_quantum, group->desired);\r
     safe_run(str);\r
    }\r
 \r
@@ -1124,7 +1135,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
         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
@@ -1144,7 +1155,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
         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
@@ -1191,8 +1202,8 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
          {\r
           printf("[down %s: %dk-%dk wants %d]", interface->name, ip->min, ip->max, ip->desired);\r
          }\r
-         sprintf(str, "%s class change dev %s parent 1:%d classid 1:%d htb rate %dkbit ceil %dkbit burst %dk prio %d", \r
-                      tc, interface->name, ip->group, ip->mark, ip->min, ip->max, burst, ip->prio);\r
+         sprintf(str, "%s class change dev %s parent 1:%d classid 1:%d htb rate %dkbit ceil %dkbit burst %dk prio %d quantum %d", \r
+                      tc, interface->name, ip->group, ip->mark, ip->min, ip->max, burst, ip->prio, htb_quantum);\r
          safe_run(str);\r
         }\r
         else\r
@@ -1203,10 +1214,10 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
                                              (int)((ip->desired/ip->keyword->asymetry_ratio)-ip->keyword->asymetry_fixed),\r
                                              (int)((ip->desired/ip->keyword->asymetry_ratio)-ip->keyword->asymetry_fixed));\r
          }\r
-         sprintf(str,"%s class change dev %s parent 1:%d classid 1:%d htb rate %dkbit ceil %dkbit burst %dk prio %d",\r
+         sprintf(str,"%s class change dev %s parent 1:%d classid 1:%d htb rate %dkbit ceil %dkbit burst %dk prio %d quantum %d",\r
                       tc, interface->name, ip->group, ip->mark,\r
                       (int)((ip->min/ip->keyword->asymetry_ratio)-ip->keyword->asymetry_fixed),\r
-                      (int)((ip->max/ip->keyword->asymetry_ratio)-ip->keyword->asymetry_fixed), burst, ip->prio);\r
+                      (int)((ip->max/ip->keyword->asymetry_ratio)-ip->keyword->asymetry_fixed), burst, ip->prio, htb_quantum);\r
          safe_run(str);\r
         }\r
        }\r
@@ -1231,7 +1242,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
   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
@@ -1278,7 +1289,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
  }\r
 \r
  /*-----------------------------------------------------------------*/\r
- printf(" + generating iptables and tc classes ... ");\r
+ printf(" + generating iptables and tc classes ... \n");\r
  /*-----------------------------------------------------------------*/\r
 \r
  for_each(ip, ips) if(ip->mark > 0)\r
@@ -1359,8 +1370,8 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
     printf("[down: %dk-%dk]", ip->min, ip->max);\r
  #endif\r
 \r
-    sprintf(str, "%s class add dev %s parent 1:%d classid 1:%d htb rate %dkbit ceil %dkbit burst %dk prio %d", \r
-                 tc, interface->name, ip->group, ip->mark, ip->min, ip->max, burst, ip->prio);\r
+    sprintf(str, "%s class add dev %s parent 1:%d classid 1:%d htb rate %dkbit ceil %dkbit burst %dk prio %d quantum %d", \r
+                 tc, interface->name, ip->group, ip->mark, ip->min, ip->max, burst, ip->prio, htb_quantum);\r
     safe_run(str);\r
 \r
     if(strcmpi(ip->keyword->leaf_discipline, "none"))\r
@@ -1389,10 +1400,11 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
   {\r
    fprintf(f, "%s %d\n", ip->addr, ip->mark);\r
   }\r
+  printf(".");\r
  }\r
  if(f > 0)\r
  {\r
-  puts("done.");\r
+  puts(" done.");\r
   fclose(f);\r
  }\r
 \r
@@ -1431,8 +1443,8 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
    /*-----------------------------------------------------------------*/\r
    puts("Generating free bandwith class ...");\r
    /*-----------------------------------------------------------------*/\r
-   sprintf(str, "%s class add dev %s parent 1:%d classid 1:%d htb rate %dkbit ceil %dkbit burst %dk prio %d",\r
-                tc, interface->name, parent, FREE_CLASS, free_min, free_max,burst, lowest_priority);\r
+   sprintf(str, "%s class add dev %s parent 1:%d classid 1:%d htb rate %dkbit ceil %dkbit burst %dk prio %d quantum %d",\r
+                tc, interface->name, parent, FREE_CLASS, free_min, free_max,burst, lowest_priority, htb_quantum);\r
    safe_run(str);\r
    /* tc SFQ */\r
    if(strcmpi(qos_leaf, "none"))\r
@@ -1444,12 +1456,15 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
    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);\r
    safe_run(str);\r
   }\r
-  /*-----------------------------------------------------------------*/\r
-  puts("Generating bandwith class for overlimit packets...");\r
-  /*-----------------------------------------------------------------*/\r
-  sprintf(str, "%s class add dev %s parent 1:%d classid 1:%d htb rate %dkbit ceil %dkbit burst %dk prio %d",\r
-               tc, interface->name, parent, OVERLIMIT_CLASS, overlimit_min, overlimit_max, burst, lowest_priority);\r
-  safe_run(str);\r
+  if(*limit_pkts) /* non-empty string?*/\r
+  {\r
+   /*-----------------------------------------------------------------*/\r
+   puts("Generating bandwith class for overlimit packets...");\r
+   /*-----------------------------------------------------------------*/\r
+   sprintf(str, "%s class add dev %s parent 1:%d classid 1:%d htb rate %dkbit ceil %dkbit burst %dk prio %d quantum %d", \r
+                tc, interface->name, parent, OVERLIMIT_CLASS, overlimit_min, overlimit_max, burst, lowest_priority, htb_quantum);\r
+   safe_run(str);\r
+  }\r
  } \r
  printf("Total IP count: %d\n", i);\r
  run_iptables_restore();\r
This page took 0.310715 seconds and 4 git commands to generate.