mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Fix up for new ptpid scheme and iface name scheme.
This commit is contained in:
parent
99c26d44ae
commit
f748082929
@ -999,12 +999,12 @@ function interface_ppps_configure($interface) {
|
||||
$ifcfg = &$config['interfaces'][$interface];
|
||||
if (is_array($config['ppps']['ppp']) && count($config['ppps']['ppp'])) {
|
||||
foreach ($config['ppps']['ppp'] as $pppid => $ppp) {
|
||||
if ($ifcfg['ptpid'] == $ppp['ptpid'])
|
||||
if ($ifcfg['if'] == $ppp['if'])
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$ppp || $ifcfg['ptpid'] != $ppp['ptpid']){
|
||||
log_error("Can't find PPP config with ptpid {$ifcfg['ptpid']} in interface_ppps_configure().");
|
||||
if (!$ppp || $ifcfg['if'] != $ppp['if']){
|
||||
log_error("Can't find PPP config for {$ifcfg['if']} in interface_ppps_configure().");
|
||||
return 0;
|
||||
}
|
||||
if (!isset($ifcfg['enable'])) {
|
||||
@ -2412,7 +2412,7 @@ function interface_dhcp_configure($interface = "wan") {
|
||||
}
|
||||
|
||||
$wanif = get_real_interface($interface);
|
||||
if (isset($wancfg['ptpid']))
|
||||
if ($wancfg['ipaddr'] == "pppoe" || $wancfg['ipaddr'] == "pptp" $wancfg['ipaddr'] == "l2tp")
|
||||
$wanif = get_real_interface($interface, true);
|
||||
if (stristr($wanif,',')) {
|
||||
log_error("Invalid interface \"{$wanif}\" in interface_dhcp_configure()");
|
||||
@ -3021,9 +3021,9 @@ function get_real_interface($interface = "wan", $get_parent = false) {
|
||||
case "l2tp":
|
||||
case "ppp":
|
||||
$wanif = $cfg['if'];
|
||||
if ($get_parent && isset($cfg['ptpid']))
|
||||
if ($get_parent)
|
||||
foreach ($config['ppps']['ppp'] as $ppp) {
|
||||
if ($ppp['ptpid'] == $cfg['ptpid'])
|
||||
if ($ppp['if'] == $cfg['if'])
|
||||
$wanif = $ppp['ports'];
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1263,12 +1263,12 @@ function get_interface_info($ifdescr) {
|
||||
|
||||
if (is_array($config['ppps']['ppp']) && count($config['ppps']['ppp'])) {
|
||||
foreach ($config['ppps']['ppp'] as $pppid => $ppp) {
|
||||
if ($config['interfaces'][$ifdescr]['ptpid'] == $ppp['ptpid'])
|
||||
if ($config['interfaces'][$ifdescr]['if'] == $ppp['if'])
|
||||
break;
|
||||
}
|
||||
}
|
||||
$dev = $ppp['ports'];
|
||||
if ($config['interfaces'][$ifdescr]['ptpid'] != $ppp['ptpid'] || empty($dev))
|
||||
if ($config['interfaces'][$ifdescr]['if'] != $ppp['if'] || empty($dev))
|
||||
break;
|
||||
if (file_exists($dev)) {
|
||||
if (file_exists("{$g['varrun_path']}/ppp_{$ifdescr}.pid")) {
|
||||
|
||||
@ -1973,7 +1973,8 @@ function upgrade_062_to_063() {
|
||||
|
||||
function upgrade_063_to_064() {
|
||||
global $config;
|
||||
if (is_array($config['ppps']['ppp']) && count($config['ppps']['ppp'])) {
|
||||
$i=0;
|
||||
if (is_array($config['ppps']['ppp']) && count($config['ppps']['ppp'])) {
|
||||
foreach ($config['ppps']['ppp'] as $pppid => $ppp) {
|
||||
if (isset($ppp['port'])){
|
||||
$config['ppps']['ppp'][$pppid]['ports'] = $ppp['port'];
|
||||
@ -1983,7 +1984,8 @@ function upgrade_063_to_064() {
|
||||
$config['ppps']['ppp'][$pppid]['type'] = "ppp";
|
||||
}
|
||||
if (!isset($ppp['ptpid'])){
|
||||
$config['ppps']['ppp'][$pppid]['ptpid'] = uniqid('', true);
|
||||
$config['ppps']['ppp'][$pppid]['ptpid'] = $i;
|
||||
$i++;
|
||||
}
|
||||
if (isset($ppp['defaultgw']))
|
||||
unset($config['ppps']['ppp'][$pppid]['defaultgw']);
|
||||
@ -2002,8 +2004,9 @@ function upgrade_063_to_064() {
|
||||
if ($ifinfo['ipaddr'] == "pppoe" || $ifinfo['ipaddr'] == "pptp"){
|
||||
if (isset($ifinfo['ptpid']))
|
||||
continue;
|
||||
$ppp['ptpid'] = uniqid('', true);
|
||||
$ppp['ptpid'] = $i;
|
||||
$ppp['type'] = $ifinfo['ipaddr'];
|
||||
$ppp['if'] = $ifinfo['ipaddr'].$i;
|
||||
$ppp['ports'] = $ifinfo['if'];
|
||||
if ($ifinfo['ipaddr'] == "pppoe"){
|
||||
$ppp['username'] = $ifinfo['pppoe_username'];
|
||||
@ -2026,7 +2029,7 @@ function upgrade_063_to_064() {
|
||||
for ($i = 0; $i < count($config['cron']['item']); $i++) {
|
||||
$item = $config['cron']['item'][$i];
|
||||
if (strpos($item['command'], "/conf/pppoe{$ifname}restart") !== false)
|
||||
$config['cron']['item'][$i]['command'] = "/var/etc/pppoe_restart_" . $ppp['ptpid'];
|
||||
$config['cron']['item'][$i]['command'] = "/var/etc/pppoe_restart_" . $ppp['if'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2036,12 +2039,10 @@ function upgrade_063_to_064() {
|
||||
$ppp['subnet'] = $ifinfo['subnet'];
|
||||
if (isset($ifinfo['remote']))
|
||||
$ppp['gateway'] = $ifinfo['remote'];
|
||||
|
||||
$ifcfg[$ifname]['ptpid'] = $ppp['ptpid'];
|
||||
if ($ifname == "wan")
|
||||
$ifcfg[$ifname]['if'] = $ifinfo['ipaddr'] ."0";
|
||||
else
|
||||
$ifcfg[$ifname]['if'] = $ifinfo['ipaddr'] . substr($ifname,3);
|
||||
|
||||
$ifcfg[$ifname]['if'] = $ifinfo['ipaddr'].$i;
|
||||
$i++;
|
||||
|
||||
unset($ifcfg[$ifname]['pppoe_username']);
|
||||
unset($ifcfg[$ifname]['pppoe_password']);
|
||||
unset($ifcfg[$ifname]['provider']);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user