diff options
author | Ermal Luçi <eri@pfsense.org> | 2009-03-30 00:37:45 +0000 |
---|---|---|
committer | Ermal Luçi <eri@pfsense.org> | 2009-03-30 00:38:36 +0000 |
commit | a55e9c701c2fc8914e0aebf12e37038f59b07cf8 (patch) | |
tree | 05b5a1bc85f8742706649429ec164f576d240975 /etc/inc/vpn.inc | |
parent | cc460ee980e427bf4acdb8a4903e3278df59ea94 (diff) | |
download | pfsense-a55e9c701c2fc8914e0aebf12e37038f59b07cf8.zip pfsense-a55e9c701c2fc8914e0aebf12e37038f59b07cf8.tar.gz |
* Hide interfaces internals to other code and use the propper interfaces.
Basically use get_interface*() functions instead of accessing fields like 'ipaddr'/'descr' etc...
* Make get_interfaces_with_gateway less heavyweight by getting information from the configuration stored in config.xml
* Some other missed custom interface list building and substituing with propper get_configured_interface*()
NOTE: This should give indipendce on dynamic interfaces on some services that before could not be used on top of this type of interfaces.
Diffstat (limited to 'etc/inc/vpn.inc')
-rw-r--r-- | etc/inc/vpn.inc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index 84b8719..6b6ae3c 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -115,9 +115,9 @@ function vpn_ipsec_configure($ipchg = false) $a_phase2 = $config['ipsec']['phase2']; $a_client = $config['ipsec']['client']; $lancfg = $config['interfaces']['lan']; - $lanip = $lancfg['ipaddr']; - $lansa = gen_subnet($lancfg['ipaddr'], $lancfg['subnet']); - $lansn = $lancfg['subnet']; + $lanip = get_interface_ip("lan"); + $lansn = get_interface_subnet("lan"); + $lansa = gen_subnet($lanip, $lansn); if (!isset($ipseccfg['enable'])) { mwexec("/sbin/ifconfig enc0 down"); @@ -791,8 +791,8 @@ EOD; /* add endpoint routes to correct gateway on interface */ if (interface_has_gateway($parentinterface)) { $gatewayip = get_interface_gateway("$parentinterface"); - $interfaceip = $config['interfaces'][$parentinterface]['ipaddr']; - $subnet_bits = $config['interfaces'][$parentinterface]['subnet']; + $interfaceip = get_interface_ip($parentinterface); + $subnet_bits = get_interface_subnet($parentinterface); $subnet_ip = gen_subnet("{$interfaceip}", "{$subnet_bits}"); /* if the remote gateway is in the local subnet, then don't add a route */ if (! ip_in_subnet($rgip, "{$subnet_ip}/{$subnet_bits}")) { @@ -1024,7 +1024,7 @@ EOD; $mpdconf .= " set ipcp dns " . join(" ", $pptpdcfg['dnsserver']) . "\n"; } else if (isset ($config['dnsmasq']['enable'])) { - $mpdconf .= " set ipcp dns " . $config['interfaces']['lan']['ipaddr']; + $mpdconf .= " set ipcp dns " . get_interface_ip("lan"); if ($syscfg['dnsserver'][0]) $mpdconf .= " " . $syscfg['dnsserver'][0]; $mpdconf .= "\n"; @@ -1224,7 +1224,7 @@ pppoe_standart: EOD; if (isset ($config['dnsmasq']['enable'])) { - $mpdconf .= " set ipcp dns " . $config['interfaces']['lan']['ipaddr']; + $mpdconf .= " set ipcp dns " . get_interface_ip("lan"); if ($syscfg['dnsserver'][0]) $mpdconf .= " " . $syscfg['dnsserver'][0]; $mpdconf .= "\n"; @@ -1406,7 +1406,7 @@ l2tp_standard: EOD; if (isset ($config['dnsmasq']['enable'])) { - $mpdconf .= " set ipcp dns " . $config['interfaces']['lan']['ipaddr']; + $mpdconf .= " set ipcp dns " . get_interface_ip("lan"); if ($syscfg['dnsserver'][0]) $mpdconf .= " " . $syscfg['dnsserver'][0]; $mpdconf .= "\n"; |