Finish Mr-4's NFACCT patch

- Correct indentation
- Remove '$type' argument to split_nfacct_list
- Update manpages.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2013-04-23 06:55:30 -07:00
parent 68c7782e7d
commit f543c3bd1e
3 changed files with 28 additions and 24 deletions

View File

@ -138,10 +138,10 @@ sub process_section ($) {
$asection = $newsect; $asection = $newsect;
} }
sub split_nfacct_list( $$;$ ) { sub split_nfacct_list( $;$ ) {
my ($list, $type, $origlist ) = @_; my ($list, $origlist ) = @_;
fatal_error( "Invalid $type list (" . ( $origlist ? $origlist : $list ) . ')' ) if $list =~ /^,|,$|,,$/; fatal_error( "Invalid nfacct list (" . ( $origlist ? $origlist : $list ) . ')' ) if $list =~ /^,|,$|,,$/;
split /,/, $list; split /,/, $list;
} }
@ -234,16 +234,16 @@ sub process_accounting_rule1( $$$$$$$$$$$ ) {
} elsif ( $action =~ /^NFACCT\(([\w,!]+)\)$/ ) { } elsif ( $action =~ /^NFACCT\(([\w,!]+)\)$/ ) {
require_capability 'NFACCT_MATCH', 'The NFACCT action', 's'; require_capability 'NFACCT_MATCH', 'The NFACCT action', 's';
$target = ''; $target = '';
my @objects = split_nfacct_list $1, 'nfacct'; my @objects = split_nfacct_list $1;
for ( @objects ) { for ( @objects ) {
if ( $_ =~ /^([\w]+)(!)?$/ ) { if ( $_ =~ /^([\w]+)(!)?$/ ) {
if ( $2 ) { if ( $2 ) {
$prerule .= "-m nfacct --nfacct-name $1 "; $prerule .= "-m nfacct --nfacct-name $1 ";
} else { } else {
$rule .= "-m nfacct --nfacct-name $1 "; $rule .= "-m nfacct --nfacct-name $1 ";
} }
} else { } else {
accounting_error; accounting_error;
} }
} }
} elsif ( $action eq 'INLINE' ) { } elsif ( $action eq 'INLINE' ) {

View File

@ -309,7 +309,7 @@
<varlistentry> <varlistentry>
<term><emphasis <term><emphasis
role="bold">NFACCT</emphasis>(<replaceable>object</replaceable>[,...])[!]</term> role="bold">NFACCT</emphasis>({<replaceable>object</replaceable>[!]}[,...])</term>
<listitem> <listitem>
<para>Added in Shorewall 4.5.7. Provides a form of accounting <para>Added in Shorewall 4.5.7. Provides a form of accounting
@ -327,12 +327,14 @@
Beginning with Shorewall 4.5.16, an arbitrary number of Beginning with Shorewall 4.5.16, an arbitrary number of
objects may be given.</para> objects may be given.</para>
<para>With Shorewall 4.5.16 or later, <emphasis <para>With Shorewall 4.5.16 or later, an nfacct
role="bold">!</emphasis> may be specified to indicate that the <replaceable>object</replaceable> in the list may optionally
nfacct <replaceable>object</replaceable>(s) will be be followed by <emphasis role="bold">!</emphasis> to indicate
incremented unconditionally. When omitted, the that the nfacct <replaceable>object</replaceable> will be
<replaceable>object</replaceable>(s) will be incremented only incremented unconditionally for each packet. When <emphasis
if all of the matches in the rule succeed.</para> role="bold">!</emphasis> is omitted, the
<replaceable>object</replaceable> will be incremented only if
all of the matches in the rule succeed.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@ -251,7 +251,7 @@
<varlistentry> <varlistentry>
<term><emphasis <term><emphasis
role="bold">NFACCT</emphasis>(<replaceable>object</replaceable>[,...])[!]</term> role="bold">NFACCT</emphasis>({<replaceable>object</replaceable>[!]}[,...])</term>
<listitem> <listitem>
<para>Added in Shorewall 4.5.7. Provides a form of accounting <para>Added in Shorewall 4.5.7. Provides a form of accounting
@ -269,12 +269,14 @@
Beginning with Shorewall 4.5.16, an arbitrary number of Beginning with Shorewall 4.5.16, an arbitrary number of
objects may be given.</para> objects may be given.</para>
<para>With Shorewall 4.5.16 or later, <emphasis <para>With Shorewall 4.5.16 or later, an nfacct
role="bold">!</emphasis> may be specified to indicate that the <replaceable>object</replaceable> in the list may optionally
nfacct <replaceable>object</replaceable>(s) will be be followed by <emphasis role="bold">!</emphasis> to indicate
incremented unconditionally. When omitted, the that the nfacct <replaceable>object</replaceable> will be
<replaceable>object</replaceable>(s) will be incremented only incremented unconditionally for each packet. When <emphasis
if all of the matches in the rule succeed.</para> role="bold">!</emphasis> is omitted, the
<replaceable>object</replaceable> will be incremented only if
all of the matches in the rule succeed.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>