From 07eccf65bb39e57f100d0ac572aac340377a5c84 Mon Sep 17 00:00:00 2001 From: Manuel Kasper Date: Wed, 3 Sep 2008 17:21:32 +0000 Subject: [PATCH] ! fix race condition on $childrunning when forking --- README | 10 +++++++++- bin/netflow-asstatd.pl | 3 ++- www/history.php | 2 +- www/linkusage.php | 2 +- www/top.php | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/README b/README index f1ad4dc..6432423 100644 --- a/README +++ b/README @@ -1,8 +1,16 @@ -AS-Stats v1 (2008-02-19) +AS-Stats v1.1 (2008-09-03) a simple tool to generate per-AS traffic graphs from NetFlow records by Manuel Kasper, Monzoon Networks AG -------------------------------------------------------------------- +Changes +------- +v1.1 Fix for a potential race condition surrounding $childrunning + (reported by Yann Gauteron; experienced on a Linux system) + +v1 Initial release + + How it works ------------ diff --git a/bin/netflow-asstatd.pl b/bin/netflow-asstatd.pl index 12452b6..ab2cb78 100755 --- a/bin/netflow-asstatd.pl +++ b/bin/netflow-asstatd.pl @@ -144,13 +144,14 @@ sub flush_cache { return; } + $childrunning = 1; my $pid = fork(); if (!defined $pid) { + $childrunning = 0; print "cannot fork\n"; } elsif ($pid != 0) { # in parent - $childrunning = 1; $ascache_lastflush = time; $ascache = {}; return; diff --git a/www/history.php b/www/history.php index bacd13b..c7e5787 100644 --- a/www/history.php +++ b/www/history.php @@ -55,7 +55,7 @@ AS: diff --git a/www/linkusage.php b/www/linkusage.php index 088bca4..ae53935 100644 --- a/www/linkusage.php +++ b/www/linkusage.php @@ -45,7 +45,7 @@ $class = (($i % 2) == 0) ? "even" : "odd"; diff --git a/www/top.php b/www/top.php index 6f4cbf5..b794a1e 100644 --- a/www/top.php +++ b/www/top.php @@ -90,7 +90,7 @@ foreach ($knownlinks as $link) {