More corrections to 'shared' providers

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@7679 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-11-17 00:14:41 +00:00
parent 72fb0f1ab0
commit 43bde8c079

View File

@ -122,8 +122,13 @@ sub setup_route_marking() {
sub copy_table( $$$ ) { sub copy_table( $$$ ) {
my ( $duplicate, $number, $realm ) = @_; my ( $duplicate, $number, $realm ) = @_;
emit ( "ip route show table $duplicate | while read net route; do", if ( $realm ) {
' case $net in', emit ( "ip route show table $duplicate | sed -r 's/ realm [[:alnum:]_]+//' | while read net route; do" )
} else {
emit ( "ip route show table $duplicate | while read net route; do" )
}
emit ( ' case $net in',
' default|nexthop)', ' default|nexthop)',
' ;;', ' ;;',
' *)', ' *)',
@ -137,8 +142,13 @@ sub copy_table( $$$ ) {
sub copy_and_edit_table( $$$$ ) { sub copy_and_edit_table( $$$$ ) {
my ( $duplicate, $number, $copy, $realm) = @_; my ( $duplicate, $number, $copy, $realm) = @_;
emit ( "ip route show table $duplicate | while read net route; do", if ( $realm ) {
' case $net in', emit ( "ip route show table $duplicate | sed -r 's/ realm [[:alnum:]_]+//' | while read net route; do" )
} else {
emit ( "ip route show table $duplicate | while read net route; do" )
}
emit ( ' case $net in',
' default|nexthop)', ' default|nexthop)',
' ;;', ' ;;',
' *)', ' *)',
@ -309,8 +319,10 @@ sub add_a_provider( $$$$$$$$ ) {
fatal_error 'A non-empty COPY column requires that a routing table be specified in the DUPLICATE column' if $copy ne '-'; fatal_error 'A non-empty COPY column requires that a routing table be specified in the DUPLICATE column' if $copy ne '-';
} }
if ( $gateway ) {
emit "run_ip route replace $gateway src $variable dev $interface table $number $realm"; emit "run_ip route replace $gateway src $variable dev $interface table $number $realm";
emit "run_ip route add default via $gateway dev $interface table $number $realm"; emit "run_ip route add default via $gateway dev $interface table $number $realm";
}
balance_default_route $balance , $gateway, $interface, $realm if $balance; balance_default_route $balance , $gateway, $interface, $realm if $balance;