liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

default.nix (1127B)


      1 ## VLAN
      2 ## ====
      3 ##
      4 ## Virtual LANs give you the ability to sub-divide a LAN. Linux can
      5 ## accept VLAN tagged traffic and presents each VLAN ID as a
      6 ## different network interface (eg: eth0.100 for VLAN ID 100)
      7 ##
      8 ## Some Liminix devices with multiple ethernet ports are implemented
      9 ## using a network switch connecting the physical ports to the CPU,
     10 ## and require using VLAN in order to send different traffic to
     11 ## different ports (e.g. LAN vs WAN)
     12 
     13 {
     14   lib,
     15   pkgs,
     16   config,
     17   ...
     18 }:
     19 let
     20   inherit (lib) mkOption types;
     21   inherit (pkgs) liminix;
     22 in
     23 {
     24   options = {
     25     system.service.vlan = mkOption { type = liminix.lib.types.serviceDefn; };
     26   };
     27   config.system.service.vlan = config.system.callService ./service.nix {
     28     ifname = mkOption {
     29       type = types.str;
     30       description = "interface name to create";
     31     };
     32     primary = mkOption {
     33       description = "existing physical interface";
     34       type = liminix.lib.types.interface;
     35     };
     36     vid = mkOption {
     37       description = "VLAN identifier (VID) in range 1-4094";
     38       type = types.str;
     39     };
     40   };
     41   config.kernel.config = {
     42     VLAN_8021Q = "y";
     43   };
     44 }