summaryrefslogtreecommitdiffstats
path: root/etc/rc.linkup
diff options
context:
space:
mode:
authorErmal LUÇI <eri@pfsense.org>2014-12-02 11:24:47 +0100
committerErmal LUÇI <eri@pfsense.org>2014-12-02 11:24:47 +0100
commit2eb3efc20a504c48b66546b4d6b9c9f837555638 (patch)
treec04efdcc2d28629f2bc59cbe1294bd0c1fe0ca35 /etc/rc.linkup
parent6a1ed2cd200f337a9bb647f19ae66606eb83c638 (diff)
downloadpfsense-2eb3efc20a504c48b66546b4d6b9c9f837555638.zip
pfsense-2eb3efc20a504c48b66546b4d6b9c9f837555638.tar.gz
Lock rc.linkup based on interface to avoid races in between up/down events which might create a loop. This is more a timing issue but better enforce serialization here. check_reload_status forces this but not between start and stop but just between similar events. Probably need to bring more inteligence there.
Diffstat (limited to 'etc/rc.linkup')
-rwxr-xr-xetc/rc.linkup5
1 files changed, 4 insertions, 1 deletions
diff --git a/etc/rc.linkup b/etc/rc.linkup
index 6cc1581..59e2089 100755
--- a/etc/rc.linkup
+++ b/etc/rc.linkup
@@ -110,6 +110,7 @@ if (isset($_GET['interface'])) {
$action = $argv[1];
$realiface = $argv[2];
}
+
switch($action) {
case "start":
case "stop":
@@ -120,11 +121,13 @@ default:
/* NOTREACHED */
break;
}
+
if (!empty($realiface)) {
if (substr($realiface, 0, 4) == 'ovpn') {
log_error("Ignoring link event for ovpn interface");
return;
}
+ $rclinkuplock = lock("rclinkup{$realiface}", LOCK_EX);
$interface = convert_real_interface_to_friendly_interface_name($realiface);
if (!empty($interface))
handle_argument_group($interface, $action);
@@ -145,6 +148,6 @@ if (!empty($realiface)) {
}
}
}
+ unlock($rclinkuplock);
}
-
?>
OpenPOWER on IntegriCloud