From 00a72b0deca2d6d7613c0d462a495daa445455f2 Mon Sep 17 00:00:00 2001 From: teastep Date: Mon, 11 Feb 2008 18:30:45 +0000 Subject: [PATCH] Add 'src=' and 'mtu=' OPTIONS in providers file git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@8181 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-perl/Shorewall/Providers.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Shorewall-perl/Shorewall/Providers.pm b/Shorewall-perl/Shorewall/Providers.pm index 7937a330b..b003e3f2b 100644 --- a/Shorewall-perl/Shorewall/Providers.pm +++ b/Shorewall-perl/Shorewall/Providers.pm @@ -228,11 +228,9 @@ sub add_a_provider( $$$$$$$$ ) { emit "echo \"qt ip route flush table $number\" >> \${VARDIR}/undo_routing"; if ( $gateway eq 'detect' ) { - $address = get_interface_address $interface unless $address; $gateway = get_interface_gateway $interface; } elsif ( $gateway && $gateway ne '-' ) { validate_address $gateway, 0; - $address = get_interface_address $interface unless $address; } else { fatal_error "Configuring multiple providers through one interface requires a gateway" if $shared; $gateway = ''; @@ -268,7 +266,7 @@ sub add_a_provider( $$$$$$$$ ) { ); } - my ( $loose, $track, $balance , $optional ) = (0,0,0,interface_is_optional( $interface )); + my ( $loose, $track, $balance , $optional, $mtu ) = (0,0,0,interface_is_optional( $interface ), '' ); unless ( $options eq '-' ) { for my $option ( split_list $options, 'option' ) { @@ -283,6 +281,11 @@ sub add_a_provider( $$$$$$$$ ) { } elsif ( $option eq 'optional' ) { set_interface_option $interface, 'optional', 1; $optional = 1; + } elsif ( $option =~ /^src=(.*)$/ ) { + fatal_error "OPTION 'src' not allowed on shared interface" if $shared; + $address = validate_address( $1 , 1 ); + } elsif ( $option =~ /^mtu=(\d+)$/ ) { + $mtu = "mtu $1 "; } else { fatal_error "Invalid option ($option)"; } @@ -335,7 +338,8 @@ sub add_a_provider( $$$$$$$$ ) { } if ( $gateway ) { - emit "run_ip route replace $gateway src $address dev $interface table $number $realm"; + $address = get_interface_address $interface unless $address; + emit "run_ip route replace $gateway src $address dev $interface ${mtu}table $number $realm"; emit "run_ip route add default via $gateway dev $interface table $number $realm"; }