prometheus.conf upgrade
[svn/Prometheus-QoS/.git] / parsehosts.c
index 7e12a41b34d1280821ef1c916e417675fade4b4a..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
@@ -259,12 +260,15 @@ void parse_hosts(char *hosts)
       }\r
      }\r
 \r
-     /* MTU is 1450 bytes = 11600 bits ~= 12 kbit, max is in kb/s \r
-        average pkt 1/2 MTU = 6 kbit*/\r
-     ip->pps_limit = ip->max/6;\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
      ip->mark = FIRSTIPCLASS+1+class_count++;     \r
This page took 0.10098 seconds and 4 git commands to generate.