1
0
Fork 0

mt300a: use module-based network services for lan/wan

This commit is contained in:
Daniel Barlow 2023-08-31 18:27:07 +01:00
parent f1dfb1f976
commit b094220466
1 changed files with 34 additions and 21 deletions

View File

@ -55,25 +55,38 @@
"${openwrt.src}/target/linux/ramips/dts" "${openwrt.src}/target/linux/ramips/dts"
]; ];
}; };
networkInterfaces = rec { networkInterfaces =
let
inherit (config.system.service.network) link;
inherit (config.system.service) vlan;
inherit (pkgs.liminix.services) oneshot;
swconfig = oneshot {
name = "swconfig";
up = ''
PATH=${pkgs.swconfig}/bin:$PATH
swconfig dev switch0 set reset
swconfig dev switch0 set enable_vlan 1
swconfig dev switch0 vlan 1 set ports '1 2 3 4 6t'
swconfig dev switch0 vlan 2 set ports '0 6t'
swconfig dev switch0 set apply
'';
down = "swconfig dev switch0 set reset";
};
in rec {
eth = link.build { ifname = "eth0"; dependencies = [swconfig]; };
# lan and wan ports are both behind a switch on eth0 # lan and wan ports are both behind a switch on eth0
eth = interface { device = "eth0"; }; lan = vlan.build {
lan = interface { ifname = "eth0.1";
type = "vlan"; primary = eth;
device = "eth0.1"; vid = "1";
link = "eth0";
id = "1";
dependencies = [eth];
}; };
wan = interface { wan = vlan.build {
type = "vlan"; ifname = "eth0.2";
device = "eth0.2"; primary = eth;
id = "2"; vid = "2";
link = "eth0";
dependencies = [eth];
}; };
wlan = interface { wlan = link.build {
device = "wlan0"; ifname = "wlan0";
dependencies = [ mac80211 ]; dependencies = [ mac80211 ];
}; };
}; };