From 43bde8c079ebcfb4115e8bc32b2b0d45856f3817 Mon Sep 17 00:00:00 2001 From: teastep Date: Sat, 17 Nov 2007 00:14:41 +0000 Subject: [PATCH] More corrections to 'shared' providers git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@7679 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-perl/Shorewall/Providers.pm | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Shorewall-perl/Shorewall/Providers.pm b/Shorewall-perl/Shorewall/Providers.pm index c74ae3e8c..6ebdd436a 100644 --- a/Shorewall-perl/Shorewall/Providers.pm +++ b/Shorewall-perl/Shorewall/Providers.pm @@ -122,8 +122,13 @@ sub setup_route_marking() { sub copy_table( $$$ ) { my ( $duplicate, $number, $realm ) = @_; - emit ( "ip route show table $duplicate | while read net route; do", - ' case $net in', + if ( $realm ) { + 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)', ' ;;', ' *)', @@ -137,8 +142,13 @@ sub copy_table( $$$ ) { sub copy_and_edit_table( $$$$ ) { my ( $duplicate, $number, $copy, $realm) = @_; - emit ( "ip route show table $duplicate | while read net route; do", - ' case $net in', + if ( $realm ) { + 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)', ' ;;', ' *)', @@ -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 '-'; } - 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"; + if ( $gateway ) { + 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"; + } balance_default_route $balance , $gateway, $interface, $realm if $balance;