-d Dry run (preview tc and iptables commands on stdout)\n\
-r Run (reset all statistics and start shaping - daily usage)\n\
-p just generate Preview of data transfer statistics and exit (after -r)\n\
--s start Shaping FUP limits (keeps data transfer stat like -p) (after -r)\n\
+-s Start shaping FUP limits (keeps data transfer stat like -p) (after -r)\n\
+-q Quit shaping FUP limits (keeps data transfer stat like -p) (after -r)\n\
-n run Now (like -r delay - overrides qos-free-delay keyword, after boot)\n\
-f just Flush iptables and tc classes and exit (stop shaping, no QiS)\n\
-9 emergency iptables flush (like -f, but dumps data transfer statistics)\n\
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; /* apply FUP - requires classmap file */\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("-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)\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) /* 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
+ }\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(stop_shaping)\r
+ {\r
+ swchar='q';\r
+ }\r
+\r
printf("Statistics preview generated (-%c switch) - now exiting ...\n", swchar);\r
exit(0);\r
} \r