diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2008-05-25 04:14:51 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2008-05-25 04:14:51 +0000 |
commit | 3d33b09e81d66fca13943a1b4ad3a20bf939610d (patch) | |
tree | d16f9d001250b750263b666d274828fe2462aa80 | |
parent | 499994ff94210eefdbdede7b347bdc928334bb7e (diff) | |
download | pfsense-3d33b09e81d66fca13943a1b4ad3a20bf939610d.zip pfsense-3d33b09e81d66fca13943a1b4ad3a20bf939610d.tar.gz |
Correctly return real wan ip when using carpdev.
-rw-r--r-- | etc/inc/interfaces.inc | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index edf7a15..3972d8d 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -1640,9 +1640,6 @@ function get_current_wan_address($interface = "wan") { $interface = filter_translate_type_to_real_interface($interface); - if($wancfg['ipaddr'] == "carpdev-dhcp") - return "\$" . convert_real_interface_to_friendly_interface_name($interface); - $ifinfo = ""; if(in_array($wancfg['ipaddr'], array('dhcp'))) { /* get interface info with netstat */ @@ -1674,6 +1671,21 @@ function get_current_wan_address($interface = "wan") { return null; } else { + if($wancfg['ipaddr'] == "carpdev-dhcp") { + /* carpdev support on WAN */ + if($config['interfaces']['wan']['ipaddr'] == "carpdev-dhcp") { + $viparr = &$config['virtualip']['vip']; + $counter = 0; + foreach ($viparr as $vip) { + if ($vip['mode'] == "carpdev-dhcp") { + if($vip['interface'] == "wan") + return str_replace("\n", "", `ifconfig carp{$counter} | grep inet | awk '{ print $2 }'`); + $counter++; + } + } + } + } + /* static WAN IP address */ return $wancfg['ipaddr']; } |