diff options
-rw-r--r-- | src/etc/inc/interfaces.inc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index dc984fd..05945d3 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -5312,6 +5312,16 @@ function get_interface_ip($interface = "wan") { return null; } + if (is_array($config['interfaces'][$interface]) && + is_ipaddr($config['interfaces'][$interface]['ipaddr'])) { + return ($config['interfaces'][$interface]['ipaddr']); + } + + /* + * Beaware that find_interface_ip() is our last option, it will + * return the first IP it find on interface, not necessarily the + * main IP address. + */ $curip = find_interface_ip($realif); if ($curip && is_ipaddr($curip) && ($curip != "0.0.0.0")) { return $curip; @@ -5351,8 +5361,15 @@ function get_interface_ipv6($interface = "wan", $flush = false) { } break; } + if (is_ipaddrv6($config['interfaces'][$interface]['ipaddrv6'])) + return ($config['interfaces'][$interface]['ipaddrv6']); } + /* + * Beaware that find_interface_ip() is our last option, it will + * return the first IP it find on interface, not necessarily the + * main IP address. + */ $curip = find_interface_ipv6($realif, $flush); if ($curip && is_ipaddrv6($curip) && ($curip != "::")) { return $curip; |