diff options
author | gnhb <gnoahb@gmail.com> | 2010-06-10 21:55:18 +0700 |
---|---|---|
committer | gnhb <gnoahb@gmail.com> | 2010-06-10 21:55:18 +0700 |
commit | 3b15d9248700922aeac69b98fbb0fc743ea0551c (patch) | |
tree | be8d785257f3ab47b1230e3a85ee75e31b96ff86 | |
parent | ab413aaa7314069b2f4a0f9368db23c462481bb3 (diff) | |
download | pfsense-3b15d9248700922aeac69b98fbb0fc743ea0551c.zip pfsense-3b15d9248700922aeac69b98fbb0fc743ea0551c.tar.gz |
Remove old interface_pppoe_configure and interface_pptp_configure functions.
-rw-r--r-- | etc/inc/interfaces.inc | 294 |
1 files changed, 0 insertions, 294 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 92a7318..42b0e42 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -2456,300 +2456,6 @@ EOD; return 0; } -function interface_pppoe_configure($interface = "wan") { - global $config, $g; - - if (!is_array($config['interfaces'][$interface])) - return; - - $wancfg =& $config['interfaces'][$interface]; - - /* generate mpd.conf */ - $fd = fopen("{$g['varetc_path']}/mpd_{$interface}.conf", "w"); - if (!$fd) { - printf("Error: cannot open mpd_{$interface}.conf in interface_pppoe_configure().\n"); - return 1; - } - - $idle = 0; - - if (isset($wancfg['ondemand'])) { - $ondemand = "enable"; - if ($wancfg['timeout']) - $idle = $wancfg['timeout']; - } else { - $ondemand = "disable"; - } - - $mpdconf = <<<EOD -startup: - # configure the web server - set console close - set web close - -default: -pppoeclient: - -EOD; - - if ($interface == "wan") - $realif = "pppoe0"; - else { - // Here code assumes only that strings of form "opt#" will be passed. - $pppoeidx = substr($interface, 3); - $realif = "pppoe{$pppoeidx}"; - } - - $mpdconf .= <<<EOD - create bundle static {$interface} - set iface name {$realif} - -EOD; - $setdefaultgw = false; - $founddefaultgw = false; - if (is_array($config['gateways']['gateway_item'])) { - foreach($config['gateways']['gateway_item'] as $gateway) { - if($interface == $gateway['interface'] && isset($gateway['defaultgw'])) { - $setdefaultgw = true; - break; - } else if (isset($gateway['defaultgw']) && !empty($gateway['interface'])) { - $founddefaultgw = true; - break; - } - } - } - if (($interface == "wan" && $founddefaultgw == false) || $setdefaultgw == true) - $mpdconf .= <<<EOD - set iface route default - -EOD; - - $mpdconf .= <<<EOD - set iface {$ondemand} on-demand - set iface idle {$idle} - set iface enable tcpmssfix - set iface up-script /usr/local/sbin/ppp-linkup - set iface down-script /usr/local/sbin/ppp-linkdown - -EOD; - - if (isset($wancfg['ondemand'])) { - if (isset($wancfg['local-ip']) && isset($wancfg['remote-ip'])) { - $mpdconf .= <<<EOD - set iface addrs {$wancfg['local-ip']} {$wancfg['remote-ip']} - -EOD; - } else { - $mpdconf .= <<<EOD - set iface addrs 192.0.2.112 192.0.2.113 - -EOD; - } - } - - if (isset($config['system']['dnsallowoverride'])) { - $mpdconf .= <<<EOD - set ipcp enable req-pri-dns - -EOD; - } - - if (!isset($wancfg['dnsnosec']) && isset($config['system']['dnsallowoverride'])) { - $mpdconf .= <<<EOD - set ipcp enable req-sec-dns - -EOD; - } - - $mpdconf .= <<<EOD - set ipcp no vjcomp - set ipcp ranges 0.0.0.0/0 0.0.0.0/0 - create link static {$interface}L1 pppoe - set link disable incoming - set link action bundle {$interface} - set auth authname "{$wancfg['pppoe_username']}" - set auth password "{$wancfg['pppoe_password']}" - set link keep-alive 10 60 - set link max-redial 0 - set link no acfcomp protocomp - set link disable pap chap - set link accept chap - set pppoe iface {$wancfg['if']} - set pppoe service "{$wancfg['provider']}" - -EOD; - if (empty($wancfg['mtu'])) - $mpdmtu = "1492"; - else - $mpdmtu = "{$wancfg['mtu']}"; - - $mpdconf .= <<<EOD - set link mtu {$mpdmtu} - open - -EOD; - - fwrite($fd, $mpdconf); - fclose($fd); - - if(file_exists("{$g['varrun_path']}/pppoe_{$interface}.pid") and $g['booting']) { - /* if we are booting and mpd has already been started then don't start again. */ - } else { - /* Bring the parent interface up */ - if($wancfg['if']) - interfaces_bring_up($wancfg['if']); - else - log_error("Could not bring wancfg['if'] up in interface_pppoe_configure()"); - - /* fire up mpd */ - mwexec("/usr/local/sbin/mpd5 -b -k -d {$g['varetc_path']} -f mpd_{$interface}.conf -p {$g['varrun_path']}/pppoe_{$interface}.pid -s {$interface} pppoeclient"); - } - - /* sleep until wan is up - or 30 seconds, whichever comes first */ - for ($count = 0; $count < 30; $count++) { - if(file_exists("{$g['tmp_path']}/{$realif}up")) { - break; - } - sleep(1); - } - - unlink_if_exists("{$g['tmp_path']}/{$realif}up"); - - return 0; -} - -function interface_pptp_configure($interface) { - global $config, $g; - - if (!is_array($config['interfaces'][$interface])) - return; - - $wancfg =& $config['interfaces'][$interface]; - - /* generate mpd.conf */ - $fd = fopen("{$g['varetc_path']}/mpd_{$interface}.conf", "w"); - if (!$fd) { - printf("Error: cannot open mpd_{$interface}.conf in interface_pptp_configure().\n"); - return 1; - } - - $idle = 0; - - if (isset($wancfg['ondemand'])) { - $ondemand = "enable"; - if ($wancfg['timeout']) - $idle = $wancfg['timeout']; - } else { - $ondemand = "disable"; - } - - $mpdconf = <<<EOD -startup: - # configure the web server - set console close - set web close - -default: -pptpclient: - -EOD; - - if ($interface == "wan") - $realif = "pptp0"; - else { - // Here code assumes only that strings of form "opt#" will be passed. - $pptpidx = substr($interface, 3); - $realif = "pptp{$pptpidx}"; - } - - $mpdconf .= <<<EOD - create bundle static {$interface} - set iface name {$realif} - -EOD; - $setdefaultgw = false; - $founddefaultgw = false; - if (is_array($config['gateways']['gateway_item'])) { - foreach($config['gateways']['gateway_item'] as $gateway) { - if($interface == $gateway['interface'] && isset($gateway['defaultgw'])) { - $setdefaultgw = true; - break; - } else if (isset($gateway['defaultgw'])) { - $founddefaultgw = true; - break; - } - } - } - if (($interface == "wan" && $founddefaultgw == false) || $setdefaultgw == true) - $mpdconf .= <<<EOD - set iface route default - -EOD; - - $mpdconf .= <<<EOD - set iface {$ondemand} on-demand - set iface idle {$idle} - set iface up-script /usr/local/sbin/ppp-linkup - set iface down-script /usr/local/sbin/ppp-linkdown - -EOD; - - if (isset($wanfg['ondemand'])) { - $mpdconf .= <<<EOD - set iface addrs 10.0.0.1 10.0.0.2 - -EOD; - } - - if (isset($config['system']['dnsallowoverride'])) { - $mpdconf .= <<<EOD - set ipcp enable req-pri-dns - -EOD; - } - - if (!isset($wancfg['dnsnosec']) && isset($config['system']['dnsallowoverride'])) { - $mpdconf .= <<<EOD - set ipcp enable req-sec-dns - -EOD; - } - - $mpdconf .= <<<EOD - set ipcp no vjcomp - set ipcp ranges 0.0.0.0/0 0.0.0.0/0 - create link static {$interface}L1 pptp - set auth authname "{$wancfg['pptp_username']}" - set auth password "{$wancfg['pptp_password']}" - set bundle no noretry - set link disable incoming - set link keep-alive 10 60 - set link max-redial 0 - set link no acfcomp protocomp - set link disable pap chap - set link accept chap - set pptp self {$wancfg['local']} - set pptp peer {$wancfg['remote']} - set pptp disable windowing - open - -EOD; - - fwrite($fd, $mpdconf); - fclose($fd); - - /* configure interface */ - if($wancfg['if']) - mwexec("/sbin/ifconfig " . escapeshellarg($wancfg['if']) . " " . - escapeshellarg($wancfg['local'] . "/" . $wancfg['subnet']) . " up"); - else - log_error("Could not bring interface wancfg['if'] up in interface_pptp_configure()"); - /* fire up mpd */ - mwexec("/usr/local/sbin/mpd5 -b -k -d {$g['varetc_path']} -f mpd_{$interface}.conf -p {$g['varrun_path']}/pptp_{$interface}.pid -s {$interface} pptpclient"); - - return 0; -} - function interfaces_group_setup() { global $config; |