Bug #3716 ยป interfaces.inc.patch
| interfaces.inc 2014-06-14 01:25:39.216359000 +0200 | ||
|---|---|---|
|
$ifdescrs = get_configured_interface_list();
|
||
|
foreach ($ifdescrs as $ifdescr => $ifname) {
|
||
|
/* check IPv4 */
|
||
|
if(is_ipaddrv4($carp_ip)) {
|
||
|
$interfaceip = get_interface_ip($ifname);
|
||
|
if(!is_ipaddrv4($interfaceip))
|
||
|
continue;
|
||
|
$subnet_bits = get_interface_subnet($ifname);
|
||
|
$subnet_ip = gen_subnet("{$interfaceip}", "{$subnet_bits}");
|
||
|
if(ip_in_subnet($carp_ip, "{$subnet_ip}/{$subnet_bits}"))
|
||
|
return $ifname;
|
||
|
}
|
||
|
/* Check IPv6 */
|
||
|
if(is_ipaddrv6($carp_ipv6)) {
|
||
|
$interfaceipv6 = get_interface_ipv6($ifname);
|
||
|
if(!is_ipaddrv6($interfaceipv6))
|
||
|
continue;
|
||
|
$prefixlen = get_interface_subnetv6($ifname);
|
||
|
if(ip_in_subnet($carp_ipv6, "{$interfaceipv6}/{$prefixlen}"))
|
||
|
return $ifname;
|
||
|
}
|
||
|
}
|
||