Project

General

Profile

« Previous | Next » 

Revision 376e6f67

Added by hamnur almost 8 years ago

Use attribute rekey_enable as usual but optionally allow to set margintime if rekeying is not disabled

View differences:

src/etc/inc/vpn.inc
1109 1109
				$reauth = "reauth = yes";
1110 1110
			}
1111 1111

  
1112
			if ($ph1ent['margintime']) {
1113
				$rekeyline = "rekey = yes";
1114
				$rekeyline .= "\n\tmargintime = {$ph1ent['margintime']}s";
1115
			} else {
1112
			if (isset($ph1ent['rekey_enable'])) {
1116 1113
				$rekeyline = "rekey = no";
1114
			} else {
1115
				$rekeyline = "rekey = yes";
1116
				if(!empty($ph1ent['margintime'])){
1117
					$rekeyline .= "\n\tmargintime = {$ph1ent['margintime']}s";
1118
				}
1117 1119
			}
1118 1120

  
1119 1121
			if ($ph1ent['nat_traversal'] == 'off') {
src/usr/local/www/vpn_ipsec_phase1.php
112 112
	if (isset($a_phase1[$p1index]['reauth_enable'])) {
113 113
		$pconfig['reauth_enable'] = true;
114 114
	}
115
	if ($a_phase1[$p1index]['margintime']) {
115

  
116
	if (isset($a_phase1[$p1index]['rekey_enable'])) {
116 117
		$pconfig['rekey_enable'] = true;
118
	}
119

  
120
	if ($a_phase1[$p1index]['margintime']) {
117 121
		$pconfig['margintime'] = $a_phase1[$p1index]['margintime'];
118 122
	}
123

  
119 124
	if (isset($a_phase1[$p1index]['responderonly'])) {
120 125
		$pconfig['responderonly'] = true;
121 126
	}
......
240 245
		$input_errors[] = gettext("The P1 lifetime must be an integer.");
241 246
	}
242 247

  
243
	if ($pconfig['rekey_enable']) {
248
	if (!isset($pconfig['rekey_enable']) && $pconfig['margintime']) {
244 249
		if(!is_numericint($pconfig['margintime'])){
245 250
			 $input_errors[] = gettext("The margintime must be an integer.");
246 251
		} else if(intval($pconfig['margintime']) >= intval($pconfig['lifetime'])){
......
476 481
		} else {
477 482
			unset($ph1ent['reauth_enable']);
478 483
		}
484

  
479 485
		if (isset($pconfig['rekey_enable'])) {
486
			$ph1ent['rekey_enable'] = true;
487
		} else {
488
			unset($ph1ent['rekey_enable']);
489
		}
490

  
491
		if (!isset($pconfig['rekey_enable'])) {
480 492
			$ph1ent['margintime'] = $pconfig['margintime'];
493
		} else {
494
			unset($ph1ent['margintime']);
481 495
		}
482 496

  
483 497
		if (isset($pconfig['responderonly'])) {
......
833 847

  
834 848
$section->addInput(new Form_Checkbox(
835 849
	'rekey_enable',
836
	'Enable rekey',
837
	'Enables renegotiation when a connection is about to expire.',
850
	'Disable rekey',
851
	'Disables renegotiation when a connection is about to expire.',
838 852
	$pconfig['rekey_enable']
839 853
));
840 854

  
......
1083 1097
	}
1084 1098

  
1085 1099
	function rekeychkbox_change() {
1086
		hide = !$('#rekey_enable').prop('checked');
1100
		hide = $('#rekey_enable').prop('checked');
1087 1101

  
1088 1102
		hideInput('margintime', hide);
1089

  
1090
		if (!$('#margintime').val()) {
1091
			$('#margintime').val('540')
1092
		}
1093
	}
1103
  }
1094 1104

  
1095 1105
	function dpdchkbox_change() {
1096 1106
		hide = !$('#dpd_enable').prop('checked');

Also available in: Unified diff