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
+ 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
+ ip->mark = FIRSTIPCLASS+1+class_count++; \r
update_network(ip->addr, ip);\r
\r
if_exists(group,groups,(group->min == ip->min)) \r
chain_postrouting="POSTROUTING";\r
}\r
\r
+ /* packet limits - this will be optional in future, hardcoded for now */\r
+ if(ip->pps_limit)\r
+ {\r
+ sprintf(limit_pkts, "-m limit --limit %d/s ", ip->pps_limit);\r
+ }\r
+ else\r
+ {\r
+ *limit_pkts = 0;\r
+ } \r
+\r
#ifdef DEBUG\r
- printf("%-22s %-16s %04d ", ip->name, ip->addr, ip->mark); \r
+ printf("%-22s %-16s %04d %d/s\n", ip->name, ip->addr, ip->mark, ip->pps_limit); \r
#endif\r
\r
- /* -------------------------------------------------------- mark download */\r
- \r
+ /* -------------------------------------------------------- mark download */ \r
sprintf(str, "-A %s -d %s/%d -o %s -j %s%d",\r
chain_postrouting, ip->addr, 32*(1+ip->v6),\r
lan, mark_iptables, ip->mark);\r
- /* -m limit --limit 1/s */ \r
iptables_save_line(str, ip->v6);\r
\r
if(qos_proxy)\r
iptables_save_line(str, ip->v6);\r
}\r
\r
- /* this will be optional in future - hardcoded for now*/\r
- sprintf(limit_pkts,"-m limit --limit %d/s ", ip->pps_limit);\r
-\r
sprintf(str, "-A %s -d %s/%d -o %s %s-j ACCEPT",\r
chain_postrouting, ip->addr, 32*(1+ip->v6), lan, limit_pkts);\r
iptables_save_line(str, ip->v6);\r