Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Jul 2017 13:32:23 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r320943 - head/etc/rc.d
Message-ID:  <201707131332.v6DDWN7q085120@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: manu
Date: Thu Jul 13 13:32:23 2017
New Revision: 320943
URL: https://svnweb.freebsd.org/changeset/base/320943

Log:
  Add ipfw_status command to etc/rc.d/ipfw
  
  This is helpful when using service/conf management tools.
  
  Sonsored-By:	Gandi.net

Modified:
  head/etc/rc.d/ipfw

Modified: head/etc/rc.d/ipfw
==============================================================================
--- head/etc/rc.d/ipfw	Thu Jul 13 09:27:11 2017	(r320942)
+++ head/etc/rc.d/ipfw	Thu Jul 13 13:32:23 2017	(r320943)
@@ -17,7 +17,9 @@ start_cmd="ipfw_start"
 start_precmd="ipfw_prestart"
 start_postcmd="ipfw_poststart"
 stop_cmd="ipfw_stop"
+status_cmd="ipfw_status"
 required_modules="ipfw"
+extra_commands="status"
 
 set_rcvar_obsolete ipv6_firewall_enable
 
@@ -107,6 +109,18 @@ ipfw_stop()
 			${_coscript} quietstop
 		fi
 	done
+}
+
+ipfw_status()
+{
+    status=$(sysctl -n net.inet.ip.fw.enable)
+    if [ ${status} -eq 0 ]; then
+	echo "ipfw is not enabled"
+	exit 1
+    else
+	echo "ipfw is enabled"
+	exit 0
+    fi
 }
 
 load_rc_config $name



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