From 8ee1d44567d9f825a9f555b36e52e45efe0106a5 Mon Sep 17 00:00:00 2001 From: "aiyion.prime" Date: Wed, 15 Jun 2022 18:12:07 +0200 Subject: [PATCH] gluon-core: split dual lan devices --- .../luasrc/lib/gluon/upgrade/020-interfaces | 4 +++ .../luasrc/lib/gluon/upgrade/115-swconfig | 28 +++++++++++++++++++ .../luasrc/lib/gluon/upgrade/320-setup-ifname | 1 + 3 files changed, 33 insertions(+) create mode 100755 package/gluon-core/luasrc/lib/gluon/upgrade/115-swconfig diff --git a/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces b/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces index 164e996a..ee953afb 100755 --- a/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces +++ b/package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces @@ -57,6 +57,10 @@ elseif platform.match('ath79', 'generic', { }) then -- Temporary solution to separate interfaces in bridged default setup lan_ifname, wan_ifname = 'eth0', 'eth1' +elseif platform.match('ath79', 'generic', { + 'ubnt,unifiac-pro', +}) then + lan_ifname, wan_ifname = 'eth0.2', 'eth0.1' elseif platform.match('lantiq') then local switch_data = board_data.switch or {} local switch0_data = switch_data.switch0 or {} diff --git a/package/gluon-core/luasrc/lib/gluon/upgrade/115-swconfig b/package/gluon-core/luasrc/lib/gluon/upgrade/115-swconfig new file mode 100755 index 00000000..01cd3811 --- /dev/null +++ b/package/gluon-core/luasrc/lib/gluon/upgrade/115-swconfig @@ -0,0 +1,28 @@ +#!/usr/bin/lua + +local platform = require 'gluon.platform' +local uci = require('simple-uci').cursor() + +local switch_vlans = { + -- device identifier, lan ports, wan ports + ["ubnt,unifiac-pro"] = {"2 0t", "3 0t"}, +} + +local board_name = platform.get_board_name() +local assignments = switch_vlans[board_name] + +if not platform.match('ath79', 'generic') or not assignments then + return +end + +uci:delete_all('network', 'switch_vlan') + +for vlan, ports in ipairs(assignments) do + uci:section("network", "switch_vlan", nil, { + device = "switch0", + vlan = vlan, + ports = ports, + }) +end + +uci:save('network') diff --git a/package/gluon-setup-mode/luasrc/lib/gluon/upgrade/320-setup-ifname b/package/gluon-setup-mode/luasrc/lib/gluon/upgrade/320-setup-ifname index 195663dd..3692fee8 100755 --- a/package/gluon-setup-mode/luasrc/lib/gluon/upgrade/320-setup-ifname +++ b/package/gluon-setup-mode/luasrc/lib/gluon/upgrade/320-setup-ifname @@ -6,6 +6,7 @@ local sysconfig = require 'gluon.sysconfig' if platform.is_outdoor_device() or platform.match('ath79', 'generic', { 'ubnt,unifi-ap-pro', + 'ubnt,unifiac-pro', }) then sysconfig.setup_ifname = sysconfig.single_ifname or sysconfig.wan_ifname