diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-07-10 15:29:23 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-07-10 15:29:23 +0300 |
commit | e3ea08d43ccf0a117b10e9d52c91612281a4193f (patch) | |
tree | 89434b6bd5e4a8edca22ae3f1903d80bb0ce0948 | |
parent | 5bbf06a701121f6c66f569e6ef99fddf017e95cd (diff) | |
download | dnstools-e3ea08d43ccf0a117b10e9d52c91612281a4193f.tar.gz dnstools-e3ea08d43ccf0a117b10e9d52c91612281a4193f.tar.bz2 |
dgd: ensure gateways are probed from the corresponding interfaces
* dgd/dgd (check_links): Bind to the corresponding interface
before piniging.
* dgd/rc.uplink (linksetup): Remove useless rules
-rwxr-xr-x | dgd/dgd | 8 | ||||
-rwxr-xr-x | dgd/rc.uplink | 4 |
2 files changed, 5 insertions, 7 deletions
@@ -439,11 +439,13 @@ sub check_links { | |||
439 | debug(1, "checking links ".($#links+1).", probes $config{core}{probes}"); | 439 | debug(1, "checking links ".($#links+1).", probes $config{core}{probes}"); |
440 | my $p = Net::Ping->new("icmp", $config{core}{timeout}); | ||
441 | for (my $i = 0; $i < $config{core}{probes}; $i++) { | 440 | for (my $i = 0; $i < $config{core}{probes}; $i++) { |
442 | foreach $link (@links) { | 441 | foreach $link (@links) { |
443 | debug(3, "ping $link->{name}"); | ||
444 | next if link_is_alive($link); | 442 | next if link_is_alive($link); |
443 | debug(3, "ping $link->{name}"); | ||
444 | my $p = Net::Ping->new("icmp", $config{core}{timeout}, undef, | ||
445 | $link->{if}); | ||
445 | ++$link->{alive} if $p->ping($link->{gw}); | 446 | ++$link->{alive} if $p->ping($link->{gw}); |
447 | $p->close(); | ||
448 | debug(3, "$link->{name} " . ($link->{alive} ? "alive" : "dead")); | ||
446 | } | 449 | } |
447 | } | 450 | } |
448 | $p->close(); | ||
449 | if (!defined($active_link)) { | 451 | if (!defined($active_link)) { |
diff --git a/dgd/rc.uplink b/dgd/rc.uplink index f116293..239d85f 100755 --- a/dgd/rc.uplink +++ b/dgd/rc.uplink | |||
@@ -28,6 +28,2 @@ END { | |||
28 | ip rule add from $3 table $1 | 28 | ip rule add from $3 table $1 |
29 | ip rule add from $5 table $1 | ||
30 | if [ -n "$6" ]; then | ||
31 | ip rule add from $6 table $1 | ||
32 | fi | ||
33 | ip route add default via $4 table $1 | 29 | ip route add default via $4 table $1 |