mirror of https://github.com/aredn/aredn.git
bugfix: get_default_gw needs to follow the route the node will use to internet.
because of previous bugfix the function needs to check table 31 and 254 (with 254 taking priority)
This commit is contained in:
parent
60b8095c08
commit
88d532a3a1
|
@ -417,9 +417,19 @@ sub get_ip6_addr
|
|||
sub get_default_gw
|
||||
{
|
||||
my $gw = "none";
|
||||
foreach(`route -n`)
|
||||
|
||||
# Table 31 is populated by OLSR
|
||||
foreach(`/usr/sbin/ip route list table 31`)
|
||||
{
|
||||
next unless /^0\.0\.0\.0\s+([\d\.]+)/;
|
||||
next unless /^default\svia\s([\d\.]+)/;
|
||||
$gw = $1;
|
||||
last;
|
||||
}
|
||||
|
||||
# However a node with a wired default gw will route via that instead
|
||||
foreach(`/usr/sbin/ip route list table 254`)
|
||||
{
|
||||
next unless /^default\svia\s([\d\.]+)/;
|
||||
$gw = $1;
|
||||
last;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue