aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--config/routed/routed.inc30
-rw-r--r--config/routed/routed.priv.inc38
-rw-r--r--config/routed/routed.xml14
-rw-r--r--pkg_config.10.xml2
-rw-r--r--pkg_config.8.xml2
-rw-r--r--pkg_config.8.xml.amd642
6 files changed, 70 insertions, 18 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");
}
diff --git a/config/routed/routed.priv.inc b/config/routed/routed.priv.inc
new file mode 100644
index 00000000..f0068f81
--- /dev/null
+++ b/config/routed/routed.priv.inc
@@ -0,0 +1,38 @@
+<?php
+/*
+ routed.priv.inc
+ part of pfSense (http://www.pfSense.org/)
+ Copyright (C) 2015 ESF, LLC
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+global $priv_list;
+
+$priv_list['page-services-routed'] = array();
+$priv_list['page-services-routed']['name'] = "WebCfg - Services: Routed";
+$priv_list['page-services-routed']['descr'] = "Allow access to routed package GUI";
+$priv_list['page-services-routed']['match'] = array();
+$priv_list['page-services-routed']['match'][] = "pkg.php?xml=routed.xml*";
+$priv_list['page-services-routed']['match'][] = "pkg_edit.php?xml=routed.xml*";
+
+?>
diff --git a/config/routed/routed.xml b/config/routed/routed.xml
index b38d7ee3..960cf83b 100644
--- a/config/routed/routed.xml
+++ b/config/routed/routed.xml
@@ -42,17 +42,23 @@
]]>
</copyright>
<name>routed</name>
- <version>1.2</version>
+ <version>1.2.2</version>
<title>Services: RIP</title>
<include_file>/usr/local/pkg/routed.inc</include_file>
+ <aftersaveredirect>pkg_edit.php?xml=routed.xml</aftersaveredirect>
<additional_files_needed>
+ <prefix>/usr/local/pkg/</prefix>
<item>https://packages.pfsense.org/packages/config/routed/routed.inc</item>
</additional_files_needed>
+ <additional_files_needed>
+ <prefix>/etc/inc/priv/</prefix>
+ <item>https://packages.pfsense.org/packages/config/routed/routed.priv.inc</item>
+ </additional_files_needed>
<menu>
<name>RIP</name>
<section>Services</section>
<configfile>routed.xml</configfile>
- <url>pkg_edit.php?xml=routed.xml&amp;id=0</url>
+ <url>pkg_edit.php?xml=routed.xml</url>
</menu>
<service>
<name>routed</name>
@@ -117,13 +123,9 @@
<type>checkbox</type>
</field>
</fields>
- <aftersaveredirect>pkg_edit.php?xml=routed.xml&amp;id=0</aftersaveredirect>
<custom_php_resync_config_command>
setup_routed();
</custom_php_resync_config_command>
- <custom_php_install_command>
- routed_install_command();
- </custom_php_install_command>
<custom_php_deinstall_command>
routed_deinstall_command();
</custom_php_deinstall_command>
diff --git a/pkg_config.10.xml b/pkg_config.10.xml
index a71fa8c7..f34af9b7 100644
--- a/pkg_config.10.xml
+++ b/pkg_config.10.xml
@@ -445,7 +445,7 @@
<category>Network Management</category>
<port_category>net</port_category>
<config_file>https://packages.pfsense.org/packages/config/routed/routed.xml</config_file>
- <version>1.2.1</version>
+ <version>1.2.2</version>
<status>RELEASE</status>
<required_version>2.2</required_version>
<configurationfile>routed.xml</configurationfile>
diff --git a/pkg_config.8.xml b/pkg_config.8.xml
index cc3c99c1..28e13668 100644
--- a/pkg_config.8.xml
+++ b/pkg_config.8.xml
@@ -479,7 +479,7 @@
<descr>RIP v1 and v2 daemon.</descr>
<category>Network Management</category>
<config_file>https://packages.pfsense.org/packages/config/routed/routed.xml</config_file>
- <version>1.1</version>
+ <version>1.2.2</version>
<status>Stable</status>
<required_version>2.1</required_version>
<configurationfile>routed.xml</configurationfile>
diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64
index 23101aaf..a5e54c50 100644
--- a/pkg_config.8.xml.amd64
+++ b/pkg_config.8.xml.amd64
@@ -466,7 +466,7 @@
<descr>RIP v1 and v2 daemon.</descr>
<category>Network Management</category>
<config_file>https://packages.pfsense.org/packages/config/routed/routed.xml</config_file>
- <version>1.1</version>
+ <version>1.2.2</version>
<status>Stable</status>
<required_version>2.1</required_version>
<configurationfile>routed.xml</configurationfile>