Normalize parameters by removing trailing omitted args

- Avoids needless duplicate action chains
This commit is contained in:
Tom Eastep 2016-12-03 11:34:02 -08:00
parent 4a0a906510
commit 53adfbe863
No known key found for this signature in database
GPG Key ID: 96E6B3F2423A4D10

View File

@ -1312,8 +1312,18 @@ sub normalize_action( $$$ ) {
# Note: SNAT actions store the current interface's name in the tag
#
$tag = '' unless defined $tag;
$param = '' unless defined $param;
$param = '' if $param eq '-';
if ( defined( $param ) ) {
#
# Normalize the parameters by removing trailing omitted
# parameters
#
1 while $param =~ s/,-$//;
$param = '' if $param eq '-';
} else {
$param = '';
}
join( ':', $action, $level, $tag, $caller, $param );
}