From df332357f43ba0e624539748d22a8bf1b60dac20 Mon Sep 17 00:00:00 2001 From: Warren Baker Date: Thu, 18 Nov 2010 22:43:08 +0200 Subject: Listen on CARP VIPs that are associated to the interfaces that have been selected. --- config/unbound/unbound.inc | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'config/unbound/unbound.inc') diff --git a/config/unbound/unbound.inc b/config/unbound/unbound.inc index 3d4bc529..2b3b30b0 100644 --- a/config/unbound/unbound.inc +++ b/config/unbound/unbound.inc @@ -28,6 +28,7 @@ if(!function_exists("get_dns_servers")) if(!function_exists("get_nameservers")) require_once("system.inc"); + function unbound_initial_setup() { global $config; @@ -204,17 +205,31 @@ function unbound_get_network_interface_addresses($subnet=false, $mask=false) { $unboundrealif = convert_friendly_interface_to_real_interface_name($unboundif); $unboundip = find_interface_ip($unboundrealif); $ipmask = find_interface_subnet($unboundrealif); + // If $subnet is passed then calculate the beginning of the network range for the IP address if ($subnet) $network = gen_subnet($unboundip, $ipmask); else $network = $unboundip; - if ($mask) + + if ($mask) $unbound_interfaces[] = "$network/$ipmask"; - else - $unbound_interfaces[] = "$network"; - } + else { + $unbound_interfaces[] = $network; + // Check for CARP addresses and also return those + if (isset($config['virtualip'])) { + foreach($config['virtualip']['vip'] as $vip) { + if (($vip['interface'] == $unboundif) && ($vip['mode'] == "carp")) { + $virtual_ip = find_interface_ip(link_ip_to_carp_interface($vip['subnet'])); + $unbound_interfaces[] = $virtual_ip; + } + } + } + } + } + return $unbound_interfaces; + } function unbound_resync_config() { -- cgit v1.2.3