Project

General

Profile

« Previous | Next » 

Revision 7ba6c13b

Added by Jim Pingle over 5 years ago

status_ipsec.php improvements

  • Fixes Child SA button JS hide. Fixes #8847
  • Adds Child SA count to JS button
  • Fixes alignment of 'Connect' button for pending P1s
  • Adds "Connect Children" button when P1 is up but P2s are not
  • Adds space after comma in P1 source so that IPv4+IPv6 P1s do not break
    word wrap

View differences:

src/usr/local/www/status_ipsec.php
43 43
	exit;
44 44
}
45 45

  
46
if ($_POST['act'] == 'connect') {
46
if (($_POST['act'] == 'connect') || ($_POST['act'] == 'childconnect')) {
47 47
	if (ctype_digit($_POST['ikeid'])) {
48 48
		$ph1ent = ipsec_get_phase1($_POST['ikeid']);
49 49
		if (!empty($ph1ent)) {
50
			if (empty($ph1ent['iketype']) || $ph1ent['iketype'] == 'ikev1' || isset($ph1ent['splitconn'])) {
50
			if (empty($ph1ent['iketype']) || ($ph1ent['iketype'] == 'ikev1') || isset($ph1ent['splitconn'])) {
51 51
				$ph2entries = ipsec_get_number_of_phase2($_POST['ikeid']);
52 52
				for ($i = 0; $i < $ph2entries; $i++) {
53 53
					$connid = escapeshellarg("con{$_POST['ikeid']}00{$i}");
54
					mwexec_bg("/usr/local/sbin/ipsec down {$connid}");
54
					if ($_POST['act'] != 'childconnect') {
55
						mwexec_bg("/usr/local/sbin/ipsec down {$connid}");
56
					}
55 57
					mwexec_bg("/usr/local/sbin/ipsec up {$connid}");
56 58
				}
57 59
			} else {
58
				mwexec_bg("/usr/local/sbin/ipsec down con" . escapeshellarg($_POST['ikeid'] . '000'));
60
				if ($_POST['act'] != 'childconnect') {
61
					mwexec_bg("/usr/local/sbin/ipsec down con" . escapeshellarg($_POST['ikeid'] . '000'));
62
				}
59 63
				mwexec_bg("/usr/local/sbin/ipsec up con" . escapeshellarg($_POST['ikeid'] . '000'));
60 64
			}
61 65
		}
......
251 255
				print("</a><br />\n");
252 256

  
253 257
			}
258
			if (empty($ikesa['child-sas'])) {
259
				print('<br/><a href="status_ipsec.php?act=childconnect&amp;ikeid=' . substr($con_id, 0, -3) . '" class="btn btn-xs btn-success" data-toggle="tooltip" title="' . gettext("Connect Children"). '" usepost>');
260
				print('<i class="fa fa-sign-in icon-embed-btn"></i>');
261
				print(gettext("Connect Children"));
262
				print("</a>\n");
263
			}
254 264

  
255 265
			print("</td>\n");
256 266
			print("</tr>\n");
......
267 277
				print('<div>');
268 278
				print('<a type="button" id="btnchildsa-'. $child_key .  '" class="btn btn-sm btn-info">');
269 279
				print('<i class="fa fa-plus-circle icon-embed-btn"></i>');
270
				print(gettext('Show child SA entries'));
280
				print(sprintf(gettext('Show child SA entries (%d)'), count($ikesa['child-sas'])));
271 281
				print("</a>\n");
272 282
				print("	</div>\n");
273 283

  
......
424 434
			if (empty($ph1src)) {
425 435
				print(gettext("Unknown"));
426 436
			} else {
427
				print(htmlspecialchars($ph1src));
437
				print(htmlspecialchars(str_replace(',', ', ', $ph1src)));
428 438
			}
429 439

  
430 440
			print("</td>\n");
......
467 477

  
468 478
				print("<td>\n");
469 479
				print(gettext("Disconnected"));
470
				print("</td>\n");
471
				print("<td>\n");
480
				print("<br/>\n");
472 481
				print('<a href="status_ipsec.php?act=connect&amp;ikeid=' . $ph1ent['ikeid'] . '" class="btn btn-xs btn-success" usepost>');
473 482
				print('<i class="fa fa-sign-in icon-embed-btn"></i>');
474 483
				print(gettext("Connect VPN"));
......
611 620
	function show_childsa(said) {
612 621
		sa_open[said] = true;
613 622
		$('#childsa-' + said).show();
614
		$('#btnchildsa-con' + said).hide();
623
		$('#btnchildsa-' + said).hide();
615 624
	}
616 625

  
617 626
	// Populate the tbody on page load

Also available in: Unified diff