Project

General

Profile

« Previous | Next » 

Revision 3cc22ff2

Added by Phil Davis over 8 years ago

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.

View differences:

src/usr/local/www/interfaces_ppps_edit.php
294 294
			}
295 295
		}
296 296

  
297
		// Loop through fields associated with an individual link/port and make an array of the data
298
		$port_fields = array("localip", "gateway", "subnet", "bandwidth", "mtu", "mru", "mrru");
297
		// Loop through each individual link/port and check max mtu
299 298
		foreach ($_POST['interfaces'] as $iface) {
300
			foreach ($port_fields as $field_label) {
301
				if (isset($_POST[$field_label . $iface]) &&
302
				    strlen($_POST[$field_label . $iface]) > 0) {
303
					$port_data[$field_label][] = $_POST[$field_label . $iface];
304
					$pconfig[$field_label][$iface] = $_POST[$field_label . $iface];
305
					$parent_array = get_parent_interface($iface);
306
					$parent = $parent_array[0];
307
					$friendly = convert_real_interface_to_friendly_interface_name($parent);
308
					if ($field_label == "mtu" && isset($config['interfaces'][$friendly]['mtu']) &&
309
					    $_POST[$field_label . $iface] > ($config['interfaces'][$friendly]['mtu'] - 8)) {
310
						$input_errors[] = sprintf(gettext("The MTU (%d) is too big for %s (maximum allowed with current settings: %d)."),
311
						    $_POST[$field_label . $iface], $iface, $config['interfaces'][$friendly]['mtu'] - 8);
312
					}
299
			if (isset($_POST['mtu'][$iface]) &&
300
			    strlen($_POST['mtu'][$iface]) > 0) {
301
				$parent_array = get_parent_interface($iface);
302
				$parent = $parent_array[0];
303
				$friendly = convert_real_interface_to_friendly_interface_name($parent);
304
				if (!empty($config['interfaces'][$friendly]['mtu']) &&
305
					$_POST['mtu'][$iface] > ($config['interfaces'][$friendly]['mtu'] - 8)) {
306
					$input_errors[] = sprintf(gettext('The MTU (%1$d) is too big for %2$s (maximum allowed with current settings: %3$d).'),
307
						$_POST['mtu'][$iface], $iface, $config['interfaces'][$friendly]['mtu'] - 8);
313 308
				}
314 309
			}
315 310
		}
316

  
317 311
	}
318 312

  
319 313
	if (!$input_errors) {
......
535 529
					$string .= " ({$ifinfo['mac']})";
536 530
				}
537 531
				if ($ifinfo['friendly']) {
538
					$string .= " - {$ifinfo['friendly']}";
539
				}
540
				if ($ifinfo['descr']) {
532
					$string .= " - " . convert_friendly_interface_to_friendly_descr($ifinfo['friendly']);
533
				} elseif ($ifinfo['descr']) {
541 534
					$string .= " - {$ifinfo['descr']}";
542 535
				}
543 536
			} else {
......
859 852
	'Idle Timeout',
860 853
	'text',
861 854
	$pconfig['idletimeout']
862
))->setHelp('If no incoming or outgoing packets are transmitted for the entered number of seconds the connection is brought down.' . " " .
855
))->setHelp('If no incoming or outgoing packets are transmitted for the entered number of seconds the connection is brought down. ' .
863 856
			'When the idle timeout occurs, if the dial-on-demand option is enabled, mpd goes back into dial-on-demand mode. ' .
864 857
			'Otherwise, the interface is brought down and all associated routes removed.');
865 858

  
......
869 862
	'Disable vjcomp (compression, auto-negotiated by default).',
870 863
	$pconfig['vjcomp']
871 864
))->setHelp('Disable vjcomp(compression) (auto-negotiated by default).' . '<br />' .
872
				'This option enables Van Jacobson TCP header compression, which saves several bytes per TCP data packet.' . " " .
865
				'This option enables Van Jacobson TCP header compression, which saves several bytes per TCP data packet. ' .
873 866
				'This option is almost always required. Compression is not effective for TCP connections with enabled modern extensions like time ' .
874 867
				'stamping or SACK, which modify TCP options between sequential packets.');
875 868

  
......
986 979
		// On page load decide the initial state based on the data.
987 980
		if (ispageload) {
988 981
<?php
989
			if (($pconfig['apn'] == "") &&
982
			$have_link_param = false;
983

  
984
			foreach ($linklist['list'] as $ifnm => $nm) {
985
				if (($pconfig['bandwidth'][$ifnm] != "") ||
986
				    ($pconfig['mtu'][$ifnm] != "") ||
987
				    ($pconfig['mru'][$ifnm] != "") ||
988
				    ($pconfig['mrru'][$ifnm] != "")) {
989
					$have_link_param = true;
990
				}
991
			}
992

  
993
			if ((!$have_link_param) &&
994
			    ($pconfig['apn'] == "") &&
990 995
			    ($pconfig['apnum'] == "") &&
991 996
			    ($pconfig['simpin'] == "") &&
992 997
			    ($pconfig['pin-wait'] == "") &&

Also available in: Unified diff