aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authordoktornotor <notordoktor@gmail.com>2015-08-01 00:53:11 +0200
committerdoktornotor <notordoktor@gmail.com>2015-08-01 00:53:11 +0200
commitafce0dd00ae818bf3a5a887bc9571d0fa1983318 (patch)
tree12c11aace258daa8eff19a90ab6f6d35391e7a32 /config
parent005e69aa843f9ef0d4ef74da4db573fb61358e20 (diff)
downloadpfsense-packages-afce0dd00ae818bf3a5a887bc9571d0fa1983318.tar.gz
pfsense-packages-afce0dd00ae818bf3a5a887bc9571d0fa1983318.tar.bz2
pfsense-packages-afce0dd00ae818bf3a5a887bc9571d0fa1983318.zip
arping.inc - multiple improvements plus code style fixes
Diffstat (limited to 'config')
-rw-r--r--config/arping/arping.inc37
1 files changed, 20 insertions, 17 deletions
diff --git a/config/arping/arping.inc b/config/arping/arping.inc
index 0054adf0..996fddf3 100644
--- a/config/arping/arping.inc
+++ b/config/arping/arping.inc
@@ -1,9 +1,9 @@
<?php
-/* $Id$ */
/*
arping.inc
+ part of pfSense (https://www.pfSense.org/)
Copyright (C) 2006 Scott Ullrich
- part of pfSense
+ Copyright (C) 2009-2015 ESF, LLC
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -28,22 +28,25 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-function arping_deinstall() {
-}
-
-function arping_package_reinstall() {
-}
-
function arping_package_php_command() {
require_once("util.inc");
- if (is_ipaddr($_POST['hostip']) || is_hostname($_POST['hostip']) || is_macaddr($_POST['hostip']))
- system("arping -c3 " . escapeshellarg($_POST['hostip']));
- else
- echo "Invalid input. Supplied address must be a valid IP or MAC address.";
+
+ $button = "<br /><br /><input class=\"formbtn\" type=\"button\" value=\"Back to ARPing\" onclick=\"history.back()\" />";
+ $int_count = (is_numeric($_POST['count']) ? (abs(intval($_POST['count']))) : 3);
+ $arping_options = " -v -c {$int_count}";
+ if (!empty($_POST['interface'])) {
+ $iface = convert_friendly_interface_to_real_interface_name($_POST['interface']);
+ $arping_options .= " -i {$iface}";
+ }
+ if (is_ipaddr($_POST['pinghost']) || is_hostname($_POST['pinghost']) || is_macaddr($_POST['pinghost'])) {
+ $arping_options .= " " . $_POST['pinghost'];
+ echo "<strong>arping {$arping_options} output:</strong><br /><br />";
+ system("/usr/local/sbin/arping {$arping_options}");
+ echo "{$button}";
+ } else {
+ echo "<div class=\"errmsg\">ERROR: Invalid input. Supplied address must be a valid hostname, IP or MAC address.</div>";
+ echo "{$button}";
+ }
exit;
}
-
-function arping_package_resync() {
-}
-
-?> \ No newline at end of file
+?>