Project

General

Profile

« Previous | Next » 

Revision bbc28078

Added by Jim Pingle over 8 years ago

Correct the descriptions and behavior of the Adaptive Start and Adaptive End settings.

View differences:

src/etc/inc/filter.inc
356 356
		$limitrules .= "set timeout { $timeoutlist }\n";
357 357
	}
358 358

  
359
	if (!empty($config['system']['adaptivestart']) && !empty($config['system']['adaptiveend'])) {
359
	if (is_numericint($config['system']['adaptivestart']) && is_numericint($config['system']['adaptiveend'])) {
360 360
		$limitrules .= "set timeout { adaptive.start {$config['system']['adaptivestart']}, adaptive.end {$config['system']['adaptiveend']} }\n";
361 361
	}
362 362

  
src/usr/local/www/system_advanced_firewall.php
79 79
	$pconfig = $_POST;
80 80

  
81 81
	/* input validation */
82
	if ((empty($_POST['adaptivestart']) && !empty($_POST['adaptiveend'])) || (!empty($_POST['adaptivestart']) && empty($_POST['adaptiveend']))) {
82
	if ((isset($_POST['adaptivestart']) && !isset($_POST['adaptiveend'])) || (!isset($_POST['adaptivestart']) && isset($_POST['adaptiveend']))) {
83 83
		$input_errors[] = gettext("The Firewall Adaptive values must be set together.");
84 84
	}
85
	if (!empty($_POST['adaptivestart']) && !is_numericint($_POST['adaptivestart'])) {
85
	if (isset($_POST['adaptivestart']) && (strlen($_POST['adaptivestart']) > 0) && !is_numericint($_POST['adaptivestart'])) {
86 86
		$input_errors[] = gettext("The Firewall Adaptive Start value must be an integer.");
87 87
	}
88
	if (!empty($_POST['adaptive-end']) && !is_numericint($_POST['adaptive-end'])) {
88
	if (isset($_POST['adaptive-end']) && (strlen($_POST['adaptive-end']) > 0) && !is_numericint($_POST['adaptive-end'])) {
89 89
		$input_errors[] = gettext("The Firewall Adaptive End value must be an integer.");
90 90
	}
91 91
	if ($_POST['firewall-maximum-states'] && !is_numericint($_POST['firewall-maximum-states'])) {
......
183 183
			unset($config['system']['scrubrnid']);
184 184
		}
185 185

  
186
		if (!empty($_POST['adaptiveend'])) {
186
		if (is_numericint($_POST['adaptiveend'])) {
187 187
			$config['system']['adaptiveend'] = $_POST['adaptiveend'];
188 188
		} else {
189 189
			unset($config['system']['adaptiveend']);
190 190
		}
191
		if (!empty($_POST['adaptivestart'])) {
191
		if (is_numericint($_POST['adaptivestart'])) {
192 192
			$config['system']['adaptivestart'] = $_POST['adaptivestart'];
193 193
		} else {
194 194
			unset($config['system']['adaptivestart']);
......
448 448
	'Adaptive start',
449 449
	'number',
450 450
	$pconfig['adaptivestart'],
451
	['min' => 1]
451
	['min' => 0]
452 452
))->setHelp('When the number of state entries exceeds this value, adaptive '.
453 453
	'scaling begins.  All timeout values are scaled linearly with factor '.
454
	'(adaptive.end - number of states) / (adaptive.end - adaptive.start).');
454
	'(adaptive.end - number of states) / (adaptive.end - adaptive.start). '.
455
	'Defaults to 60% of the Firewall Maximum States value');
455 456

  
456 457
$group->add(new Form_Input(
457 458
	'adaptiveend',
458 459
	'Adaptive end',
459 460
	'number',
460 461
	$pconfig['adaptiveend'],
461
	['min' => 1]
462
	['min' => 0]
462 463
))->setHelp('When reaching this number of state entries, all timeout values '.
463 464
	'become zero, effectively purging all state entries immediately.  This '.
464 465
	'value is used to define the scale factor, it should not actually be '.
465
	'reached (set a lower state limit, see below).');
466
	'reached (set a lower state limit, see below). '.
467
	'Defaults to 120% of the Firewall Maximum States value');
466 468

  
467 469
$group->setHelp('Timeouts for states can be scaled adaptively as the number of '.
468
	'state table entries grows. Leave blank for the default (0)');
470
	'state table entries grows. Leave blank to use default values, set to '.
471
	'0 to disable Adaptive Timeouts');
469 472

  
470 473
$section->add($group);
471 474

  

Also available in: Unified diff