aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2014-05-08 18:23:44 -0300
committerRenato Botelho <garga@FreeBSD.org>2014-05-08 18:23:44 -0300
commitd9a0afd04141ff3798358ea90770b91e23d597c0 (patch)
tree2b1ba995638d79841ce4288d5e5670327a603c1c
parent89ae41977ee81bd970c4e4cc7e3849300533e689 (diff)
parent76a6a0ee241ee33c77c07999dd901c10ef466694 (diff)
downloadpfsense-packages-d9a0afd04141ff3798358ea90770b91e23d597c0.tar.gz
pfsense-packages-d9a0afd04141ff3798358ea90770b91e23d597c0.tar.bz2
pfsense-packages-d9a0afd04141ff3798358ea90770b91e23d597c0.zip
Merge pull request #609 from dhoffend/master
-rw-r--r--config/quagga_ospfd/quagga_ospfd.inc69
-rw-r--r--config/quagga_ospfd/quagga_ospfd.xml11
-rw-r--r--config/quagga_ospfd/quagga_ospfd_interfaces.xml4
-rw-r--r--config/quagga_ospfd/quagga_ospfd_raw.xml71
-rw-r--r--config/quagga_ospfd/status_ospfd.php4
-rw-r--r--pkg_config.10.xml2
-rw-r--r--pkg_config.8.xml2
-rw-r--r--pkg_config.8.xml.amd642
8 files changed, 121 insertions, 44 deletions
diff --git a/config/quagga_ospfd/quagga_ospfd.inc b/config/quagga_ospfd/quagga_ospfd.inc
index 782baf0f..17c13246 100644
--- a/config/quagga_ospfd/quagga_ospfd.inc
+++ b/config/quagga_ospfd/quagga_ospfd.inc
@@ -74,20 +74,20 @@ function quagga_ospfd_install_conf() {
$quagga_config_base = PKG_QUAGGA_CONFIG_BASE;
$noaccept = "";
+
+ // generate ospfd.conf based on the assistant
+ if(is_array($config['installedpackages']['quaggaospfd']['config']))
+ $ospfd_conf = &$config['installedpackages']['quaggaospfd']['config'][0];
+ else {
+ log_error("Quagga OSPFd: No config data found.");
+ return;
+ }
- if ($config['installedpackages']['quaggaospfd']['rawconfig'] && $config['installedpackages']['quaggaospfd']['rawconfig']['item']) {
+ if (isset($config['installedpackages']['quaggaospfdraw']['config'][0]['ospfd'])
+ && !empty($config['installedpackages']['quaggaospfdraw']['config'][0]['ospfd'])) {
// if there is a raw config specifyed in tthe config.xml use that instead of the assisted config
- $conffile = implode("\n",$config['installedpackages']['quaggaospfd']['rawconfig']['item']);
- //$conffile = $config['installedpackages']['quaggaospfd']['rawconfig'];
+ $conffile = str_replace("\r","",base64_decode($config['installedpackages']['quaggaospfdraw']['config'][0]['ospfd']));
} else {
- // generate ospfd.conf based on the assistant
- if($config['installedpackages']['quaggaospfd']['config'])
- $ospfd_conf = &$config['installedpackages']['quaggaospfd']['config'][0];
- else {
- log_error("Quagga OSPFd: No config data found.");
- return;
- }
-
$conffile = "# This file was created by the pfSense package manager. Do not edit!\n\n";
if($ospfd_conf['password'])
@@ -100,7 +100,7 @@ function quagga_ospfd_install_conf() {
$passive_interfaces = array();
$interface_networks = array();
- if ($config['installedpackages']['quaggaospfdinterfaces']['config']) {
+ if (is_array($config['installedpackages']['quaggaospfdinterfaces']['config'])) {
foreach ($config['installedpackages']['quaggaospfdinterfaces']['config'] as $conf) {
$realif = get_real_interface($conf['interface']);
$conffile .= "interface {$realif}\n" ;
@@ -242,17 +242,23 @@ function quagga_ospfd_install_conf() {
fclose($fd);
/* Make zebra config */
- $zebraconffile = "# This file was created by the pfSense package manager. Do not edit!\n\n";
- if($ospfd_conf['password'])
- $zebraconffile .= "password {$ospfd_conf['password']}\n";
- if ($ospfd_conf['logging'])
- $zebraconffile .= "log syslog\n";
- if (!empty($noaccept)) {
- $zebraconffile .= $noaccept;
- $zebraconffile .= "ip prefix-list ACCEPTFILTER permit any\n";
- $zebraconffile .= "route-map ACCEPTFILTER permit 10\n";
- $zebraconffile .= "match ip address prefix-list ACCEPTFILTER\n";
- $zebraconffile .= "ip protocol ospf route-map ACCEPTFILTER\n";
+ if (isset($config['installedpackages']['quaggaospfdraw']['config'][0]['zebra'])
+ && !empty($config['installedpackages']['quaggaospfdraw']['config'][0]['zebra'])) {
+ // if there is a raw config specifyed in tthe config.xml use that instead of the assisted config
+ $zebraconffile = str_replace("\r","",base64_decode($config['installedpackages']['quaggaospfdraw']['config'][0]['zebra']));
+ } else {
+ $zebraconffile = "# This file was created by the pfSense package manager. Do not edit!\n\n";
+ if($ospfd_conf['password'])
+ $zebraconffile .= "password {$ospfd_conf['password']}\n";
+ if ($ospfd_conf['logging'])
+ $zebraconffile .= "log syslog\n";
+ if (!empty($noaccept)) {
+ $zebraconffile .= $noaccept;
+ $zebraconffile .= "ip prefix-list ACCEPTFILTER permit any\n";
+ $zebraconffile .= "route-map ACCEPTFILTER permit 10\n";
+ $zebraconffile .= "match ip address prefix-list ACCEPTFILTER\n";
+ $zebraconffile .= "ip protocol ospf route-map ACCEPTFILTER\n";
+ }
}
$fd = fopen("{$quagga_config_base}/zebra.conf", "w");
fwrite($fd, $zebraconffile);
@@ -375,23 +381,6 @@ function quagga_ospfd_validate_input() {
$input_errors[] = "Please select an interface to use for Quagga OSPFd.";
}
-// get the raw ospfd confi file for manual inspection/editing
-function quagga_ospfd_get_raw_config() {
- return file_get_contents(PKG_QUAGGA_CONFIG_BASE . "/ospfd.conf");
-}
-
-// serialize the raw ospfd confi file to config.xml
-function quagga_ospfd_put_raw_config($conffile) {
- global $config;
- if ($conffile == "")
- unset($config['installedpackages']['quaggaospfd']['rawconfig']);
- else {
- $config['installedpackages']['quaggaospfd']['rawconfig'] = array();
- $config['installedpackages']['quaggaospfd']['rawconfig']['item'] = explode("\n",$_POST['quagga_ospfd_raw']);
- $config['installedpackages']['quaggaospfd']['rawconfig'] = $conffile;
- }
-}
-
function quagga_get_carp_status_by_ip($ipaddr) {
$iface = trim(find_carp_interface($ipaddr));
if ($iface) {
diff --git a/config/quagga_ospfd/quagga_ospfd.xml b/config/quagga_ospfd/quagga_ospfd.xml
index 76a396fa..8edfcc3f 100644
--- a/config/quagga_ospfd/quagga_ospfd.xml
+++ b/config/quagga_ospfd/quagga_ospfd.xml
@@ -15,6 +15,11 @@
<item>https://packages.pfsense.org/packages/config/quagga_ospfd/quagga_ospfd_interfaces.xml</item>
</additional_files_needed>
<additional_files_needed>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>644</chmod>
+ <item>http://www.pfsense.com/packages/config/quagga_ospfd/quagga_ospfd_raw.xml</item>
+ </additional_files_needed>
+ <additional_files_needed>
<prefix>/usr/local/www/</prefix>
<chmod>644</chmod>
<item>https://packages.pfsense.org/packages/config/quagga_ospfd/status_ospfd.php</item>
@@ -42,6 +47,10 @@
<url>pkg.php?xml=quagga_ospfd_interfaces.xml</url>
</tab>
<tab>
+ <text>Raw Config</text>
+ <url>pkg_edit.php?xml=quagga_ospfd_raw.xml&amp;id=0</url>
+ </tab>
+ <tab>
<text>Status</text>
<url>/status_ospfd.php</url>
</tab>
@@ -199,4 +208,4 @@
<custom_php_validation_command>
quagga_ospfd_validate_input();
</custom_php_validation_command>
-</packagegui> \ No newline at end of file
+</packagegui>
diff --git a/config/quagga_ospfd/quagga_ospfd_interfaces.xml b/config/quagga_ospfd/quagga_ospfd_interfaces.xml
index 09635597..f9953112 100644
--- a/config/quagga_ospfd/quagga_ospfd_interfaces.xml
+++ b/config/quagga_ospfd/quagga_ospfd_interfaces.xml
@@ -27,6 +27,10 @@
<active/>
</tab>
<tab>
+ <text>Raw Config</text>
+ <url>pkg_edit.php?xml=quagga_ospfd_raw.xml&amp;id=0</url>
+ </tab>
+ <tab>
<text>Status</text>
<url>/status_ospfd.php</url>
</tab>
diff --git a/config/quagga_ospfd/quagga_ospfd_raw.xml b/config/quagga_ospfd/quagga_ospfd_raw.xml
new file mode 100644
index 00000000..b34558de
--- /dev/null
+++ b/config/quagga_ospfd/quagga_ospfd_raw.xml
@@ -0,0 +1,71 @@
+<packagegui>
+ <name>quagga_ospfd_raw</name>
+ <version>0.1</version>
+ <title>Services: Quagga OSPFd</title>
+ <include_file>/usr/local/pkg/quagga_ospfd.inc</include_file>
+ <aftersaveredirect>pkg_edit.php?xml=quagga_ospfd_raw.xml&amp;id=0</aftersaveredirect>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>077</chmod>
+ <item>http://www.pfsense.com/packages/config/quagga_ospfd/quagga_ospfd.inc</item>
+ </additional_files_needed>
+ <menu>
+ <name>OSPF</name>
+ <tooltiptext>Modify Quagga RAW Config.</tooltiptext>
+ <section>Services</section>
+ <configfile>quagga_ospfd.xml</configfile>
+ <url>/pkg_edit.php?xml=quagga_ospfd.xml&amp;id=0</url>
+ </menu>
+ <tabs>
+ <tab>
+ <text>Global Settings</text>
+ <url>pkg_edit.php?xml=quagga_ospfd.xml&amp;id=0</url>
+ </tab>
+ <tab>
+ <text>Interface Settings</text>
+ <url>pkg.php?xml=quagga_ospfd_interfaces.xml</url>
+ </tab>
+ <tab>
+ <text>Raw Config</text>
+ <url>pkg_edit.php?xml=quagga_ospfd_raw.xml&amp;id=0</url>
+ <active/>
+ </tab>
+ <tab>
+ <text>Status</text>
+ <url>/status_ospfd.php</url>
+ </tab>
+ </tabs>
+ <service>
+ <name>Quagga OSPFd</name>
+ <rcfile>quagga.sh</rcfile>
+ <executable>ospfd</executable>
+ </service>
+ <service>
+ <name>Quagga Zebra</name>
+ <rcfile>quagga.sh</rcfile>
+ <executable>zebra</executable>
+ </service>
+ <fields>
+ <field>
+ <fielddescr>ospfd.conf</fielddescr>
+ <fieldname>ospfd</fieldname>
+ <description>Note: Once you click "Save" below, the assistant (in the "Global Settings" and "Interface Settings" tabs above) will be overridden with whatever you type here. To get back the assisted config save this form below once with both empty input fields.</description>
+ <type>textarea</type>
+ <encoding>base64</encoding>
+ <rows>30</rows>
+ <cols>65</cols>
+ </field>
+ <field>
+ <fielddescr>zebra.conf</fielddescr>
+ <fieldname>zebra</fieldname>
+ <description>Note: Once you click "Save" below, the assistant (in the "Global Settings" and "Interface Settings" tabs above) will be overridden with whatever you type here. To get back the assisted config save this form below once with both empty input fields.</description>
+ <type>textarea</type>
+ <encoding>base64</encoding>
+ <rows>30</rows>
+ <cols>65</cols>
+ </field>
+ </fields>
+ <custom_php_resync_config_command>
+ quagga_ospfd_install_conf();
+ </custom_php_resync_config_command>
+</packagegui>
diff --git a/config/quagga_ospfd/status_ospfd.php b/config/quagga_ospfd/status_ospfd.php
index dc6c6aea..8ecf19d0 100644
--- a/config/quagga_ospfd/status_ospfd.php
+++ b/config/quagga_ospfd/status_ospfd.php
@@ -33,6 +33,7 @@ $pgtitle = "Quagga OSPF: Status";
include("head.inc");
$control_script = "/usr/local/bin/quaggactl";
+$pkg_homedir = "/var/etc/quagga";
/* List all of the commands as an index. */
function listCmds() {
@@ -90,6 +91,7 @@ function doCmdT($title, $command) {
$tab_array = array();
$tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=quagga_ospfd.xml&id=0");
$tab_array[] = array(gettext("Interface Settings"), false, "/pkg.php?xml=quagga_ospfd_interfaces.xml");
+ $tab_array[] = array(gettext("RAW Config"), false, "/pkg_edit.php?xml=quagga_ospfd_raw.xml&id=0");
$tab_array[] = array(gettext("Status"), true, "/status_ospfd.php");
display_top_tabs($tab_array);
?>
@@ -110,6 +112,8 @@ function doCmdT($title, $command) {
defCmdT("Quagga OSPF Interfaces", "{$control_script} ospf interfaces");
defCmdT("Quagga OSPF CPU Usage", "{$control_script} ospf cpu");
defCmdT("Quagga OSPF Memory", "{$control_script} ospf mem");
+ defCmdT("Quagga ospfd.conf", "/bin/cat {$pkg_homedir}/ospfd.conf");
+ defCmdT("Quagga zebra.conf", "/bin/cat {$pkg_homedir}/zebra.conf");
?>
<div id="cmdspace" style="width:100%">
<?php listCmds(); ?>
diff --git a/pkg_config.10.xml b/pkg_config.10.xml
index 562c7e94..fbeff13b 100644
--- a/pkg_config.10.xml
+++ b/pkg_config.10.xml
@@ -1299,7 +1299,7 @@
<name>Quagga OSPF</name>
<descr>OSPF routing protocol using Quagga -- WARNING! Installs files to the same place as OpenOSPFD and OpenBGPD. Installing both will break things.</descr>
<maintainer>jimp@pfsense.org</maintainer>
- <version>0.99.22.3 v0.6.1</version>
+ <version>0.99.22.3 v0.6.2</version>
<category>Routing</category>
<status>BETA</status>
<depends_on_package_pbi>quagga-0.99.22.3-##ARCH##.pbi</depends_on_package_pbi>
diff --git a/pkg_config.8.xml b/pkg_config.8.xml
index d21a8ebe..616c898d 100644
--- a/pkg_config.8.xml
+++ b/pkg_config.8.xml
@@ -1726,7 +1726,7 @@
<name>Quagga OSPF</name>
<descr>OSPF routing protocol using Quagga -- WARNING! Installs files to the same place as OpenOSPFD and OpenBGPD. Installing both will break things.</descr>
<maintainer>jimp@pfsense.org</maintainer>
- <version>0.99.22.3 v0.6.1</version>
+ <version>0.99.22.3 v0.6.2</version>
<category>Routing</category>
<status>BETA</status>
<depends_on_package_base_url>https://files.pfsense.org/packages/8/All/</depends_on_package_base_url>
diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64
index f536622c..c4d76916 100644
--- a/pkg_config.8.xml.amd64
+++ b/pkg_config.8.xml.amd64
@@ -1713,7 +1713,7 @@
<name>Quagga OSPF</name>
<descr>OSPF routing protocol using Quagga -- WARNING! Installs files to the same place as OpenOSPFD and OpenBGPD. Installing both will break things.</descr>
<maintainer>jimp@pfsense.org</maintainer>
- <version>0.99.22.3 v0.6.1</version>
+ <version>0.99.22.3 v0.6.2</version>
<category>Routing</category>
<status>BETA</status>
<depends_on_package_base_url>https://files.pfsense.org/packages/amd64/8/All/</depends_on_package_base_url>