git://git.onelab.eu
/
distributedratelimiting.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tweaked the timing of flow expiration.
[distributedratelimiting.git]
/
drl
/
standard.c
diff --git
a/drl/standard.c
b/drl/standard.c
index
5b860a3
..
5c6a6d8
100644
(file)
--- a/
drl/standard.c
+++ b/
drl/standard.c
@@
-106,7
+106,7
@@
standard_flow *standard_table_lookup(standard_flow_table table, const key_flow *
dst.s_addr = ntohl(flow->dest_ip);
strcpy(sip, inet_ntoa(src));
strcpy(dip, inet_ntoa(dst));
dst.s_addr = ntohl(flow->dest_ip);
strcpy(sip, inet_ntoa(src));
strcpy(dip, inet_ntoa(dst));
- printlog(LOG_DEBUG, "ALLOC:%s:%h
d -> %s:%hd
\n", sip,
+ printlog(LOG_DEBUG, "ALLOC:%s:%h
u -> %s:%hu
\n", sip,
flow->source_port, dip, flow->dest_port);
}
flow->source_port, dip, flow->dest_port);
}
@@
-137,7
+137,6
@@
int standard_table_sample(standard_flow_table table, const key_flow *key) {
void standard_table_remove(standard_flow_table table, standard_flow *flow) {
key_flow key;
uint32_t hash;
void standard_table_remove(standard_flow_table table, standard_flow *flow) {
key_flow key;
uint32_t hash;
- standard_flow *current, *prev;
assert(flow);
assert(flow);
@@
-156,23
+155,23
@@
void standard_table_remove(standard_flow_table table, standard_flow *flow) {
/* It's the head of the hash list. */
table->flows[hash] = flow->nexth;
} else {
/* It's the head of the hash list. */
table->flows[hash] = flow->nexth;
} else {
+ standard_flow *current, *prev;
+
prev = table->flows[hash];
prev = table->flows[hash];
- current = table->flows[hash]->nexth;
-
while (current != NULL
) {
+
for (current = table->flows[hash]->nexth; current; current = current->nexth
) {
if (current == flow) {
prev->nexth = flow->nexth;
break;
} else {
prev = current;
if (current == flow) {
prev->nexth = flow->nexth;
break;
} else {
prev = current;
- current = current->next;
}
}
}
}
- //assert(current != NULL);
if (current == NULL) {
if (current == NULL) {
- printlog(LOG_
DEBUG
, "Flow %p disappeared?\n", flow);
+ printlog(LOG_
CRITICAL
, "Flow %p disappeared?\n", flow);
}
}
+ assert(current != NULL);
}
/* Remove the flow from the linked list. */
}
/* Remove the flow from the linked list. */