summaryrefslogtreecommitdiffstats
path: root/etc/inc/pfsense-utils.inc
diff options
context:
space:
mode:
authorSeth Mos <seth.mos@xs4all.nl>2008-06-05 08:51:10 +0000
committerSeth Mos <seth.mos@xs4all.nl>2008-06-05 08:51:10 +0000
commit20fdc10f3761081f423bfc3a38e2ebe7a2aa3055 (patch)
treed47cadf9f88313852b555e8fdcf451b989388de1 /etc/inc/pfsense-utils.inc
parent2f306bdbc65d4f2f7cd1a028cd835e9766d7828a (diff)
downloadpfsense-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.inc20
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;
}
OpenPOWER on IntegriCloud