prometheus.conf upgrade
[svn/Prometheus-QoS/.git] / parsehosts.c
index 5014ffb8287cb168d2c6b5df709745ddb25eff7d..9ee2c2b003995e59c746cbe7789dd563f553817a 100644 (file)
@@ -151,6 +151,7 @@ void parse_hosts(char *hosts)
  char *str, *ptr;\r
  char *substring;\r
  struct IP *network;\r
+ int pktratio;\r
 \r
  parse(hosts)\r
  {\r
@@ -258,10 +259,19 @@ void parse_hosts(char *hosts)
        ip->max = ip->min;\r
       }\r
      }\r
-     \r
-     /* MTU is 1450 bytes = 11600 bits ~= 12 kbit, max is in kb/s */\r
-     ip->pps_limit = ip->max/12;\r
-     ip->mark = FIRSTIPCLASS+1+class_count++;\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
+     {\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
+     ip->mark = FIRSTIPCLASS+1+class_count++;     \r
      update_network(ip->addr, ip);\r
 \r
      if_exists(group,groups,(group->min == ip->min)) \r
This page took 0.136996 seconds and 4 git commands to generate.