int nodelay = FALSE;\r
int just_preview = FALSE; /* preview - generate just stats */\r
int start_shaping = FALSE; /* apply FUP - requires classmap file */\r
+ int stop_shaping = FALSE; /* lift FUP - requires classmap file */\r
+ int reduce_ceil = 0; /* allow only rate+(ceil-rate)/2, /4, etc. */\r
int just_logs = FALSE; /* just parse logs */\r
int run = FALSE;\r
int total = 0;\r
argument("-f") { run=TRUE; just_flush=TRUE; }\r
argument("-9") { run=TRUE; just_flush=9; }\r
argument("-p") { run=TRUE; just_preview=TRUE; }\r
+ argument("-q") { run=TRUE; just_preview=TRUE; stop_shaping=TRUE; }\r
+ argument("-2") { run=TRUE; just_preview=TRUE; reduce_ceil=2; }\r
+ argument("-4") { run=TRUE; just_preview=TRUE; reduce_ceil=4; }\r
argument("-s") { run=TRUE; just_preview=TRUE; start_shaping=TRUE; }\r
argument("-r") { run=TRUE; }\r
argument("-n") { run=TRUE; nodelay=TRUE; }\r
\r
if(just_preview)\r
{\r
- if(start_shaping)\r
+ if(start_shaping || stop_shaping || reduce_ceil)\r
{\r
printf("Reading %s and applying Fair Use Policy rules ... \n", classmap);\r
parse(classmap)\r
if_exists(ip,ips,eq(ip->addr,_))\r
{\r
ip->mark=atoi(ptr);\r
- if(ip->max < ip->desired) /* apply FUP limit immediately.... */\r
+ if(ip->max < ip->desired || stop_shaping || reduce_ceil) /* apply or disable FUP limit immediately.... */\r
{\r
- printf("Applying limit for %-22s %-16s %04d ", ip->name, ip->addr, ip->mark); \r
+ if(stop_shaping)\r
+ {\r
+ ip->max = ip->desired;\r
+ printf("Removing limit for %-22s %-16s %04d ", ip->name, ip->addr, ip->mark); \r
+ }\r
+ else\r
+ {\r
+ printf("Applying limit for %-22s %-16s %04d ", ip->name, ip->addr, ip->mark);\r
+ if(reduce_ceil)\r
+ {\r
+ ip->max = ip->min + (ip->desired-ip->min)/reduce_ceil;\r
+ }\r
+ }\r
printf("(down: %dk-%dk ", ip->min, ip->max); \r
sprintf(str, "%s class change dev %s parent 1:%d classid 1:%d htb rate %dkbit ceil %dkbit burst %dk prio %d", \r
tc, lan, ip->group, ip->mark,ip->min,ip->max, burst, ip->prio);\r
perror(classmap);\r
puts("Warning - classmap file not fund, just generating preview ...");\r
start_shaping=FALSE;\r
+ stop_shaping=FALSE;\r
}\r
done; /* ugly macro end */\r
}\r
{\r
swchar='s';\r
}\r
+ else if(reduce_ceil)\r
+ {\r
+ swchar='0'+reduce_ceil; /* -2, -4 */\r
+ }\r
+ else if(stop_shaping)\r
+ {\r
+ swchar='q';\r
+ }\r
+\r
printf("Statistics preview generated (-%c switch) - now exiting ...\n", swchar);\r
exit(0);\r
} \r