diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index c5c3ff281..d4af95ae6 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -1408,108 +1408,6 @@ function interfaces_ptpid_next() return $ptpid; } -function getMPDCRONSettings($pppif) -{ - global $config; - - $cron_cmd_file = "/var/etc/pppoe_restart_{$pppif}"; - - if (isset($config['cron']['item'])) { - foreach ($config['cron']['item'] as $i => $item) { - if (stripos($item['command'], $cron_cmd_file) !== false) { - return array("ID" => $i, "ITEM" => $item); - } - } - } - - return null; -} - -function handle_pppoe_reset($post_array) -{ - global $config; - - $pppif = "{$post_array['type']}{$post_array['ptpid']}"; - $cron_cmd_file = "/var/etc/pppoe_restart_{$pppif}"; - - if (!isset($config['cron']['item']) || !is_array($config['cron']['item'])) { - $config['cron']['item'] = array(); - } - - $itemhash = getMPDCRONSettings($pppif); - - // reset cron items if necessary and return - if (empty($post_array['pppoe-reset-type'])) { - if (isset($itemhash)) { - unset($config['cron']['item'][$itemhash['ID']]); - } - killbypid('/var/run/cron.pid', 'HUP'); - return; - } - - if (empty($itemhash)) { - $itemhash = array(); - } - - $item = array(); - if (isset($post_array['pppoe-reset-type']) && $post_array['pppoe-reset-type'] == "custom") { - $item['minute'] = $post_array['pppoe_resetminute']; - $item['hour'] = $post_array['pppoe_resethour']; - if (isset($post_array['pppoe_resetdate']) && $post_array['pppoe_resetdate'] <> "") { - $date = explode("/", $post_array['pppoe_resetdate']); - $item['mday'] = $date[1]; - $item['month'] = $date[0]; - } else { - $item['mday'] = "*"; - $item['month'] = "*"; - } - $item['wday'] = "*"; - $item['who'] = "root"; - $item['command'] = $cron_cmd_file; - } elseif (isset($post_array['pppoe-reset-type']) && $post_array['pppoe-reset-type'] == "preset") { - switch ($post_array['pppoe_pr_preset_val']) { - case "monthly": - $item['minute'] = "0"; - $item['hour'] = "0"; - $item['mday'] = "1"; - $item['month'] = "*"; - $item['wday'] = "*"; - break; - case "weekly": - $item['minute'] = "0"; - $item['hour'] = "0"; - $item['mday'] = "*"; - $item['month'] = "*"; - $item['wday'] = "0"; - break; - case "daily": - $item['minute'] = "0"; - $item['hour'] = "0"; - $item['mday'] = "*"; - $item['month'] = "*"; - $item['wday'] = "*"; - break; - case "hourly": - $item['minute'] = "0"; - $item['hour'] = "*"; - $item['mday'] = "*"; - $item['month'] = "*"; - $item['wday'] = "*"; - break; - } // end switch - $item['who'] = "root"; - $item['command'] = $cron_cmd_file; - } - if (empty($item)) { - return; - } - if (isset($itemhash['ID'])) { - $config['cron']['item'][$itemhash['ID']] = $item; - } else { - $config['cron']['item'][] = $item; - } -} - /* * This function can configure PPPoE, MLPPP (PPPoE), PPTP. * It writes the mpd config file to /var/etc every time the link is opened. @@ -1839,14 +1737,6 @@ EOD; mwexec("/usr/local/sbin/mpd5 -b -k -d /var/etc -f mpd_{$interface}.conf -p /var/run/" . escapeshellarg($ppp['type']) . "_{$interface}.pid -s ppp " . escapeshellarg($ppp['type']) . "client"); - // Check for PPPoE periodic reset request - if ($ppp['type'] == "pppoe") { - if (!empty($ppp['pppoe-reset-type'])) { - interface_setup_pppoe_reset_file($ppp['if'], $interface); - } else { - interface_setup_pppoe_reset_file($ppp['if']); - } - } /* wait for up to 10 seconds for the interface to appear (ppp(oe)) */ $i = 0; while ($i < 10) { @@ -4965,26 +4855,6 @@ function is_jumbo_capable($iface) } } -function interface_setup_pppoe_reset_file($pppif, $iface = '') -{ - $cron_file = "/var/etc/pppoe_restart_{$pppif}"; - - if (!empty($iface) && !empty($pppif)) { - $cron_cmd = << 23)) { - $input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23)."); - } - if (!empty($pconfig['pppoe_resetminute']) && (!is_numericint($pconfig['pppoe_resetminute']) || $pconfig['pppoe_resetminute'] < 0 || $pconfig['pppoe_resetminute'] > 59)) { - $input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59)."); - } - if (!empty($pconfig['pppoe_resetdate']) && !is_numeric(str_replace("/", "", $pconfig['pppoe_resetdate']))) { - $input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy)."); - } - } if (!empty($pconfig['localip']) && !is_ipaddrv4($pconfig['localip'])) { $input_errors[] = gettext("A valid PPTP local IP address must be specified."); } @@ -1037,10 +1014,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { if (!empty($pconfig['pppoe_idletimeout'])) { $new_ppp_config['idletimeout'] = $pconfig['pppoe_idletimeout']; } - - if (!empty($pconfig['pppoe-reset-type'])) { - $new_ppp_config['pppoe-reset-type'] = $pconfig['pppoe-reset-type']; - } break; case "pptp": case "l2tp": @@ -1273,8 +1246,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { exec('/bin/kill ' . $pid); } } - // yak... room for improvement here.... - handle_pppoe_reset($pconfig); // save to config write_config(); @@ -1294,9 +1265,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { mark_subsystem_dirty('interfaces'); - /* regenerate cron settings/crontab file */ - configure_cron(); - header("Location: interfaces.php?if={$if}"); exit; } @@ -1629,21 +1597,6 @@ include("head.inc"); }); }); - // pppoe reset_type - $("#reset_type").change(function() { - if ($(this).val() == 'preset') { - $('#pppoepresetwrap').show(); - $('#pppoecustomwrap').hide(); - } - else if ($(this).val() == 'custom') { - $('#pppoecustomwrap').show(); - $('#pppoepresetwrap').hide(); - } else { - $('#pppoecustomwrap').hide(); - $('#pppoepresetwrap').hide(); - } - }); - $("#reset_type").change(); $("#mtu").change(function(){ // ppp uses an mtu if (!isNaN($("#mtu").val()) && $("#mtu").val() > 8) { @@ -2260,76 +2213,6 @@ include("head.inc"); - - - - - - - - - - -
- -   -
-
" id="pppoecustomwrap"> - -
- -
- "*" && $pconfig['pppoe_resetmonth'] <> "*") { - $pconfig['pppoe_resetdate'] = "{$pconfig['pppoe_resetmonth']}/{$pconfig['pppoe_resetmday']}/" . date("Y"); - } - ?> - - - -
-
" id="pppoepresetwrap"> - - /> - -
- /> - -
- /> - -
- /> - -

