From d41bb44745966a668f55d14e9bb53ebd22c4d91e Mon Sep 17 00:00:00 2001 From: PiBa-NL Date: Sun, 23 Sep 2012 00:44:52 +0200 Subject: [PATCH] Add a "Sockets listening" page to the Diagnostics menu. This for easy viewing of what services are bound to which interface and port. ( based on the file diag_sockets.php from forum member 'bardelot' http://forum.pfsense.org/index.php/topic,53070.msg284360.html#msg284360 ) --- usr/local/www/diag_sockets.php | 115 +++++++++++++++++++++++++++++++++ usr/local/www/fbegin.inc | 1 + 2 files changed, 116 insertions(+) create mode 100644 usr/local/www/diag_sockets.php diff --git a/usr/local/www/diag_sockets.php b/usr/local/www/diag_sockets.php new file mode 100644 index 0000000000..3c81fc72a4 --- /dev/null +++ b/usr/local/www/diag_sockets.php @@ -0,0 +1,115 @@ + + + + +
+ + + + + + + + + + + +
Socket information explanation
+This page show the output for the commands: "sockstat -4lL" and "sockstat -6lL".
+The information listed for each socket is:
USER The user who owns the socket.
COMMAND The command which holds the socket.
PID The process ID of the command which holds the socket.
FD The file descriptor number of the socket.
PROTO The transport protocol associated with the socket for Internet sockets, or the type of socket (stream or data-gram) for UNIX sockets.
ADDRESS (UNIX sockets only) For bound sockets, this is the file-name of the socket. For other sockets, it is the name, PID and file descriptor number of the peer, or ``(none)'' if the socket is neither bound nor connected.
LOCAL ADDRESS (Internet sockets only) The address the local end of the socket is bound to (see getsockname(2)).
FOREIGN ADDRESS (Internet sockets only) The address the foreign end of the socket is bound to (see getpeername(2)).
+ $table) { + $elements = ($tabindex == 0 ? 7 : 7); + $name = ($tabindex == 0 ? 'IPv4' : 'IPv6'); +?> +
+ + +
+ + $line) { + if ($i == 0) + $class = 'listhdrr'; + else + $class = 'listlr'; + + if (trim($line) == "") + continue; + print("\n"); + $j = 0; + foreach (explode(' ', $line) as $entry) { + if ($entry == '' || $entry == "ADDRESS") continue; + if ($i == 0) + print("\n"); + else + print("\n"); + if ($i > 0) + $class = 'listr'; + $j++; + } + print("\n"); + }?> +
$entry$entry
+
+ + + +
+ + diff --git a/usr/local/www/fbegin.inc b/usr/local/www/fbegin.inc index bb118693ef..17c3185746 100755 --- a/usr/local/www/fbegin.inc +++ b/usr/local/www/fbegin.inc @@ -229,6 +229,7 @@ $diagnostics_menu[] = array(gettext("pfTop"), "/diag_system_pftop.php"); $diagnostics_menu[] = array(gettext("Reboot"), "/reboot.php"); $diagnostics_menu[] = array(gettext("Routes"), "/diag_routes.php"); $diagnostics_menu[] = array(gettext("SMART Status"), "/diag_smart.php"); +$diagnostics_menu[] = array(gettext("Sockets listening"), "/diag_sockets.php" ); $diagnostics_menu[] = array(gettext("States"), "/diag_dump_states.php"); $diagnostics_menu[] = array(gettext("States Summary"), "/diag_states_summary.php"); $diagnostics_menu[] = array(gettext("System Activity"), "/diag_system_activity.php");