Move plat-fallback-prefix logic into get_plat_prefix()

Feature introduced in 8aa8bfa was defective from day one, it seems.

Fixes #39
This commit is contained in:
Tore Anderson
2024-08-17 08:48:06 +02:00
parent 04062b282d
commit 3ea303b521

4
clatd
View File

@@ -374,6 +374,9 @@ sub get_plat_prefix {
} }
if(@prefixes) { if(@prefixes) {
return $prefixes[0]; return $prefixes[0];
} elsif($CFG{"plat-fallback-prefix"}) {
p("No PLAT prefix could be discovered, using fallback");
return $CFG{"plat-fallback-prefix"};
} else { } else {
p("No PLAT prefix could be discovered. Your ISP probably doesn't provide", p("No PLAT prefix could be discovered. Your ISP probably doesn't provide",
" NAT64/DNS64 PLAT service. Exiting."); " NAT64/DNS64 PLAT service. Exiting.");
@@ -735,7 +738,6 @@ p("Starting clatd v$VERSION by Tore Anderson <tore\@fud.no>");
# Step 1: Fill in any essential blanks in the configuration by auto-detecting # Step 1: Fill in any essential blanks in the configuration by auto-detecting
# any missing values. # any missing values.
$CFG{"plat-prefix"} ||= get_plat_prefix(); $CFG{"plat-prefix"} ||= get_plat_prefix();
$CFG{"plat-prefix"} ||= $CFG{"plat-fallback-prefix"};
if(!$CFG{"plat-prefix"}) { if(!$CFG{"plat-prefix"}) {
w("No PLAT prefix was discovered or specified; 464XLAT cannot work."); w("No PLAT prefix was discovered or specified; 464XLAT cannot work.");
exit 0; exit 0;