aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2022-10-24 21:35:41 +0200
committerKarel Kočí <cynerd@email.cz>2022-10-24 21:35:41 +0200
commite8610a073d67ab2be05175f386218a7772b0a892 (patch)
tree1ebc031a21c8c9d980a2f45382ee7a50206a0a69
parente0470d0a5bc6d5cd5cdc3a5b515d12f3594d3ec2 (diff)
downloadnixturris-e8610a073d67ab2be05175f386218a7772b0a892.tar.gz
nixturris-e8610a073d67ab2be05175f386218a7772b0a892.tar.bz2
nixturris-e8610a073d67ab2be05175f386218a7772b0a892.zip
nixos/hostapd: added bridge
-rw-r--r--nixos/modules/hostapd.nix21
1 files changed, 21 insertions, 0 deletions
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 {