If get_interface_ip(v6) is passed an IP, return the IP.

Properly set up interface binding for v6 link local IPs. Ticket #4021

except had to comment out the fix for now because of #4062 to avoid config breakage.
This commit is contained in:
Chris Buechler 2014-12-02 20:15:04 -06:00
parent 0b0d83cbf0
commit a0e9e17d2d
2 changed files with 19 additions and 6 deletions

View File

@ -4795,6 +4795,10 @@ function ip_in_interface_alias_subnet($interface, $ipalias) {
}
function get_interface_ip($interface = "wan") {
// if we get passed an IP for some reason, return the IP.
if (is_ipaddr($interface))
return $interface;
$realif = get_failover_interface($interface);
if (!$realif) {
if (strstr($interface, "_vip"))
@ -4813,6 +4817,10 @@ function get_interface_ip($interface = "wan") {
function get_interface_ipv6($interface = "wan", $flush = false) {
global $config;
// if we get passed an IP for some reason, return the IP.
if (is_ipaddr($interface))
return $interface;
$realif = get_failover_interface($interface, "inet6");
if (!$realif) {
if (strstr($interface, "_vip"))

View File

@ -148,12 +148,17 @@ EOF;
$bindints .= "interface: ::0\n";
} else {
foreach($active_interfaces as $ubif) {
$intip = get_interface_ip($ubif);
if (is_ipaddrv4($intip))
$bindints .= "interface: $intip\n";
$intip = get_interface_ipv6($ubif);
if (is_ipaddrv6($intip))
$bindints .= "interface: $intip\n";
if (is_ipaddr($ubif)) {
//$bindints .= "interface: $ubif\n"; -- until redmine #4062 is fixed, then uncomment this.
} else {
$intip = get_interface_ip($ubif);
if (is_ipaddrv4($intip))
$bindints .= "interface: $intip\n";
$intip = get_interface_ipv6($ubif);
if (is_ipaddrv6($intip))
if (substr($intip, 0, 4) != "fe80") // skipping link local for the moment to not break people's configs: https://redmine.pfsense.org/issues/4062
$bindints .= "interface: $intip\n";
}
}
}
} else {