mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-18 12:20:42 +01:00
Allow synonyms for column names in alternate specification formats
- gateway and gateways in the tunnels file - mark and action in the tcrules file Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
dd8e9ff09d
commit
2cbf1e86ad
@ -1468,11 +1468,13 @@ sub supplied( $ ) {
|
|||||||
# supply '-' in omitted trailing columns.
|
# supply '-' in omitted trailing columns.
|
||||||
# Handles all of the supported forms of column/pair specification
|
# Handles all of the supported forms of column/pair specification
|
||||||
#
|
#
|
||||||
sub split_line1( $$;$ ) {
|
sub split_line1( $$;$$ ) {
|
||||||
my ( $description, $columnsref, $nopad) = @_;
|
my ( $description, $columnsref, $nopad, $maxcolumns ) = @_;
|
||||||
|
|
||||||
my @maxcolumns = ( sort { $a <=> $b } values %$columnsref );
|
unless ( defined $maxcolumns ) {
|
||||||
my $maxcolumns = ( $maxcolumns[-1] || 0 ) + 1;
|
my @maxcolumns = ( keys %$columnsref );
|
||||||
|
$maxcolumns = @maxcolumns;
|
||||||
|
}
|
||||||
#
|
#
|
||||||
# First see if there is a semicolon on the line; what follows will be column/value paris
|
# First see if there is a semicolon on the line; what follows will be column/value paris
|
||||||
#
|
#
|
||||||
|
@ -197,11 +197,11 @@ sub process_tc_rule( ) {
|
|||||||
my ( $originalmark, $source, $dest, $proto, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $headers, $probability , $dscp );
|
my ( $originalmark, $source, $dest, $proto, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $headers, $probability , $dscp );
|
||||||
if ( $family == F_IPV4 ) {
|
if ( $family == F_IPV4 ) {
|
||||||
( $originalmark, $source, $dest, $proto, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $probability, $dscp ) =
|
( $originalmark, $source, $dest, $proto, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $probability, $dscp ) =
|
||||||
split_line1 'tcrules file', { mark => 0, action => 0, source => 1, dest => 2, proto => 3, dport => 4, sport => 5, user => 6, test => 7, length => 8, tos => 9, connbytes => 10, helper => 11, probability => 12 , dscp => 13 };
|
split_line1 'tcrules file', { mark => 0, action => 0, source => 1, dest => 2, proto => 3, dport => 4, sport => 5, user => 6, test => 7, length => 8, tos => 9, connbytes => 10, helper => 11, probability => 12 , dscp => 13 }, undef , 14;
|
||||||
$headers = '-';
|
$headers = '-';
|
||||||
} else {
|
} else {
|
||||||
( $originalmark, $source, $dest, $proto, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $headers, $probability, $dscp ) =
|
( $originalmark, $source, $dest, $proto, $ports, $sports, $user, $testval, $length, $tos , $connbytes, $helper, $headers, $probability, $dscp ) =
|
||||||
split_line1 'tcrules file', { mark => 0, action => 0, source => 1, dest => 2, proto => 3, dport => 4, sport => 5, user => 6, test => 7, length => 8, tos => 9, connbytes => 10, helper => 11, headers => 12, probability => 13 , dscp => 14 };
|
split_line1 'tcrules file', { mark => 0, action => 0, source => 1, dest => 2, proto => 3, dport => 4, sport => 5, user => 6, test => 7, length => 8, tos => 9, connbytes => 10, helper => 11, headers => 12, probability => 13 , dscp => 14 }, undef, 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
our @tccmd;
|
our @tccmd;
|
||||||
|
@ -292,10 +292,9 @@ sub setup_tunnels() {
|
|||||||
|
|
||||||
while ( read_a_line( NORMAL_READ ) ) {
|
while ( read_a_line( NORMAL_READ ) ) {
|
||||||
|
|
||||||
my ( $kind, $zone, $gateway, $gatewayzones ) = split_line1 'tunnels file', { type => 0, zone => 1, gateway => 2, gateways => 2, gateway_zone => 3 };
|
my ( $kind, $zone, $gateway, $gatewayzones ) = split_line1 'tunnels file', { type => 0, zone => 1, gateway => 2, gateways => 2, gateway_zone => 3 }, undef, 4;
|
||||||
|
|
||||||
fatal_error 'TYPE must be specified' if $kind eq '-';
|
fatal_error 'TYPE must be specified' if $kind eq '-';
|
||||||
fatal_error 'ZONE must be specified' if $zone eq '-';
|
|
||||||
|
|
||||||
if ( $kind eq 'COMMENT' ) {
|
if ( $kind eq 'COMMENT' ) {
|
||||||
process_comment;
|
process_comment;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<pubdate><?dbtimestamp format="Y/m/d"?></pubdate>
|
<pubdate><?dbtimestamp format="Y/m/d"?></pubdate>
|
||||||
|
|
||||||
<copyright>
|
<copyright>
|
||||||
<year>2001-2011</year>
|
<year>2001-2012</year>
|
||||||
|
|
||||||
<holder>Thomas M. Eastep</holder>
|
<holder>Thomas M. Eastep</holder>
|
||||||
</copyright>
|
</copyright>
|
||||||
@ -705,7 +705,9 @@ ACCEPT net:\
|
|||||||
<row>
|
<row>
|
||||||
<entry>tcrules</entry>
|
<entry>tcrules</entry>
|
||||||
|
|
||||||
<entry>mark,source,dest,proto,dport,sport,user,test,length,tos,connbytes,helper,headers</entry>
|
<entry>mark,source,dest,proto,dport,sport,user,test,length,tos,connbytes,helper,headers.
|
||||||
|
Beginning with Shorewall 4.5.3, 'action' is a synonym for
|
||||||
|
'mark'.</entry>
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
<row>
|
<row>
|
||||||
@ -717,7 +719,8 @@ ACCEPT net:\
|
|||||||
<row>
|
<row>
|
||||||
<entry>tunnels</entry>
|
<entry>tunnels</entry>
|
||||||
|
|
||||||
<entry>type,zone,gateway,gateway_zone</entry>
|
<entry>type,zone,gateway,gateway_zone. Beginning with Shorewall
|
||||||
|
4.5.3, 'gateways' is a synonym for 'gateway'.</entry>
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
<row>
|
<row>
|
||||||
|
Loading…
Reference in New Issue
Block a user