Package: hostapd
Version: 2:2.4-1+deb9u1
Severity: wishlist
Tags: patch

Dear Andrew,

Please consider replacing hostapd.service with [email protected]
template - this makes it a lot easier if you have multiple WLAN cards

Here's the template I use:

  [Unit]
  Description=Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP 
Authenticator (%I)
  After=network.target
  BindsTo=sys-subsystem-net-devices-%i.device

  [Service]
  EnvironmentFile=/etc/default/hostapd
  ExecStart=/usr/sbin/hostapd $DAEMON_OPTS /etc/hostapd/%i.conf
  Restart=on-failure
  RestartSec=1

  [Install]
  WantedBy=multi-user.target sys-subsystem-net-devices-%i.device


it assumes one will feed it with wlan interface name, f.e.

  $ systemctl start [email protected]

will read config data from /etc/hostapd/wlan0.conf which should contain
"interface=wlan0" and will be stopped automatically if wlan0 interface is no
longer available (I use it to disable hostapd if USB device is removed or start
hostapd when USB device is inserted)

Note that I also changed forking type & removed creating PID file since
systemd can handle all this stuff

DAEMON_OPTS from /etc/default/hostapd is shared in all instances (if one needs
more options)

It's probably also worth mentioning `systemctl enable [email protected]`
commnand in a README

Reply via email to