Strip prefix length before route lookup for $plat_prefix

Recent Linux kernels have removed the ability to do a `ip -6 route get` lookup
for destinations with a prefix length:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0eff0a274104487938d741b5c37aca1795afd184

Strip the prefix length before doing this lookup, so that it is done for the
first address in `$plat_prefix` instead.

Closes #12.
This commit is contained in:
Tore Anderson
2019-05-20 09:13:05 +02:00
parent 888e30bd2b
commit 19c4042f1e

1
clatd
View File

@@ -393,6 +393,7 @@ sub get_plat_dev {
if(!$plat_prefix) { if(!$plat_prefix) {
err("get_plat_dev(): No PLAT prefix to work with"); err("get_plat_dev(): No PLAT prefix to work with");
} }
$plat_prefix =~ s|/\d+$||;
open(my $fd, '-|', cfg("cmd-ip"), qw(-6 route get), $plat_prefix) open(my $fd, '-|', cfg("cmd-ip"), qw(-6 route get), $plat_prefix)
or err("get_plat_dev(): 'ip -6 route get $plat_prefix' failed to execute"); or err("get_plat_dev(): 'ip -6 route get $plat_prefix' failed to execute");
while(<$fd>) { while(<$fd>) {