Merge branch '4.5.5'

Conflicts:
	Shorewall/Perl/Shorewall/Providers.pm
This commit is contained in:
Tom Eastep 2012-06-11 17:02:59 -07:00
commit 19cace7e8d
2 changed files with 19 additions and 6 deletions

View File

@ -698,13 +698,14 @@ CEOF
emit ''; emit '';
if ( $gateway ) { if ( $gateway ) {
if ( $family == F_IPV4 ) { if ( $family == F_IPV4 ) {
emit qq(run_ip route replace $gateway dev $physical table ) . DEFAULT_TABLE; emit qq(run_ip route replace $gateway/32 dev $physical table ) . DEFAULT_TABLE;
emit qq(run_ip route replace default via $gateway src $address dev $physical table ) . DEFAULT_TABLE . qq( metric $number); emit qq(run_ip route replace default via $gateway src $address dev $physical table ) . DEFAULT_TABLE . qq( metric $number);
} else { } else {
emit qq(qt \$IP -6 route del default via $gateway src $address dev $physical table ) . DEFAULT_TABLE . qq( metric $number); emit qq(qt \$IP -6 route del default via $gateway src $address dev $physical table ) . DEFAULT_TABLE . qq( metric $number);
emit qq(run_ip route add default via $gateway src $address dev $physical table ) . DEFAULT_TABLE . qq( metric $number); emit qq(run_ip route add default via $gateway src $address dev $physical table ) . DEFAULT_TABLE . qq( metric $number);
} }
emit qq(echo "qt \$IP -$family route del default via $gateway table ) . DEFAULT_TABLE . qq(" >> \${VARDIR}/undo_${table}_routing); emit qq(echo "qt \$IP -$family route del default via $gateway table ) . DEFAULT_TABLE . qq(" >> \${VARDIR}/undo_${table}_routing);
emit qq(echo "qt \$IP -4 route del $gateway/32 dev $physical table ) . DEFAULT_TABLE . qq(" >> \${VARDIR}/undo_${table}_routing) if $family == F_IPV4;
} else { } else {
emit qq(run_ip route add default table ) . DEFAULT_TABLE . qq( dev $physical metric $number); emit qq(run_ip route add default table ) . DEFAULT_TABLE . qq( dev $physical metric $number);
emit qq(echo "qt \$IP -$family route del default dev $physical table ) . DEFAULT_TABLE . qq(" >> \${VARDIR}/undo_${table}_routing); emit qq(echo "qt \$IP -$family route del default dev $physical table ) . DEFAULT_TABLE . qq(" >> \${VARDIR}/undo_${table}_routing);
@ -1156,14 +1157,16 @@ sub finish_providers() {
emit( " progress_message \"Fallback route '\$(echo \$FALLBACK_ROUTE | sed 's/\$\\s*//')' Added\"", emit( " progress_message \"Fallback route '\$(echo \$FALLBACK_ROUTE | sed 's/\$\\s*//')' Added\"",
'else', 'else',
'#', ' #',
'# We don\'t have any \'fallback\' providers so we delete any default routes in the default table', ' # We don\'t have any \'fallback\' providers so we delete any default routes in the default table',
'#', ' #',
" while qt \$IP -$family route del default table " . DEFAULT_TABLE . '; do true; done', ' delete_default_routes ' . DEFAULT_TABLE,
'fi', 'fi',
'' ); '' );
} elsif ( $config{USE_DEFAULT_RT} ) { } elsif ( $config{USE_DEFAULT_RT} ) {
emit "while qt \$IP -$family route del default table " . DEFAULT_TABLE . '; do true; done' unless $metrics; emit( 'delete_default_routes ' . DEFAULT_TABLE,
''
);
} }
unless ( $config{KEEP_RT_TABLES} ) { unless ( $config{KEEP_RT_TABLES} ) {

View File

@ -339,6 +339,16 @@ replace_default_route() # $1 = USE_DEFAULT_RT
fi fi
} }
#
# Delete default routes with metric 0 from the passed routing table
#
delete_default_routes() # $1 = table number
{
$IP -$g_family route ls table $1 | fgrep default | fgrep -v metric | while read route; do
qt $IP -$g_family route del $route
done
}
restore_default_route() # $1 = USE_DEFAULT_RT restore_default_route() # $1 = USE_DEFAULT_RT
{ {
local result local result