From 62eadf9df48d2bf3e21e0634d8b35efc70ee0244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ermal=20Lu=E7i?= Date: Fri, 26 Feb 2010 12:14:18 +0000 Subject: Allow multiple interfaces to be specified for an area. --- config/openospfd/openospfd.inc | 112 +++++++++++++++++++----------- config/openospfd/openospfd.xml | 72 +++++++------------ config/openospfd/openospfd_interfaces.xml | 108 ++++++++++++++++++++++++++++ 3 files changed, 206 insertions(+), 86 deletions(-) create mode 100644 config/openospfd/openospfd_interfaces.xml (limited to 'config/openospfd') diff --git a/config/openospfd/openospfd.inc b/config/openospfd/openospfd.inc index 8d8a59da..6d50cce9 100644 --- a/config/openospfd/openospfd.inc +++ b/config/openospfd/openospfd.inc @@ -28,7 +28,7 @@ */ function ospfd_install_conf() { - global $config, $g; + global $config, $g, $input_errors; conf_mount_rw(); @@ -63,46 +63,59 @@ function ospfd_install_conf() { if ($ospfd_conf['resdistributestatic']) $conffile .= "redistribute static\n"; + if ($ospfd_conf['spfholdtime']) + $conffile .= "spf-holdtime {$ospfd_conf['spfholdtime']}\n"; + + if ($ospfd_conf['spfdelay']) + $conffile .= "spf-delay {$ospfd_conf['spfdelay']}\n"; + + if ($ospfd_conf['rfc1583']) + $conffile .= "rfc1583compat yes\n"; + $conffile .= "area {$ospfd_conf['area']} {\n"; - $conffile .= "\tinterface " . $config['interfaces'][$ospfd_conf['interface']]['if']; - $options_present = false; - if (!empty($ospfd_conf['metric'])) { - $options_present = true; - $ifconfigs .= "\t\tmetric {$ospfd_conf['metric']}\n"; + if ($config['installedpackages']['ospfdinterfaces']['config']) { + foreach ($config['installedpackages']['ospfdinterfaces']['config'] as $conf) { + $conffile .= "\tinterface " . $config['interfaces'][$conf['interface']]['if']; + $options_present = false; + if (!empty($conf['metric'])) { + $options_present = true; + $ifconfigs .= "\t\tmetric {$conf['metric']}\n"; + } + if (!empty($conf['hellointervalinseconds'])) { + $options_present = true; + $ifconfigs .= "\t\thello-interval {$conf['hellointervalinseconds']}\n"; + } + if ($conf['md5password'] && !empty($conf['password'])) { + $options_present = true; + $ifconfigs .= "\t\tauth-type crypt\n"; + $ifconfigs .= "\t\tauth-md 1 \"" . substr($conf['password'], 0, 15) . "\"\n"; + $ifconfigs .= "\t\tauth-md-keyid 1\n"; + } else if (!empty($conf['passward'])) { + $options_present = true; + $ifconfigs .= "\t\tauth-type simple\n"; + $ifconfigs .= "\t\tauth-key \"" . substr($conf['password'], 0, 7) . "\"\n"; + } + if (!empty($conf['routerpriorityelections'])) { + $options_present = true; + $ifconfigs .= "\t\trouter-priority {$conf['routerpriorityelections']}\n"; + } + if (!empty($conf['retransmitinterval'])) { + $options_present = true; + $ifconfigs .= "\t\tretransmit-interval {$conf['retransmitinterval']}\n"; + } + if (!empty($conf['deadtimer'])) { + $options_present = true; + $ifconfigs .= "\t\trouter-dead-time {$conf['deadtimer']}\n"; + } + if (!empty($ifconfigs)) { + $conffile .= " {\n {$ifconfigs} \n"; + if ($options_present == true) + $conffile .= "\t}\n"; + } else + $conffile .= "\n"; + } } - if (!empty($ospfd_conf['hellointervalinseconds'])) { - $options_present = true; - $ifconfigs .= "\t\thello-interval {$ospfd_conf['hellointervalinseconds']}\n"; - } - if ($ospfd_conf['md5password'] && !empty($ospfd_conf['password'])) { - $options_present = true; - $ifconfigs .= "\t\tauth-type crypt\n"; - $ifconfigs .= "\t\tauth-md 1 \"" . substr($ospfd_conf['password'], 0, 15) . "\"\n"; - $ifconfigs .= "\t\tauth-md-keyid 1\n"; - } else if (!empty($ospfd_conf['passward'])) { - $options_present = true; - $ifconfigs .= "\t\tauth-type simple\n"; - $ifconfigs .= "\t\tauth-key \"" . substr($ospfd_conf['password'], 0, 7) . "\"\n"; - } - if (!empty($ospfd_conf['routerpriorityelections'])) { - $options_present = true; - $ifconfigs .= "\t\trouter-priority {$ospfd_conf['routerpriorityelections']}\n"; - } - if (!empty($ospfd_conf['retransmitinterval'])) { - $options_present = true; - $ifconfigs .= "\t\tretransmit-interval {$ospfd_conf['retransmitinterval']}\n"; - } - if (!empty($ospfd_conf['deadtimer'])) { - $options_present = true; - $ifconfigs .= "\t\trouter-dead-time {$ospfd_conf['deadtimer']}\n"; - } - if (!empty($ifconfigs)) { - $conffile .= " {\n {$ifconfigs} \n"; - if ($options_present == true) - $conffile .= "\t}\n"; - } else - $conffile .= "\n"; $conffile .= "}\n"; } @@ -134,6 +147,21 @@ function ospfd_install_conf() { conf_mount_ro(); } +function ospfd_validate_interface() { + global $config, $g, $input_errors; + + if ($config['installedpackages']['ospfdinterfaces']['config']) { + foreach ($config['installedpackages']['ospfdinterfaces']['config'] as $index => $conf) { + if ($index == 0) + continue; + if ($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 ospfd_validate_input() { global $config, $g, $input_errors; @@ -141,8 +169,12 @@ function ospfd_validate_input() { $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['md5password'] && empty($_POST['password'])) - $input_errors[] = "Please input a password."; + 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']['ospfdinterfaces']['config']) + $input_errors[] = "Please select an interface to use for OSPFd."; } // get the raw ospfd confi file for manual inspection/editing diff --git a/config/openospfd/openospfd.xml b/config/openospfd/openospfd.xml index b7393484..fea7e67f 100644 --- a/config/openospfd/openospfd.xml +++ b/config/openospfd/openospfd.xml @@ -16,6 +16,17 @@ openospfd.xml /pkg_edit.php?xml=openospfd.xml&id=0 + + + Global Settings + pkg_edit.php?xml=openospfd.xml&id=0 + + + + Interface Settings + pkg.php?xml=openospfd_interfaces.xml + + ospfd ospfd.sh @@ -41,31 +52,6 @@ Enables the updating of the host routing table checkbox - - Listening Interface - interface - Enter the desired participating interface here. - interfaces_selection - - - - Metric - metric - Metric for this OSPF interface (leave blank for default). - input - - - Enable MD5 password for this OSPFd interface (default no) - md5password - Enables the use of an MD5 password to on this instance - checkbox - - - Password - password - Password for this OSPF interface. - input - Redistribute connected subnets redistributeconnectedsubnets @@ -79,35 +65,29 @@ checkbox - Router Priority - routerpriorityelections - 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. - input + Redistribute static + resdistributestatic + Enables the redistribution of static routes + checkbox - Hello Interval - hellointervalinseconds - Hello Interval this OSPF interface in seconds (Default 10). + SPF Hold Time + spfholdtime + Set the SPF holdtime in seconds. The minimum time between two consecutive shortest path first calculations. The default value is 5 seconds; the valid range is 1-5 seconds. input - Retransmit Interval - retransmitinterval - Retransmit Interval this OSPF interface in seconds (Default 5). + SPF Delay + spfdelay + Set SPF delay in seconds. 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 sec-onds. input - Dead Timer - deadtimer - Dead Timer for this OSPF interface in seconds (Default 40). - input - - - Redistribute static - resdistributestatic - Enables the redistribution of static routes - checkbox - + RFC 1583 compatible + rfc1583 + If set to yes, decisions regarding AS-external routes are evaluated according to RFC 1583. The default is no. + checkbox + ospfd_install_conf(); diff --git a/config/openospfd/openospfd_interfaces.xml b/config/openospfd/openospfd_interfaces.xml new file mode 100644 index 00000000..b8f2522e --- /dev/null +++ b/config/openospfd/openospfd_interfaces.xml @@ -0,0 +1,108 @@ + + OSPFd Interfaces + 0.1 + Services: OSPFd + /usr/local/pkg/openospfd.inc + pkg_edit.php?xml=openospfd.xml&id=0 + + /usr/local/pkg/ + 077 + http://www.pfsense.com/packages/config/openospfd/openospfd.inc + + + OSPFd + Modify ospfd settings. +
Services
+ openospfd.xml + /pkg_edit.php?xml=openospfd.xml&id=0 +
+ + + Global Settings + pkg_edit.php?xml=openospfd.xml&id=0 + + + Interface Settings + pkg.php?xml=openospfd_interfaces.xml + + + + + + Interface + interface + + + Description + descr + + + + ospfd + ospfd.sh + ospfd + + + + Interface + interface + Enter the desired participating interface here. + interfaces_selection + + + + Metric + metric + Metric for this OSPF interface (leave blank for default). + input + + + Description + descr + 30 + input + + + Enable MD5 password for this OSPFd interface (default no) + md5password + Enables the use of an MD5 password to on this instance + checkbox + + + Password + password + Password for this OSPF interface. + input + + + Router Priority + routerpriorityelections + 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. + input + + + Hello Interval + hellointervalinseconds + Hello Interval this OSPF interface in seconds (Default 10). + input + + + Retransmit Interval + retransmitinterval + Retransmit Interval this OSPF interface in seconds (Default 5). + input + + + Dead Timer + deadtimer + Dead Timer for this OSPF interface in seconds (Default 40). + input + + + + ospfd_install_conf(); + + + ospfd_validate_interface(); + +
-- cgit v1.2.3