From 87b86000b23e4afddf4aabe67be79187974122c7 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 8 Sep 2018 21:59:50 +0000 Subject: [PATCH] method to creat ap0 and have hostapd use it --- roles/network/tasks/hostapd.yml | 8 ++++++++ roles/network/templates/hostapd/70-persistent-net.rules | 3 +++ roles/network/templates/hostapd/hostapd.conf.j2 | 3 +-- roles/network/templates/hostapd/iiab-hostapd.conf.j2 | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 roles/network/templates/hostapd/70-persistent-net.rules diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 386eafb92..cea1f1bd4 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -21,6 +21,14 @@ mode: 0644 when: discovered_wireless_iface != "none" +- name: Use custom udev rule to create ap0 + template: + src: hostapd/70-persistent-net.rules + dest: /etc/udev/rules.d/70-persistent-net.rules + owner: root + group: root + mode: 0644 + - name: Use custom systemd unit file to start 'hostapd' service template: src: hostapd/hostapd.service.j2 diff --git a/roles/network/templates/hostapd/70-persistent-net.rules b/roles/network/templates/hostapd/70-persistent-net.rules new file mode 100644 index 000000000..5e9cca3c3 --- /dev/null +++ b/roles/network/templates/hostapd/70-persistent-net.rules @@ -0,0 +1,3 @@ +SUBSYSTEM=="ieee80211", ACTION=="add|change", KERNEL=="phy0", \ + RUN+="/sbin/iw phy phy0 interface add ap0 type __ap", \ + RUN+="MAC=`iw dev wlan0 info | grep addr | sed -e s/addr//` && /bin/ip link set ap0 address $MAC" diff --git a/roles/network/templates/hostapd/hostapd.conf.j2 b/roles/network/templates/hostapd/hostapd.conf.j2 index 9e38ace62..097a8d41a 100644 --- a/roles/network/templates/hostapd/hostapd.conf.j2 +++ b/roles/network/templates/hostapd/hostapd.conf.j2 @@ -1,7 +1,6 @@ # Basic configuration -interface={% if iiab_wireless_lan_iface is defined %}{{ iiab_wireless_lan_iface }}{% endif %} - +interface=ap0 ssid={{ host_ssid }} channel={{ host_channel }} diff --git a/roles/network/templates/hostapd/iiab-hostapd.conf.j2 b/roles/network/templates/hostapd/iiab-hostapd.conf.j2 index 3cfffc69e..097a8d41a 100644 --- a/roles/network/templates/hostapd/iiab-hostapd.conf.j2 +++ b/roles/network/templates/hostapd/iiab-hostapd.conf.j2 @@ -1,6 +1,6 @@ # Basic configuration -interface={{ discovered_wireless_iface }} +interface=ap0 ssid={{ host_ssid }} channel={{ host_channel }}