From e8610a073d67ab2be05175f386218a7772b0a892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Mon, 24 Oct 2022 21:35:41 +0200 Subject: nixos/hostapd: added bridge --- nixos/modules/hostapd.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/nixos/modules/hostapd.nix b/nixos/modules/hostapd.nix index 3b2d9e6..15d7fdb 100644 --- a/nixos/modules/hostapd.nix +++ b/nixos/modules/hostapd.nix @@ -84,6 +84,25 @@ let ''; }; + bridge = mkOption { + type = with types; nullOr str; + default = null; + example = "br0"; + description = '' + In case of atheros and nl80211 driver interfaces, an additional + configuration parameter, bridge, may be used to notify hostapd if the + interface is included in a bridge. This parameter is not used with + Host AP driver. If the bridge parameter is not set, the drivers will + automatically figure out the bridge interface (assuming sysfs is + enabled and mounted to /sys) and this parameter may not be needed. + + For nl80211, this parameter can be used to request the AP interface to + be added to the bridge automatically (brctl may refuse to do this + before hostapd has been started to change the interface mode). If + needed, the bridge interface is also created. + ''; + }; + group = mkOption { default = "wheel"; example = "network"; @@ -447,6 +466,7 @@ let logger_stdout_level=${toString icfg.logLevel} interface=${iface} + ${optionalString (icfg.bridge != null) "bridge=${icfg.bridge}"} driver=${icfg.driver} use_driver_iface_addr=1 hw_mode=${icfg.hwMode} @@ -569,6 +589,7 @@ in systemd.services.hostapd = let interfaces = map utils.escapeSystemdPath (attrNames (filterAttrs (n: v: v.enable) cfg.interfaces)); links = interfaces ++ (map utils.escapeSystemdPath (concatMap attrNames (catAttrs "bss" (attrValues (filterAttrs (n: v: v.enable) cfg.interfaces))))); + # TODO also include bridge?? devices = map (ifc: "sys-subsystem-net-devices-${ifc}.device") interfaces; services = map (ifc: "network-link-${ifc}.service") links; in { -- cgit v1.2.3