int prio;\r
int fixedprio;\r
int group;\r
+ int lmsid;\r
unsigned long long direct;\r
unsigned long long proxy;\r
unsigned long long upload;\r
ip->addr = "";\r
ip->sharing = NULL;\r
ip->prio = highest_priority+1;\r
- ip->fixedprio = 0;\r
+ ip->lmsid = \\r
+ ip->fixedprio = \\r
ip->mark = \\r
ip->min = \\r
ip->max = \\r
/* debug printf("(%s,%d) -> ",ip,bitmask); */\r
\r
if(ip && *ip && bitmask>=0 && bitmask<=32)\r
+ {\r
string(outip,strlen(ip)+10); /*fuck unicode? assertion: 10>strlen("_%d_%d") */\r
+ }\r
else \r
+ {\r
/* should never exit here */\r
return "undefined";\r
+ }\r
outptr=outip;\r
while(ip && *ip)\r
{\r
if(dot<(bitmask/8-1)) \r
{\r
if(format_as_chainname)\r
+ {\r
*outptr='_';\r
+ }\r
else\r
+ {\r
*outptr='.';\r
+ }\r
outptr++;\r
dot++;\r
}\r
keyword->fixed_prio=0; /* fixed data limit for setting lower HTB prio */\r
keyword->reserve_min=8; /* bonus for nominal HTB rate bandwidth (in kbps) */\r
keyword->reserve_max=0; /* malus for nominal HTB ceil (in kbps) */\r
-/* obsolete:\r
- keyword->divide_max=0; relative malus: new_ceil=rate+(old_ceil-rate)/divide_max\r
- keyword->htb_ceil_bonus_divide=0; relative bonus: new_ceil=old_ceil+old_ceil/htb_ceil_bonus_divide */\r
keyword->default_prio=highest_priority+1;\r
keyword->html_color="000000";\r
keyword->ip_count=0;\r
{\r
int l=strlen(keyword->key);\r
\r
-\r
if(!strncmp(keyword->key,_,l) && strlen(_)>l+2)\r
{\r
char *tmptr=_; /* <---- l+1 ----> */\r
ioption("htb-default-prio",keyword->default_prio);\r
ioption("htb-rate-bonus",keyword->reserve_min);\r
ioption("htb-ceil-malus",keyword->reserve_max);\r
- /* obsolete:\r
- ioption("htb-ceil-divide",keyword->divide_max);\r
- ioption("htb-ceil-bonus-divide",keyword->htb_ceil_bonus_divide);\r
- */\r
option("leaf-discipline",keyword->leaf_discipline);\r
option("html-color",keyword->html_color);\r
_=tmptr;\r
\r
if(keyword->data_limit || keyword->fixed_limit || \r
keyword->data_prio || keyword->fixed_prio)\r
- use_credit=1; \r
+ {\r
+ use_credit=1; \r
+ }\r
}\r
}\r
}\r
}\r
}\r
\r
- if (strcmpi(cnf, "mark")){\r
- filter_type = 2;\r
- mark = "CLASSIFY";\r
- mark_iptables = "CLASSIFY --set-class 1:";\r
- }else{\r
- filter_type = 1;\r
- mark = "MARK";\r
- mark_iptables = "MARK --set-mark ";\r
+ if (strcmpi(cnf, "mark"))\r
+ {\r
+ filter_type = 2;\r
+ mark = "CLASSIFY";\r
+ mark_iptables = "CLASSIFY --set-class 1:";\r
+ }\r
+ else\r
+ {\r
+ filter_type = 1;\r
+ mark = "MARK";\r
+ mark_iptables = "MARK --set-mark ";\r
}\r
\r
/* are supplied values meaningful ?*/\r
ip->upload=traffic;\r
ip->pktsup=pkts;\r
if(include_upload)\r
+ {\r
ip->traffic+=traffic;\r
+ }\r
else \r
+ {\r
if(traffic>ip->traffic)\r
+ {\r
ip->traffic=traffic; \r
+ }\r
+ }\r
}\r
} \r
}\r
substring+=strlen(keyword->key)+1;\r
ptr=substring;\r
while(*ptr && *ptr!='-')\r
+ {\r
ptr++;\r
+ }\r
if(*ptr=='-')\r
{\r
*ptr=0;\r
else \r
{\r
ip->max-=ip->keyword->reserve_max;\r
-\r
-/*\r
- if(ip->keyword->divide_max>1)\r
- ip->max=ip->min+(ip->max-ip->min)/ip->keyword->divide_max;\r
- if(ip->keyword->htb_ceil_bonus_divide>0)\r
- ip->max+=ip->max/ip->keyword->htb_ceil_bonus_divide;\r
-*/\r
if(ip->max<ip->min)\r
+ {\r
ip->max=ip->min;\r
+ }\r
}\r
ip->mark=FIRSTIPCLASS+1+class_count++;\r
\r
break;\r
}\r
if(!sharedip)\r
+ {\r
printf("Unresolved shared connection: %s %s sharing-%s\n",ip->addr,ip->name,ip->sharing);\r
+ }\r
}\r
\r
if(enable_credit && just_flush<9)\r
/*-----------------------------------------------------------------*/\r
\r
iptables_file=fopen(iptablesfile,"w");\r
- if (iptables_file == NULL) {\r
+ if (iptables_file == NULL)\r
+ {\r
puts("Cannot open iptablesfile!");\r
exit(-1);\r
}\r
\r
log_file=fopen(cmdlog,"w");\r
- if (log_file == NULL) {\r
+ if (log_file == NULL) \r
+ {\r
puts("Cannot open logfile!");\r
exit(-1);\r
}\r
chain="post_noproxy"; \r
}\r
else\r
+ {\r
chain="POSTROUTING";\r
+ }\r
\r
sprintf(str,"-A %s -s %s -o %s -j ACCEPT", chain, qos_free_zone, lan);\r
save_line(str);\r
sort(idx,idxs,order_by,bitmask);\r
\r
i=0;\r
-\r
for_each(idx,idxs)\r
{\r
subnet=subnet_id(idx->addr,idx->bitmask);\r
sprintf(buf,"post_%s",idx->parent->id);\r
}\r
else\r
+ {\r
buf="POSTROUTING";\r
+ }\r
\r
sprintf(str,"-A %s -d %s/%d -o %s -j post_%s", buf, subnet, idx->bitmask, lan, idx->id);\r
save_line(str);\r
sprintf(buf,"forw_%s",idx->parent->id);\r
}\r
else\r
+ {\r
buf="FORWARD";\r
+ }\r
\r
sprintf(str,"-A %s -s %s/%d -o %s -j forw_%s", buf, subnet, idx->bitmask, wan, idx->id);\r
save_line(str);\r
/*-----------------------------------------------------------------*/\r
puts("Locating heavy downloaders and generating root classes ...");\r
/*-----------------------------------------------------------------*/\r
- sort(ip,ips,desc_order_by,traffic);\r
- \r
+ sort(ip,ips,desc_order_by,traffic); \r
\r
/*-----------------------------------------------------------------*/\r
/* sub-scope - local variables */ \r
safe_run(str);\r
}\r
\r
- if(group_count++<max_nesting) parent=group->id;\r
+ if(group_count++<max_nesting)\r
+ {\r
+ parent=group->id;\r
+ }\r
\r
rate-=digital_divide*group->min;\r
if(rate<group->min)rate=group->min;\r