Add DEVICE column to routes file

This commit is contained in:
Tom Eastep 2010-11-17 08:35:20 -08:00
parent 421b1e745d
commit 5e1c8f8d2a
5 changed files with 42 additions and 6 deletions

View File

@ -642,7 +642,7 @@ sub add_an_rtrule( ) {
}
sub add_a_route( ) {
my ( $provider, $dest, $gateway ) = split_line 2, 3, 'routes file';
my ( $provider, $dest, $gateway, $device ) = split_line 2, 4, 'routes file';
our $current_if;
@ -668,7 +668,9 @@ sub add_a_route( ) {
validate_address ( $gateway, 1 ) if $gateway ne '-';
my ( $optional, $number , $physical ) = ( $providers{$provider}{optional} , $providers{$provider}{number}, $providers{$provider}{physical} );
my ( $optional, $number ) = ( $providers{$provider}{optional} , $providers{$provider}{number} );
my $physical = $device eq '-' ? $providers{$provider}{physical} : physical_name( $device );
if ( $providers{$provider}{optional} ) {
my $base = uc chain_base( $physical );
@ -679,9 +681,11 @@ sub add_a_route( ) {
}
if ( $gateway ne '-' ) {
emit( "if ! qt \$IP route -4 add $dest via $gateway dev $physical table $number; then",
" run_ip route add $dest via $gateway table $number",
"fi" );
if ( $device ne '-' ) {
emit( "run_ip route add $dest via $gateway dev $physical table $number" );
} else {
emit ("run_ip route add $dest via $gateway table $number" );
}
} else {
emit( "run_ip route add $dest dev $physical table $number" );
}

View File

@ -5,4 +5,5 @@
#
# For additional information, see http://www.shorewall.net/MultiISP.html
##############################################################################
#PROVIDER DEST GATEWAY
#PROVIDER DEST GATEWAY DEVICE

9
Shorewall6/routes Normal file
View File

@ -0,0 +1,9 @@
#
# Shorewall6 version 4 - routes File
#
# For information about entries in this file, type "man shorewall6-routes"
#
# For additional information, see http://www.shorewall.net/MultiISP.html
##############################################################################
#PROVIDER DEST GATEWAY DEVICE

View File

@ -55,6 +55,17 @@
DEST.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>DEVICE (Optional)</term>
<listitem>
<para>Specifies the device route. If neither DEVICE nor GATEWAY is
given, then the INTERFACE specified for the PROVIDER in <ulink
url="shorewall-providers.html">shorewall-providers</ulink>
(5).</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

View File

@ -55,6 +55,17 @@
DEST.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>DEVICE (Optional)</term>
<listitem>
<para>Specifies the device route. If neither DEVICE nor GATEWAY is
given, then the INTERFACE specified for the PROVIDER in <ulink
url="shorewall6-providers.html">shorewall6-providers</ulink>
(5).</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>