svn commit: r320943 - head/etc/rc.d

Emmanuel Vadot manu at FreeBSD.org
Thu Jul 13 13:32:24 UTC 2017


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


More information about the svn-src-head mailing list