Add the 'reenable' command

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2015-04-28 13:02:12 -07:00
parent 0abd51c796
commit 2cea78e6df
7 changed files with 128 additions and 13 deletions

View File

@ -3834,6 +3834,7 @@ usage() # $1 = exit status
echo " logwatch [<refresh interval>]" echo " logwatch [<refresh interval>]"
echo " open <source> <dest> [ <protocol> [ <port> ] ]" echo " open <source> <dest> [ <protocol> [ <port> ] ]"
echo " reject <address> ..." echo " reject <address> ..."
echo " reenable <interface>"
echo " reset [ <chain> ... ]" echo " reset [ <chain> ... ]"
echo " restart [ -n ] [ -p ] [ -f ] [ -C ] [ <directory> ]" echo " restart [ -n ] [ -p ] [ -f ] [ -C ] [ <directory> ]"
echo " restore [ -n ] [ -p ] [ -C ] [ <file name> ]" echo " restore [ -n ] [ -p ] [ -C ] [ <file name> ]"
@ -4102,7 +4103,7 @@ shorewall_cli() {
shift shift
restart_command $@ restart_command $@
;; ;;
disable|enable) disable|enable|reenable)
get_config Yes get_config Yes
if product_is_started; then if product_is_started; then
run_it ${VARDIR}/firewall $g_debugging $@ run_it ${VARDIR}/firewall $g_debugging $@

View File

