-s start shaping! (keep data transfer statistics - but apply shaping)\n\\r
*/\r
}\r
+\r
/* === Configuraration file values defaults - stored in global variables ==== */\r
\r
int filter_type = 1; /*1 mark, 2 classify*/\r
const int idxtable_bitmask1 = 3; /* this is no longer configurable */\r
const int idxtable_bitmask2 = 3; /* this is no longer configurable */\r
\r
-/* ==== This is C<<1 stuff - learn C<<1 first! http://cll1.arachne.cz ==== */\r
+/* ==== This is C<<1 stuff - learn C<<1 first! https://dev.arachne.cz/svn/cll1h ==== */\r
\r
struct IP\r
{\r
ip->addr = "";\r
ip->sharing = NULL;\r
ip->prio = highest_priority+1;\r
- ip->lmsid = \\r
+ ip->lmsid = -1;\r
ip->fixedprio = \\r
ip->mark = \\r
ip->min = \\r
}\r
\r
char *hash_id(char *ip,int bitmask)\r
-{ return very_ugly_ipv4_code(ip,bitmask,1); }\r
+{ \r
+ return very_ugly_ipv4_code(ip,bitmask,1);\r
+}\r
\r
char *subnet_id(char *ip,int bitmask)\r
-{ return very_ugly_ipv4_code(ip,bitmask,0); }\r
+{\r
+ return very_ugly_ipv4_code(ip,bitmask,0);\r
+}\r
\r
/* ================= Let's parse configuration file here =================== */\r
\r
\r
if(accept && traffic>0 && ipaddr)\r
{\r
- if(proxyflag)printf("(proxy) ");\r
- else if(!downloadflag) printf("(upload) ");\r
+ if(proxyflag)\r
+ {\r
+ printf("(proxy) ");\r
+ }\r
+ else if(!downloadflag)\r
+ {\r
+ printf("(upload) ");\r
+ }\r
printf("IP %s: %Lu M (%ld pkts)\n", ipaddr, traffic, pkts);\r
\r
if_exists(ip,ips,eq(ip->addr,ipaddr)); \r
if(downloadflag)\r
{\r
if(proxyflag)\r
+ {\r
ip->proxy=traffic;\r
+ }\r
else\r
+ {\r
ip->traffic+=traffic;\r
+ }\r
ip->direct=ip->traffic-ip->upload-ip->proxy;\r
ip->pktsdown=pkts;\r
}\r
\r
void safe_run(char *cmd)\r
{\r
- if(dry_run) printf("\n=>%s\n",cmd); else system(cmd);\r
- if(log_file) fprintf(log_file,"%s\n",cmd);\r
+ if(dry_run)\r
+ {\r
+ printf("\n=>%s\n",cmd);\r
+ }\r
+ else\r
+ {\r
+ system(cmd);\r
+ }\r
+ if(log_file)\r
+ {\r
+ fprintf(log_file,"%s\n",cmd);\r
+ }\r
}\r
\r
void save_line(char *line)\r
fclose(iptables_file);\r
if(dry_run) \r
{\r
- parse(iptablesfile)\r
- {\r
- str=_;\r
- printf("%s\n", str);\r
- }done;\r
+ parse(iptablesfile)\r
+ {\r
+ printf("%s\n",_);\r
+ }\r
+ done;\r
}\r
\r
sprintf(restor,"%s <%s",iptablesrestore, iptablesfile);\r
{\r
lmsid=++ptr;\r
while(*ptr && *ptr!='}')\r
+ {\r
ptr++;\r
+ }\r
*ptr=0;\r
}\r
\r
ptr=str;\r
while(*ptr && *ptr!=' ' && *ptr!=9)\r
+ {\r
ptr++;\r
+ }\r
\r
*ptr=0;\r
ipaddr=str;\r
ptr++;\r
while(*ptr && (*ptr==' ' || *ptr==9))\r
+ {\r
ptr++;\r
+ }\r
ipname=ptr; \r
while(*ptr && *ptr!=' ' && *ptr!=9)\r
+ {\r
ptr++;\r
+ }\r
*ptr=0;\r
\r
if_exists(ip,ips,eq(ip->addr,ipaddr));\r
long traffic;\r
long guaranted;\r
int i;\r
+ int lmsid;\r
long l;\r
list(IpLog);\r
} *iplog,*iplogs;\r
accept_month=0;\r
traffic_month=0;\r
guaranted=0;\r
- lmsid=0;\r
+ lmsid=-1;\r
parse(filename)\r
{\r
y_ok=m_ok=0; \r
iplog->name = name;\r
iplog->guaranted = guaranted;\r
iplog->traffic = traffic_month;\r
+ iplog->lmsid = lmsid;\r
insert(iplog,iplogs,desc_order_by,traffic);\r
printf(" %ld MB\n",iplog->traffic);\r
}\r
\r
printf("\n\\r
Prometheus QoS - \"fair-per-IP\" Quality of Service setup utility.\n\\r
-Version %s - Copyright (C)2005-2008 Michael Polak (xChaos)\n\\r
+Version %s - Copyright (C)2005-2011 Michael Polak (xChaos)\n\\r
iptables-restore & burst tunning & classify modification by Ludva\n\\r
Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);\r
\r
if(found_lmsid)\r
{\r
fputs("<td align=\"right\">",f);\r
- if(ip->lmsid)\r
+ if(ip->lmsid > 0)\r
{\r
/*base URL will be configurable soon ... */\r
fprintf(f,"<a href=\"https://hermes.spoje.net/?m=customerinfo&id=%d\">%04d</a>\n", ip->lmsid, ip->lmsid);\r
}\r
+ else if(ip->lmsid == 0)\r
+ {\r
+ fputs("----",f);\r
+ }\r
fputs("</td>\n",f); \r
}\r
fprintf(f,"<td align=\"right\">%Lu M</td>\n", ip->credit);\r