liminix/modules/vlan/service.nix
Raito Bezarius 2ab144a281
Some checks failed
build liminix / build_vm_qemu_mips (push) Failing after 5m17s
build liminix / build_zyxel-nwa50ax_mips (push) Has been cancelled
build liminix / test_hostapd (push) Has been cancelled
build liminix / test_shell_customization (push) Has been cancelled
feat: add support for untagged frames
Should cover egress & ingress.

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

21 lines
555 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 ${vid} pvid untagged master"}
${liminix.networking.ifup name ifname}
(in_outputs ${name}
echo ${ifname} > ifname
)
'';
down = "ip link set down dev ${ifname}";
dependencies = [ primary ];
}