diff options
author | Seth Mos <seth.mos@xs4all.nl> | 2008-06-05 08:51:10 +0000 |
---|---|---|
committer | Seth Mos <seth.mos@xs4all.nl> | 2008-06-05 08:51:10 +0000 |
commit | 20fdc10f3761081f423bfc3a38e2ebe7a2aa3055 (patch) | |
tree | d47cadf9f88313852b555e8fdcf451b989388de1 /etc/inc/pfsense-utils.inc | |
parent | 2f306bdbc65d4f2f7cd1a028cd835e9766d7828a (diff) | |
download | pfsense-20fdc10f3761081f423bfc3a38e2ebe7a2aa3055.zip pfsense-20fdc10f3761081f423bfc3a38e2ebe7a2aa3055.tar.gz |
Make the vpn configuration add static routes on interfaces other then WAN.
link_carp_interface_to_parent() now correctly returns parent interface instead of always WAN.
Diffstat (limited to 'etc/inc/pfsense-utils.inc')
-rw-r--r-- | etc/inc/pfsense-utils.inc | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 47854d5..bd27bad 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -1211,20 +1211,26 @@ function link_carp_interface_to_parent($interface) { global $config; if($interface == "") return; - $ifdescrs = array('wan', 'lan'); + $ifdescrs = array("wan" => "wan", "lan" => "lan"); for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) $ifdescrs['opt' . $j] = "opt" . $j; + $carp_int = $interface; + $carp_ip = find_interface_ip($interface); + $carp_subnet = find_virtual_ip_netmask($carp_ip); + $starting_ip = gen_subnet("{$carp_ip}", "{$carp_subnet}"); $carp_ints = ""; $num_carp_ints = find_number_of_created_carp_interfaces(); + foreach ($ifdescrs as $ifdescr => $ifname) { - $carp_int = $interface; - $carp_ip = find_interface_ip($interface); - $carp_subnet = find_virtual_ip_netmask($carp_ip); - $starting_ip = gen_subnet("{$carp_ip}", "{$carp_subnet}"); - if(ip_in_subnet($starting_ip, "{$carp_ip}/{$carp_subnet}")) - if(!stristr($carp_ints, $carp_int)) + if(interface_has_gateway($ifname)) { + $interfaceip = $config['interfaces'][$ifname]['ipaddr']; + $subnet_bits = $config['interfaces'][$ifname]['subnet']; + $subnet_ip = gen_subnet("{$interfaceip}", "{$subnet_bits}"); + if(ip_in_subnet($carp_ip, "{$subnet_ip}/{$subnet_bits}")) { return $ifname; + } + } } return $carp_ints; } |