lmsid -> code
[svn/Prometheus-QoS/.git] / prometheus.c
index 9ddd593c3991661fde2cadeccb4454a2048d2eae..d8069b89661bc1aa747247495dd58cc1b881bd56 100644 (file)
@@ -7,7 +7,7 @@
 /* Credit: CZFree.Net,Martin Devera,Netdave,Aquarius,Gandalf  */\r
 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */\r
 \r
-/* Modified by: xChaos, 20220327\r
+/* Modified by: xChaos, 20220607\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-b";\r
+const char *version = "1.0.0-d";\r
 \r
 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */\r
 /* Versions: 0.9.0 is development release, 1.0 will be "stable"    */\r
@@ -105,7 +105,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
@@ -663,7 +663,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
@@ -684,7 +684,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
@@ -782,6 +782,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
@@ -1279,7 +1288,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
@@ -1390,10 +1399,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
@@ -1445,12 +1455,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 quantum %d",\r
-               tc, interface->name, parent, OVERLIMIT_CLASS, overlimit_min, overlimit_max, burst, lowest_priority, htb_quantum);\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.166706 seconds and 4 git commands to generate.