lib/config/legacy: treat single eth0 as wan port

This commit is contained in:
Astro 2021-11-06 03:36:55 +01:00
parent e975d78504
commit 7834d64e27
1 changed files with 16 additions and 4 deletions

View File

@ -443,11 +443,23 @@ in
in in
if model ? ports if model ? ports
then then
lib.optionalAttrs (builtins.length wanTargets > 0) { if model.ports == [ {
"${builtins.head wanTargets}".ports = getPorts "wan"; interface = "eth0";
} // lib.optionalAttrs (ap ? lan-access) { port = "lan";
"${ap.lan-access}".ports = getPorts "lan.*"; type = "phys";
} ] && builtins.length wanTargets > 0
then {
# Only 1 Ethernet port, treat as uplink
"${builtins.head wanTargets}".ports = [ "eth0" ];
} }
else
lib.optionalAttrs (builtins.length wanTargets > 0) {
"${builtins.head wanTargets}".ports = getPorts "wan";
} // lib.optionalAttrs (ap ? lan-access) {
"${ap.lan-access}".ports = self.lib.unique (
getPorts "lan.*"
);
}
else else
builtins.trace "No known ports for OpenWRT model ${ap.model}" builtins.trace "No known ports for OpenWRT model ${ap.model}"
{}; {};