Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Mar 2016 17:22:27 +0000 (UTC)
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r297315 - head/etc/rc.d
Message-ID:  <201603271722.u2RHMRJw008751@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kp
Date: Sun Mar 27 17:22:27 2016
New Revision: 297315
URL: https://svnweb.freebsd.org/changeset/base/297315

Log:
  pf: Friendly error message for status if pf.ko is not loaded
  
  Check if pf.ko is loaded (i.e. /dev/pf exists) before trying to use it. This
  means that '/etc/rc.d/pf status' will no longer return 'pfctl: /dev/pf: No such
  file or directory' but 'pf.ko is not loaded'.
  
  PR:		205671
  Submitted by:	Johannes Jost Meixner <xmj@FreeBSD.org>

Modified:
  head/etc/rc.d/pf

Modified: head/etc/rc.d/pf
==============================================================================
--- head/etc/rc.d/pf	Sun Mar 27 16:27:49 2016	(r297314)
+++ head/etc/rc.d/pf	Sun Mar 27 17:22:27 2016	(r297315)
@@ -66,7 +66,11 @@ pf_resync()
 
 pf_status()
 {
-	$pf_program -s info
+	if ! [ -c /dev/pf ] ; then
+		echo "pf.ko is not loaded"
+	else
+		$pf_program -s info
+	fi
 }
 
 run_rc_command "$1"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603271722.u2RHMRJw008751>