Revision 3c5f4441
Added by Stephen Jones almost 7 years ago
src/usr/local/www/status_ipsec.php | ||
---|---|---|
68 | 68 |
} |
69 | 69 |
} else if ($_POST['act'] == 'ikedisconnect') { |
70 | 70 |
|
71 |
if (ctype_digit($_POST['ikeid'])) { |
|
72 |
if (!empty($_POST['ikesaid']) && ctype_digit($_POST['ikesaid'])) { |
|
73 |
mwexec_bg("/usr/local/sbin/ipsec down " ."'" . "con" . escapeshellarg($_POST['ikeid']) . "[" . escapeshellarg($_POST['ikesaid']) . "]" . "'"); |
|
74 |
} else { |
|
75 |
mwexec_bg("/usr/local/sbin/ipsec down con" . escapeshellarg($_POST['ikeid'])); |
|
76 |
} |
|
71 |
if (!empty($_POST['ikesaid']) && ctype_digit($_POST['ikesaid'])) { |
|
72 |
mwexec_bg("/usr/local/sbin/ipsec down " ."'" . escapeshellarg($_POST['ikeid']) . "[" . escapeshellarg($_POST['ikesaid']) . "]" . "'"); |
|
73 |
} else { |
|
74 |
mwexec_bg("/usr/local/sbin/ipsec down " . escapeshellarg($_POST['ikeid'])); |
|
77 | 75 |
} |
78 | 76 |
} else if ($_POST['act'] == 'childdisconnect') { |
79 | 77 |
//pull out number from id |
80 |
$id_val = filter_var($_POST['ikeid'], FILTER_SANITIZE_NUMBER_INT); |
|
81 |
|
|
82 |
if (ctype_digit($id_val)) { |
|
83 | 78 |
if (!empty($_POST['ikesaid']) && ctype_digit($_POST['ikesaid'])) { |
84 |
mwexec_bg("/usr/local/sbin/ipsec down con" . escapeshellarg($id_val) . "{" . escapeshellarg($_POST['ikesaid']) . "}");
|
|
79 |
mwexec_bg("/usr/local/sbin/ipsec down " . escapeshellarg($_POST['ikeid']) . "{" . escapeshellarg($_POST['ikesaid']) . "}");
|
|
85 | 80 |
} |
86 |
} |
|
87 | 81 |
} |
88 | 82 |
|
89 | 83 |
// Table body is composed here so that it can be more easily updated via AJAX |
... | ... | |
114 | 108 |
} |
115 | 109 |
|
116 | 110 |
print("<tr>\n"); |
111 |
|
|
112 |
print("<td>\n"); |
|
113 |
print(htmlspecialchars($ikesa['con-id'])) . ":\n"; |
|
114 |
print('#' . htmlspecialchars($ikesa['uniqueid'])); |
|
115 |
print("</td>\n"); |
|
116 |
|
|
117 | 117 |
print("<td>\n"); |
118 | 118 |
if (is_array($a_phase1) && htmlspecialchars(ipsec_get_descr($ph1idx)) == "") { |
119 | 119 |
foreach ($a_phase1 as $ph1) { |
... | ... | |
125 | 125 |
} |
126 | 126 |
print(htmlspecialchars(ipsec_get_descr($ph1idx))); |
127 | 127 |
print("</td>\n"); |
128 |
|
|
128 | 129 |
print("<td>\n"); |
129 | 130 |
|
130 | 131 |
if (!empty($ikesa['local-id'])) { |
... | ... | |
239 | 240 |
printf(gettext('%1$s seconds (%2$s) ago'), htmlspecialchars($ikesa['established']), convert_seconds_to_dhms($ikesa['established'])); |
240 | 241 |
} |
241 | 242 |
|
242 |
print("</span>"); |
|
243 |
print("</td>\n"); |
|
244 |
print("<td>\n"); |
|
243 |
print("</span><br /><br />"); |
|
245 | 244 |
|
246 | 245 |
if ($ikesa['state'] != 'ESTABLISHED') { |
247 | 246 |
|
... | ... | |
252 | 251 |
|
253 | 252 |
} else { |
254 | 253 |
|
255 |
print('<a href="status_ipsec.php?act=ikedisconnect&ikeid=' . $con_id . '&ikesaid=' .$ikesa['uniqueid'] . '"class="btn btn-xs btn-danger" data-toggle="tooltip" title="' . gettext("Disconnect VPN") . '" usepost>');
|
|
254 |
print('<a href="status_ipsec.php?act=ikedisconnect&ikeid=' . $ikesa['con-id']. '&ikesaid=' .$ikesa['uniqueid'] . '"class="btn btn-xs btn-danger" data-toggle="tooltip" title="' . gettext("Disconnect VPN") . '" usepost>');
|
|
256 | 255 |
print('<i class="fa fa-trash icon-embed-btn"></i>'); |
257 | 256 |
print(gettext("Disconnect")); |
258 | 257 |
print("</a><br />\n"); |
... | ... | |
281 | 280 |
print('<table class="table table-hover table-condensed" id="childsa-'.$child_key . '" style="display:none">'); |
282 | 281 |
print("<thead>\n"); |
283 | 282 |
print('<tr class="bg-info">'); |
284 |
print('<th><?=gettext("Local subnets")?></th>'); |
|
285 |
print('<th><?=gettext("Local SPI(s)")?></th>'); |
|
286 |
print('<th><?=gettext("Remote subnets")?></th>'); |
|
287 |
print('<th><?=gettext("Times")?></th>'); |
|
288 |
print('<th><?=gettext("Algo")?></th>'); |
|
289 |
print('<th><?=gettext("Stats")?></th>'); |
|
283 |
print('<th>' . gettext("IPsec ID") . '</th>'); |
|
284 |
print('<th>' . gettext("Local subnets") . '</th>'); |
|
285 |
print('<th>' . gettext("Local SPI(s)") . '</th>'); |
|
286 |
print('<th>' . gettext("Remote subnets") . '</th>'); |
|
287 |
print('<th>' . gettext("Times") . '</th>'); |
|
288 |
print('<th>' . gettext("Algo") . '</th>'); |
|
289 |
print('<th>' . gettext("Stats") . '</th>'); |
|
290 | 290 |
print('<th><!-- Buttons --></th>'); |
291 | 291 |
print("</tr\n"); |
292 | 292 |
print("</thead>\n"); |
... | ... | |
295 | 295 |
foreach ($ikesa['child-sas'] as $childid => $childsa) { |
296 | 296 |
print("<tr>"); |
297 | 297 |
print("<td>\n"); |
298 |
print($childsa['name'] . ":<br />"); |
|
299 |
print("#" . $childsa['uniqueid']); |
|
300 |
print("</td>\n"); |
|
301 |
print("<td>\n"); |
|
298 | 302 |
|
299 | 303 |
if (is_array($childsa['local-ts'])) { |
300 | 304 |
foreach ($childsa['local-ts'] as $lnets) { |
... | ... | |
505 | 509 |
<table class="table table-striped table-condensed table-hover sortable-theme-bootstrap" data-sortable> |
506 | 510 |
<thead> |
507 | 511 |
<tr> |
512 |
<th><?=gettext("IPsec ID")?></th> |
|
508 | 513 |
<th><?=gettext("Description")?></th> |
509 | 514 |
<th><?=gettext("Local ID")?></th> |
510 | 515 |
<th><?=gettext("Local IP")?></th> |
... | ... | |
589 | 594 |
|
590 | 595 |
// Update "Show child SA" handlers |
591 | 596 |
$('[id^=btnchildsa-]').click(function () { |
592 |
show_childsa($(this).prop("id").replace( /^\D+/g, ''));
|
|
597 |
show_childsa($(this).prop("id").replace( 'btnchildsa-', ''));
|
|
593 | 598 |
}); |
594 | 599 |
|
595 | 600 |
// Check the sa_open array for child SAs that have been opened |
596 |
$('[id^=childsa-con]').each(function(idx) {
|
|
597 |
sa_idx = $(this).prop("id").replace( /^\D+/g, '');
|
|
601 |
$('[id^=childsa-]').each(function(idx) { |
|
602 |
sa_idx = $(this).prop("id").replace( 'childsa-', '');
|
|
598 | 603 |
|
599 | 604 |
if (sa_open[sa_idx]) { |
600 | 605 |
show_childsa(sa_idx); |
... | ... | |
611 | 616 |
|
612 | 617 |
function show_childsa(said) { |
613 | 618 |
sa_open[said] = true; |
614 |
$('#childsa-con' + said).show();
|
|
619 |
$('#childsa-' + said).show(); |
|
615 | 620 |
$('#btnchildsa-con' + said).hide(); |
616 | 621 |
} |
617 | 622 |
|
Also available in: Unified diff
Fixed #8598 Added IPsec ID to the table, Moved the disconnect button over to better fit the page, Also fixed the disconnect button and show child button for mobile clients