GIT.Harvie.CZ
/
svn
/
Prometheus-QoS
/
.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
special class for overlimit packets (will be configurable)
[svn/Prometheus-QoS/.git]
/
parsehosts.c
diff --git
a/parsehosts.c
b/parsehosts.c
index b21af786e7d7c87a4dc0d5afb52107f08fe200a0..7e12a41b34d1280821ef1c916e417675fade4b4a 100644
(file)
--- a/
parsehosts.c
+++ b/
parsehosts.c
@@
-17,7
+17,7
@@
extern int free_min;
extern const int highest_priority;
\r
extern char *ip6prefix;
\r
\r
extern const int highest_priority;
\r
extern char *ip6prefix;
\r
\r
-
struct IP* find_network_for_ip(char *ipaddr_orig
);
\r
+
void update_network(char *look_for, struct IP* ip
);
\r
/* implemented in networks.c */
\r
\r
/* This must be object oriented! This looks almost like constructor ;-) */
\r
/* implemented in networks.c */
\r
\r
/* This must be object oriented! This looks almost like constructor ;-) */
\r
@@
-40,6
+40,7
@@
void TheIP(char *ipaddr, int is_network)
ip->direct = \
\r
ip->traffic = \
\r
ip->pktsup = \
\r
ip->direct = \
\r
ip->traffic = \
\r
ip->pktsup = \
\r
+ ip->pps_limit = \
\r
ip->pktsdown = 0;
\r
ip->keyword = keywords;
\r
ip->v6 = (strchr(ip->addr,':')!=NULL);
\r
ip->pktsdown = 0;
\r
ip->keyword = keywords;
\r
ip->v6 = (strchr(ip->addr,':')!=NULL);
\r
@@
-235,6
+236,7
@@
void parse_hosts(char *hosts)
*ptr=0;
\r
ip->max = ip->desired = atoi(ptr+1);
\r
}
\r
*ptr=0;
\r
ip->max = ip->desired = atoi(ptr+1);
\r
}
\r
+
\r
ip->min = atoi(substring);
\r
if(ip->min <= 0)
\r
{
\r
ip->min = atoi(substring);
\r
if(ip->min <= 0)
\r
{
\r
@@
-242,6
+244,7
@@
void parse_hosts(char *hosts)
str, free_min);
\r
ip->min = free_min;
\r
}
\r
str, free_min);
\r
ip->min = free_min;
\r
}
\r
+
\r
if(ip->max <= ip->min)
\r
{
\r
ip->fixedprio = TRUE;
\r
if(ip->max <= ip->min)
\r
{
\r
ip->fixedprio = TRUE;
\r
@@
-250,24
+253,23
@@
void parse_hosts(char *hosts)
else
\r
{
\r
ip->max -= ip->keyword->reserve_max;
\r
else
\r
{
\r
ip->max -= ip->keyword->reserve_max;
\r
- if(ip->max
<
ip->min)
\r
+ if(ip->max
<
ip->min)
\r
{
\r
{
\r
- ip->max
=
ip->min;
\r
+ ip->max
=
ip->min;
\r
}
\r
}
\r
}
\r
}
\r
- ip->mark = FIRSTIPCLASS+1+class_count++;
\r
\r
\r
- network = find_network_for_ip(ip->addr);
\r
- if(network)
\r
+ /* MTU is 1450 bytes = 11600 bits ~= 12 kbit, max is in kb/s
\r
+ average pkt 1/2 MTU = 6 kbit*/
\r
+ ip->pps_limit = ip->max/6;
\r
+ if(ip->pps_limit > 10000) /* this limit seems to be hardcoded in iptables */
\r
{
\r
{
\r
- network->min += ip->min;
\r
- network->desired += ip->max;
\r
- if(ip->max > network->max)
\r
- {
\r
- network->max = ip->max;
\r
- }
\r
+ ip->pps_limit = 0; /* do not apply packet limits */
\r
}
\r
\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
{
\r
group->count++;
\r
if_exists(group,groups,(group->min == ip->min))
\r
{
\r
group->count++;
\r
@@
-300,4
+302,7
@@
void parse_hosts(char *hosts)
exit(-1);
\r
}
\r
done; /* ugly macro end */
\r
exit(-1);
\r
}
\r
done; /* ugly macro end */
\r
+// TheIP("0.0.0.0", TRUE);
\r
+// ip->name = "TOTAL";
\r
+// ip->mask = 0;
\r
}
\ No newline at end of file
}
\ No newline at end of file
This page took
0.1108 seconds
and
4
git commands to generate.