aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/quagga_ospfd/quagga_ospfd.inc270
-rw-r--r--config/quagga_ospfd/quagga_ospfd.xml173
-rw-r--r--config/quagga_ospfd/quagga_ospfd_interfaces.xml128
-rw-r--r--config/quagga_ospfd/quaggactl75
-rw-r--r--config/quagga_ospfd/status_ospfd.php129
-rw-r--r--pkg_config.8.xml15
-rw-r--r--pkg_config.8.xml.amd6415
7 files changed, 805 insertions, 0 deletions
diff --git a/config/quagga_ospfd/quagga_ospfd.inc b/config/quagga_ospfd/quagga_ospfd.inc
new file mode 100644
index 00000000..2a068022
--- /dev/null
+++ b/config/quagga_ospfd/quagga_ospfd.inc
@@ -0,0 +1,270 @@
+<?php
+/*
+ quagga_ospfd.inc
+ Copyright (C) 2010 Ermal Luçi
+ Copyright (C) 2012 Jim Pingle
+ part of pfSense
+ 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.
+*/
+
+function quagga_ospfd_get_interfaces() {
+ global $config;
+ $interfaces = get_configured_interface_with_descr();
+ $ospf_ifs = array();
+ foreach ($interfaces as $iface => $ifacename) {
+ $tmp["name"] = $ifacename;
+ $tmp["value"] = $iface;
+ $ospf_ifs[] = $tmp;
+ }
+
+ foreach (array('server', 'client') as $mode) {
+ if (is_array($config['openvpn']["openvpn-{$mode}"])) {
+ foreach ($config['openvpn']["openvpn-{$mode}"] as $id => $setting) {
+ if (!isset($setting['disable'])) {
+ $tmp["name"] = gettext("OpenVPN") . " ".$mode.": ".htmlspecialchars($setting['description']);
+ $tmp["value"] = 'ovpn' . substr($mode, 0, 1) . $setting['vpnid'];
+ $ospf_ifs[] = $tmp;
+ }
+ }
+ }
+ }
+
+ return $ospf_ifs;
+}
+
+function quagga_ospfd_install_conf() {
+ global $config, $g, $input_errors;
+
+ conf_mount_rw();
+
+ if ($config['installedpackages']['quaggaospfd']['rawconfig'] && $config['installedpackages']['quaggaospfd']['rawconfig']['item']) {
+ // 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'];
+ } 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'])
+ $conffile .= "password {$ospfd_conf['password']}\n";
+
+ if ($ospfd_conf['logging'])
+ $conffile .= "log syslog\n";
+
+ /* Interface Settings */
+ $passive_interfaces = array();
+ $interface_networks = array();
+ if ($config['installedpackages']['quaggaospfdinterfaces']['config']) {
+ foreach ($config['installedpackages']['quaggaospfdinterfaces']['config'] as $conf) {
+ $realif = get_real_interface($conf['interface']);
+ $conffile .= "interface {$realif}\n" ;
+ if (!empty($conf['metric'])) {
+ $conffile .= " ip ospf cost {$conf['metric']}\n";
+ }
+ if (!empty($conf['hellointervalinseconds'])) {
+ $conffile .= " ip ospf hello-interval {$conf['hellointervalinseconds']}\n";
+ }
+ if ($conf['md5password'] && !empty($conf['password'])) {
+ $conffile .= " ip ospf authentication message-digest\n";
+ $conffile .= " ip ospf message-digest-key 1 md5 \"" . substr($conf['password'], 0, 15) . "\"\n";
+ } else if (!empty($conf['password'])) {
+ $conffile .= " ip ospf authentication-key \"" . substr($conf['password'], 0, 8) . "\"\n";
+ }
+ if (!empty($conf['routerpriorityelections'])) {
+ $conffile .= " ip ospf priority {$conf['routerpriorityelections']}\n";
+ }
+ if (!empty($conf['retransmitinterval'])) {
+ $conffile .= " ip ospf retransmit-interval {$conf['retransmitinterval']}\n";
+ }
+ if (!empty($conf['deadtimer'])) {
+ $conffile .= " ip ospf dead-interval {$conf['deadtimer']}\n";
+ }
+ if (!empty($conf['passive'])) {
+ $passive_interfaces[] = $realif;
+ }
+ $interface_ip = find_interface_ip($realif);
+ $interface_subnet = find_interface_subnet($realif);
+ /* Cheap hack since point-to-points won't attach if /32 is used. */
+ if ($interface_subnet == 32)
+ $interface_subnet = 30;
+ $subnet = gen_subnet($interface_ip, $interface_subnet);
+ $interface_networks[] = "{$subnet}/{$interface_subnet}";
+ }
+ }
+
+ /* OSPF Settings */
+
+ $conffile .= "\n\nrouter ospf\n";
+
+ // Specify router id
+ if($ospfd_conf['routerid'])
+ $conffile .= " ospf router-id {$ospfd_conf['routerid']}\n";
+
+ if ($ospfd_conf['updatefib'])
+ $conffile .= " area {$ospfd_conf['area']} stub\n";
+
+ if ($ospfd_conf['logging'] && $ospfd_conf['adjacencylog'])
+ $conffile .= " log-adjacency-changes detail\n";
+
+ if ($ospfd_conf['redistributeconnectedsubnets'])
+ $conffile .= " redistribute connected\n";
+
+ if ($ospfd_conf['redistributestatic'])
+ $conffile .= " redistribute static\n";
+
+ if ($ospfd_conf['redistributedefaultroute'])
+ $conffile .= " default-information originate\n";
+
+ if ($ospfd_conf['spfholdtime'] || $ospfd_conf['spfdelay']) {
+ $spf_minhold = ($ospfd_conf['spfholdtime']) ? $ospfd_conf['spfholdtime'] : 1000;
+ $spf_maxhold = $spf_minhold * 10;
+ $spf_delay = ($ospfd_conf['spfdelay']) ? $ospfd_conf['spfdelay'] : 200;
+ $conffile .= " timers throttle spf {$spf_delay} {$spf_minhold} {$spf_maxhold}\n";
+ }
+
+ if ($ospfd_conf['rfc1583'])
+ $conffile .= " ospf rfc1583compatibility\n";
+
+ if (is_array($passive_interfaces))
+ foreach ($passive_interfaces as $pint)
+ $conffile .= " passive-interface {$pint}\n";
+
+ if (is_array($interface_networks))
+ foreach ($interface_networks as $ifn)
+ $conffile .= " network {$ifn} area {$ospfd_conf['area']}\n";
+
+ if (is_array($ospfd_conf['row'])) {
+ foreach ($ospfd_conf['row'] as $redistr) {
+ if (isset($redistr['redistribute']))
+ $conffile .= " no ";
+ $conffile .= " network {$redistr['routevalue']} area {$ospfd_conf['area']}\n";
+ }
+ }
+ }
+
+ $fd = fopen("/usr/local/etc/quagga/ospfd.conf", "w");
+
+ // Write out the configuration file
+ fwrite($fd, $conffile);
+
+ // Close file handle
+ 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";
+ $fd = fopen("/usr/local/etc/quagga/zebra.conf", "w");
+ fwrite($fd, $zebraconffile);
+ fclose($fd);
+
+ // Create rc.d file
+ $rc_file_stop = <<<EOF
+kill -9 `cat /var/run/quagga/zebra.pid`
+kill -9 `cat /var/run/quagga/ospfd.pid`
+EOF;
+ $rc_file_start = <<<EOF
+/bin/mkdir -p /var/run/quagga
+/bin/mkdir -p /var/log/quagga
+/usr/sbin/chown -R quagga:quagga /var/run/quagga
+/usr/sbin/chown -R quagga:quagga /var/log/quagga
+/usr/local/sbin/zebra -d
+/usr/local/sbin/ospfd -d
+EOF;
+ write_rcfile(array(
+ "file" => "quagga.sh",
+ "start" => $rc_file_start,
+ "stop" => $rc_file_stop
+ )
+ );
+
+ // Ensure files have correct permissions
+ exec("chmod a+rx /usr/local/etc/rc.d/quagga.sh");
+ exec("chmod u+rw,go-rw /usr/local/etc/quagga/ospfd.conf");
+ exec("chmod u+rw,go-rw /usr/local/etc/quagga/zebra.conf");
+
+ // Kick off newly created rc.d script
+ exec("/usr/local/etc/rc.d/quagga.sh restart");
+
+ // Back to RO mount for NanoBSD and friends
+ conf_mount_ro();
+}
+
+function quagga_ospfd_validate_interface() {
+ global $config, $g, $id, $input_errors;
+
+ if ($config['installedpackages']['quaggaospfdinterfaces']['config']) {
+ foreach ($config['installedpackages']['quaggaospfdinterfaces']['config'] as $index => $conf) {
+ if ($index == 0)
+ continue;
+ if ($id != $index && $conf['interface'] == $_POST['interface'])
+ $input_errors[] = "Interface {$_POST['interface']} is already configured.";
+ }
+ }
+ if ($_POST['md5password'] && empty($_POST['password']))
+ $input_errors[] = "Please input a password.";
+}
+
+function quagga_ospfd_validate_input() {
+ global $config, $g, $input_errors;
+
+ if (!empty($_POST['routerid']) && !is_ipaddr($_POST['routerid']))
+ $input_errors[] = "Router ID must be an address.";
+ if (!is_ipaddr($_POST['area']))
+ $input_errors[] = "Area needs to be a valid ip_address.";
+ if ($_POST['spfholdtime'] <> "" && ($_POST['spfholdtime'] < 1 || $_POST['spfholdtime'] > 5))
+ $input_errors[] = "SPF holdtime needs to be between 1 and 5.";
+ if ($_POST['spfdelay'] <> "" && ($_POST['spfdelay'] < 1 || $_POST['spfdelay'] > 10))
+ $input_errors[] = "SPF delay needs to be between 1 and 10.";
+ if (!$config['installedpackages']['quaggaospfdinterfaces']['config'])
+ $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("/usr/local/etc/quagga/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;
+ }
+}
+
+?>
diff --git a/config/quagga_ospfd/quagga_ospfd.xml b/config/quagga_ospfd/quagga_ospfd.xml
new file mode 100644
index 00000000..3e76c4e4
--- /dev/null
+++ b/config/quagga_ospfd/quagga_ospfd.xml
@@ -0,0 +1,173 @@
+<packagegui>
+ <name>quagga_ospfd</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.xml&amp;id=0</aftersaveredirect>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>644</chmod>
+ <item>http://www.pfsense.com/packages/config/quagga_ospfd/quagga_ospfd.inc</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_interfaces.xml</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/</prefix>
+ <chmod>644</chmod>
+ <item>http://www.pfsense.com/packages/config/quagga_ospfd/status_ospfd.php</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/bin/</prefix>
+ <chmod>777</chmod>
+ <item>http://www.pfsense.com/packages/config/quagga_ospfd/quaggactl</item>
+ </additional_files_needed>
+ <menu>
+ <name>Quagga OSPFd</name>
+ <tooltiptext>Modify Quagga ospfd settings.</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>
+ <active/>
+ </tab>
+ <tab>
+ <text>Interface Settings</text>
+ <url>pkg.php?xml=quagga_ospfd_interfaces.xml</url>
+ </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>Master Password</fielddescr>
+ <fieldname>password</fieldname>
+ <description>
+ <![CDATA[
+ Password to access the Zebra and OSPF management daemons. Required.
+ ]]>
+ </description>
+ <type>input</type>
+ <required/>
+ </field>
+ <field>
+ <fielddescr>Logging</fielddescr>
+ <fieldname>logging</fieldname>
+ <description>If set to yes, Logs will be written via syslog.</description>
+ <type>checkbox</type>
+ </field>
+ <field>
+ <fielddescr>Log Adjacency Changes</fielddescr>
+ <fieldname>adjacencylog</fieldname>
+ <description>If set to yes, adjacency changes will be written via syslog.</description>
+ <type>checkbox</type>
+ </field>
+ <field>
+ <fielddescr>Router ID</fielddescr>
+ <fieldname>routerid</fieldname>
+ <description>
+ <![CDATA[
+ Specify the Router ID. RID is the highest logical (loopback) IP address configured on a router. For more information on router identifiers see <a target='_new' href='http://en.wikipedia.org/wiki/Open_Shortest_Path_First'>wikipedia</a>.
+ ]]>
+ </description>
+ <type>input</type>
+ </field>
+ <field>
+ <fielddescr>Area</fielddescr>
+ <fieldname>area</fieldname>
+ <description>
+ <![CDATA[
+ OSPFd area for this instance of OSPF. For more information on Areas see <a target='_new' href='http://en.wikipedia.org/wiki/Open_Shortest_Path_First#Area_types'>wikipedia</a>.
+ ]]>
+ </description>
+ <type>input</type>
+ <required/>
+ </field>
+ <field>
+ <fielddescr>Disable FIB updates (Routing table)</fielddescr>
+ <fieldname>updatefib</fieldname>
+ <description>Disables the updating of the host routing table(turns into stub router).</description>
+ <type>checkbox</type>
+ </field>
+ <field>
+ <fielddescr>Redistribute connected subnets</fielddescr>
+ <fieldname>redistributeconnectedsubnets</fieldname>
+ <description>Enables the redistribution of connected networks (Default no)</description>
+ <type>checkbox</type>
+ </field>
+ <field>
+ <fielddescr>Redistribute default route</fielddescr>
+ <fieldname>redistributedefaultroute</fieldname>
+ <description>Enables the redistribution of a default route to this device (Default no)</description>
+ <type>checkbox</type>
+ </field>
+ <field>
+ <fielddescr>Redistribute static</fielddescr>
+ <fieldname>redistributestatic</fieldname>
+ <description>Enables the redistribution of static routes</description>
+ <type>checkbox</type>
+ </field>
+ <field>
+ <fielddescr>SPF Hold Time</fielddescr>
+ <fieldname>spfholdtime</fieldname>
+ <description>Set the SPF holdtime in MILLIseconds. The minimum time between two consecutive shortest path first calculations. The default value is 5 seconds; the valid range is 1-5 seconds.</description>
+ <type>input</type>
+ </field>
+ <field>
+ <fielddescr>SPF Delay</fielddescr>
+ <fieldname>spfdelay</fieldname>
+ <description>Set SPF delay in MILLIseconds. The delay between receiving an update to the link state database and starting the shortest path first calculation. The default value is 1; valid range is 1-10 seconds.</description>
+ <type>input</type>
+ </field>
+ <field>
+ <fielddescr>RFC 1583 compatible</fielddescr>
+ <fieldname>rfc1583</fieldname>
+ <description>If set to yes, decisions regarding AS-external routes are evaluated according to RFC 1583. The default is no.</description>
+ <type>checkbox</type>
+ </field>
+ <field>
+ <fielddescr>These rules take precedence over any redistribute options specified above.</fielddescr>
+ <fieldname>none</fieldname>
+ <type>rowhelper</type>
+ <rowhelper>
+ <rowhelperfield>
+ <fielddescr>Disable &lt;br/&gt;Redistribution</fielddescr>
+ <fieldname>redistribute</fieldname>
+ <description>Redistribute rules.</description>
+ <type>checkbox</type>
+ <size>20</size>
+ </rowhelperfield>
+ <rowhelperfield>
+ <fielddescr>Subnet to Route</fielddescr>
+ <fieldname>routevalue</fieldname>
+ <type>input</type>
+ <size>25</size>
+ </rowhelperfield>
+ </rowhelper>
+ </field>
+ </fields>
+ <custom_php_resync_config_command>
+ quagga_ospfd_install_conf();
+ </custom_php_resync_config_command>
+ <custom_php_validation_command>
+ quagga_ospfd_validate_input();
+ </custom_php_validation_command>
+</packagegui> \ No newline at end of file
diff --git a/config/quagga_ospfd/quagga_ospfd_interfaces.xml b/config/quagga_ospfd/quagga_ospfd_interfaces.xml
new file mode 100644
index 00000000..e0f55a58
--- /dev/null
+++ b/config/quagga_ospfd/quagga_ospfd_interfaces.xml
@@ -0,0 +1,128 @@
+<packagegui>
+ <name>quagga_ospfd_interfaces</name>
+ <version>0.1</version>
+ <title>Services: Quagga OSPFd</title>
+ <include_file>/usr/local/pkg/quagga_ospfd.inc</include_file>
+ <aftersaveredirect>pkg.php?xml=quagga_ospfd_interfaces.xml</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 ospfd Interface settings.</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>
+ <active/>
+ </tab>
+ <tab>
+ <text>Status</text>
+ <url>/status_ospfd.php</url>
+ </tab>
+ </tabs>
+ <adddeleteeditpagefields>
+ <columnitem>
+ <fielddescr>Interface</fielddescr>
+ <fieldname>interface</fieldname>
+ </columnitem>
+ <columnitem>
+ <fielddescr>Description</fielddescr>
+ <fieldname>descr</fieldname>
+ </columnitem>
+ </adddeleteeditpagefields>
+ <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>Interface</fielddescr>
+ <fieldname>interface</fieldname>
+ <description>Enter the desired participating interface here.</description>
+ <type>select_source</type>
+ <source><![CDATA[quagga_ospfd_get_interfaces()]]></source>
+ <source_name>name</source_name>
+ <source_value>value</source_value>
+ <required/>
+ </field>
+ <field>
+ <fielddescr>Metric</fielddescr>
+ <fieldname>metric</fieldname>
+ <description>Metric (cost) for this OSPF interface (leave blank for default).</description>
+ <type>input</type>
+ </field>
+ <field>
+ <fielddescr>Description</fielddescr>
+ <fieldname>descr</fieldname>
+ <size>30</size>
+ <type>input</type>
+ </field>
+ <field>
+ <fielddescr>Interface is Passive</fielddescr>
+ <fieldname>passive</fieldname>
+ <description>Prevent transmission and reception of OSPF packets on this interface. The specified interface will be announced as a stub network.</description>
+ <type>checkbox</type>
+ </field>
+ <field>
+ <fielddescr>Enable MD5 password for this Quagga OSPFd interface (default no)</fielddescr>
+ <fieldname>md5password</fieldname>
+ <description>Enables the use of an MD5 password to on this instance</description>
+ <type>checkbox</type>
+ </field>
+ <field>
+ <fielddescr>Password</fielddescr>
+ <fieldname>password</fieldname>
+ <description>Password for this OSPF interface.</description>
+ <type>input</type>
+ </field>
+ <field>
+ <fielddescr>Router Priority</fielddescr>
+ <fieldname>routerpriorityelections</fieldname>
+ <description>
+ Router priority when participating in elections for DR (Default 1) Valid range is 0-255. 0 will cause the router to not participate in election.
+ </description>
+ <type>input</type>
+ </field>
+ <field>
+ <fielddescr>Hello Interval</fielddescr>
+ <fieldname>hellointervalinseconds</fieldname>
+ <description>Hello Interval this OSPF interface in seconds (Default 10).</description>
+ <type>input</type>
+ </field>
+ <field>
+ <fielddescr>Retransmit Interval</fielddescr>
+ <fieldname>retransmitinterval</fieldname>
+ <description>Retransmit Interval this OSPF interface in seconds (Default 5).</description>
+ <type>input</type>
+ </field>
+ <field>
+ <fielddescr>Dead Timer</fielddescr>
+ <fieldname>deadtimer</fieldname>
+ <description>Dead Timer for this OSPF interface in seconds (Default 40).</description>
+ <type>input</type>
+ </field>
+ </fields>
+ <custom_php_resync_config_command>
+ quagga_ospfd_install_conf();
+ </custom_php_resync_config_command>
+ <custom_php_validation_command>
+ quagga_ospfd_validate_interface();
+ </custom_php_validation_command>
+</packagegui>
diff --git a/config/quagga_ospfd/quaggactl b/config/quagga_ospfd/quaggactl
new file mode 100644
index 00000000..198a8411
--- /dev/null
+++ b/config/quagga_ospfd/quaggactl
@@ -0,0 +1,75 @@
+#!/bin/sh
+RC_SCRIPT=/usr/local/etc/rc.d/quagga.sh
+
+ZEBRA_CONFIG=/usr/local/etc/quagga/zebra.conf
+ZEBRA_PORT=2601
+ZEBRA_PASSWORD=`/usr/bin/grep '^password ' ${ZEBRA_CONFIG} | /usr/bin/awk '{print $2};'`
+
+OSPF_CONFIG=/usr/local/etc/quagga/ospfd.conf
+OSPF_PORT=2604
+OSPF_PASSWORD=`/usr/bin/grep '^password ' ${OSPF_CONFIG} | /usr/bin/awk '{print $2};'`
+
+daemon_command() {
+ COMMANDS=${2}
+ COMMANDS=${COMMANDS}`echo -e "\n${3}\n"`
+ COMMANDS=${COMMANDS}`echo -e "\nexit\n"`
+ echo "$COMMANDS" | /usr/bin/nc localhost ${1} | /usr/bin/tail -n +10 | sed '$d'
+}
+
+case $1 in
+stop)
+ $RC_SCRIPT stop
+ ;;
+start)
+ $RC_SCRIPT start
+ ;;
+restart)
+ $RC_SCRIPT restart
+ ;;
+zebra)
+ case $2 in
+ cpu*)
+ daemon_command ${ZEBRA_PORT} ${ZEBRA_PASSWORD} "show thread cpu"
+ ;;
+ mem*)
+ shift; shift;
+ daemon_command ${ZEBRA_PORT} ${ZEBRA_PASSWORD} "show memory $*"
+ ;;
+ int*)
+ daemon_command ${ZEBRA_PORT} ${ZEBRA_PASSWORD} "show interface $3"
+ ;;
+ rou*)
+ daemon_command ${ZEBRA_PORT} ${ZEBRA_PASSWORD} "show ip route"
+ ;;
+ esac ;;
+ospf)
+ case $2 in
+ cpu*)
+ daemon_command ${OSPF_PORT} ${OSPF_PASSWORD} "show thread cpu"
+ ;;
+ mem*)
+ shift; shift;
+ daemon_command ${OSPF_PORT} ${OSPF_PASSWORD} "show memory $*"
+ ;;
+ gen*)
+ daemon_command ${OSPF_PORT} ${OSPF_PASSWORD} "show ip ospf"
+ ;;
+ nei*)
+ shift; shift;
+ daemon_command ${OSPF_PORT} ${OSPF_PASSWORD} "show ip ospf neighbor $*"
+ ;;
+ dat*)
+ shift; shift;
+ daemon_command ${OSPF_PORT} ${OSPF_PASSWORD} "show ip ospf database $*"
+ ;;
+ int*)
+ daemon_command ${OSPF_PORT} ${OSPF_PASSWORD} "show ip ospf interface $3"
+ ;;
+ bor*)
+ daemon_command ${OSPF_PORT} ${OSPF_PASSWORD} "show ip ospf border-routers"
+ ;;
+ rou*)
+ daemon_command ${OSPF_PORT} ${OSPF_PASSWORD} "show ip ospf route"
+ ;;
+ esac ;;
+esac
diff --git a/config/quagga_ospfd/status_ospfd.php b/config/quagga_ospfd/status_ospfd.php
new file mode 100644
index 00000000..7a4c66d2
--- /dev/null
+++ b/config/quagga_ospfd/status_ospfd.php
@@ -0,0 +1,129 @@
+<?php
+/*
+ status_ospfd.php
+ Copyright (C) 2010 Nick Buraglio; nick@buraglio.com
+ Copyright (C) 2010 Scott Ullrich <sullrich@pfsense.org>
+ 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("guiconfig.inc");
+
+$pgtitle = "Quagga OSPF: Status";
+include("head.inc");
+
+$control_script = "/root/quaggactl.sh";
+
+/* List all of the commands as an index. */
+function listCmds() {
+ global $commands;
+ echo "<br/>This status page includes the following information:\n";
+ echo "<ul width=\"100%\">\n";
+ for ($i = 0; isset($commands[$i]); $i++ ) {
+ echo "<li><strong><a href=\"#" . $commands[$i][0] . "\">" . $commands[$i][0] . "</a></strong></li>\n";
+ }
+ echo "</ul>\n";
+}
+
+function execCmds() {
+ global $commands;
+ for ($i = 0; isset($commands[$i]); $i++ ) {
+ doCmdT($commands[$i][0], $commands[$i][1]);
+ }
+}
+
+/* Define a command, with a title, to be executed later. */
+function defCmdT($title, $command) {
+ global $commands;
+ $title = htmlspecialchars($title,ENT_NOQUOTES);
+ $commands[] = array($title, $command);
+}
+
+function doCmdT($title, $command) {
+ echo "<p>\n";
+ echo "<a name=\"" . $title . "\">\n";
+ echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
+ echo "<tr><td class=\"listtopic\">" . $title . "</td></tr>\n";
+ echo "<tr><td class=\"listlr\"><pre>"; /* no newline after pre */
+
+ $execOutput = "";
+ $execStatus = "";
+ exec ($command . " 2>&1", $execOutput, $execStatus);
+ for ($i = 0; isset($execOutput[$i]); $i++) {
+ if ($i > 0) {
+ echo "\n";
+ }
+ echo htmlspecialchars($execOutput[$i],ENT_NOQUOTES);
+ }
+ echo "</pre></tr>\n";
+ echo "</table>\n";
+}
+
+?>
+
+<html>
+ <body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+ <?php include("fbegin.inc"); ?>
+ <?php if ($savemsg) print_info_box($savemsg); ?>
+
+ <table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td class="tabnavtbl">
+<?php
+ $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("Status"), true, "/status_ospfd.php");
+ display_top_tabs($tab_array);
+ ?>
+ </td></tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td>
+<?php
+ defCmdT("Quagga OSPF General", "{$control_script} ospf general");
+ defCmdT("Quagga OSPF Neighbors", "{$control_script} ospf neighbor");
+ defCmdT("Quagga OSPF Database", "{$control_script} ospf database");
+ defCmdT("Quagga OSPF Router Database", "{$control_script} ospf database router");
+ defCmdT("Quagga OSPF Routes", "{$control_script} ospf route");
+ defCmdT("Quagga Zebra Routes", "{$control_script} zebra route");
+ 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");
+?>
+ <div id="cmdspace" style="width:100%">
+ <?php listCmds(); ?>
+ <?php execCmds(); ?>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+ </table>
+ <?php include("fend.inc"); ?>
+ </body>
+</html>
diff --git a/pkg_config.8.xml b/pkg_config.8.xml
index bebc49e9..84a6ecd6 100644
--- a/pkg_config.8.xml
+++ b/pkg_config.8.xml
@@ -1395,5 +1395,20 @@
<required_version>2.0</required_version>
<maximum_version>2.1</maximum_version>
</package>
+ <package>
+ <name>Quagga OSPF</name>
+ <descr>OSPF routing protocol using Quagga -- WARNING! Installs files to the same place as OpenOSPFD. Installing both will break things.</descr>
+ <maintainer>jimp@pfsense.org</maintainer>
+ <version>0.99.20_3</version>
+ <category>Routing</category>
+ <status>BETA</status>
+ <depends_on_package_base_url>http://files.pfsense.org/packages/8/All/</depends_on_package_base_url>
+ <depends_on_package>quagga-0.99.20_3.tbz</depends_on_package>
+ <config_file>http://www.pfsense.com/packages/config/quagga_ospfd/quagga_ospfd.xml</config_file>
+ <build_port_path>/usr/ports/net/quagga</build_port_path>
+ <pkginfolink></pkginfolink>
+ <required_version>2.0</required_version>
+ <configurationfile>quagga_ospfd.xml</configurationfile>
+ </package>
</packages>
</pfsensepkgs>
diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64
index 04bbb532..03d17a16 100644
--- a/pkg_config.8.xml.amd64
+++ b/pkg_config.8.xml.amd64
@@ -1323,5 +1323,20 @@
<required_version>2.0</required_version>
<maximum_version>2.1</maximum_version>
</package>
+ <package>
+ <name>Quagga OSPF</name>
+ <descr>OSPF routing protocol using Quagga -- WARNING! Installs files to the same place as OpenOSPFD. Installing both will break things.</descr>
+ <maintainer>jimp@pfsense.org</maintainer>
+ <version>0.99.20_3</version>
+ <category>Routing</category>
+ <status>BETA</status>
+ <depends_on_package_base_url>http://files.pfsense.org/packages/8/All/</depends_on_package_base_url>
+ <depends_on_package>quagga-0.99.20_3.tbz</depends_on_package>
+ <config_file>http://www.pfsense.com/packages/config/quagga_ospfd/quagga_ospfd.xml</config_file>
+ <build_port_path>/usr/ports/net/quagga</build_port_path>
+ <pkginfolink></pkginfolink>
+ <required_version>2.0</required_version>
+ <configurationfile>quagga_ospfd.xml</configurationfile>
+ </package>
</packages>
</pfsensepkgs>