Project

General

Profile

Feature #12968 » diag_packet_capture.patch

Phil Wardt, 03/21/2022 02:36 PM

View differences:

src/usr/local/www/diag_packet_capture.php
280 280
			if (file_exists($fp.$fn)) {
281 281
				unlink ($fp.$fn);
282 282
			}
283

  
284 283
		} elseif ($_POST['stopbtn'] != "") {
285 284
			$action = gettext("Stop");
286 285
			$processes_running = trim(shell_exec("/bin/ps axw -O pid= | /usr/bin/grep tcpdump | /usr/bin/grep {$fn} | /usr/bin/egrep -v '(pflog|grep)'"));
......
297 296
		} elseif ($_POST['downloadbtn'] != "") {
298 297
			//download file
299 298
			send_user_download('file', $fp.$fn);
299
		} elseif ($_POST['clearbtn'] != "") {
300
			//clear log file
301
			if (file_exists($fp.$fn)) {
302
				unlink ($fp.$fn);
300 303
			}
301 304
		}
305
	}
302 306
} else {
303 307
	$do_tcpdump = false;
304 308
}
......
491 495
		null,
492 496
		'fa-download'
493 497
	))->addClass('btn-primary');
498

  
499
	$form->addGlobal(new Form_Button(
500
		'clearbtn',
501
		'Clear Log',
502
		null,
503
		'fa-undo'
504
	))->addClass('btn-danger restore');
494 505

  
495 506
	if (file_exists($fp.$fns)) {
496 507
		$section->addInput(new Form_StaticText(
(1-1/4)