Merge branch '4.5.6'

This commit is contained in:
Tom Eastep 2012-07-06 12:30:52 -07:00
commit 5616c96745
3 changed files with 22 additions and 18 deletions

View File

@ -1662,7 +1662,7 @@ sub close_file() {
sub have_capability( $ ); sub have_capability( $ );
# #
# Report an error from process_conditional() -- the first argument is the linenumber # Report an error from process_conditional()
# #
sub cond_error( $$$ ) { sub cond_error( $$$ ) {
$currentfilename = $_[1]; $currentfilename = $_[1];
@ -1676,14 +1676,6 @@ sub cond_error( $$$ ) {
sub evaluate_expression( $$$ ) { sub evaluate_expression( $$$ ) {
my ( $expression , $filename , $linenumber ) = @_; my ( $expression , $filename , $linenumber ) = @_;
if ( $family == F_IPV4 ) {
$expression =~ s/__IPV6/0/g;
$expression =~ s/__IPV4/1/g;
} else {
$expression =~ s/__IPV6/1/g;
$expression =~ s/__IPV4/0/g;
}
my $count = 0; my $count = 0;
# $1 $2 $3 - $4 # $1 $2 $3 - $4
@ -1707,6 +1699,8 @@ sub evaluate_expression( $$$ ) {
my $val; my $val;
if ( exists $capdesc{$cap} ) { if ( exists $capdesc{$cap} ) {
$val = have_capability( $cap ); $val = have_capability( $cap );
} elsif ( $cap =~ /^IPV([46])$/ ) {
$val = ( $family == $1 )
} else { } else {
cond_error "Unknown capability ($cap)", $filename, $linenumber; cond_error "Unknown capability ($cap)", $filename, $linenumber;
} }
@ -1714,12 +1708,24 @@ sub evaluate_expression( $$$ ) {
$expression = join( '', $first, $val, $rest ); $expression = join( '', $first, $val, $rest );
} }
my $val = eval qq(package Shorewall::User;\nuse strict;\n# line $linenumber "$filename"\n$expression); my $val;
if ( $expression =~ /^\s*(\d+)\s*$/ || $expression =~ /\s*'(.*?)'\s*$/ ) {
#
# Simple one-term expression -- don't compile it
#
$val = $1;
} else {
#
# Not a simple one-term expression
#
$val = eval qq(package Shorewall::User;\nuse strict;\n# line $linenumber "$filename"\n$expression);
unless ( $val ) { unless ( $val ) {
cond_error( "Couldn't parse expression: $@" , $filename, $linenumber ) if $@; cond_error( "Couldn't parse expression: $@" , $filename, $linenumber ) if $@;
cond_error( "Undefined expression" , $filename, $linenumber ) unless defined $val; cond_error( "Undefined expression" , $filename, $linenumber ) unless defined $val;
} }
}
$val; $val;
} }

View File

@ -2160,7 +2160,7 @@ sub setup_tc() {
setup_traffic_shaping if @tcdevices && $config{TC_ENABLED} ne 'Shared'; setup_traffic_shaping if @tcdevices && $config{TC_ENABLED} ne 'Shared';
} }
if ( $config{TC_ENABLED} ) { if ( $config{MANGLE_ENABLED} ) {
our @tccmd = ( { match => sub ( $ ) { $_[0] eq 'SAVE' } , our @tccmd = ( { match => sub ( $ ) { $_[0] eq 'SAVE' } ,
target => 'CONNMARK --save-mark --mask' , target => 'CONNMARK --save-mark --mask' ,
mark => $config{TC_EXPERT} ? HIGHMARK : SMALLMARK, mark => $config{TC_EXPERT} ? HIGHMARK : SMALLMARK,
@ -2254,9 +2254,7 @@ sub setup_tc() {
clear_comment; clear_comment;
} }
}
if ( $config{MANGLE_ENABLED} ) {
if ( my $fn = open_file 'secmarks' ) { if ( my $fn = open_file 'secmarks' ) {
first_entry "$doing $fn..."; first_entry "$doing $fn...";

View File

@ -181,7 +181,7 @@ get_config() {
if [ "$2" = Yes ]; then if [ "$2" = Yes ]; then
case $STARTUP_ENABLED in case $STARTUP_ENABLED in
No|no|NO) No|no|NO)
echo " ERROR: $g_product startup is disabled. To enable startup, set STARTUP_ENABLED=Yes in ${CONFDIR}/${g_program}.conf" >&2 echo " ERROR: $g_product startup is disabled. To enable startup, set STARTUP_ENABLED=Yes in ${g_confdir}/${g_program}.conf" >&2
exit 2 exit 2
;; ;;
Yes|yes|YES) Yes|yes|YES)