liminix/modules/vlan/service.nix
Raito Bezarius 1322de1ee0
All checks were successful
build liminix / build_vm_qemu_mips (push) Successful in 39m35s
build liminix / build_zyxel-nwa50ax_mips (push) Successful in 39m35s
build liminix / test_shell_customization (push) Successful in 39m31s
build liminix / test_hostapd (push) Successful in 39m52s
feat: add support for untagged frames
Should cover egress & ingress.

Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2024-12-09 01:25:52 +01:00

21 lines
573 B
Nix

{
liminix
, lib
}:
{ ifname, primary, vid, untagged } :
let
inherit (lib) optionalString;
inherit (liminix.services) oneshot;
in oneshot rec {
name = "${ifname}.link";
up = ''
ip link add link $(output ${primary} ifname) name ${ifname} type vlan id ${vid}
${optionalString untagged.egress "bridge vlan add dev ${ifname} vid ${toString untagged.vid} pvid untagged master"}
${liminix.networking.ifup name ifname}
(in_outputs ${name}
echo ${ifname} > ifname
)
'';
down = "ip link set down dev ${ifname}";
dependencies = [ primary ];
}