@ -289,6 +289,20 @@
</arg> </arg></arg> </arg> </arg></arg>
</cmdsynopsis> </cmdsynopsis>
<cmdsynopsis>
<command>shorewall-lite</command>
<arg
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
<arg>-<replaceable>options</replaceable></arg>
<arg choice="plain"><option>reenable</option></arg>
<arg choice="plain">{ <replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</arg>
</cmdsynopsis>
<cmdsynopsis> <cmdsynopsis>
<command>shorewall-lite</command> <command>shorewall-lite</command>
@ -792,8 +806,8 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><emphasis role="bold">hits </emphasis> [-<option>t</option>] <term><emphasis role="bold">hits </emphasis>
</term> [-<option>t</option>]</term>
<listitem> <listitem>
<para>Generates several reports from Shorewall-lite log messages in <para>Generates several reports from Shorewall-lite log messages in
@ -958,6 +972,20 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><emphasis role="bold">reenable</emphasis>{
<replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</term>
<listitem>
<para>Added in Shorewall 4.6.9. This is equivalent to a
<command>disable</command> command followed by an
<command>enable</command> command on the specified
<replaceable>interface</replaceable> or
<replaceable>provider</replaceable>.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><emphasis role="bold">reject</emphasis><replaceable> <term><emphasis role="bold">reject</emphasis><replaceable>
address</replaceable></term> address</replaceable></term>
@ -970,7 +998,7 @@
<varlistentry> <varlistentry>
<term><emphasis role="bold">reset [<replaceable>chain</replaceable>, <term><emphasis role="bold">reset [<replaceable>chain</replaceable>,
...]</emphasis><acronym></acronym></term> ...]</emphasis><acronym/></term>
<listitem> <listitem>
<para>Resets the packet and byte counters in the specified <para>Resets the packet and byte counters in the specified

View File

@ -1516,7 +1516,7 @@ EOF
" start_provider_$provider" ); " start_provider_$provider" );
} }
emit ( ' else', emit ( ' elif [ -z $2 ]; then',
" startup_error \"Interface $providerref->{physical} is already enabled\"", " startup_error \"Interface $providerref->{physical} is already enabled\"",
' fi', ' fi',
' ;;' ' ;;'
@ -1564,7 +1564,7 @@ EOF
} }
emit( " stop_$providerref->{what}_$provider", emit( " stop_$providerref->{what}_$provider",
' else', ' elif [ -z "$2" ]; then',
" startup_error \"Interface $providerref->{physical} is already disabled\"", " startup_error \"Interface $providerref->{physical} is already disabled\"",
' fi', ' fi',
' ;;' ' ;;'

View File

@ -15,6 +15,7 @@ usage() {
echo " down <interface>" echo " down <interface>"
echo " enable <interface>" echo " enable <interface>"
echo " reset" echo " reset"
echo " reenable <interface>"
echo " refresh" echo " refresh"
echo " restart" echo " restart"
echo " run <command> [ <parameter> ... ]" echo " run <command> [ <parameter> ... ]"
@ -393,6 +394,19 @@ case "$COMMAND" in
mutex_off mutex_off
status=0 status=0
;; ;;
reenable)
[ $# -eq 1 ] && exit 0
shift
[ $# -ne 1 ] && usage 2
mutex_on
if product_is_started; then
detect_configuration $1
COMMAND=enable disable_provider $1 Yes
COMMAND=disable enable_provider $1 Yes
fi
mutex_off
status=0
;;
run) run)
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then
shift shift

View File

@ -385,6 +385,20 @@
</arg> </arg></arg> </arg> </arg></arg>
</cmdsynopsis> </cmdsynopsis>
<cmdsynopsis>
<command>shorewall</command>
<arg
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
<arg>-<replaceable>options</replaceable></arg>
<arg choice="plain"><option>reenable</option></arg>
<arg choice="plain">{ <replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</arg>
</cmdsynopsis>
<cmdsynopsis> <cmdsynopsis>
<command>shorewall</command> <command>shorewall</command>
@ -1199,8 +1213,8 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><emphasis role="bold">hits</emphasis> [-<option>t</option>] <term><emphasis role="bold">hits</emphasis>
</term> [-<option>t</option>]</term>
<listitem> <listitem>
<para>Generates several reports from Shorewall log messages in the <para>Generates several reports from Shorewall log messages in the
@ -1424,6 +1438,20 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><emphasis role="bold">reenable</emphasis>{
<replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</term>
<listitem>
<para>Added in Shorewall 4.6.9. This is equivalent to a
<command>disable</command> command followed by an
<command>enable</command> command on the specified
<replaceable>interface</replaceable> or
<replaceable>provider</replaceable>.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><emphasis role="bold">refresh </emphasis> [-<option>n</option>] <term><emphasis role="bold">refresh </emphasis> [-<option>n</option>]
[-<option>d</option>] [-<option>T</option>] [-i] [-<option>D [-<option>d</option>] [-<option>T</option>] [-i] [-<option>D
@ -1550,7 +1578,7 @@
<varlistentry> <varlistentry>
<term><emphasis role="bold">reset [<replaceable>chain</replaceable>, <term><emphasis role="bold">reset [<replaceable>chain</replaceable>,
...]</emphasis><acronym></acronym></term> ...]</emphasis><acronym/></term>
<listitem> <listitem>
<para>Resets the packet and byte counters in the specified <para>Resets the packet and byte counters in the specified

View File

@ -277,6 +277,20 @@
</arg> </arg></arg> </arg> </arg></arg>
</cmdsynopsis> </cmdsynopsis>
<cmdsynopsis>
<command>shorewall6-lite</command>
<arg
choice="opt"><option>trace</option>|<option>debug</option><arg><option>nolock</option></arg></arg>
<arg>-<replaceable>options</replaceable></arg>
<arg choice="plain"><option>reenable</option></arg>
<arg choice="plain">{ <replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</arg>
</cmdsynopsis>
<cmdsynopsis> <cmdsynopsis>
<command>shorewall6-lite</command> <command>shorewall6-lite</command>
@ -933,6 +947,20 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><emphasis role="bold">reenable</emphasis>{
<replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</term>
<listitem>
<para>Added in Shorewall 4.6.9. This is equivalent to a
<command>disable</command> command followed by an
<command>enable</command> command on the specified
<replaceable>interface</replaceable> or
<replaceable>provider</replaceable>.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><emphasis role="bold">reject</emphasis><replaceable> <term><emphasis role="bold">reject</emphasis><replaceable>
address</replaceable></term> address</replaceable></term>
@ -945,7 +973,7 @@
<varlistentry> <varlistentry>
<term><emphasis role="bold">reset [<replaceable>chain</replaceable>, <term><emphasis role="bold">reset [<replaceable>chain</replaceable>,
...]</emphasis><acronym></acronym></term> ...]</emphasis><acronym/></term>
<listitem> <listitem>
<para>Resets the packet and byte counters in the specified <para>Resets the packet and byte counters in the specified

View File

@ -347,8 +347,10 @@
<arg>-<replaceable>options</replaceable></arg> <arg>-<replaceable>options</replaceable></arg>
<arg <arg choice="plain"><option>reenable</option></arg>
choice="plain"><option>recover</option><arg><option>-n</option></arg><arg><option>-p</option></arg></arg>
<arg choice="plain">{ <replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</arg>
</cmdsynopsis> </cmdsynopsis>
<cmdsynopsis> <cmdsynopsis>
@ -1333,6 +1335,20 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><emphasis role="bold">reenable</emphasis>{
<replaceable>interface</replaceable> |
<replaceable>provider</replaceable> }</term>
<listitem>
<para>Added in Shorewall 4.6.9. This is equivalent to a
<command>disable</command> command followed by an
<command>enable</command> command on the specified
<replaceable>interface</replaceable> or
<replaceable>provider</replaceable>.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><emphasis role="bold">refresh </emphasis>[-<option>n</option>] <term><emphasis role="bold">refresh </emphasis>[-<option>n</option>]
[-<option>d</option>] [-<option>T</option>] [-i] [-<option>d</option>] [-<option>T</option>] [-i]
@ -1459,7 +1475,7 @@
<varlistentry> <varlistentry>
<term><emphasis role="bold">reset [<replaceable>chain</replaceable>, <term><emphasis role="bold">reset [<replaceable>chain</replaceable>,
...]</emphasis><acronym></acronym></term> ...]</emphasis><acronym/></term>
<listitem> <listitem>
<para>Resets the packet and byte counters in the specified <para>Resets the packet and byte counters in the specified