-
-
- - diff --git a/src/www/interfaces_ppps.php b/src/www/interfaces_ppps.php index 5977b52dc..c4825a0d2 100644 --- a/src/www/interfaces_ppps.php +++ b/src/www/interfaces_ppps.php @@ -57,8 +57,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (ppp_inuse($a_ppps[$id]['if'])) { $input_errors[] = gettext("This point-to-point link cannot be deleted because it is still being used as an interface."); } else { - unset($a_ppps[$id]['pppoe-reset-type']); - handle_pppoe_reset($a_ppps[$id]); unset($a_ppps[$id]); write_config(); header("Location: interfaces_ppps.php"); diff --git a/src/www/interfaces_ppps_edit.php b/src/www/interfaces_ppps_edit.php index 683288fcd..3a5151971 100644 --- a/src/www/interfaces_ppps_edit.php +++ b/src/www/interfaces_ppps_edit.php @@ -49,7 +49,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { } // plain 1-on-1 copy $copy_fields = array('ptpid', 'type', 'username', 'idletimeout', 'uptime', 'descr', 'simpin', 'pin-wait', - 'apn', 'apnum', 'phone', 'connect-timeout', 'provider', 'pppoe-reset-type'); + 'apn', 'apnum', 'phone', 'connect-timeout', 'provider'); foreach ($copy_fields as $fieldname) { if (isset($a_ppps[$id][$fieldname])) { $pconfig[$fieldname] = $a_ppps[$id][$fieldname]; @@ -77,24 +77,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { $pconfig['initstr'] = isset($a_ppps[$id]['initstr']) ? base64_decode($a_ppps[$id]['initstr']) : null; $pconfig['null_service'] = (isset($a_ppps[$id]['provider']) && empty($a_ppps[$id]['provider'])); - // init resetpppoe_reset vars - $pconfig['pppoe_resetminute'] = null; - $pconfig['pppoe_resethour'] = null; - $pconfig['pppoe_resetmday'] = null; - $pconfig['pppoe_resetmonth'] = null; - $pconfig['pppoe_resetwday'] = null; - // read resetpppoe_reset vars - if (!empty($a_ppps[$id]['pppoe-reset-type'])) { - $itemhash = getMPDCRONSettings($a_ppps[$id]['if']); - if (!empty($itemhash)) { - $cronitem = $itemhash['ITEM']; - $pconfig['pppoe_resetminute'] = $cronitem['minute']; - $pconfig['pppoe_resethour'] = $cronitem['hour']; - $pconfig['pppoe_resetmday'] = $cronitem['mday']; - $pconfig['pppoe_resetmonth'] = $cronitem['month']; - $pconfig['pppoe_resetwday'] = $cronitem['wday']; - } - } if ($pconfig['ptpid'] == null) { $pconfig['ptpid'] = interfaces_ptpid_next(); } @@ -156,18 +138,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { $input_errors[] = gettext("The idle timeout value must be an integer."); } - if (!empty($pconfig['pppoe-reset-type'])) { - if (!empty($pconfig['pppoe_resethour']) && (!is_numericint($pconfig['pppoe_resethour']) || $pconfig['pppoe_resethour'] < 0 || $pconfig['pppoe_resethour'] > 23)) { - $input_errors[] = gettext("A valid PPPoE reset hour must be specified (0-23)."); - } - if (!empty($pconfig['pppoe_resetminute']) && (!is_numericint($pconfig['pppoe_resetminute']) || $pconfig['pppoe_resetminute'] < 0 || $pconfig['pppoe_resetminute'] > 59)) { - $input_errors[] = gettext("A valid PPPoE reset minute must be specified (0-59)."); - } - if (!empty($pconfig['pppoe_resetdate']) && !is_numeric(str_replace("/", "", $pconfig['pppoe_resetdate']))) { - $input_errors[] = gettext("A valid PPPoE reset date must be specified (mm/dd/yyyy)."); - } - } - foreach($pconfig['ports'] as $iface_idx => $iface){ if (!empty($pconfig['localip'][$iface_idx]) && !is_ipaddr($pconfig['localip'][$iface_idx])) { $input_errors[] = sprintf(gettext("A valid local IP address must be specified for %s."),$iface); @@ -243,9 +213,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { } else { $ppp['provider'] = !empty($pconfig['null_service']); } - if (!empty($pconfig['pppoe-reset-type'])) { - $ppp['pppoe-reset-type'] = $pconfig['pppoe-reset-type']; - } break; case "pptp": case "l2tp": @@ -271,11 +238,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { if (!is_dir('/var/spool/lock')) { mwexec('/bin/mkdir -p /var/spool/lock'); } - /* handle_pppoe_reset is called here because if user changes Link Type from PPPoE to another type we - must be able to clear the config data in the section of config.xml if it exists - */ - // yak... room for improvement here.... (see interfaces.php as well) - handle_pppoe_reset($pconfig); if (isset($id)) { $a_ppps[$id] = $ppp; @@ -284,7 +246,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { } write_config(); - configure_cron(); $iflist = get_configured_interface_with_descr(); foreach ($iflist as $pppif => $ifdescr) { if ($config['interfaces'][$pppif]['if'] == $ppp['if']) @@ -305,7 +266,7 @@ include("head.inc"); $(document).ready(function() { // change type $("#type").change(function(){ - $('#ppp,#ppp_adv,#pppoe,#pppoe_adv,#ppp_provider,#phone_num,#apn_').hide(); + $('#ppp,#ppp_adv,#pppoe,#ppp_provider,#phone_num,#apn_').hide(); $('#ports > [data-type="serial"]').hide(); $('#ports > [data-type="serial"]').prop('disabled', true); $('#ports > [data-type="interface"]').hide(); @@ -333,7 +294,6 @@ include("head.inc"); break; case "pppoe": $('#pppoe').show(); - $('#pppoe_adv').show(); // fall through to show interface items default: $('#ports > [data-type="interface"]').show(); @@ -643,81 +603,6 @@ include("head.inc");
- - - - - - - - - - - - - -