diff --git a/net/quagga/src/etc/inc/plugins.inc.d/quagga.inc b/net/quagga/src/etc/inc/plugins.inc.d/quagga.inc index 32786c1a0..442ecd285 100644 --- a/net/quagga/src/etc/inc/plugins.inc.d/quagga.inc +++ b/net/quagga/src/etc/inc/plugins.inc.d/quagga.inc @@ -26,6 +26,43 @@ POSSIBILITY OF SUCH DAMAGE. */ +function ospfd_enabled() +{ + $model = new \OPNsense\Quagga\OSPF(); + if ((string)$model->enabled == '1') { + return true; + } + + return false; +} + +function quagga_firewall($fw) +{ + if (ospfd_enabled()) { + $ospf = new \OPNsense\Quagga\OSPF(); + foreach ($ospf->networks->network->__items as $network) { + if ((string)$network->enabled == '1') { + $fw->registerFilterRule( + 1, /* priority */ + array( + 'ipprotocol' => 'inet', + 'protocol' => 'ospf', + 'statetype' => 'keep', + 'label' => 'Pass OSPF (autogenerated)', + 'from' => $network->ipaddr . '/' . $network->netmask, + 'to' => '224.0.0.0/4', + 'direction' => 'in', + 'type' => 'pass', + 'disablereplyto' => 1, + 'quick' => true + ), + null + ); + } + } + } +} + function quagga_services() { global $config;