Unverified Commit 989cca26 authored by Philip Taron's avatar Philip Taron
Browse files

systemd.network.netdev: Add support for WLAN devices

These are virtual interface, where one physical wifi adapter can have
more than one interface.

See https://systemd.network/systemd.netdev.html#%5BWLAN%5D%20Section%20Options
and https://github.com/systemd/systemd/commit/dedf2d0054eb3150697b1540bf9733cba9e881fd
parent de635523
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -65,6 +65,9 @@ in {
    '' + optionalString (def.vrfConfig != { }) ''
      [VRF]
      ${attrsToSection def.vrfConfig}
    '' + optionalString (def.wlanConfig != { }) ''
      [WLAN]
      ${attrsToSection def.wlanConfig}
    '' + optionalString (def.batmanAdvancedConfig != { }) ''
      [BatmanAdvanced]
      ${attrsToSection def.batmanAdvancedConfig}
+24 −0
Original line number Diff line number Diff line
@@ -159,6 +159,7 @@ let
          "geneve"
          "l2tp"
          "macsec"
          "wlan"
          "vrf"
          "vcan"
          "vxcan"
@@ -468,6 +469,19 @@ let
        (assertMinimum "Table" 0)
      ];

      sectionWLAN = checkUnitConfig "WLAN" [
        (assertOnlyFields [
          "PhysicalDevice"
          "Type"
          "WDS"
        ])
        # systemd supports strings here too ("phy0") but index is good enough
        (assertInt "PhysicalDevice")
        (assertMinimum "PhysicalDevice" 0)
        (assertValueOneOf "Type" ["ad-hoc" "station" "ap" "ap-vlan" "wds" "monitor" "mesh-point" "p2p-client" "p2p-go" "p2p-device" "ocb" "nan"])
        (assertValueOneOf "WDS" boolValues)
      ];

      sectionBatmanAdvanced = checkUnitConfig "BatmanAdvanced" [
        (assertOnlyFields [
          "GatewayMode"
@@ -1779,6 +1793,16 @@ let
      '';
    };

    wlanConfig = mkOption {
      default = {};
      example = { PhysicalDevice = 0; Type = "station"; };
      type = types.addCheck (types.attrsOf unitOption) check.netdev.sectionWLAN;
      description = lib.mdDoc ''
        Each attribute in this set specifies an option in the `[WLAN]` section of the unit.
        See {manpage}`systemd.netdev(5)` for details.
      '';
    };

    batmanAdvancedConfig = mkOption {
      default = {};
      example = {