From 0098b559c1dff219f982690c15b365c814c5d787 Mon Sep 17 00:00:00 2001 From: John Grange Date: Mon, 28 May 2012 18:45:05 -0700 Subject: Multiple Areas in networks and interfaces Added ability to change areas for selected interfaces and networks that are shared. Signed-off-by: John Grange --- config/quagga_ospfd/quagga_ospfd.inc | 43 +++++++++++++++++++------ config/quagga_ospfd/quagga_ospfd.xml | 6 ++++ config/quagga_ospfd/quagga_ospfd_interfaces.xml | 6 ++++ 3 files changed, 45 insertions(+), 10 deletions(-) (limited to 'config/quagga_ospfd') diff --git a/config/quagga_ospfd/quagga_ospfd.inc b/config/quagga_ospfd/quagga_ospfd.inc index 54d4ef3f..4b7e007e 100644 --- a/config/quagga_ospfd/quagga_ospfd.inc +++ b/config/quagga_ospfd/quagga_ospfd.inc @@ -82,6 +82,7 @@ function quagga_ospfd_install_conf() { /* 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']); @@ -116,9 +117,18 @@ function quagga_ospfd_install_conf() { if ($interface_subnet == 32) $interface_subnet = 30; $subnet = gen_subnet($interface_ip, $interface_subnet); - $interface_networks[] = "{$subnet}/{$interface_subnet}"; - } + if (!empty($conf['interfacearea'])) { + $interface_networks[] = array( "subnet" => "{$subnet}/{$interface_subnet}", "area" => $conf['interfacearea']); + } + else { + $interface_networks[] = array( "subnet" => "{$subnet}/{$interface_subnet}", "area" => $ospfd_conf['area']); + } + + + + } } + /* OSPF Settings */ @@ -153,24 +163,37 @@ function quagga_ospfd_install_conf() { if ($ospfd_conf['rfc1583']) $conffile .= " ospf rfc1583compatibility\n"; - if (is_array($passive_interfaces)) + 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) - if (is_subnet($ifn)) - $conffile .= " network {$ifn} area {$ospfd_conf['area']}\n"; + if (is_array($interface_networks)) { + foreach ($interface_networks as $ifn) { + + if (is_subnet($ifn['subnet'])) { + $conffile .= " network {$ifn['subnet']} area {$ifn['area']}\n"; + } + + } + } if (is_array($ospfd_conf['row'])) { foreach ($ospfd_conf['row'] as $redistr) { - if (isset($redistr['redistribute'])) + + if (isset($redistr['redistribute'])) { $conffile .= " no "; - $conffile .= " network {$redistr['routevalue']} area {$ospfd_conf['area']}\n"; + } + if ($redistr['routearea'] == "") { + $conffile .= " network {$redistr['routevalue']} area {$ospfd_conf['area']}\n"; + } + else { + $conffile .= " network {$redistr['routevalue']} area {$redistr['routearea']}\n"; + } } } } - $fd = fopen("/usr/local/etc/quagga/ospfd.conf", "w"); // Write out the configuration file diff --git a/config/quagga_ospfd/quagga_ospfd.xml b/config/quagga_ospfd/quagga_ospfd.xml index 3e76c4e4..49c9d86c 100644 --- a/config/quagga_ospfd/quagga_ospfd.xml +++ b/config/quagga_ospfd/quagga_ospfd.xml @@ -161,6 +161,12 @@ input 25 + + Area ID + routearea + input + 10 + diff --git a/config/quagga_ospfd/quagga_ospfd_interfaces.xml b/config/quagga_ospfd/quagga_ospfd_interfaces.xml index e0f55a58..21bc877f 100644 --- a/config/quagga_ospfd/quagga_ospfd_interfaces.xml +++ b/config/quagga_ospfd/quagga_ospfd_interfaces.xml @@ -68,6 +68,12 @@ Metric (cost) for this OSPF interface (leave blank for default). input + + Area + interfacearea + The area for this interface (leave blank for default). + input + Description descr -- cgit v1.2.3