Projet

Général

Profil

« Précédent | Suivant » 

Révision 80a261a2

Ajouté par PiBa-NL il y a plus de 9 ans

CARP, allow carp ip to be outside interface and alias subnets (FreeBSD10 feature)

Voir les différences:

etc/inc/interfaces.inc
2184 2184
	}
2185 2185

  
2186 2186
	if (is_ipaddrv4($vip['subnet'])) {
2187
		/* Ensure CARP IP really exists prior to loading up. */
2187
		/* Ensure a IP on this interface exists prior to configuring CARP. */
2188 2188
		$ww_subnet_ip = find_interface_ip($realif);
2189
		$ww_subnet_bits = find_interface_subnet($realif);
2190
		if (!ip_in_subnet($vip['subnet'], gen_subnet($ww_subnet_ip, $ww_subnet_bits) . "/" . $ww_subnet_bits) && !ip_in_interface_alias_subnet($vip['interface'], $vip['subnet'])) {
2191
			file_notice("CARP", sprintf(gettext("Sorry but we could not find a matching real interface subnet for the virtual IP address %s."), $vip['subnet']), "Firewall: Virtual IP", "");
2189
		if (!is_ipaddrv4($ww_subnet_ip)) {
2190
			file_notice("CARP", sprintf(gettext("Sorry but we could not find a required assigned ip address on the interface for the virtual IP address %s."), $vip['subnet']), "Firewall: Virtual IP", "");
2192 2191
			return;
2193 2192
		}
2194 2193
	} else if (is_ipaddrv6($vip['subnet'])) {
2195
		/* Ensure CARP IP really exists prior to loading up. */
2194
		/* Ensure a IP on this interface exists prior to configuring CARP. */
2196 2195
		$ww_subnet_ip = find_interface_ipv6($realif);
2197
		$ww_subnet_bits = find_interface_subnetv6($realif);
2198
		if (!ip_in_subnet($vip['subnet'], gen_subnetv6($ww_subnet_ip, $ww_subnet_bits) . "/" . $ww_subnet_bits) && !ip_in_interface_alias_subnet($vip['interface'], $vip['subnet'])) {
2199
			file_notice("CARP", sprintf(gettext("Sorry but we could not find a matching real interface subnet for the virtual IPv6 address %s."), $vip['subnet']), "Firewall: Virtual IP", "");
2196
		if (!is_ipaddrv6($ww_subnet_ip)) {
2197
			file_notice("CARP", sprintf(gettext("Sorry but we could not find a required assigned ip address on the interface for the virtual IPv6 address %s."), $vip['subnet']), "Firewall: Virtual IP", "");
2200 2198
			return;
2201 2199
		}
2202 2200
	}
......
2221 2219
	if (is_ipaddrv4($vip['subnet']))
2222 2220
		mwexec("/sbin/ifconfig {$realif} " . escapeshellarg($vip['subnet']) . "/" . escapeshellarg($vip['subnet_bits']) . " alias vhid " . escapeshellarg($vip['vhid']));
2223 2221
	else if (is_ipaddrv6($vip['subnet']))
2224
		mwexec("/sbin/ifconfig {$realif} inet6 " . escapeshellarg($vip['subnet']) . " prefixlen " . escapeshellarg($vip['subnet_bits']) . " vhid " . escapeshellarg($vip['vhid']));
2222
		mwexec("/sbin/ifconfig {$realif} inet6 " . escapeshellarg($vip['subnet']) . " prefixlen " . escapeshellarg($vip['subnet_bits']) . " alias vhid " . escapeshellarg($vip['vhid']));
2225 2223

  
2226 2224
	return $realif;
2227 2225
}
......
4494 4492
}
4495 4493

  
4496 4494
function get_all_carp_interfaces() {
4495
    trigger_error("Broken function get_all_carp_interfaces() called. Remo", E_USER_NOTICE);
4497 4496
	$ints = str_replace("\n", " ", `ifconfig | grep "carp:" -B2 | grep ": flag" | cut -d: -f1`);
4498 4497
	$ints = explode(" ", $ints);
4499 4498
	return $ints;

Formats disponibles : Unified diff