Skip to contentSkip to conversation

merge mod_alarm() into add_alarm()

PATCH Pablo Neira Ayuso 1 participant 5 messages Jan 20, 2008 – Jan 21, 2008 6 messages not in the archive netfilter

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

Pablo Neira Ayuso

author maintainer
#2 lore raw
Quoted 6 lines · Max Kellermann
 include/alarm.h   |    4 +---
 src/alarm.c       |   13 +++++--------
 src/cache_timer.c |    5 ++---
 src/sync-alarm.c  |   17 +++++++----------
 src/sync-ftfw.c   |    8 +++-----
 5 files changed, 18 insertions(+), 29 deletions(-)

Applied a similar version. Thanks.

BTW, I'm cc'ing to both netfilter-devel and netfilter-failover, next time just include netfilter-devel since we're discussing development stuff.

Signature · 1 line
"Los honestos son inadaptados sociales" -- Les Luthiers

A message that is not in the archive (sent off-list or not yet received): [email protected]

author maintainer
#4 lore raw

Re: [nf-failover] [conntrack-utils PATCH r7254 02/14] remove duplicate init_alarm() invocations

src/sync-alarm.c static void cache_alarm_add(struct us_conntrack *u, void *data) · line 52

Quoted 9 lines · Max Kellermann
src/sync-alarm.c +0 -1
index f605586..062c0b4 100644
@@ -49,7 +49,6 @@ static void cache_alarm_add(struct us_conntrack *u, void *data)
 {
 	struct alarm_list *alarm = data;
 
-	init_alarm(alarm, u, refresher);

I guess that you wanted to remove init_alarm() from refresher() instead. Fixed and applied. Thanks.

Signature · 1 line
"Los honestos son inadaptados sociales" -- Les Luthiers

A message that is not in the archive (sent off-list or not yet received): [email protected]

author maintainer
#6 lore raw

Re: [nf-failover] [conntrack-utils PATCH r7254 04/14] fix misoptimization for next_alarm calculation

Quoted 12 lines · Max Kellermann

do_alarm_run() determines the next_alarm time. there is however a condition where this result comes wrong, because of "unsafe" side effects of list_for_each_entry_safe(). Example: imagine there are two
alarms: A is due now, and B is due in 5 minutes.

When do_alarm_run() runs alarm A, list_for_each_entry_safe() remembers B as the alarm for the next loop iteration.

Now A re-schedules itself in 1 minute. It is again the first entry in the alarm_list queue, but list_for_each_entry_safe() will not handle it in this loop.

Quoted 5 lines

Instead, do_alarm_run() sees B and returns "5 minutes" as the next_alarm time.

Solve this by breaking from the loop when a late event is detected, and letting get_next_alarm() do all the work.

Good point. I noticed this while rewriting the alarm scheduler, in the rewrite it should handle this case correctly.

Signature · 1 line
"Los honestos son inadaptados sociales" -- Les Luthiers

A message that is not in the archive (sent off-list or not yet received): [email protected]

author maintainer
#8 lore raw

Re: [nf-failover] [conntrack-utils PATCH r7254 08/14] check alarms even if select()!=0

Quoted 5 lines · Max Kellermann

It is not documented that select() always returns 0 when the timeout expires - the timeout may expire, and there may be events on file descriptors at the same time. Don't check the select() return value, check timerisset(next_alarm) instead, and always update next_alarm with get_next_alarm()

Indeed, good point. This was fixed in r7260.

Quoted 2 lines

Also the old code never checked for new alarms which were added during the file descriptor handlers.

Same thing.

Signature · 1 line
"Los honestos son inadaptados sociales" -- Les Luthiers

A message that is not in the archive (sent off-list or not yet received): [email protected]

author maintainer
#10 lore raw

Re: [nf-failover] [conntrack-utils PATCH r7254 05/14] make the "tv" parameter const

I have kept back 5/14, 6/14, 7/14 and 9/14 since I don't find an obvious way to merge this to r7260. Thanks anyway for your work again.

Signature · 1 line
"Los honestos son inadaptados sociales" -- Les Luthiers