Avoid using a bogus CLAT address if no EUI-64

get_clat_v6_addr() didn't actually check if it saw any Modified EUI-64
based addresses on the PLAT device before proceeding. This caused it to
return a bogus CLAT address (::c1:a700:0) instead of failing with a
useful error message.
This commit is contained in:
Tore Anderson 2014-06-29 13:27:53 +02:00
parent 7e35aa56c7
commit da7b48e779
1 changed files with 5 additions and 0 deletions

5
clatd
View File

@ -471,6 +471,11 @@ sub get_clat_v6_addr {
close($fd)
or err("'ip -6 address list scope global dev $plat_dev' failed");
if(!$ip) {
err("No Modified EUI-64-based address seen on $plat_dev; clatd cannot ",
"auto-generate a CLAT IPv6 address (try setting 'clat-v6-addr')");
}
# First clear the middle 0xfffe bits of the interface ID
my $mask = Net::IP->new("ffff:ffff:ffff:ffff:ffff:ff00:00ff:ffff");
$mask = $mask->intip();