simple iptables based packet limiter to deflect DoS attacks on our clients
[svn/Prometheus-QoS/.git] / parsehosts.c
index ac9b39f..5014ffb 100644 (file)
@@ -40,6 +40,7 @@ void TheIP(char *ipaddr, int is_network)
  ip->direct      = \\r
  ip->traffic     = \\r
  ip->pktsup      = \\r
+ ip->pps_limit   = \\r
  ip->pktsdown    = 0;\r
  ip->keyword     = keywords;\r
  ip->v6          = (strchr(ip->addr,':')!=NULL);\r
@@ -252,12 +253,14 @@ void parse_hosts(char *hosts)
      else \r
      {\r
       ip->max -= ip->keyword->reserve_max;\r
-      if(ip->max<ip->min)\r
+      if(ip->max < ip->min)\r
       {\r
-       ip->max=ip->min;\r
+       ip->max = ip->min;\r
       }\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
      update_network(ip->addr, ip);\r
 \r
This page took 0.107759 seconds and 4 git commands to generate.