summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2017-02-07 18:37:45 +0545
committerRenato Botelho <renato@netgate.com>2017-02-07 14:58:03 -0200
commitdcef6e2dd621cd1f78bb54272d27d7152cad02c8 (patch)
tree4c5164803d5fc2221749e510d51cb0e882840063 /src
parent36245b2f8f3794e1243ec52b5b54416caf3bbfeb (diff)
downloadpfsense-dcef6e2dd621cd1f78bb54272d27d7152cad02c8.zip
pfsense-dcef6e2dd621cd1f78bb54272d27d7152cad02c8.tar.gz
interfaces_ppps_edit fixes that will work on 2.3.3 also
1) Make "The MTU is too big" message actually come out. The code around line 300 was rubbish (maybe from before bootstrap?). 2) Show friendly description rather than 'wan' 'lan' opt1' in interface link list. 3) If any specific link parameters are set, then open the advanced section on page load. I tested on a 2.4 system, then applied these diff on a 2.3.3 system and it worked there also. So this should backport fine. (cherry picked from commit 3cc22ff255bbc980786fca4723b01cc9524e1cf5)
Diffstat (limited to 'src')
-rw-r--r--src/usr/local/www/interfaces_ppps_edit.php49
1 files changed, 27 insertions, 22 deletions
diff --git a/src/usr/local/www/interfaces_ppps_edit.php b/src/usr/local/www/interfaces_ppps_edit.php
index 16a760e..d30a62a 100644
--- a/src/usr/local/www/interfaces_ppps_edit.php
+++ b/src/usr/local/www/interfaces_ppps_edit.php
@@ -326,26 +326,20 @@ if (isset($_POST) && is_array($_POST) && count($_POST) > 0) {
}
}
- // Loop through fields associated with an individual link/port and make an array of the data
- $port_fields = array("localip", "gateway", "subnet", "bandwidth", "mtu", "mru", "mrru");
+ // Loop through each individual link/port and check max mtu
foreach ($_POST['interfaces'] as $iface) {
- foreach ($port_fields as $field_label) {
- if (isset($_POST[$field_label . $iface]) &&
- strlen($_POST[$field_label . $iface]) > 0) {
- $port_data[$field_label][] = $_POST[$field_label . $iface];
- $pconfig[$field_label][$iface] = $_POST[$field_label . $iface];
- $parent_array = get_parent_interface($iface);
- $parent = $parent_array[0];
- $friendly = convert_real_interface_to_friendly_interface_name($parent);
- if ($field_label == "mtu" && isset($config['interfaces'][$friendly]['mtu']) &&
- $_POST[$field_label . $iface] > ($config['interfaces'][$friendly]['mtu'] - 8)) {
- $input_errors[] = sprintf(gettext("The MTU (%d) is too big for %s (maximum allowed with current settings: %d)."),
- $_POST[$field_label . $iface], $iface, $config['interfaces'][$friendly]['mtu'] - 8);
- }
+ if (isset($_POST['mtu'][$iface]) &&
+ strlen($_POST['mtu'][$iface]) > 0) {
+ $parent_array = get_parent_interface($iface);
+ $parent = $parent_array[0];
+ $friendly = convert_real_interface_to_friendly_interface_name($parent);
+ if (!empty($config['interfaces'][$friendly]['mtu']) &&
+ $_POST['mtu'][$iface] > ($config['interfaces'][$friendly]['mtu'] - 8)) {
+ $input_errors[] = sprintf(gettext('The MTU (%1$d) is too big for %2$s (maximum allowed with current settings: %3$d).'),
+ $_POST['mtu'][$iface], $iface, $config['interfaces'][$friendly]['mtu'] - 8);
}
}
}
-
}
if (!$input_errors) {
@@ -566,9 +560,8 @@ function build_link_list() {
$string .= " ({$ifinfo['mac']})";
}
if ($ifinfo['friendly']) {
- $string .= " - {$ifinfo['friendly']}";
- }
- if ($ifinfo['descr']) {
+ $string .= " - " . convert_friendly_interface_to_friendly_descr($ifinfo['friendly']);
+ } elseif ($ifinfo['descr']) {
$string .= " - {$ifinfo['descr']}";
}
} else {
@@ -890,7 +883,7 @@ $section->addInput(new Form_Input(
'Idle Timeout',
'text',
$pconfig['idletimeout']
-))->setHelp('If no incoming or outgoing packets are transmitted for the entered number of seconds the connection is brought down.' . " " .
+))->setHelp('If no incoming or outgoing packets are transmitted for the entered number of seconds the connection is brought down. ' .
'When the idle timeout occurs, if the dial-on-demand option is enabled, mpd goes back into dial-on-demand mode. ' .
'Otherwise, the interface is brought down and all associated routes removed.');
@@ -900,7 +893,7 @@ $section->addInput(new Form_Checkbox(
'Disable vjcomp (compression, auto-negotiated by default).',
$pconfig['vjcomp']
))->setHelp('Disable vjcomp(compression) (auto-negotiated by default).' . '<br />' .
- 'This option enables Van Jacobson TCP header compression, which saves several bytes per TCP data packet.' . " " .
+ 'This option enables Van Jacobson TCP header compression, which saves several bytes per TCP data packet. ' .
'This option is almost always required. Compression is not effective for TCP connections with enabled modern extensions like time ' .
'stamping or SACK, which modify TCP options between sequential packets.');
@@ -1017,7 +1010,19 @@ events.push(function() {
// On page load decide the initial state based on the data.
if (ispageload) {
<?php
- if (($pconfig['apn'] == "") &&
+ $have_link_param = false;
+
+ foreach ($linklist['list'] as $ifnm => $nm) {
+ if (($pconfig['bandwidth'][$ifnm] != "") ||
+ ($pconfig['mtu'][$ifnm] != "") ||
+ ($pconfig['mru'][$ifnm] != "") ||
+ ($pconfig['mrru'][$ifnm] != "")) {
+ $have_link_param = true;
+ }
+ }
+
+ if ((!$have_link_param) &&
+ ($pconfig['apn'] == "") &&
($pconfig['apnum'] == "") &&
($pconfig['simpin'] == "") &&
($pconfig['pin-wait'] == "") &&
OpenPOWER on IntegriCloud