liminix/modules/vlan/default.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

45 lines
1.3 KiB
Nix

## VLAN
## ====
##
## Virtual LANs give you the ability to sub-divide a LAN. Linux can
## accept VLAN tagged traffic and presents each VLAN ID as a
## different network interface (eg: eth0.100 for VLAN ID 100)
##
## Some Liminix devices with multiple ethernet ports are implemented
## using a network switch connecting the physical ports to the CPU,
## and require using VLAN in order to send different traffic to
## different ports (e.g. LAN vs WAN)
{ lib, pkgs, config, ...}:
let
inherit (lib) mkOption types;
inherit (pkgs.liminix.services) oneshot;
inherit (pkgs) liminix;
in
{
options = {
system.service.vlan = mkOption { type = liminix.lib.types.serviceDefn; };
};
config.system.service.vlan = liminix.callService ./service.nix {
ifname = mkOption {
type = types.str;
description = "interface name to create";
};
primary = mkOption {
description = "existing physical interface";
type = liminix.lib.types.interface;
};
vid = mkOption {
description = "VLAN identifier (VID) in range 1-4094";
type = types.str;
};
untagged.egress = mkOption {
description = "Whether packets from this interface will go out *untagged*";
type = types.bool;
default = false;
};
};
config.kernel.config = {
VLAN_8021Q = "y";
};
}