diff options
author | Ermal Luçi <eri@pfsense.org> | 2010-02-26 12:14:18 +0000 |
---|---|---|
committer | Ermal Luçi <eri@pfsense.org> | 2010-02-26 12:15:59 +0000 |
commit | 62eadf9df48d2bf3e21e0634d8b35efc70ee0244 (patch) | |
tree | aa47507411e98228e459cd4b98dc5a1a3a79698c /config | |
parent | 963e88f3968506780f8b75f3d7cf7b08db7e87f8 (diff) | |
download | pfsense-packages-62eadf9df48d2bf3e21e0634d8b35efc70ee0244.tar.gz pfsense-packages-62eadf9df48d2bf3e21e0634d8b35efc70ee0244.tar.bz2 pfsense-packages-62eadf9df48d2bf3e21e0634d8b35efc70ee0244.zip |
Allow multiple interfaces to be specified for an area.
Diffstat (limited to 'config')
-rw-r--r-- | config/openospfd/openospfd.inc | 112 | ||||
-rw-r--r-- | config/openospfd/openospfd.xml | 72 | ||||
-rw-r--r-- | config/openospfd/openospfd_interfaces.xml | 108 |
3 files changed, 206 insertions, 86 deletions
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 @@ <configfile>openospfd.xml</configfile> <url>/pkg_edit.php?xml=openospfd.xml&id=0</url> </menu> + <tabs> + <tab> + <text>Global Settings</text> + <url>pkg_edit.php?xml=openospfd.xml&id=0</url> + <active/> + </tab> + <tab> + <text>Interface Settings</text> + <url>pkg.php?xml=openospfd_interfaces.xml</url> + </tab> + </tabs> <service> <name>ospfd</name> <rcfile>ospfd.sh</rcfile> @@ -42,31 +53,6 @@ <type>checkbox</type> </field> <field> - <fielddescr>Listening Interface</fielddescr> - <fieldname>interface</fieldname> - <description>Enter the desired participating interface here.</description> - <type>interfaces_selection</type> - <required/> - </field> - <field> - <fielddescr>Metric</fielddescr> - <fieldname>metric</fieldname> - <description>Metric for this OSPF interface (leave blank for default).</description> - <type>input</type> - </field> - <field> - <fielddescr>Enable MD5 password for this 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>Redistribute connected subnets</fielddescr> <fieldname>redistributeconnectedsubnets</fieldname> <description>Enables the redistribution of connected networks (Default no)</description> @@ -79,35 +65,29 @@ <type>checkbox</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> + <fielddescr>Redistribute static</fielddescr> + <fieldname>resdistributestatic</fieldname> + <description>Enables the redistribution of static routes</description> + <type>checkbox</type> </field> <field> - <fielddescr>Hello Interval</fielddescr> - <fieldname>hellointervalinseconds</fieldname> - <description>Hello Interval this OSPF interface in seconds (Default 10).</description> + <fielddescr>SPF Hold Time</fielddescr> + <fieldname>spfholdtime</fieldname> + <description>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.</description> <type>input</type> </field> <field> - <fielddescr>Retransmit Interval</fielddescr> - <fieldname>retransmitinterval</fieldname> - <description>Retransmit Interval this OSPF interface in seconds (Default 5).</description> + <fielddescr>SPF Delay</fielddescr> + <fieldname>spfdelay</fieldname> + <description>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.</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> - <field> - <fielddescr>Redistribute static</fielddescr> - <fieldname>resdistributestatic</fieldname> - <description>Enables the redistribution of static routes</description> - <type>checkbox</type> - </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> </fields> <custom_php_resync_config_command> 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 @@ +<packagegui> + <name>OSPFd Interfaces</name> + <version>0.1</version> + <title>Services: OSPFd</title> + <include_file>/usr/local/pkg/openospfd.inc</include_file> + <aftersaveredirect>pkg_edit.php?xml=openospfd.xml&id=0</aftersaveredirect> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>077</chmod> + <item>http://www.pfsense.com/packages/config/openospfd/openospfd.inc</item> + </additional_files_needed> + <menu> + <name>OSPFd</name> + <tooltiptext>Modify ospfd settings.</tooltiptext> + <section>Services</section> + <configfile>openospfd.xml</configfile> + <url>/pkg_edit.php?xml=openospfd.xml&id=0</url> + </menu> + <tabs> + <tab> + <text>Global Settings</text> + <url>pkg_edit.php?xml=openospfd.xml&id=0</url> + </tab> + <tab> + <text>Interface Settings</text> + <url>pkg.php?xml=openospfd_interfaces.xml</url> + <active/> + </tab> + </tabs> + <adddeleteeditpagefields> + <columnitem> + <fielddescr>Interface</fielddescr> + <fieldname>interface</fieldname> + </columnitem> + <columnitem> + <fielddescr>Description</fielddescr> + <fieldname>descr</fieldname> + </columnitem> + </adddeleteeditpagefields> + <service> + <name>ospfd</name> + <rcfile>ospfd.sh</rcfile> + <executable>ospfd</executable> + </service> + <fields> + <field> + <fielddescr>Interface</fielddescr> + <fieldname>interface</fieldname> + <description>Enter the desired participating interface here.</description> + <type>interfaces_selection</type> + <required/> + </field> + <field> + <fielddescr>Metric</fielddescr> + <fieldname>metric</fieldname> + <description>Metric 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>Enable MD5 password for this 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> + ospfd_install_conf(); + </custom_php_resync_config_command> + <custom_php_validation_command> + ospfd_validate_interface(); + </custom_php_validation_command> +</packagegui> |