Project

General

Profile

Bug #3716 ยป interfaces.inc.patch

Marc Posch, 06/22/2014 04:36 PM

View differences:

interfaces.inc 2014-06-14 01:25:39.216359000 +0200
4177 4177
	$ifdescrs = get_configured_interface_list();
4178 4178
	foreach ($ifdescrs as $ifdescr => $ifname) {
4179 4179
		/* check IPv4 */
4180 4180
		if(is_ipaddrv4($carp_ip)) {
4181 4181
			$interfaceip = get_interface_ip($ifname);
4182
			if(!is_ipaddrv4($interfaceip))
4183
				continue;
4182 4184
			$subnet_bits = get_interface_subnet($ifname);
4183 4185
			$subnet_ip = gen_subnet("{$interfaceip}", "{$subnet_bits}");
4184 4186
			if(ip_in_subnet($carp_ip, "{$subnet_ip}/{$subnet_bits}"))
4185 4187
				return $ifname;
4186 4188
		}
4187 4189
		/* Check IPv6 */
4188 4190
		if(is_ipaddrv6($carp_ipv6)) {
4189 4191
			$interfaceipv6 = get_interface_ipv6($ifname);
4192
			if(!is_ipaddrv6($interfaceipv6))
4193
				continue;
4190 4194
			$prefixlen = get_interface_subnetv6($ifname);
4191 4195
			if(ip_in_subnet($carp_ipv6, "{$interfaceipv6}/{$prefixlen}"))
4192 4196
				return $ifname;
4193 4197
		}
4194 4198
	}
    (1-1/1)