diff options
author | Renato Botelho <renato@netgate.com> | 2015-08-11 08:13:15 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2015-08-11 08:13:15 -0300 |
commit | 825c50cd46de155ea98755f998a9691107f59f41 (patch) | |
tree | 9d7edf4ae2f5b75367ae02fcfe0f687dccb7d706 /config | |
parent | ba0577ec9993d99e742c44b0ce56b12a50b24ddc (diff) | |
parent | e456f6d20d83021176738436a862116b36f97c51 (diff) | |
download | pfsense-packages-825c50cd46de155ea98755f998a9691107f59f41.tar.gz pfsense-packages-825c50cd46de155ea98755f998a9691107f59f41.tar.bz2 pfsense-packages-825c50cd46de155ea98755f998a9691107f59f41.zip |
Merge pull request #976 from doktornotor/patch-19
Diffstat (limited to 'config')
-rw-r--r-- | config/olsrd/olsrd.inc | 91 | ||||
-rw-r--r-- | config/olsrd/olsrd.xml | 79 |
2 files changed, 118 insertions, 52 deletions
diff --git a/config/olsrd/olsrd.inc b/config/olsrd/olsrd.inc index 9eee0196..4e15f9cf 100644 --- a/config/olsrd/olsrd.inc +++ b/config/olsrd/olsrd.inc @@ -1,34 +1,64 @@ <?php -/* COPYRIGHT */ - +/* + olsrd.inc + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2012 Ermal Luçi + 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. +*/ require_once("config.inc"); function setup_wireless_olsr() { global $config, $g; - if ($g['platform'] == 'jail' || !$config['installedpackages']['olsrd'] || !$config['installedpackages']) + if ($g['platform'] == 'jail' || !$config['installedpackages']['olsrd'] || !$config['installedpackages']) { return; - if(isset($config['system']['developerspew'])) { + } + if (isset($config['system']['developerspew'])) { $mt = microtime(); echo "setup_wireless_olsr($interface) being called $mt\n"; } conf_mount_rw(); - foreach($config['installedpackages']['olsrd']['config'] as $olsrd) { + foreach ($config['installedpackages']['olsrd']['config'] as $olsrd) { $olsr_enable = $olsrd['enable']; if ($olsr_enable <> "on") { - if (is_process_running("olsrd")) + if (is_process_running("olsrd")) { mwexec("/usr/bin/killall olsrd", true); + } return; } $fd = fopen("{$g['varetc_path']}/olsr.conf", "w"); - if($olsrd['announcedynamicroute'] or $olsrd['enableannounce'] == "on") { + if ($olsrd['announcedynamicroute'] or $olsrd['enableannounce'] == "on") { $enableannounce .= "\nHna4\n"; $enableannounce .= "{\n"; - if($olsrd['announcedynamicroute']) + } + if ($olsrd['announcedynamicroute']) { $enableannounce .= "\t{$olsrd['announcedynamicroute']}\n"; - if($olsrd['enableannounce'] == "on") + } + if ($olsrd['enableannounce'] == "on") { $enableannounce .= "0.0.0.0 0.0.0.0"; $enableannounce .= "\n}\n"; } else { @@ -171,8 +201,8 @@ MprCoverage 3 EODA; -if($olsrd['enablehttpinfo'] == "on") { - $olsr .= <<<EODB + if ($olsrd['enablehttpinfo'] == "on") { + $olsr .= <<<EODB LoadPlugin "/usr/local/lib/olsrd_httpinfo.so.0.1" { @@ -182,11 +212,11 @@ LoadPlugin "/usr/local/lib/olsrd_httpinfo.so.0.1" EODB; -} + } -if($olsrd['enabledsecure'] == "on") { - @file_put_contents("{$g['tmp_path']}/olsrkey.txt", $olsrd['securekey']); - $olsr .= <<<EODC + if ($olsrd['enabledsecure'] == "on") { + @file_put_contents("{$g['tmp_path']}/olsrkey.txt", $olsrd['securekey']); + $olsr .= <<<EODC LoadPlugin "/usr/local/lib/olsrd_secure.so.0.5" { @@ -195,9 +225,9 @@ LoadPlugin "/usr/local/lib/olsrd_secure.so.0.5" EODC; -} + } -if($olsrd['enabledyngw'] == "on") { + if ($olsrd['enabledyngw'] == "on") { /* unset default route, olsr auto negotiates */ mwexec("/sbin/route delete default"); @@ -222,13 +252,13 @@ LoadPlugin "/usr/local/lib/olsrd_dyn_gw.so.0.4" EODE; -} + } -foreach($config['installedpackages']['olsrd']['config'] as $conf) { - $interfaces = explode(',', $conf['iface_array']); - foreach($interfaces as $interface) { - $realinterface = convert_friendly_interface_to_real_interface_name($interface); -$olsr .= <<<EODAD + foreach ($config['installedpackages']['olsrd']['config'] as $conf) { + $interfaces = explode(',', $conf['iface_array']); + foreach ($interfaces as $interface) { + $realinterface = convert_friendly_interface_to_real_interface_name($interface); + $olsr .= <<<EODAD Interface "{$realinterface}" { @@ -271,20 +301,21 @@ Interface "{$realinterface}" EODAD; + } + break; } - break; + + fwrite($fd, $olsr); + fclose($fd); + } - fwrite($fd, $olsr); - fclose($fd); - } - if (is_process_running("olsrd")) + if (is_process_running("olsrd")) { mwexec("/usr/bin/killall olsrd", true); + } sleep(2); - mwexec_bg("/usr/local/sbin/olsrd -f {$g['varetc_path']}/olsr.conf"); - conf_mount_ro(); } diff --git a/config/olsrd/olsrd.xml b/config/olsrd/olsrd.xml index 3939f357..464f730d 100644 --- a/config/olsrd/olsrd.xml +++ b/config/olsrd/olsrd.xml @@ -1,19 +1,59 @@ <?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE packagegui SYSTEM "../schema/packages.dtd"> +<?xml-stylesheet type="text/xsl" href="../xsl/package.xsl"?> <packagegui> + <copyright> +<![CDATA[ +/* $Id$ */ +/* ====================================================================================== */ +/* + olsrd.xml + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2012 Ermal Luçi + 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. +*/ +/* ====================================================================================== */ + ]]> + </copyright> <name>olsrd</name> - <version>1.0</version> + <version>1.0.3</version> <title>OLSRD</title> <include_file>/usr/local/pkg/olsrd.inc</include_file> - <!-- Menu is where this packages menu will appear --> <menu> <name>OLSRD</name> <section>Services</section> <configfile>olsrd.xml</configfile> </menu> <service> - <name>OLSRD</name> - <rcfile>/usr/local/sbin/olsrd -f /var/etc/olsr.conf</rcfile> - </service> + <name>OLSRD</name> + <rcfile>/usr/local/sbin/olsrd -f /var/etc/olsr.conf</rcfile> + </service> <tabs> <tab> <text>OLSRD Settings</text> @@ -22,20 +62,15 @@ </tab> </tabs> <additional_files_needed> - <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> - <item>https://packages.pfsense.org/packages/config/olsrd/olsrd.inc</item> - </additional_files_needed> - <!-- configpath gets expanded out automatically and config items will be - stored in that location --> + <prefix>/usr/local/pkg/</prefix> + <item>https://packages.pfsense.org/packages/config/olsrd/olsrd.inc</item> + </additional_files_needed> <configpath>['installedpackages']['OLSRD']['config']</configpath> - <!-- fields gets invoked when the user adds or edits a item. the following items - will be parsed and rendered for the user as a gui with input, and selectboxes. --> <fields> <field> <fielddescr>Enable OLSR</fielddescr> <fieldname>enable</fieldname> - <description>Enables the dynamic mesh linking daemon</description> + <description>Enables the dynamic mesh linking daemon.</description> <type>checkbox</type> </field> <field> @@ -56,18 +91,18 @@ <multiple>true</multiple> <size>3</size> <type>interfaces_selection</type> - <description>Select the interfaces that OLSR will bind to. You can use the CTRL or COMMAND key to select multiple interfaces.</description> + <description>Select the interfaces that OLSR will bind to. You can use the CTRL or COMMAND key to select multiple interfaces.</description> </field> <field> <fielddescr>Enable HTTPInfo Plugin</fielddescr> <fieldname>enablehttpinfo</fieldname> - <description>Enables the OLSR stats web server</description> + <description>Enables the OLSR stats web server.</description> <type>checkbox</type> </field> <field> <fielddescr>HTTPInfo Port</fielddescr> <fieldname>port</fieldname> - <description>Port that HTTPInfo will listen on</description> + <description>Port that HTTPInfo will listen on.</description> <type>input</type> </field> <field> @@ -85,19 +120,19 @@ <field> <fielddescr>Enable Dynamic Gateway</fielddescr> <fieldname>enabledyngw</fieldname> - <description>Enables the OLSR Dynamic Gateways feature</description> + <description>Enables the OLSR Dynamic Gateways feature.</description> <type>checkbox</type> </field> <field> <fielddescr>Announce self as Dynamic Gateway</fielddescr> <fieldname>enableannounce</fieldname> - <description>Enables the OLSR Dynamic Gateways Announcing feature</description> + <description>Enables the OLSR Dynamic Gateways Announcing feature.</description> <type>checkbox</type> </field> <field> <fielddescr>Announce Dynamic local route</fielddescr> <fieldname>announcedynamicroute</fieldname> - <description>Enter the IP/Netmask</description> + <description>Enter the IP/Netmask.</description> <type>textarea</type> <rows>3</rows> <cols>50</cols> @@ -105,7 +140,7 @@ <field> <fielddescr>Ping</fielddescr> <fieldname>ping</fieldname> - <description>Pings this host to ensure connectivity</description> + <description>Pings this host to ensure connectivity.</description> <type>input</type> </field> <field> @@ -117,7 +152,7 @@ <field> <fielddescr>Enable Secure Mode</fielddescr> <fieldname>enabledsecure</fieldname> - <description>Enables the secure mode</description> + <description>Enables the secure mode.</description> <type>checkbox</type> </field> <field> |