~ubuntu-branches/debian/sid/shorewall/sid

« back to all changes in this revision

Viewing changes to Perl/Shorewall/Providers.pm

  • Committer: Package Import Robot
  • Author(s): Roberto C. Sanchez
  • Date: 2013-10-03 19:42:15 UTC
  • mfrom: (1.3.54)
  • Revision ID: package-import@ubuntu.com-20131003194215-7loykbugk8oq5b21
Tags: 4.5.21-1
* New Upstream Version
* Remove linux-image from suggests (Closes: #724564)

Show diffs side-by-side

added added

removed removed

Lines of Context:
474
474
        $gateway = '';
475
475
    }
476
476
 
477
 
    my ( $loose, $track, $balance, $default, $default_balance, $optional, $mtu, $tproxy, $local, $load, $what );
 
477
    my ( $loose, $track, $balance, $default, $default_balance, $optional, $mtu, $tproxy, $local, $load, $what, $hostroute );
478
478
 
479
479
    if ( $pseudo ) {    
480
 
        ( $loose, $track,                   $balance , $default, $default_balance,                $optional,                           $mtu, $tproxy , $local, $load, $what ) =
481
 
        ( 0,      0                       , 0 ,        0,        0,                               1                                  , ''  , 0       , 0,      0,     'interface');
 
480
        ( $loose, $track,                   $balance , $default, $default_balance,                $optional,                           $mtu, $tproxy , $local, $load, $what ,      $hostroute ) =
 
481
        ( 0,      0                       , 0 ,        0,        0,                               1                                  , ''  , 0       , 0,      0,     'interface', 0);
482
482
    } else {
483
 
        ( $loose, $track,                   $balance , $default, $default_balance,                $optional,                           $mtu, $tproxy , $local, $load, $what )=
484
 
        ( 0,      $config{TRACK_PROVIDERS}, 0 ,        0,        $config{USE_DEFAULT_RT} ? 1 : 0, interface_is_optional( $interface ), ''  , 0       , 0,      0,     'provider');
 
483
        ( $loose, $track,                   $balance , $default, $default_balance,                $optional,                           $mtu, $tproxy , $local, $load, $what      , $hostroute )=
 
484
        ( 0,      $config{TRACK_PROVIDERS}, 0 ,        0,        $config{USE_DEFAULT_RT} ? 1 : 0, interface_is_optional( $interface ), ''  , 0       , 0,      0,     'provider',  1);
485
485
    }
486
486
 
487
487
    unless ( $options eq '-' ) {
535
535
                $noautosrc = 0;
536
536
            } elsif ( $option eq 'noautosrc' ) {
537
537
                $noautosrc = 1;
 
538
            } elsif ( $option eq 'hostroute' ) {
 
539
                $hostroute = 1;
 
540
            } elsif ( $option eq 'nohostroute' ) {
 
541
                $hostroute = 0;
538
542
            } else {
539
543
                fatal_error "Invalid option ($option)";
540
544
            }
642
646
                           load        => $load ,
643
647
                           pseudo      => $pseudo ,
644
648
                           what        => $what ,
 
649
                           hostroute   => $hostroute ,
645
650
                           rules       => [] ,
646
651
                           routes      => [] ,
647
652
                           routedests  => {} ,
718
723
    my $pseudo      = $providerref->{pseudo};
719
724
    my $what        = $providerref->{what};
720
725
    my $label       = $pseudo ? 'Optional Interface' : 'Provider';
 
726
    my $hostroute   = $providerref->{hostroute};
721
727
 
722
728
    my $dev         = var_base $physical;
723
729
    my $base        = uc $dev;
798
804
 
799
805
    if ( $gateway ) {
800
806
        $address = get_interface_address $interface unless $address;
801
 
        if ( $family == F_IPV4 ) {
802
 
            emit "run_ip route replace $gateway src $address dev $physical ${mtu}";
803
 
            emit "run_ip route replace $gateway src $address dev $physical ${mtu}table $id $realm";
804
 
        } else {
805
 
            emit "qt \$IP -6 route add $gateway src $address dev $physical ${mtu}";
806
 
            emit "qt \$IP -6 route del $gateway src $address dev $physical ${mtu}table $id $realm";
807
 
            emit "run_ip route add $gateway src $address dev $physical ${mtu}table $id $realm";
 
807
 
 
808
        if ( $hostroute ) {
 
809
            if ( $family == F_IPV4 ) {
 
810
                emit "run_ip route replace $gateway src $address dev $physical ${mtu}";
 
811
                emit "run_ip route replace $gateway src $address dev $physical ${mtu}table $id $realm";
 
812
            } else {
 
813
                emit "qt \$IP -6 route add $gateway src $address dev $physical ${mtu}" if $hostroute;
 
814
                emit "qt \$IP -6 route del $gateway src $address dev $physical ${mtu}table $id $realm";
 
815
                emit "run_ip route add $gateway src $address dev $physical ${mtu}table $id $realm";
 
816
            }
808
817
        }
809
818
 
810
819
        emit "run_ip route add default via $gateway src $address dev $physical ${mtu}table $id $realm";