aboutsummaryrefslogtreecommitdiffstats
path: root/config/routed/routed.inc
diff options
context:
space:
mode:
authorChris Buechler <cmb@pfsense.org>2015-11-14 23:54:36 -0600
committerChris Buechler <cmb@pfsense.org>2015-11-14 23:54:36 -0600
commit9f8721bfa64e9c069a3e431a770b1360b19f9621 (patch)
tree3275436be7b1edacb176eb34d69fdca8fa539ebb /config/routed/routed.inc
parent0aedb5463da777b29d114b56af95381973b12346 (diff)
parentd4cd9e30cfae8cf3ac6c9756ed6d27db33c79b61 (diff)
downloadpfsense-packages-9f8721bfa64e9c069a3e431a770b1360b19f9621.tar.gz
pfsense-packages-9f8721bfa64e9c069a3e431a770b1360b19f9621.tar.bz2
pfsense-packages-9f8721bfa64e9c069a3e431a770b1360b19f9621.zip
Merge pull request #1163 from doktornotor/patch-20
Diffstat (limited to 'config/routed/routed.inc')
-rw-r--r--config/routed/routed.inc30
1 files changed, 21 insertions, 9 deletions
diff --git a/config/routed/routed.inc b/config/routed/routed.inc
index 3bcef0aa..c83b0052 100644
--- a/config/routed/routed.inc
+++ b/config/routed/routed.inc
@@ -29,7 +29,6 @@
*/
function setup_routed() {
global $config;
- $gw = "";
if (!is_array($config['installedpackages']['routed'])) {
return;
@@ -37,6 +36,10 @@ function setup_routed() {
if (!is_array($config['installedpackages']['routed']['config'])) {
return;
}
+
+ $gw = "";
+ conf_mount_rw();
+
if (isset($config['installedpackages']['routed']['config'][0]['enable']) &&
$config['installedpackages']['routed']['config'][0]['enable'] == "on") {
/* if user selected individual interfaces */
@@ -55,21 +58,30 @@ function setup_routed() {
/* setup for all interfaces */
$gw = setup_etc_gateways();
}
- conf_mount_rw();
file_put_contents("/etc/gateways", $gw);
- conf_mount_ro();
- restart_service("routed");
+ routed_write_rcfile();
+ if (is_service_running("routed")) {
+ restart_service("routed");
+ } else {
+ start_service("routed");
+ }
} else {
- stop_service("routed");
+ if (is_service_running("routed")) {
+ stop_service("routed");
+ }
+ unlink_if_exists("/etc/gateways");
+ unlink_if_exists("/usr/local/etc/rc.d/routed.sh");
}
+
+ conf_mount_ro();
}
-function setup_etc_gateways($iface="", $mode="") {
+function setup_etc_gateways($iface = "", $mode = "") {
global $config;
$ret = "";
if ($iface != "") {
- $realif=convert_friendly_interface_to_real_interface_name($iface);
+ $realif = convert_friendly_interface_to_real_interface_name($iface);
if (!empty($realif)) {
$ret = "if={$realif} ";
}
@@ -104,7 +116,7 @@ function setup_etc_gateways($iface="", $mode="") {
return $ret;
}
-function routed_install_command() {
+function routed_write_rcfile() {
write_rcfile(array(
"file" => "routed.sh",
"start" => "/usr/bin/nohup /sbin/routed > /dev/null 2>&1 &",
@@ -114,7 +126,7 @@ function routed_install_command() {
}
function routed_deinstall_command() {
- stop_service("routed");
+ unlink_if_exists("/etc/gateways");
unlink_if_exists("/usr/local/etc/rc.d/routed.sh");
}