From 87b86000b23e4afddf4aabe67be79187974122c7 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 8 Sep 2018 21:59:50 +0000 Subject: [PATCH 01/93] 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 }} From d03df344ff174f68219bcf2258d2ca3291c7ccdc Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 8 Sep 2018 22:55:18 +0000 Subject: [PATCH 02/93] alter dhcpcd.conf for ap0 --- roles/network/templates/network/dhcpcd.conf.j2 | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/roles/network/templates/network/dhcpcd.conf.j2 b/roles/network/templates/network/dhcpcd.conf.j2 index f1265b10c..ac139711a 100644 --- a/roles/network/templates/network/dhcpcd.conf.j2 +++ b/roles/network/templates/network/dhcpcd.conf.j2 @@ -42,16 +42,12 @@ slaac private # Always (try) to run DHCP client on RPi's Ethernet port, for in-field # "cablemodems" used by many non-technical operators, who want Zero-Hassle # Updates. This means AVOIDING "denyinterfaces eth0" below: -{% if is_raspbian and hostapd_enabled %} -denyinterfaces{% if discovered_wireless_iface != "none" %} {{ discovered_wireless_iface }}{% endif %} -{% elif is_raspbian %} -#denyinterfaces{% if discovered_wireless_iface != "none" %} {{ discovered_wireless_iface }}{% endif %} -{% else %} -denyinterfaces{% if iiab_wireless_lan_iface is defined %} {{ iiab_wireless_lan_iface }}{% endif %}{% if iiab_wired_lan_iface is defined %} {{ iiab_wired_lan_iface }}{% endif %} +{% if is_rpi and hostapd_enabled %} +denyinterfaces ap0 +{% endif %} +{% if iiab_wired_lan_iface is defined %} +denyinterfaces {{ iiab_wired_lan_iface }} {% endif %} - -# FYI this 'denyinterfaces' line (here in /etc/dhcpcd.conf) is commented out by -# /usr/bin/iiab-hotspot-off, and uncommented by /usr/bin/iiab-hotspot-on {% if dhcpcd_result == "enabled" and iiab_lan_iface != "none" %} interface {{ iiab_lan_iface }} From 6ba20a63e973afc2797ba63f03b0f55d70dbdc5b Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 8 Sep 2018 23:40:02 +0000 Subject: [PATCH 03/93] start hostapd before dhcpcd --- roles/network/templates/hostapd/hostapd.service.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/network/templates/hostapd/hostapd.service.j2 b/roles/network/templates/hostapd/hostapd.service.j2 index 4094b812a..bf1d8bef8 100644 --- a/roles/network/templates/hostapd/hostapd.service.j2 +++ b/roles/network/templates/hostapd/hostapd.service.j2 @@ -1,7 +1,7 @@ [Unit] Description=Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator -Before=network.target -Wants=network-pre.target +After=network-pre.target +Before=network.target dhcpcd.service [Service] Type=idle From c56b9e651077ad994e7679f82a45de4ad6b2b7ad Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 13 Sep 2018 17:14:44 +0000 Subject: [PATCH 04/93] use hostapd's service file to create ap0 --- roles/network/tasks/hostapd.yml | 8 -------- roles/network/templates/hostapd/hostapd.service.j2 | 1 + 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index cea1f1bd4..386eafb92 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -21,14 +21,6 @@ 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/hostapd.service.j2 b/roles/network/templates/hostapd/hostapd.service.j2 index bf1d8bef8..8ccce4c7f 100644 --- a/roles/network/templates/hostapd/hostapd.service.j2 +++ b/roles/network/templates/hostapd/hostapd.service.j2 @@ -6,6 +6,7 @@ Before=network.target dhcpcd.service [Service] Type=idle PIDFile=/run/hostapd.pid +ExecStartPre=/sbin/iw phy phy0 interface add ap0 type __ap ExecStart=/usr/sbin/hostapd -P /run/hostapd.pid /etc/hostapd/hostapd.conf [Install] From 71907893cb178bb5e5ba12e29e87b877b4afba08 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Fri, 30 Nov 2018 02:20:20 -0600 Subject: [PATCH 05/93] set ap0 mac_addr to be different from wlan0 --- roles/network/templates/hostapd/50-hostapd | 12 ++++++++++++ .../templates/hostapd/70-persistent-net.rules | 2 +- roles/network/templates/hostapd/hostapd.service.j2 | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 roles/network/templates/hostapd/50-hostapd diff --git a/roles/network/templates/hostapd/50-hostapd b/roles/network/templates/hostapd/50-hostapd new file mode 100644 index 000000000..b663599b3 --- /dev/null +++ b/roles/network/templates/hostapd/50-hostapd @@ -0,0 +1,12 @@ + +if [ "$interface" = "wlan0" ]; then + syslog info "50-hostapd-ap0" + sleep 2 + # wpa_supplicant wants MHz for frequency= while hostapd wants channel..... whatever + # FREQ=`iw wlan0 info|grep channel|cut -d' ' -f9` + FREQ=`iw wlan0 info|grep channel|cut -d' ' -f2` + sed -i -e "s/^frequency.*/channel=$FREQ /" /etc/hostapd/hostapd.conf + syslog info "50-hostapd restarting hostapd" + systemctl daemon-reload + systemctl restart hostapd +fi diff --git a/roles/network/templates/hostapd/70-persistent-net.rules b/roles/network/templates/hostapd/70-persistent-net.rules index 5e9cca3c3..7bb53337d 100644 --- a/roles/network/templates/hostapd/70-persistent-net.rules +++ b/roles/network/templates/hostapd/70-persistent-net.rules @@ -1,3 +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" + RUN+="/sbin/ip link set ap0 address b8:27:99:12:34:56" diff --git a/roles/network/templates/hostapd/hostapd.service.j2 b/roles/network/templates/hostapd/hostapd.service.j2 index 8ccce4c7f..26195358e 100644 --- a/roles/network/templates/hostapd/hostapd.service.j2 +++ b/roles/network/templates/hostapd/hostapd.service.j2 @@ -6,7 +6,8 @@ Before=network.target dhcpcd.service [Service] Type=idle PIDFile=/run/hostapd.pid -ExecStartPre=/sbin/iw phy phy0 interface add ap0 type __ap +ExecStartPre=/sbin/iw phy phy0 interface add ap0 type __ap 2>1 > /dev/null +ExecStartPre=/sbin/ip link set ap0 address b8:27:99:12:34:56 2>1 > /dev/null ExecStart=/usr/sbin/hostapd -P /run/hostapd.pid /etc/hostapd/hostapd.conf [Install] From 188407614cef0f868f45d4d0fe4340ca78558c6c Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 2 Dec 2018 23:15:22 -0600 Subject: [PATCH 06/93] dhcpcd hook for hostapd --- roles/network/tasks/hostapd.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 386eafb92..ae53d7807 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -48,6 +48,15 @@ mode: 0755 when: is_raspbian | bool +- name: Create dhcpcd hook for hostapd + template: + src: hostapd/50-hostapd + dest: /lib/dhcpcd/dhcpcd-hooks/50-hostapd + owner: root + group: root + mode: 0644 + when: is_rpi + - name: Disable the Access Point 'hostapd' service systemd: name: hostapd From 79a829dabe83c78bc77e635d958d05a4e1f278ca Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 2 Dec 2018 23:16:08 -0600 Subject: [PATCH 07/93] softcode apo_mac_addr --- roles/network/defaults/main.yml | 35 +++++++++++++++++++ .../templates/hostapd/70-persistent-net.rules | 2 +- .../templates/hostapd/hostapd.service.j2 | 2 +- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/roles/network/defaults/main.yml b/roles/network/defaults/main.yml index 7cdf5b37c..b46dc0930 100644 --- a/roles/network/defaults/main.yml +++ b/roles/network/defaults/main.yml @@ -97,6 +97,41 @@ wondershaper_upspeed: "1024" # Unused # network_config_dir: /etc/network/interfaces.d +# Wi-Fi +host_ssid: IIAB +hostapd_wait: 1 +host_wifi_mode: g +host_channel: 6 +host_wireless_n: False +ap0_mac_addr: b8:27:99:12:34:56 +# Below moved to /etc/iiab/local_vars.yml: (so implementer sets this) +#host_country_code: US +hostapd_secure: True +hostapd_password: "iiab2017" +driver_name: nl80211 +hostapd_enabled: True +# Above is forcibly set to False (in roles/network/tasks/main.yml) if IIAB is +# being WiFi-installed (run "iiab-hotspot-on" AFTER ./iiab-install completes +# and content is downloaded, to enable the internal WiFi Access Point / AP!) +reboot_to_AP: False +# For those installing IIAB over WiFi: "reboot_to_AP: True" overrides the above +# detection of WiFi-as-gateway, forcing "hostapd_enabled: True" regardless. + +network_config_dir: /etc/network/interfaces.d +#iiab_network_mode: "Gateway" +dns_jail_enabled: False +services_externally_visible: False + +# DNS / name resolution +dhcpd_install: True +dhcpd_enabled: False +#dhcp_service: ???? # Set in individual OS's /opt/iiab/iiab/vars/.yml for use in roles/network/tasks/dhcpd.yml +#dhcp_service2: "dhcpd disabled" # Moved to roles/network/tasks/computed_services.yml as community transitions from named/BIND to dnsmasq (PR #1202) +named_install: True +named_enabled: False +dnsmasq_enabled: True +dnsmasq_install: True + # Originally for @tim-moody's Nodogsplash approach to Captive Portal # Highly experimental as of June 2018: https://github.com/iiab/iiab/issues/608 # diff --git a/roles/network/templates/hostapd/70-persistent-net.rules b/roles/network/templates/hostapd/70-persistent-net.rules index 7bb53337d..3ced0ef8b 100644 --- a/roles/network/templates/hostapd/70-persistent-net.rules +++ b/roles/network/templates/hostapd/70-persistent-net.rules @@ -1,3 +1,3 @@ SUBSYSTEM=="ieee80211", ACTION=="add|change", KERNEL=="phy0", \ RUN+="/sbin/iw phy phy0 interface add ap0 type __ap", \ - RUN+="/sbin/ip link set ap0 address b8:27:99:12:34:56" + RUN+="/sbin/ip link set ap0 address {{ ap0_mac_addr }}" diff --git a/roles/network/templates/hostapd/hostapd.service.j2 b/roles/network/templates/hostapd/hostapd.service.j2 index 26195358e..73500c0f6 100644 --- a/roles/network/templates/hostapd/hostapd.service.j2 +++ b/roles/network/templates/hostapd/hostapd.service.j2 @@ -7,7 +7,7 @@ Before=network.target dhcpcd.service Type=idle PIDFile=/run/hostapd.pid ExecStartPre=/sbin/iw phy phy0 interface add ap0 type __ap 2>1 > /dev/null -ExecStartPre=/sbin/ip link set ap0 address b8:27:99:12:34:56 2>1 > /dev/null +ExecStartPre=/sbin/ip link set ap0 address {{ ap0_mac_addr }} 2>1 > /dev/null ExecStart=/usr/sbin/hostapd -P /run/hostapd.pid /etc/hostapd/hostapd.conf [Install] From 218872c637ed0a68625300ff3ce6204893055e42 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 31 Dec 2018 00:51:29 -0600 Subject: [PATCH 08/93] refine hostapd.service --- roles/network/templates/hostapd/hostapd.service.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/network/templates/hostapd/hostapd.service.j2 b/roles/network/templates/hostapd/hostapd.service.j2 index 73500c0f6..5c92483c7 100644 --- a/roles/network/templates/hostapd/hostapd.service.j2 +++ b/roles/network/templates/hostapd/hostapd.service.j2 @@ -6,8 +6,8 @@ Before=network.target dhcpcd.service [Service] Type=idle PIDFile=/run/hostapd.pid -ExecStartPre=/sbin/iw phy phy0 interface add ap0 type __ap 2>1 > /dev/null -ExecStartPre=/sbin/ip link set ap0 address {{ ap0_mac_addr }} 2>1 > /dev/null +ExecStartPre=-/sbin/iw phy phy0 interface add ap0 type __ap +ExecStartPre=-/sbin/ip link set ap0 address {{ ap0_mac_addr }} ExecStart=/usr/sbin/hostapd -P /run/hostapd.pid /etc/hostapd/hostapd.conf [Install] From 75133bd7115d21fa3dd9c8b93080fd410fad8ae1 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 8 Aug 2019 13:04:48 -0500 Subject: [PATCH 09/93] refine hostapd.service.j2 --- roles/network/templates/hostapd/hostapd.service.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/network/templates/hostapd/hostapd.service.j2 b/roles/network/templates/hostapd/hostapd.service.j2 index 5c92483c7..f7e19b96a 100644 --- a/roles/network/templates/hostapd/hostapd.service.j2 +++ b/roles/network/templates/hostapd/hostapd.service.j2 @@ -1,7 +1,8 @@ [Unit] Description=Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator -After=network-pre.target Before=network.target dhcpcd.service +After=network-pre.target +Wants=network-pre.target [Service] Type=idle From 9df4e169b64d8e36f415266c397f758d084a5848 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 12 Feb 2020 14:42:54 -0600 Subject: [PATCH 10/93] slimdown defaults --- roles/network/defaults/main.yml | 36 +-------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/roles/network/defaults/main.yml b/roles/network/defaults/main.yml index b46dc0930..c052fcc46 100644 --- a/roles/network/defaults/main.yml +++ b/roles/network/defaults/main.yml @@ -38,6 +38,7 @@ hostapd_wait: 5 host_wireless_n: False driver_name: nl80211 +ap0_mac_addr: b8:27:99:12:34:56 # DNS / name resolution # dhcpd_install: False @@ -97,41 +98,6 @@ wondershaper_upspeed: "1024" # Unused # network_config_dir: /etc/network/interfaces.d -# Wi-Fi -host_ssid: IIAB -hostapd_wait: 1 -host_wifi_mode: g -host_channel: 6 -host_wireless_n: False -ap0_mac_addr: b8:27:99:12:34:56 -# Below moved to /etc/iiab/local_vars.yml: (so implementer sets this) -#host_country_code: US -hostapd_secure: True -hostapd_password: "iiab2017" -driver_name: nl80211 -hostapd_enabled: True -# Above is forcibly set to False (in roles/network/tasks/main.yml) if IIAB is -# being WiFi-installed (run "iiab-hotspot-on" AFTER ./iiab-install completes -# and content is downloaded, to enable the internal WiFi Access Point / AP!) -reboot_to_AP: False -# For those installing IIAB over WiFi: "reboot_to_AP: True" overrides the above -# detection of WiFi-as-gateway, forcing "hostapd_enabled: True" regardless. - -network_config_dir: /etc/network/interfaces.d -#iiab_network_mode: "Gateway" -dns_jail_enabled: False -services_externally_visible: False - -# DNS / name resolution -dhcpd_install: True -dhcpd_enabled: False -#dhcp_service: ???? # Set in individual OS's /opt/iiab/iiab/vars/.yml for use in roles/network/tasks/dhcpd.yml -#dhcp_service2: "dhcpd disabled" # Moved to roles/network/tasks/computed_services.yml as community transitions from named/BIND to dnsmasq (PR #1202) -named_install: True -named_enabled: False -dnsmasq_enabled: True -dnsmasq_install: True - # Originally for @tim-moody's Nodogsplash approach to Captive Portal # Highly experimental as of June 2018: https://github.com/iiab/iiab/issues/608 # From 3f749036e4b173c28b4b918a3c7cd8ac6f8efd28 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 26 Feb 2020 02:21:27 -0600 Subject: [PATCH 11/93] update hostapd.service --- roles/network/templates/hostapd/hostapd.service.j2 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/roles/network/templates/hostapd/hostapd.service.j2 b/roles/network/templates/hostapd/hostapd.service.j2 index f7e19b96a..fbbdd37fc 100644 --- a/roles/network/templates/hostapd/hostapd.service.j2 +++ b/roles/network/templates/hostapd/hostapd.service.j2 @@ -1,8 +1,11 @@ [Unit] Description=Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator -Before=network.target dhcpcd.service -After=network-pre.target Wants=network-pre.target +After=network-pre.target +{% if is_rpi %} +Before=dhcpcd.service +{% endif %} +Before=network.target [Service] Type=idle @@ -10,6 +13,8 @@ PIDFile=/run/hostapd.pid ExecStartPre=-/sbin/iw phy phy0 interface add ap0 type __ap ExecStartPre=-/sbin/ip link set ap0 address {{ ap0_mac_addr }} ExecStart=/usr/sbin/hostapd -P /run/hostapd.pid /etc/hostapd/hostapd.conf +ExecStartPost=-/sbin/ip link set ap0 up +ExecStopPost=-/sbin/iw dev ap0 del [Install] WantedBy=multi-user.target From 0bcf3c8184f760ebe752af5e23bc8456c1f3d275 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 26 Feb 2020 02:22:06 -0600 Subject: [PATCH 12/93] update dhcpcd hook --- roles/network/templates/hostapd/50-hostapd | 26 ++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/roles/network/templates/hostapd/50-hostapd b/roles/network/templates/hostapd/50-hostapd index b663599b3..47a769639 100644 --- a/roles/network/templates/hostapd/50-hostapd +++ b/roles/network/templates/hostapd/50-hostapd @@ -1,12 +1,20 @@ if [ "$interface" = "wlan0" ]; then - syslog info "50-hostapd-ap0" - sleep 2 - # wpa_supplicant wants MHz for frequency= while hostapd wants channel..... whatever - # FREQ=`iw wlan0 info|grep channel|cut -d' ' -f9` - FREQ=`iw wlan0 info|grep channel|cut -d' ' -f2` - sed -i -e "s/^frequency.*/channel=$FREQ /" /etc/hostapd/hostapd.conf - syslog info "50-hostapd restarting hostapd" - systemctl daemon-reload - systemctl restart hostapd + REASON="$reason" + if [ "$reason" = "CARRIER" ]; then + syslog info "50-iiab CARRIER change wlan0" + # wpa_supplicant wants MHz for frequency= while hostapd wants channel..... whatever + # FREQ=`iw wlan0 info|grep channel|cut -d' ' -f9` + FREQ=`iw wlan0 info|grep channel|cut -d' ' -f2` + syslog info "40-iiab set channel $FREQ" + sed -i -e "s/^channel.*/channel=$FREQ /" /etc/hostapd/hostapd.conf + # will need a reboot for hostapd if the channel changed + fi + # spams the logging + #syslog info "50-iiab set ap0 spam $REASON" + if [ -e /sys/class/net/ap0 ] && ! [ "$reason" = "ROUTERADVERT" ]; then + syslog info "50-iiab set ap0 up $REASON" + # keeps ap0 up so hostapd works + ip link set ap0 up + fi fi From 37da7407d473170bee2e68a3163d65d809e0b5f7 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 26 Feb 2020 02:23:27 -0600 Subject: [PATCH 13/93] update iiab-hotspot support files --- roles/2-common/templates/iiab-startup.sh | 4 ++-- .../network/templates/network/iiab-hotspot-off | 12 ++++++------ .../network/templates/network/iiab-hotspot-on | 18 ++++++++---------- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/roles/2-common/templates/iiab-startup.sh b/roles/2-common/templates/iiab-startup.sh index b563b908d..e84eab8f0 100644 --- a/roles/2-common/templates/iiab-startup.sh +++ b/roles/2-common/templates/iiab-startup.sh @@ -31,8 +31,8 @@ if [[ $(grep -i raspbian /etc/*release) && #) #]]; then - ip link set dev wlan0 promisc on - echo "wlan0 promiscuous mode ON, internal AP OFF: github.com/iiab/iiab/issues/638" +# ip link set dev wlan0 promisc on + echo "wlan0 promiscuous mode ON, internal AP OFF: github.com/iiab/iiab/issues/638 DISABLED" fi exit 0 diff --git a/roles/network/templates/network/iiab-hotspot-off b/roles/network/templates/network/iiab-hotspot-off index 2341c6f5b..5541a260e 100755 --- a/roles/network/templates/network/iiab-hotspot-off +++ b/roles/network/templates/network/iiab-hotspot-off @@ -1,19 +1,19 @@ #!/bin/bash -sed -i -e "s/^denyinterfaces/#denyinterfaces/" /etc/dhcpcd.conf +#sed -i -e "s/^denyinterfaces/#denyinterfaces/" /etc/dhcpcd.conf systemctl disable hostapd systemctl stop hostapd #systemctl disable dnsmasq #systemctl stop dnsmasq -systemctl daemon-reload -systemctl restart dhcpcd +#systemctl daemon-reload +#systemctl restart dhcpcd #systemctl restart networking 6/15/2019 TFM removed # Temporary promiscuous-mode workaround for RPi's WiFi "10SEC disease" # Set wlan0 to promiscuous when AP's OFF (for possible WiFi gateway) # SEE ALSO iiab-hotspot-on + /usr/libexec/iiab-startup.sh # https://github.com/iiab/iiab/issues/638#issuecomment-355455454 -if grep -qi raspbian /etc/*release; then - ip link set dev wlan0 promisc on -fi +#if grep -qi raspbian /etc/*release; then +# ip link set dev wlan0 promisc on +#fi sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=False/" {{ iiab_env_file }} diff --git a/roles/network/templates/network/iiab-hotspot-on b/roles/network/templates/network/iiab-hotspot-on index 9b57c579a..c88130d4c 100755 --- a/roles/network/templates/network/iiab-hotspot-on +++ b/roles/network/templates/network/iiab-hotspot-on @@ -1,13 +1,11 @@ #!/bin/bash -cp -f /etc/hostapd/hostapd.conf.iiab /etc/hostapd/hostapd.conf -sed -i -e "s/^#denyinterfaces/denyinterfaces/" /etc/dhcpcd.conf +#cp -f /etc/hostapd/hostapd.conf.iiab /etc/hostapd/hostapd.conf +#sed -i -e "s/^#denyinterfaces/denyinterfaces/" /etc/dhcpcd.conf # shut down wlan0 in case connected to network -ip link set wlan0 down +#ip link set wlan0 down systemctl enable hostapd -#systemctl enable dnsmasq -systemctl daemon-reload -systemctl restart dhcpcd -#systemctl restart networking 6/15/2019 TFM removed +#systemctl daemon-reload +#systemctl restart dhcpcd systemctl start hostapd systemctl start dnsmasq @@ -15,9 +13,9 @@ systemctl start dnsmasq # Disable "promiscuous" on wlan0 when AP (i.e. no WiFi gateway) # SEE ALSO iiab-hotspot-off + /usr/libexec/iiab-startup.sh # https://github.com/iiab/iiab/issues/638#issuecomment-355455454 -if grep -qi raspbian /etc/*release; then - ip link set dev wlan0 promisc off -fi +#if grep -qi raspbian /etc/*release; then +# ip link set dev wlan0 promisc off +#fi sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=True/" {{ iiab_env_file }} From 7b1f7016e5f65d9fcdbd7058af1875e8205f73d4 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 10 Mar 2020 00:38:58 -0500 Subject: [PATCH 14/93] remove is_rpi -> is_raspbian, more notes --- roles/network/templates/hostapd/hostapd.service.j2 | 2 +- roles/network/templates/network/dhcpcd.conf.j2 | 11 ++++++++--- roles/network/templates/network/rpi.j2 | 2 ++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/roles/network/templates/hostapd/hostapd.service.j2 b/roles/network/templates/hostapd/hostapd.service.j2 index fbbdd37fc..5c743898a 100644 --- a/roles/network/templates/hostapd/hostapd.service.j2 +++ b/roles/network/templates/hostapd/hostapd.service.j2 @@ -2,7 +2,7 @@ Description=Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator Wants=network-pre.target After=network-pre.target -{% if is_rpi %} +{% if is_raspbian %} Before=dhcpcd.service {% endif %} Before=network.target diff --git a/roles/network/templates/network/dhcpcd.conf.j2 b/roles/network/templates/network/dhcpcd.conf.j2 index ac139711a..88c88201a 100644 --- a/roles/network/templates/network/dhcpcd.conf.j2 +++ b/roles/network/templates/network/dhcpcd.conf.j2 @@ -38,13 +38,18 @@ require dhcp_server_identifier slaac private # IIAB +denyinterfaces ap0 +# Setting iiab_wired_lan_iface would install the device as a slave under +# br0 so we need to turn off the dhcp client in that network layout. +# Auto creation of the wired slave is suppressed in discovered_network.yml +# -> Set iiab_wired_lan_iface if present is conditional on is_raspbian +# Slave creation can be forced by populating local_vars.yml with +# 'iiab_wired_lan_iface: eth0' which populates /etc/network/interfaces.d/iiab +# with 'bridge_ports eth0' in place of 'bridge_ports none' # Always (try) to run DHCP client on RPi's Ethernet port, for in-field # "cablemodems" used by many non-technical operators, who want Zero-Hassle # Updates. This means AVOIDING "denyinterfaces eth0" below: -{% if is_rpi and hostapd_enabled %} -denyinterfaces ap0 -{% endif %} {% if iiab_wired_lan_iface is defined %} denyinterfaces {{ iiab_wired_lan_iface }} {% endif %} diff --git a/roles/network/templates/network/rpi.j2 b/roles/network/templates/network/rpi.j2 index 9e3c1b69b..a2860fb95 100644 --- a/roles/network/templates/network/rpi.j2 +++ b/roles/network/templates/network/rpi.j2 @@ -3,6 +3,8 @@ # gui_desired_network_role is {{ gui_desired_network_role }} {% endif %} {% if iiab_network_mode != "Appliance" %} +# auto wired slave creation is suppressed in detected_network.yml +# 'none' would become the name of the wired slave device. ################# LANCONTROLLER ################### auto br0 iface br0 inet manual From 23124b3a19de0ec217898518d4459775e8d23731 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 10 Mar 2020 00:51:38 -0500 Subject: [PATCH 15/93] iiab-hotspot-on|off for all, is_rpi, style --- roles/network/tasks/hostapd.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index ae53d7807..9eba9d159 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -1,7 +1,7 @@ - name: Turn off hostapd when no wifi interface present or in "Appliance Mode" set_fact: hostapd_enabled: False - when: not iiab_wireless_lan_iface is defined or iiab_network_mode == "Appliance" + when: iiab_wireless_lan_iface is undefined or iiab_network_mode == "Appliance" - name: Create /etc/hostapd/hostapd.conf from template template: @@ -37,7 +37,6 @@ owner: root group: root mode: 0755 - when: is_raspbian | bool - name: Create /usr/bin/iiab-hotspot-off from template template: @@ -46,7 +45,6 @@ owner: root group: root mode: 0755 - when: is_raspbian | bool - name: Create dhcpcd hook for hostapd template: @@ -55,7 +53,7 @@ owner: root group: root mode: 0644 - when: is_rpi + when: is_raspbian - name: Disable the Access Point 'hostapd' service systemd: From bccb15552306131a73c850debf44144ffa4e024d Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 10 Mar 2020 11:42:21 -0500 Subject: [PATCH 16/93] better discription of when rpi_debian.yml task is used --- roles/network/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/tasks/main.yml b/roles/network/tasks/main.yml index b2729314b..e73b12eea 100644 --- a/roles/network/tasks/main.yml +++ b/roles/network/tasks/main.yml @@ -89,7 +89,7 @@ when: is_debuntu and systemd_networkd_active #and not installing -- name: RPi's have dhcpcd in use +- name: Raspbian uses dhcpcd only with no N-M or SYS-NETD active include_tasks: rpi_debian.yml when: is_raspbian #and not installing From aab9c1ba874f38234a3202ca9705991b1ef1bd9b Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 11 Mar 2020 00:39:45 -0500 Subject: [PATCH 17/93] setup auto restart of hostapd - based on current stock service file --- roles/network/templates/hostapd/hostapd.service.j2 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/network/templates/hostapd/hostapd.service.j2 b/roles/network/templates/hostapd/hostapd.service.j2 index 5c743898a..abc718d0c 100644 --- a/roles/network/templates/hostapd/hostapd.service.j2 +++ b/roles/network/templates/hostapd/hostapd.service.j2 @@ -8,11 +8,13 @@ Before=dhcpcd.service Before=network.target [Service] -Type=idle +Type=forking +Restart=on-failure +RestartSec=2 PIDFile=/run/hostapd.pid ExecStartPre=-/sbin/iw phy phy0 interface add ap0 type __ap ExecStartPre=-/sbin/ip link set ap0 address {{ ap0_mac_addr }} -ExecStart=/usr/sbin/hostapd -P /run/hostapd.pid /etc/hostapd/hostapd.conf +ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid /etc/hostapd/hostapd.conf ExecStartPost=-/sbin/ip link set ap0 up ExecStopPost=-/sbin/iw dev ap0 del From cc5674a922780553ba73befa07c6806db873a5a5 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 11 Mar 2020 14:59:21 -0500 Subject: [PATCH 18/93] iiab-network remove stale config_vars creation --- iiab-network | 6 ------ 1 file changed, 6 deletions(-) diff --git a/iiab-network b/iiab-network index 0bef05005..ee9d057bc 100755 --- a/iiab-network +++ b/iiab-network @@ -11,12 +11,6 @@ if [ ! -f iiab-network.yml ]; then exit 1 fi -if [ ! -f /etc/iiab/config_vars.yml ]; then - echo "Creating stub /etc/iiab/config_vars.yml" - mkdir -p /etc/iiab - echo "{}" > /etc/iiab/config_vars.yml -fi - OS="unknown" # will be overridden below, if /etc/iiab/iiab.env is legit if [ -f /etc/iiab/iiab.env ]; then echo "Reading /etc/iiab/iiab.env" From ad5d4c4f73882d038cc880b9293ffc5437374429 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 11 Mar 2020 15:10:37 -0500 Subject: [PATCH 19/93] add stage lockout from iiab-configure --- iiab-network | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/iiab-network b/iiab-network index ee9d057bc..caded9a6a 100755 --- a/iiab-network +++ b/iiab-network @@ -15,6 +15,29 @@ OS="unknown" # will be overridden below, if /etc/iiab/iiab.env is legit if [ -f /etc/iiab/iiab.env ]; then echo "Reading /etc/iiab/iiab.env" source /etc/iiab/iiab.env + STAGE=0 + if grep -q STAGE= /etc/iiab/iiab.env ; then + echo -e "\nExtracted STAGE=$STAGE (counter) from /etc/iiab/iiab.env" + if ! [ "$STAGE" -eq "$STAGE" ] 2> /dev/null; then + echo -e "\nEXITING: STAGE (counter) value == ""$STAGE"" is non-integer" + exit 1 + elif [ "$STAGE" -lt 0 ] || [ "$STAGE" -gt 9 ]; then + echo -e "\nEXITING: STAGE (counter) value == ""$STAGE"" is out-of-range" + exit 1 + elif [ "$STAGE" -lt 3 ]; then + echo -e "\nEXITING: STAGE (counter) value == ""$STAGE" + echo -e "\nIIAB Stage 3 not complete." + echo -e "\nPlease run: ./iiab-install" + exit 1 + else + echo -e "\nEXITING: STAGE (counter) not found" + echo -e "\nIIAB not installed." + echo -e "\nPlease run: ./iiab-install" + exit 1 + fi +else + echo -e "\nEXITING: /etc/iiab/iiab.env not found" + exit 1 fi echo "Ansible will now run iiab-network.yml -- log file is iiab-network.log" From eebd14581e57a1cee59f5a173e3200a7073325c2 Mon Sep 17 00:00:00 2001 From: George Hunt Date: Tue, 17 Mar 2020 03:43:47 +0000 Subject: [PATCH 20/93] typos --- iiab-network | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/iiab-network b/iiab-network index caded9a6a..d73978e63 100755 --- a/iiab-network +++ b/iiab-network @@ -14,8 +14,8 @@ fi OS="unknown" # will be overridden below, if /etc/iiab/iiab.env is legit if [ -f /etc/iiab/iiab.env ]; then echo "Reading /etc/iiab/iiab.env" - source /etc/iiab/iiab.env STAGE=0 + source /etc/iiab/iiab.env if grep -q STAGE= /etc/iiab/iiab.env ; then echo -e "\nExtracted STAGE=$STAGE (counter) from /etc/iiab/iiab.env" if ! [ "$STAGE" -eq "$STAGE" ] 2> /dev/null; then @@ -29,6 +29,7 @@ if [ -f /etc/iiab/iiab.env ]; then echo -e "\nIIAB Stage 3 not complete." echo -e "\nPlease run: ./iiab-install" exit 1 + fi else echo -e "\nEXITING: STAGE (counter) not found" echo -e "\nIIAB not installed." From bf5dc8cf1550cdc86aaec4b0ebe81e012f0bc7fa Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 24 Mar 2020 21:41:20 -0500 Subject: [PATCH 21/93] generate random mac address for ap0 --- roles/network/tasks/hostapd.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 9eba9d159..8ac825472 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: Generate new random mac address for ap0 + shell: tr -dc A-F0-9 < /dev/urandom | head -c 10 | sed -r 's/(..)/\1:/g;s/:$//;s/^/02:/' + register: ap0_mac + +- name: Setting ap0 mac address for use in hostapd service file + set_fact: + ap0_mac_addr: "{{ ap0_mac.stdout }}" + - name: Use custom systemd unit file to start 'hostapd' service template: src: hostapd/hostapd.service.j2 From 39cf3b2947c7d1c48ca5e0165a870a76a0b87fb9 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Fri, 3 Apr 2020 03:53:46 -0500 Subject: [PATCH 22/93] exclude ap0 from count_wifi_interfaces --- roles/network/tasks/detected_network.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/tasks/detected_network.yml b/roles/network/tasks/detected_network.yml index 25f71d48d..e97cfb74b 100644 --- a/roles/network/tasks/detected_network.yml +++ b/roles/network/tasks/detected_network.yml @@ -81,7 +81,7 @@ #item|trim != discovered_wan_iface - name: Count WiFi ifaces - shell: "ls -la /sys/class/net/*/phy80211 | awk -F / '{print $5}' | wc -l" + shell: "ls -la /sys/class/net/*/phy80211 | awk -F / '{print $5}' | grep -v -e ap0 | wc -l" register: count_wifi_interfaces # facts are apparently all stored as text, so do text comparisons from here on From 668b8baf10b0b49f4681936d67929581ff0320a7 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Fri, 3 Apr 2020 05:24:22 -0500 Subject: [PATCH 23/93] keep wlan0 and ap0 on the same channel on RPi hardware --- roles/network/tasks/hostapd.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 8ac825472..fe535a41b 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -3,6 +3,16 @@ hostapd_enabled: False when: iiab_wireless_lan_iface is undefined or iiab_network_mode == "Appliance" +- name: Detect current Wifi channel + shell: iw {{ discovered_wireless_iface }} info | grep channel | cut -d' ' -f2 + register: current_host_channel + when: discovered_wireless_iface != "none" + +- name: Setting WiFi channel to {{ current_host_channel.stdout }} on RPi hardware + set_fact: + host_channel: "{{ current_host_channel.stdout }}" + when: current_host_channel.stdout != "" and discovered_wireless_iface != "none" and rpi_model != "none" + - name: Create /etc/hostapd/hostapd.conf from template template: src: hostapd/hostapd.conf.j2 From 3e02d5721025a73f2eee98cb9261c4cf350d31e9 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Fri, 3 Apr 2020 09:23:33 -0500 Subject: [PATCH 24/93] restart - use ap0 for bridge slave test --- roles/network/tasks/restart.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/tasks/restart.yml b/roles/network/tasks/restart.yml index 6c6720d3c..b4c7ccce2 100644 --- a/roles/network/tasks/restart.yml +++ b/roles/network/tasks/restart.yml @@ -60,7 +60,7 @@ command: /usr/bin/iiab-gen-iptables - name: Checking if WiFi slave is active - shell: brctl show br0 | grep {{ iiab_wireless_lan_iface }} | wc -l + shell: brctl show br0 | grep ap0 | wc -l when: hostapd_enabled and iiab_wireless_lan_iface is defined and iiab_lan_iface == "br0" register: wifi_slave From 36212548f43c7f2d67d1e6a3611f6821413e1206 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Apr 2020 01:07:26 -0500 Subject: [PATCH 25/93] hostapd.service - Before wpa_supplicant --- roles/network/templates/hostapd/hostapd.service.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/network/templates/hostapd/hostapd.service.j2 b/roles/network/templates/hostapd/hostapd.service.j2 index abc718d0c..11318a2d7 100644 --- a/roles/network/templates/hostapd/hostapd.service.j2 +++ b/roles/network/templates/hostapd/hostapd.service.j2 @@ -5,6 +5,8 @@ After=network-pre.target {% if is_raspbian %} Before=dhcpcd.service {% endif %} +Before=wpa_supplicant.service +Before=wpa_supplicant@{{ discovered_wireless_iface }}.service Before=network.target [Service] From ac935f4c932be4ad0425081b06cbf206fc9abc94 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Fri, 3 Apr 2020 03:50:16 -0500 Subject: [PATCH 26/93] netplan don't delete user's wifi config --- roles/network/tasks/netplan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/tasks/netplan.yml b/roles/network/tasks/netplan.yml index 69959b77f..b865e4834 100644 --- a/roles/network/tasks/netplan.yml +++ b/roles/network/tasks/netplan.yml @@ -12,9 +12,9 @@ file: state: absent path: /etc/netplan/{{ item }} + when: netplan.stdout.find("yaml") != -1 and (item != "02-iiab-config.yaml") with_items: - "{{ netplan.stdout_lines }}" - when: netplan.stdout.find("yaml") != -1 - name: Cheap way to do systemd unmask file: From d0a27ce0df6ae49fdb98c3ec2108fc4a2ce5bd7c Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Fri, 3 Apr 2020 01:03:46 -0500 Subject: [PATCH 27/93] systemd-networkd version of dhcpcd's 50-hostapd hook --- roles/network/tasks/hostapd.yml | 28 +++++++++++++++++++ roles/network/templates/hostapd/00-iiab-debug | 2 ++ roles/network/templates/hostapd/netd-disp | 6 ++++ 3 files changed, 36 insertions(+) create mode 100644 roles/network/templates/hostapd/00-iiab-debug create mode 100644 roles/network/templates/hostapd/netd-disp diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index fe535a41b..691d9a76b 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -73,6 +73,34 @@ mode: 0644 when: is_raspbian +- name: Create networkd-dispatcher diagnosic hook for recording network events + template: + owner: root + group: root + mode: 0755 + src: "{{ item.src }}" + dest: "{{ item.dest }}" + with_items: + - { src: 'hostapd/00-iiab-debug', dest: '/etc/networkd-dispatcher/carrier.d/00-iiab-debug' } + - { src: 'hostapd/00-iiab-debug', dest: '/etc/networkd-dispatcher/degraded.d/00-iiab-debug' } + - { src: 'hostapd/00-iiab-debug', dest: '/etc/networkd-dispatcher/dormant.d/00-iiab-debug' } + - { src: 'hostapd/00-iiab-debug', dest: '/etc/networkd-dispatcher/no-carrier.d/00-iiab-debug' } + - { src: 'hostapd/00-iiab-debug', dest: '/etc/networkd-dispatcher/off.d/00-iiab-debug' } + - { src: 'hostapd/00-iiab-debug', dest: '/etc/networkd-dispatcher/routable.d/00-iiab-debug' } + when: systemd_networkd_active and discovered_wireless_iface != "none" + +- name: Create networkd-dispatcher hook for hostapd on RPi hardware + template: + owner: root + group: root + mode: 0755 + src: "{{ item.src }}" + dest: "{{ item.dest }}" + with_items: + - { src: 'hostapd/netd-disp', dest: '/etc/networkd-dispatcher/carrier.d/iiab-wifi' } + - { src: 'hostapd/netd-disp', dest: '/etc/networkd-dispatcher/no-carrier.d/iiab-wifi' } + when: systemd_networkd_active and discovered_wireless_iface != "none" and rpi_model != "none" + - name: Disable the Access Point 'hostapd' service systemd: name: hostapd diff --git a/roles/network/templates/hostapd/00-iiab-debug b/roles/network/templates/hostapd/00-iiab-debug new file mode 100644 index 000000000..d1d028d52 --- /dev/null +++ b/roles/network/templates/hostapd/00-iiab-debug @@ -0,0 +1,2 @@ +#!/bin/bash +echo "NET-DISP-$AdministrativeState $IFACE $STATE" diff --git a/roles/network/templates/hostapd/netd-disp b/roles/network/templates/hostapd/netd-disp new file mode 100644 index 000000000..f950ac4a1 --- /dev/null +++ b/roles/network/templates/hostapd/netd-disp @@ -0,0 +1,6 @@ +#!/bin/bash +if [ "$IFACE" == "{{ discovered_wireless_iface }}" ]; then + echo "NET-DISP-WiFi $IFACE $STATE" + /usr/sbin/ip link set up ap0 +fi + From ccb1bf348a141302ffdd1ad38848623a9dc0e2fd Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Apr 2020 01:35:02 -0500 Subject: [PATCH 28/93] adjust networkd-dispatcher dnsmasq script --- roles/network/templates/hostapd/netd-disp | 1 + roles/network/templates/network/dnsmasq.sh.j2 | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/roles/network/templates/hostapd/netd-disp b/roles/network/templates/hostapd/netd-disp index f950ac4a1..5b13d4167 100644 --- a/roles/network/templates/hostapd/netd-disp +++ b/roles/network/templates/hostapd/netd-disp @@ -1,4 +1,5 @@ #!/bin/bash + if [ "$IFACE" == "{{ discovered_wireless_iface }}" ]; then echo "NET-DISP-WiFi $IFACE $STATE" /usr/sbin/ip link set up ap0 diff --git a/roles/network/templates/network/dnsmasq.sh.j2 b/roles/network/templates/network/dnsmasq.sh.j2 index 31700113e..1969f8da5 100755 --- a/roles/network/templates/network/dnsmasq.sh.j2 +++ b/roles/network/templates/network/dnsmasq.sh.j2 @@ -1,5 +1,7 @@ #!/bin/bash if [ "$IFACE" == "{{ iiab_lan_iface }}" ]; then - /bin/systemctl restart dnsmasq.service + echo "Restarting dnsmasq in 5 seconds" + /bin/sleep 5 && /bin/systemctl --no-block restart dnsmasq.service + echo "Restarting dnsmasq" fi From a31145443611fc9f8878e4edbfe818c4e0408db1 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Apr 2020 01:37:05 -0500 Subject: [PATCH 29/93] network/main remove installing, move hostapd.yml, notes, cleanup --- roles/network/tasks/{ => fedora}/NM.yml | 0 .../tasks/fedora/create_ifcfg.yml.deprecated | 17 +++++++++++ .../tasks/{ => fedora}/detected_redhat.yml | 0 .../network/tasks/{ => fedora}/edit_ifcfg.yml | 0 .../network/tasks/{ => fedora}/enable_wan.yml | 0 .../network/tasks/fedora/hosts.yml.deprecated | 28 +++++++++++++++++++ .../network/tasks/{ => fedora}/ifcfg_mods.yml | 0 roles/network/tasks/{ => fedora}/redetect.yml | 0 roles/network/tasks/{ => fedora}/static.yml | 0 roles/network/tasks/main.yml | 15 ++-------- 10 files changed, 48 insertions(+), 12 deletions(-) rename roles/network/tasks/{ => fedora}/NM.yml (100%) create mode 100644 roles/network/tasks/fedora/create_ifcfg.yml.deprecated rename roles/network/tasks/{ => fedora}/detected_redhat.yml (100%) rename roles/network/tasks/{ => fedora}/edit_ifcfg.yml (100%) rename roles/network/tasks/{ => fedora}/enable_wan.yml (100%) create mode 100644 roles/network/tasks/fedora/hosts.yml.deprecated rename roles/network/tasks/{ => fedora}/ifcfg_mods.yml (100%) rename roles/network/tasks/{ => fedora}/redetect.yml (100%) rename roles/network/tasks/{ => fedora}/static.yml (100%) diff --git a/roles/network/tasks/NM.yml b/roles/network/tasks/fedora/NM.yml similarity index 100% rename from roles/network/tasks/NM.yml rename to roles/network/tasks/fedora/NM.yml diff --git a/roles/network/tasks/fedora/create_ifcfg.yml.deprecated b/roles/network/tasks/fedora/create_ifcfg.yml.deprecated new file mode 100644 index 000000000..7c982dbd2 --- /dev/null +++ b/roles/network/tasks/fedora/create_ifcfg.yml.deprecated @@ -0,0 +1,17 @@ +- name: Stop 'Wired WAN connection' + shell: nmcli dev disconnect {{ discovered_wan_iface }} + ignore_errors: True + changed_when: False + when: discovered_wan_iface != "none" and not has_WAN and has_ifcfg_gw == "none" + +# set user_wan_iface: for static +# use wan_* for static info +- name: Supply ifcfg-WAN file + template: src=network/ifcfg-WAN.j2 + dest=/etc/sysconfig/network-scripts/ifcfg-WAN + when: iiab_wan_iface != "none" and not has_WAN and has_ifcfg_gw == "none" + +- name: Now setting ifcfg-WAN True after creating file + set_fact: + has_WAN: True + when: iiab_wan_iface != "none" and has_ifcfg_gw == "none" diff --git a/roles/network/tasks/detected_redhat.yml b/roles/network/tasks/fedora/detected_redhat.yml similarity index 100% rename from roles/network/tasks/detected_redhat.yml rename to roles/network/tasks/fedora/detected_redhat.yml diff --git a/roles/network/tasks/edit_ifcfg.yml b/roles/network/tasks/fedora/edit_ifcfg.yml similarity index 100% rename from roles/network/tasks/edit_ifcfg.yml rename to roles/network/tasks/fedora/edit_ifcfg.yml diff --git a/roles/network/tasks/enable_wan.yml b/roles/network/tasks/fedora/enable_wan.yml similarity index 100% rename from roles/network/tasks/enable_wan.yml rename to roles/network/tasks/fedora/enable_wan.yml diff --git a/roles/network/tasks/fedora/hosts.yml.deprecated b/roles/network/tasks/fedora/hosts.yml.deprecated new file mode 100644 index 000000000..ce4a7467f --- /dev/null +++ b/roles/network/tasks/fedora/hosts.yml.deprecated @@ -0,0 +1,28 @@ +# this (hosts.yml) WAS invoked by roles/network/tasks/main.yml up until 2019-12-10 + +#TODO: Use vars instead of hardcoded values +- name: Remove FQDN with 172.18.96.1 in /etc/hosts without LAN (if iiab_lan_iface == "none" and not installing) + lineinfile: + path: /etc/hosts + regexp: '^172\.18\.96\.1' + state: absent + when: iiab_lan_iface == "none" and not installing + +- name: Configure FQDN with 172.18.96.1 in /etc/hosts with LAN (if iiab_lan_iface != "none" and not installing) + lineinfile: + path: /etc/hosts + regexp: '^172\.18\.96\.1' + line: '172.18.96.1 {{ iiab_hostname }}.{{ iiab_domain }} {{ iiab_hostname }} box box.lan' + state: present + when: not (iiab_lan_iface == "none") and not installing + +# roles/0-init/tasks/hostname.yml ALSO does this: +- name: 'Put FQDN & hostnames in /etc/hosts: "127.0.0.1 {{ iiab_hostname }}.{{ iiab_domain }} localhost.localdomain localhost {{ iiab_hostname }} box box.lan" (if iiab_lan_iface == "none" and not installing, appliance mode?)' + lineinfile: + path: /etc/hosts + regexp: '^127\.0\.0\.1' + line: '127.0.0.1 {{ iiab_hostname }}.{{ iiab_domain }} localhost.localdomain localhost {{ iiab_hostname }} box box.lan' + owner: root + group: root + mode: 0644 + when: iiab_lan_iface == "none" and not installing diff --git a/roles/network/tasks/ifcfg_mods.yml b/roles/network/tasks/fedora/ifcfg_mods.yml similarity index 100% rename from roles/network/tasks/ifcfg_mods.yml rename to roles/network/tasks/fedora/ifcfg_mods.yml diff --git a/roles/network/tasks/redetect.yml b/roles/network/tasks/fedora/redetect.yml similarity index 100% rename from roles/network/tasks/redetect.yml rename to roles/network/tasks/fedora/redetect.yml diff --git a/roles/network/tasks/static.yml b/roles/network/tasks/fedora/static.yml similarity index 100% rename from roles/network/tasks/static.yml rename to roles/network/tasks/fedora/static.yml diff --git a/roles/network/tasks/main.yml b/roles/network/tasks/main.yml index e73b12eea..486532cae 100644 --- a/roles/network/tasks/main.yml +++ b/roles/network/tasks/main.yml @@ -1,12 +1,12 @@ - include_tasks: detected_network.yml - when: not installing # REMOVE THIS LINE IF installing IS ALWAYS false AS SET IN roles/0-init/defaults/main.yml - name: IF WIFI IS PRIMARY GATEWAY, PLEASE RUN 'iiab-hotspot-on' MANUALLY set_fact: hostapd_enabled: False # used in (1) hostapd.yml, (2) rpi_debian.yml + # (3) its dhcpcd.conf.j2, (4) restart.yml no_net_restart: True # used below in (1) sysd-netd-debian.yml, - # (2) debian.yml, (3) rpi_debian.yml + # (2) debian.yml, (3) rpi_debian.yml, + # (4) NM-debian.yml when: discovered_wireless_iface == iiab_wan_iface and not reboot_to_AP # EITHER WAY: hostapd_enabled's state is RECORDED into {{ iiab_env_file }} # in hostapd.yml for later use by... @@ -25,9 +25,6 @@ # when: is_raspbian and discovered_wireless_iface is defined and discovered_wireless_iface == iiab_wan_iface and reboot_to_AP - include_tasks: computed_network.yml - when: not installing #REMOVE THIS LINE IF installing IS ALWAYS false AS SET IN roles/0-init/defaults/main.yml - -- include_tasks: hostapd.yml #- name: RPi - don't reboot to AP post install - installed via wifi - don't blow away current network # set_fact: @@ -35,13 +32,6 @@ # hostapd_enabled: False # when: is_raspbian and discovered_wireless_iface is defined and discovered_wired_iface != iiab_wan_iface -##### Start static ip address info for first run ##### -#- include_tasks: static.yml -# when: 'iiab_wan_iface != "none" and wan_ip != "dhcp"' -##### End static ip address info - -#- include_tasks: hosts.yml - - name: Configure wondershaper include_tasks: wondershaper.yml when: wondershaper_install or wondershaper_installed is defined @@ -63,6 +53,7 @@ - include_tasks: avahi.yml - include_tasks: computed_services.yml - include_tasks: enable_services.yml +- include_tasks: hostapd.yml #### End services From 1693e502bad7c933b8887918524c8030340fe74e Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Apr 2020 03:15:14 -0500 Subject: [PATCH 30/93] Rework reserved_wifi -> reserved_device --- roles/network/defaults/main.yml | 2 +- roles/network/tasks/detected_network.yml | 21 +++++++++------------ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/roles/network/defaults/main.yml b/roles/network/defaults/main.yml index c052fcc46..87296ede1 100644 --- a/roles/network/defaults/main.yml +++ b/roles/network/defaults/main.yml @@ -66,7 +66,7 @@ wan_cidr: # Set defaults for discovery process as strings wifi1: "not found-1" wifi2: "not found-2" -ap_device: "none" +exclude_device: "none" device_gw: "none" device_gw2: "" diff --git a/roles/network/tasks/detected_network.yml b/roles/network/tasks/detected_network.yml index e97cfb74b..b047488a9 100644 --- a/roles/network/tasks/detected_network.yml +++ b/roles/network/tasks/detected_network.yml @@ -15,9 +15,9 @@ device_gw: "{{ discovered_wan_iface }}" when: ansible_default_ipv4.gateway is defined -- name: Red Hat network detection (redhat) - include_tasks: detected_redhat.yml - when: is_redhat | bool +#- name: Red Hat network detection (redhat) +# include_tasks: detected_redhat.yml +# when: is_redhat | bool - name: Setting dhcpcd_test results set_fact: @@ -97,13 +97,14 @@ ap_device: "eth0" when: iiab_wan_iface != "eth0" and discovered_wireless_iface != "none" and xo_model == "XO-1.5" -- name: Exclude reserved WiFi adapter if defined - takes adapter name +- name: Exclude reserved Network Adapter if defined - takes adapter name set_fact: - ap_device: "{{ reserved_wifi }}" - when: reserved_wifi is defined and discovered_wireless_iface != iiab_wan_iface and num_wifi_interfaces >= "2" + exclude_device: "{{ reserved_device }}" +# when: reserved_device is defined and discovered_wireless_iface != iiab_wan_iface and num_wifi_interfaces >= "2" + when: reserved_device is defined - name: Count LAN ifaces - shell: ls /sys/class/net | grep -v -e ap0 -e wwlan -e ppp -e lo -e br0 -e tun -e br- -e docker -e bridge0 -e veth -e {{ device_gw }} -e {{ ap_device }} | wc -l + shell: ls /sys/class/net | grep -v -e ap0 -e wwlan -e ppp -e lo -e br0 -e tun -e br- -e docker -e bridge0 -e veth -e {{ device_gw }} -e {{ exclude_device }} | wc -l register: num_lan_interfaces_result - name: Calculate number of LAN interfaces including WiFi @@ -112,7 +113,7 @@ # LAN - pick non WAN's - name: Create list of LAN (non WAN) ifaces - shell: ls /sys/class/net | grep -v -e ap0 -e wwlan -e ppp -e lo -e br0 -e tun -e br- -e docker -e bridge0 -e veth -e {{ device_gw }} -e {{ ap_device }} + shell: ls /sys/class/net | grep -v -e ap0 -e wwlan -e ppp -e lo -e br0 -e tun -e br- -e docker -e bridge0 -e veth -e {{ device_gw }} -e {{ exclude_device }} when: num_lan_interfaces != "0" register: lan_list_result @@ -143,10 +144,6 @@ iiab_wired_lan_iface: "{{ discovered_wired_iface }}" when: discovered_wired_iface is defined and discovered_wired_iface != "none" and discovered_wired_iface != iiab_wan_iface and not is_raspbian -#unused -#- name: Get a list of ifcfg files to delete -# moved to detected_redhat - # use value only if present - name: 2 or more devices on the LAN - use bridging set_fact: From 3d5428b0a5c89ca4088ee7d3e3cd5fd65eb878c0 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Apr 2020 05:09:03 -0500 Subject: [PATCH 31/93] sysd-netd-debian - multi wired slaves --- roles/network/tasks/sysd-netd-debian.yml | 9 ++++++--- roles/network/templates/network/systemd-br0-slave.j2 | 6 +++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/roles/network/tasks/sysd-netd-debian.yml b/roles/network/tasks/sysd-netd-debian.yml index 7bc70071b..3af9ed8a4 100644 --- a/roles/network/tasks/sysd-netd-debian.yml +++ b/roles/network/tasks/sysd-netd-debian.yml @@ -11,11 +11,14 @@ src: network/systemd-br0-network.j2 when: iiab_lan_iface == "br0" -- name: Copy the bridge script - Assigns br0 wired slaves +# can be more than one wired interface +- name: Wired enslaving - Assigns lan_list_results to br0 as wired slaves if present template: - dest: /etc/systemd/network/IIAB-Slave.network src: network/systemd-br0-slave.j2 - when: iiab_wired_lan_iface is defined and iiab_lan_iface == "br0" + dest: /etc/systemd/network/IIAB-Slave-{{ item|trim }}.network + with_items: + - "{{ lan_list_result.stdout_lines }}" + when: iiab_wired_lan_iface is defined and num_lan_interfaces >= 2 - name: Remove static WAN template file: diff --git a/roles/network/templates/network/systemd-br0-slave.j2 b/roles/network/templates/network/systemd-br0-slave.j2 index 8a31fef2e..15fb5b16e 100644 --- a/roles/network/templates/network/systemd-br0-slave.j2 +++ b/roles/network/templates/network/systemd-br0-slave.j2 @@ -1,5 +1,9 @@ -# /etc/systemd/network/IIAB-Slave.network +# /etc/systemd/network/IIAB-Slave-{{ iiab_wired_lan_iface }}.network [Match] Name={{ iiab_wired_lan_iface }} + +[Link] +RequiredForOnline=no + [Network] Bridge=br0 From ef7ad608006de68c095c253b20959af2a3167588 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Apr 2020 05:52:35 -0500 Subject: [PATCH 32/93] netplan - need to start netplan-wpa@ after hostapd --- roles/network/tasks/detected_network.yml | 8 +++++--- roles/network/tasks/netplan.yml | 4 ---- roles/network/templates/hostapd/hostapd.service.j2 | 3 +++ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/roles/network/tasks/detected_network.yml b/roles/network/tasks/detected_network.yml index b047488a9..95cdbeef3 100644 --- a/roles/network/tasks/detected_network.yml +++ b/roles/network/tasks/detected_network.yml @@ -15,9 +15,11 @@ device_gw: "{{ discovered_wan_iface }}" when: ansible_default_ipv4.gateway is defined -#- name: Red Hat network detection (redhat) -# include_tasks: detected_redhat.yml -# when: is_redhat | bool +- name: Figure out netplan file name + shell: ls /etc/netplan + register: netplan + ignore_errors: True # pre 17.10 doesn't use netplan + when: is_ubuntu - name: Setting dhcpcd_test results set_fact: diff --git a/roles/network/tasks/netplan.yml b/roles/network/tasks/netplan.yml index b865e4834..98b8e4656 100644 --- a/roles/network/tasks/netplan.yml +++ b/roles/network/tasks/netplan.yml @@ -1,7 +1,3 @@ -- name: Figure out netplan file name - shell: ls /etc/netplan - register: netplan - - name: Disable cloud-init the easy way shell: touch /etc/cloud/cloud-init.disabled when: ("item" == "50-cloud-init.yaml") diff --git a/roles/network/templates/hostapd/hostapd.service.j2 b/roles/network/templates/hostapd/hostapd.service.j2 index 11318a2d7..05c0846ba 100644 --- a/roles/network/templates/hostapd/hostapd.service.j2 +++ b/roles/network/templates/hostapd/hostapd.service.j2 @@ -7,6 +7,9 @@ Before=dhcpcd.service {% endif %} Before=wpa_supplicant.service Before=wpa_supplicant@{{ discovered_wireless_iface }}.service +{% if netplan.stdout.find("yaml") != -1 %} +Before=netplan-wpa@{{ discovered_wireless_iface }} +{% endif %} Before=network.target [Service] From 3c1bcc01ef91bb3bb5708a387dd5edc9ae157e1a Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Apr 2020 06:07:05 -0500 Subject: [PATCH 33/93] lets try netplan apply to restart the network --- roles/network/tasks/restart.yml | 4 ++++ roles/network/tasks/sysd-netd-debian.yml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/roles/network/tasks/restart.yml b/roles/network/tasks/restart.yml index b4c7ccce2..cf4d9ee4e 100644 --- a/roles/network/tasks/restart.yml +++ b/roles/network/tasks/restart.yml @@ -53,6 +53,10 @@ creates: /etc/sysconfig/olpc-scripts/setup.d/installed/gateway when: iiab_network_mode == "Gateway" +- name: Reload netplan when Wifi is present on Ubuntu 18+ + shell: netplan apply + when: not no_net_restart and is_ubuntu and netplan.stdout.find("yaml") != -1 + - name: Waiting {{ hostapd_wait }} seconds for network to stabilize (dnsmasq will fail if br0 isn't in a 'up' state!) shell: sleep {{ hostapd_wait }} diff --git a/roles/network/tasks/sysd-netd-debian.yml b/roles/network/tasks/sysd-netd-debian.yml index 3af9ed8a4..9a478ea4a 100644 --- a/roles/network/tasks/sysd-netd-debian.yml +++ b/roles/network/tasks/sysd-netd-debian.yml @@ -55,4 +55,4 @@ name: systemd-networkd enabled: yes state: restarted - when: not nobridge is defined and not no_net_restart + when: not no_net_restart and netplan.stdout.find("yaml") == -1 From 3b0be9d865fa24e5a916566eb73b5d748a9b0b04 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Apr 2020 13:06:41 -0500 Subject: [PATCH 34/93] touchup hostapd.service.j2 for Raspbian --- roles/network/templates/hostapd/hostapd.service.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/templates/hostapd/hostapd.service.j2 b/roles/network/templates/hostapd/hostapd.service.j2 index 05c0846ba..047ef4b4f 100644 --- a/roles/network/templates/hostapd/hostapd.service.j2 +++ b/roles/network/templates/hostapd/hostapd.service.j2 @@ -7,7 +7,7 @@ Before=dhcpcd.service {% endif %} Before=wpa_supplicant.service Before=wpa_supplicant@{{ discovered_wireless_iface }}.service -{% if netplan.stdout.find("yaml") != -1 %} +{% if is_ubuntu and netplan.stdout.find("yaml") != -1 %} Before=netplan-wpa@{{ discovered_wireless_iface }} {% endif %} Before=network.target From 3dd370e0885d9e4e4669a815d5ea26df0594c091 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Apr 2020 13:20:08 -0500 Subject: [PATCH 35/93] limit hostapd to 2.4GHz for now on RPI --- roles/network/tasks/hostapd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 691d9a76b..1c0df4803 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -11,7 +11,7 @@ - name: Setting WiFi channel to {{ current_host_channel.stdout }} on RPi hardware set_fact: host_channel: "{{ current_host_channel.stdout }}" - when: current_host_channel.stdout != "" and discovered_wireless_iface != "none" and rpi_model != "none" + when: current_host_channel.stdout != "" and current_host_channel.stdout|int <= 13 and discovered_wireless_iface != "none" and rpi_model != "none" - name: Create /etc/hostapd/hostapd.conf from template template: From 6783038b290557f8f97e05b37e8fc7bbe16bd8b8 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Apr 2020 21:40:38 -0500 Subject: [PATCH 36/93] don't forget about non-netplan networkd netplan.stdout is undefined should handle debian netplan.stdout.find("yaml") == -1) should handle U-16.04 U-18+ uses netplan --- roles/network/tasks/sysd-netd-debian.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/tasks/sysd-netd-debian.yml b/roles/network/tasks/sysd-netd-debian.yml index 9a478ea4a..5e1650bc3 100644 --- a/roles/network/tasks/sysd-netd-debian.yml +++ b/roles/network/tasks/sysd-netd-debian.yml @@ -55,4 +55,4 @@ name: systemd-networkd enabled: yes state: restarted - when: not no_net_restart and netplan.stdout.find("yaml") == -1 + when: (netplan.stdout is undefined or netplan.stdout.find("yaml") == -1) and not no_net_restart From 1d4e427fa96d79900e2f14596777dd4a44d084aa Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 6 Apr 2020 05:19:16 -0500 Subject: [PATCH 37/93] softcode exclude devices, move tests and turn into hard failures, record wifi after channel detection, prior_gateway_device, fix ap0 exclude --- roles/network/defaults/main.yml | 3 +- roles/network/tasks/computed_network.yml | 49 ++--------------------- roles/network/tasks/computed_services.yml | 8 ++++ roles/network/tasks/detected_network.yml | 46 ++++++++++++++------- roles/network/tasks/main.yml | 2 +- 5 files changed, 46 insertions(+), 62 deletions(-) diff --git a/roles/network/defaults/main.yml b/roles/network/defaults/main.yml index 87296ede1..867ab89f6 100644 --- a/roles/network/defaults/main.yml +++ b/roles/network/defaults/main.yml @@ -62,13 +62,14 @@ strict_networking: False iiab_demo_mode: False gui_static_wan: False wan_cidr: +virtual_network_devices: "-e ap0 -e lo -e br0 -e tun -e br- -e docker -e bridge0 -e veth" # Set defaults for discovery process as strings wifi1: "not found-1" wifi2: "not found-2" exclude_device: "none" device_gw: "none" -device_gw2: "" +prior_gw_device: "" iiab_wan_iface: "none" iiab_lan_iface: "none" diff --git a/roles/network/tasks/computed_network.yml b/roles/network/tasks/computed_network.yml index fb27dc7b5..08540b94e 100644 --- a/roles/network/tasks/computed_network.yml +++ b/roles/network/tasks/computed_network.yml @@ -6,20 +6,6 @@ user_wan_iface: "{{ discovered_wan_iface }}" when: not (discovered_wan_iface == "none") and not (xo_model == "none") and has_ifcfg_gw == "none" -#- name: Checking for NetworkManager-config-server -# shell: rpm -qa | grep NetworkManager-config-server | wc -l -# register: strict_networking_check - -#- name: Found Checking for NetworkManager-config-server -# set_fact: -# strict_networking: True -# when: strict_networking_check == "1" - -#- name: Use restricted network features -# set_fact: -# iiab_demo_mode: True -# when: teamviewer_install and not strict_networking - - name: XO laptop wants USB WiFi interface as AP mode set_fact: iiab_wireless_lan_iface: "{{ discovered_lan_iface }}" @@ -62,7 +48,7 @@ user_wan_iface: "none" when: not iiab_wan_enabled -# gui wants LanController # keeps ifcfg-WAN but onboot=no +# gui wants LanController # the change over might be a little bumpy ATM. - name: Setting GUI wants 'LanController' set_fact: @@ -71,10 +57,9 @@ iiab_gateway_enabled: "False" when: gui_desired_network_role is defined and gui_desired_network_role == "LanController" -# device_gw is used with the LAN detection and LAN's ifcfg file deletion. -# single interface vars/ users would need to set iiab_wan_enabled False as above, to disable the WAN -# and set user_lan_iface = to suppress the auto detection for the same effect. - +# discovered_wan_iface is used with the LAN detection, single interface vars/ users would +# need to set iiab_wan_enabled False as above, to disable the WAN and set +# user_lan_iface: to suppress the auto detection for the same effect. - name: Setting user_lan_iface for 'LanController' for single interface set_fact: user_lan_iface: "{{ discovered_wan_iface }}" @@ -143,24 +128,6 @@ iiab_lan_iface: "{{ user_lan_iface }}" when: not (user_lan_iface == "auto") -# so this works -- name: Interface count - shell: ls /sys/class/net | grep -v -e lo -e bridge0 -e veth -e "br-*" -e docker| wc | awk '{print $1}' - register: adapter_count - -# well if there ever was a point to tell the user things are FUBAR this is it. -- name: We're hosed no work interfaces - set_fact: - iiab_network_mode: "No_network_found" - when: adapter_count.stdout|int == 0 - -# well if there ever was a point to tell the user things are FUBAR this is it. -- name: I'm not guessing declare gateway please - set_fact: - iiab_network_mode: "Undetectable_use_local_vars" - iiab_wan_iface: "none" - when: adapter_count.stdout|int >= 5 and device_gw == "none" and gui_wan_iface == "unset" and gui_static_wan is defined - - name: Record IIAB_WAN_DEVICE to {{ iiab_env_file }} lineinfile: path: "{{ iiab_env_file }}" @@ -197,11 +164,3 @@ value: "{{ iiab_lan_iface }}" - option: iiab_network_mode value: "{{ iiab_network_mode }}" - - option: hostapd_enabled - value: "{{ hostapd_enabled }}" - - option: host_ssid - value: "{{ host_ssid }}" - - option: host_wifi_mode - value: "{{ host_wifi_mode }}" - - option: host_channel - value: "{{ host_channel }}" diff --git a/roles/network/tasks/computed_services.yml b/roles/network/tasks/computed_services.yml index 72fdd951c..1c4ee95ba 100644 --- a/roles/network/tasks/computed_services.yml +++ b/roles/network/tasks/computed_services.yml @@ -74,3 +74,11 @@ value: "{{ dnsmasq_enabled }}" - option: no_net_restart value: "{{ no_net_restart }}" + - option: hostapd_enabled + value: "{{ hostapd_enabled }}" + - option: host_ssid + value: "{{ host_ssid }}" + - option: host_wifi_mode + value: "{{ host_wifi_mode }}" + - option: host_channel + value: "{{ host_channel }}" diff --git a/roles/network/tasks/detected_network.yml b/roles/network/tasks/detected_network.yml index 95cdbeef3..e2dc13e32 100644 --- a/roles/network/tasks/detected_network.yml +++ b/roles/network/tasks/detected_network.yml @@ -1,15 +1,26 @@ -- name: iiab_wan_device - shell: grep IIAB_WAN_DEVICE {{ iiab_env_file }} | awk -F "=" '{print $2}' - when: iiab_stage|int > 4 - register: prior_gw +# so this works +- name: Interface count + shell: ls /sys/class/net | grep -v {{ virtual_network_devices }} | wc | awk '{print $1}' + register: adapter_count + +# well if there ever was a point to tell the user things are FUBAR this is it. +- name: We're hosed no work interfaces + fail: # FORCE IT RED THIS ONCE! + msg: "No_network_found" + when: adapter_count.stdout|int == 0 - name: Checking for old device gateway interface for device test + shell: grep IIAB_WAN_DEVICE {{ iiab_env_file }} | awk -F "=" '{print $2}' + when: iiab_stage|int == 9 + register: prior_gw + +- name: Setting device_gw, prior_gw_device set_fact: device_gw: "{{ prior_gw.stdout }}" - device_gw2: "{{ prior_gw.stdout }}" - when: iiab_stage|int > 4 and prior_gw is defined and prior_gw.stdout != "" + prior_gw_device: "{{ prior_gw.stdout }}" + when: prior_gw.stdout is defined and prior_gw.stdout != "" -- name: Setting WAN if detected +- name: Setting WAN, device_gw if detected set_fact: iiab_wan_iface: "{{ discovered_wan_iface }}" device_gw: "{{ discovered_wan_iface }}" @@ -77,7 +88,7 @@ set_fact: wifi2: "{{ item|trim }}" discovered_wireless_iface: "{{ item|trim }}" - when: wireless_list2.stdout is defined and not wireless_list2.stdout == "ap0" + when: wireless_list2.stdout is defined and item|trim != "ap0" with_items: - "{{ wireless_list2.stdout_lines }}" #item|trim != discovered_wan_iface @@ -86,7 +97,6 @@ shell: "ls -la /sys/class/net/*/phy80211 | awk -F / '{print $5}' | grep -v -e ap0 | wc -l" register: count_wifi_interfaces -# facts are apparently all stored as text, so do text comparisons from here on - name: Remember number of WiFi devices set_fact: num_wifi_interfaces: "{{ count_wifi_interfaces.stdout|int }}" @@ -96,17 +106,16 @@ - name: XO laptop override 2 WiFi on LAN set_fact: - ap_device: "eth0" + exclude_device: "eth0" when: iiab_wan_iface != "eth0" and discovered_wireless_iface != "none" and xo_model == "XO-1.5" - name: Exclude reserved Network Adapter if defined - takes adapter name set_fact: exclude_device: "{{ reserved_device }}" -# when: reserved_device is defined and discovered_wireless_iface != iiab_wan_iface and num_wifi_interfaces >= "2" when: reserved_device is defined - name: Count LAN ifaces - shell: ls /sys/class/net | grep -v -e ap0 -e wwlan -e ppp -e lo -e br0 -e tun -e br- -e docker -e bridge0 -e veth -e {{ device_gw }} -e {{ exclude_device }} | wc -l + shell: ls /sys/class/net | grep -v {{ virtual_network_devices }} -e wwlan -e ppp -e {{ device_gw }} -e {{ exclude_device }} | wc -l register: num_lan_interfaces_result - name: Calculate number of LAN interfaces including WiFi @@ -115,7 +124,7 @@ # LAN - pick non WAN's - name: Create list of LAN (non WAN) ifaces - shell: ls /sys/class/net | grep -v -e ap0 -e wwlan -e ppp -e lo -e br0 -e tun -e br- -e docker -e bridge0 -e veth -e {{ device_gw }} -e {{ exclude_device }} + shell: ls /sys/class/net | grep -v {{ virtual_network_devices }} -e wwlan -e ppp -e {{ device_gw }} -e {{ exclude_device }} when: num_lan_interfaces != "0" register: lan_list_result @@ -196,8 +205,8 @@ with_items: - option: has_ifcfg_gw value: "{{ has_ifcfg_gw }}" - - option: prior_gateway_(device_gw2) - value: "{{ device_gw2 }}" + - option: prior_gateway_device + value: "{{ prior_gw_device }}" - option: dhcpcd_result value: "{{ dhcpcd_result }}" - option: network_manager_active @@ -226,3 +235,10 @@ value: "{{ iiab_lan_iface }}" - option: iiab_wan_iface value: "{{ iiab_wan_iface }}" + +# well if there ever was a point to tell the user things are FUBAR this is it. +# limit 2 network adapters wifi wired +- name: I'm not guessing declare gateway please + fail: # FORCE IT RED THIS ONCE! + msg: "Undetectable gateway or prior gateway for use with static network addressing from admin-console use local_vars to declare user_wan_iface" + when: adapter_count.stdout|int >=3 and gui_wan_iface == "unset" and gui_static_wan diff --git a/roles/network/tasks/main.yml b/roles/network/tasks/main.yml index 486532cae..dcff50019 100644 --- a/roles/network/tasks/main.yml +++ b/roles/network/tasks/main.yml @@ -51,9 +51,9 @@ #### Start services - include_tasks: avahi.yml +- include_tasks: hostapd.yml - include_tasks: computed_services.yml - include_tasks: enable_services.yml -- include_tasks: hostapd.yml #### End services From 2059de2383342c05e04a47516f1de1002493d82e Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 6 Apr 2020 05:20:28 -0500 Subject: [PATCH 38/93] forgot .service --- roles/network/templates/hostapd/hostapd.service.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/templates/hostapd/hostapd.service.j2 b/roles/network/templates/hostapd/hostapd.service.j2 index 047ef4b4f..9aca337b0 100644 --- a/roles/network/templates/hostapd/hostapd.service.j2 +++ b/roles/network/templates/hostapd/hostapd.service.j2 @@ -8,7 +8,7 @@ Before=dhcpcd.service Before=wpa_supplicant.service Before=wpa_supplicant@{{ discovered_wireless_iface }}.service {% if is_ubuntu and netplan.stdout.find("yaml") != -1 %} -Before=netplan-wpa@{{ discovered_wireless_iface }} +Before=netplan-wpa@{{ discovered_wireless_iface }}.service {% endif %} Before=network.target From 9893e62fd504083b031707b422641828a6f9b8ad Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 8 Apr 2020 08:34:26 -0500 Subject: [PATCH 39/93] int casting --- roles/network/tasks/sysd-netd-debian.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/tasks/sysd-netd-debian.yml b/roles/network/tasks/sysd-netd-debian.yml index 5e1650bc3..1805020e1 100644 --- a/roles/network/tasks/sysd-netd-debian.yml +++ b/roles/network/tasks/sysd-netd-debian.yml @@ -18,7 +18,7 @@ dest: /etc/systemd/network/IIAB-Slave-{{ item|trim }}.network with_items: - "{{ lan_list_result.stdout_lines }}" - when: iiab_wired_lan_iface is defined and num_lan_interfaces >= 2 + when: iiab_wired_lan_iface is defined and num_lan_interfaces|int >= 2 - name: Remove static WAN template file: From ca8e9ab79ad07b5650fa699208ad4a4176bce434 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 8 Apr 2020 20:55:22 -0500 Subject: [PATCH 40/93] let NM if active handle wired slaves --- roles/network/tasks/sysd-netd-debian.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/tasks/sysd-netd-debian.yml b/roles/network/tasks/sysd-netd-debian.yml index 1805020e1..3126da053 100644 --- a/roles/network/tasks/sysd-netd-debian.yml +++ b/roles/network/tasks/sysd-netd-debian.yml @@ -18,7 +18,7 @@ dest: /etc/systemd/network/IIAB-Slave-{{ item|trim }}.network with_items: - "{{ lan_list_result.stdout_lines }}" - when: iiab_wired_lan_iface is defined and num_lan_interfaces|int >= 2 + when: iiab_wired_lan_iface is defined and num_lan_interfaces|int >= 2 and not network_manager_active - name: Remove static WAN template file: From 04c876b28a1448f30a4b00c8e83587edec55ff90 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 13 Apr 2020 04:50:56 -0500 Subject: [PATCH 41/93] don't clobber later revisions to hostapd.service.j2 --- roles/network/tasks/hostapd.yml | 13 +++++++++++-- roles/network/templates/hostapd/hostapd.legacy.j2 | 12 ++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 roles/network/templates/hostapd/hostapd.legacy.j2 diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 1c0df4803..0a759249b 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -39,14 +39,23 @@ set_fact: ap0_mac_addr: "{{ ap0_mac.stdout }}" -- name: Use custom systemd unit file to start 'hostapd' service +- name: Use custom 'hostapd' systemd service unit file using ap0 when wifi_up_down template: src: hostapd/hostapd.service.j2 dest: /etc/systemd/system/hostapd.service owner: root group: root mode: 0644 - when: discovered_wireless_iface != "none" + when: discovered_wireless_iface != "none" and wifi_up_down + +- name: Use custom 'hostapd' systemd service unit file for {{ discovered_wireless_iface }} when not wifi_up_down + template: + src: hostapd/hostapd.legacy.j2 + dest: /etc/systemd/system/hostapd.service + owner: root + group: root + mode: 0644 + when: discovered_wireless_iface != "none" and not wifi_up_down - name: Create /usr/bin/iiab-hotspot-on from template template: diff --git a/roles/network/templates/hostapd/hostapd.legacy.j2 b/roles/network/templates/hostapd/hostapd.legacy.j2 new file mode 100644 index 000000000..4094b812a --- /dev/null +++ b/roles/network/templates/hostapd/hostapd.legacy.j2 @@ -0,0 +1,12 @@ +[Unit] +Description=Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator +Before=network.target +Wants=network-pre.target + +[Service] +Type=idle +PIDFile=/run/hostapd.pid +ExecStart=/usr/sbin/hostapd -P /run/hostapd.pid /etc/hostapd/hostapd.conf + +[Install] +WantedBy=multi-user.target From a81f8383bbc06ff731433d4986dec343e2bec39a Mon Sep 17 00:00:00 2001 From: George Hunt Date: Fri, 10 Apr 2020 20:48:10 +0100 Subject: [PATCH 42/93] change wifi_up_down to true in local_vars preselects --- vars/local_vars_big.yml | 2 ++ vars/local_vars_medium.yml | 2 ++ vars/local_vars_min.yml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/vars/local_vars_big.yml b/vars/local_vars_big.yml index 24ef93c34..24f67e278 100644 --- a/vars/local_vars_big.yml +++ b/vars/local_vars_big.yml @@ -46,6 +46,8 @@ host_wifi_mode: g host_channel: 6 hostapd_secure: False hostapd_password: changeme +wifi_up_down: True # Creates a second virtual wifi adapter for WiFi upstream to internet + # as well as classroom hotspot, use iiab_gateway_enabled for pass through # See "How do I set a static IP address?" for Ethernet, in http://FAQ.IIAB.IO wan_ip: dhcp # wan_ip: 192.168.1.99 diff --git a/vars/local_vars_medium.yml b/vars/local_vars_medium.yml index b8f66307b..d43af20dc 100644 --- a/vars/local_vars_medium.yml +++ b/vars/local_vars_medium.yml @@ -46,6 +46,8 @@ host_wifi_mode: g host_channel: 6 hostapd_secure: False hostapd_password: changeme +wifi_up_down: True # Creates a second virtual wifi adapter for WiFi upstream to internet + # as well as classroom hotspot, use iiab_gateway_enabled for pass through # See "How do I set a static IP address?" for Ethernet, in http://FAQ.IIAB.IO wan_ip: dhcp # wan_ip: 192.168.1.99 diff --git a/vars/local_vars_min.yml b/vars/local_vars_min.yml index 8918cd634..2f982d59b 100644 --- a/vars/local_vars_min.yml +++ b/vars/local_vars_min.yml @@ -46,6 +46,8 @@ host_wifi_mode: g host_channel: 6 hostapd_secure: False hostapd_password: changeme +wifi_up_down: True # Creates a second virtual wifi adapter for WiFi upstream to internet + # as well as classroom hotspot, use iiab_gateway_enabled for pass through # See "How do I set a static IP address?" for Ethernet, in http://FAQ.IIAB.IO wan_ip: dhcp # wan_ip: 192.168.1.99 From b0a54afc1c099bba02a91e9d428b452d5f4f5c70 Mon Sep 17 00:00:00 2001 From: George Hunt Date: Fri, 10 Apr 2020 15:23:49 -0700 Subject: [PATCH 43/93] remove dhcpcd hooks if not up_down --- roles/network/tasks/hostapd.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 0a759249b..403015e48 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -82,6 +82,12 @@ mode: 0644 when: is_raspbian +- name: Remove dhcpcd hook for hostapd if WiFi is not split + file: + path: /lib/dhcpcd/dhcpcd-hooks/50-hostapd + state: absent + when: is_raspbian and not wifi_up_down + - name: Create networkd-dispatcher diagnosic hook for recording network events template: owner: root From 97fa35c9d2e53e01d319e51876d4b90a59833f5c Mon Sep 17 00:00:00 2001 From: George Hunt Date: Fri, 10 Apr 2020 20:42:26 +0100 Subject: [PATCH 44/93] don't let dhcpcd muck around with wlan0 if it's under the br0 --- roles/network/tasks/hostapd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 403015e48..75cd0f564 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -80,7 +80,7 @@ owner: root group: root mode: 0644 - when: is_raspbian + when: is_raspbian and wifi_up_down - name: Remove dhcpcd hook for hostapd if WiFi is not split file: From 75162642ad3fbe3d43102b9134c9c1ffbde0029e Mon Sep 17 00:00:00 2001 From: George Hunt Date: Sun, 12 Apr 2020 17:53:26 +0100 Subject: [PATCH 45/93] suppose iiab-wifi should be absent when not wifi_up_down --- roles/network/tasks/hostapd.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 75cd0f564..0cd9a2d5d 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -114,7 +114,16 @@ with_items: - { src: 'hostapd/netd-disp', dest: '/etc/networkd-dispatcher/carrier.d/iiab-wifi' } - { src: 'hostapd/netd-disp', dest: '/etc/networkd-dispatcher/no-carrier.d/iiab-wifi' } - when: systemd_networkd_active and discovered_wireless_iface != "none" and rpi_model != "none" + when: systemd_networkd_active and discovered_wireless_iface != "none" and rpi_model != "none" and wifi_up_down + +- name: Remove networkd-dispatcher hook for hostapd on RPi hardware and not up/down + file: + path: "{{ item.dest}} + status: absent + with_items: + - { src: 'hostapd/netd-disp', dest: '/etc/networkd-dispatcher/carrier.d/iiab-wifi' } + - { src: 'hostapd/netd-disp', dest: '/etc/networkd-dispatcher/no-carrier.d/iiab-wifi' } + when: systemd_networkd_active and discovered_wireless_iface != "none" and rpi_model != "none" and not wifi_up_down - name: Disable the Access Point 'hostapd' service systemd: From 4d9d925db8dbc6c0da711cabb663d687105005fa Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 12 Apr 2020 15:29:14 -0500 Subject: [PATCH 46/93] one template - 2 copies --- roles/network/tasks/hostapd.yml | 2 +- .../templates/hostapd/iiab-hostapd.conf.j2 | 32 ------------------- 2 files changed, 1 insertion(+), 33 deletions(-) delete mode 100644 roles/network/templates/hostapd/iiab-hostapd.conf.j2 diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 0cd9a2d5d..1e6326258 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -24,7 +24,7 @@ - name: Create backup /etc/hostapd/hostapd.conf.iiab from template template: - src: hostapd/iiab-hostapd.conf.j2 + src: hostapd/hostapd.conf.j2 dest: /etc/hostapd/hostapd.conf.iiab owner: root group: root diff --git a/roles/network/templates/hostapd/iiab-hostapd.conf.j2 b/roles/network/templates/hostapd/iiab-hostapd.conf.j2 deleted file mode 100644 index 097a8d41a..000000000 --- a/roles/network/templates/hostapd/iiab-hostapd.conf.j2 +++ /dev/null @@ -1,32 +0,0 @@ -# Basic configuration - -interface=ap0 - -ssid={{ host_ssid }} -channel={{ host_channel }} -{%if iiab_lan_iface == "br0" %} -bridge=br0 -{% endif %} - -# Hardware configuration -driver={{ driver_name }} -{%if host_wireless_n %} -ieee80211n=1 -{% endif %} -country_code={{ host_country_code }} -# limit emissions to what is legal in country -ieee80211d=1 -hw_mode={{ host_wifi_mode }} - -{%if hostapd_secure %} -# Use WPA authentication -auth_algs=1 -# Use WPA2 -wpa=2 -# Use a pre-shared key -wpa_key_mgmt=WPA-PSK -# The network passphrase -wpa_passphrase={{ hostapd_password }} -# Use AES, instead of TKIP -rsn_pairwise=CCMP -{% endif %} From 640dbd64eae4a94766a956ce350184e76e35d57b Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 13 Apr 2020 02:15:14 -0500 Subject: [PATCH 47/93] use wifi_up_down to set iiab_wireless_lan_iface --- roles/network/tasks/detected_network.yml | 10 ++++++++-- roles/network/tasks/restart.yml | 2 +- roles/network/templates/hostapd/hostapd.conf.j2 | 2 +- roles/network/templates/network/dhcpcd.conf.j2 | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/roles/network/tasks/detected_network.yml b/roles/network/tasks/detected_network.yml index e2dc13e32..05c329dbe 100644 --- a/roles/network/tasks/detected_network.yml +++ b/roles/network/tasks/detected_network.yml @@ -145,10 +145,16 @@ with_items: - "{{ lan_list_result.stdout_lines }}" -- name: Set iiab_wireless_lan_iface if present + +- name: Set iiab_wireless_lan_iface to {{ discovered_wireless_iface }} if not none set_fact: iiab_wireless_lan_iface: "{{ discovered_wireless_iface }}" - when: discovered_wireless_iface is defined and discovered_wireless_iface != "none" and discovered_wireless_iface != iiab_wan_iface + when: discovered_wireless_iface != "none" and discovered_wireless_iface != iiab_wan_iface + +- name: Set iiab_wireless_lan_iface to ap0 if WiFi device is present + set_fact: + iiab_wireless_lan_iface: ap0 + when: discovered_wireless_iface != "none" and wifi_up_down - name: Set iiab_wired_lan_iface if present set_fact: diff --git a/roles/network/tasks/restart.yml b/roles/network/tasks/restart.yml index cf4d9ee4e..459400326 100644 --- a/roles/network/tasks/restart.yml +++ b/roles/network/tasks/restart.yml @@ -64,7 +64,7 @@ command: /usr/bin/iiab-gen-iptables - name: Checking if WiFi slave is active - shell: brctl show br0 | grep ap0 | wc -l + shell: brctl show br0 | grep {{ iiab_wireless_lan_iface }} | wc -l when: hostapd_enabled and iiab_wireless_lan_iface is defined and iiab_lan_iface == "br0" register: wifi_slave diff --git a/roles/network/templates/hostapd/hostapd.conf.j2 b/roles/network/templates/hostapd/hostapd.conf.j2 index 097a8d41a..28c558e14 100644 --- a/roles/network/templates/hostapd/hostapd.conf.j2 +++ b/roles/network/templates/hostapd/hostapd.conf.j2 @@ -1,6 +1,6 @@ # Basic configuration -interface=ap0 +interface={{ iiab_wireless_lan_iface }} ssid={{ host_ssid }} channel={{ host_channel }} diff --git a/roles/network/templates/network/dhcpcd.conf.j2 b/roles/network/templates/network/dhcpcd.conf.j2 index 88c88201a..bc8f47ebd 100644 --- a/roles/network/templates/network/dhcpcd.conf.j2 +++ b/roles/network/templates/network/dhcpcd.conf.j2 @@ -38,7 +38,7 @@ require dhcp_server_identifier slaac private # IIAB -denyinterfaces ap0 +denyinterfaces {{ iiab_wireless_lan_iface }} # Setting iiab_wired_lan_iface would install the device as a slave under # br0 so we need to turn off the dhcp client in that network layout. From ab0cb6fc90831c7ffb9e60327b343384e5ee4cfe Mon Sep 17 00:00:00 2001 From: George Hunt Date: Sun, 12 Apr 2020 17:34:39 +0100 Subject: [PATCH 48/93] disable hostspot on/off if up/down enabled --- roles/network/templates/network/iiab-hotspot-off | 8 ++++++++ roles/network/templates/network/iiab-hotspot-on | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/roles/network/templates/network/iiab-hotspot-off b/roles/network/templates/network/iiab-hotspot-off index 5541a260e..be78c0993 100755 --- a/roles/network/templates/network/iiab-hotspot-off +++ b/roles/network/templates/network/iiab-hotspot-off @@ -1,4 +1,11 @@ #!/bin/bash + +{% if wifi_up_down %} +echo "Iiab-hotspot-up/down only functions when /etc/iiab/wifi_up_down is set to False" +echo " If you want hotspot on/off function please set wifi_up_down and run /opt/iiab/iiab/iiab-network" +exit 0 + +{% else %} #sed -i -e "s/^denyinterfaces/#denyinterfaces/" /etc/dhcpcd.conf systemctl disable hostapd systemctl stop hostapd @@ -15,5 +22,6 @@ systemctl stop hostapd #if grep -qi raspbian /etc/*release; then # ip link set dev wlan0 promisc on #fi +{% endif %} sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=False/" {{ iiab_env_file }} diff --git a/roles/network/templates/network/iiab-hotspot-on b/roles/network/templates/network/iiab-hotspot-on index c88130d4c..8630c7fdf 100755 --- a/roles/network/templates/network/iiab-hotspot-on +++ b/roles/network/templates/network/iiab-hotspot-on @@ -1,4 +1,11 @@ #!/bin/bash + +{% if wifi_up_down %} +echo "Iiab-hotspot-up/down only functions when /etc/iiab/wifi_up_down is set to False" +echo " If you want hotspot on/off function please set wifi_up_down and run /opt/iiab/iiab/iiab-network" +exit 0 + +{% else %} #cp -f /etc/hostapd/hostapd.conf.iiab /etc/hostapd/hostapd.conf #sed -i -e "s/^#denyinterfaces/denyinterfaces/" /etc/dhcpcd.conf # shut down wlan0 in case connected to network @@ -16,6 +23,7 @@ systemctl start dnsmasq #if grep -qi raspbian /etc/*release; then # ip link set dev wlan0 promisc off #fi +{% endif %} sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=True/" {{ iiab_env_file }} From 207cc98255868f92e8fd1befeece7e1821a1764e Mon Sep 17 00:00:00 2001 From: George Hunt Date: Sun, 12 Apr 2020 17:43:20 +0100 Subject: [PATCH 49/93] revert hotspot on/off to master before ap0 when wifi_up_down is false --- roles/network/templates/network/iiab-hotspot-off | 13 +++++++------ roles/network/templates/network/iiab-hotspot-on | 16 +++++++++------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/roles/network/templates/network/iiab-hotspot-off b/roles/network/templates/network/iiab-hotspot-off index be78c0993..449b0ac0b 100755 --- a/roles/network/templates/network/iiab-hotspot-off +++ b/roles/network/templates/network/iiab-hotspot-off @@ -6,22 +6,23 @@ echo " If you want hotspot on/off function please set wifi_up_down and run /opt exit 0 {% else %} -#sed -i -e "s/^denyinterfaces/#denyinterfaces/" /etc/dhcpcd.conf +# hotspot-off before ap0_updown +sed -i -e "s/^denyinterfaces/#denyinterfaces/" /etc/dhcpcd.conf systemctl disable hostapd systemctl stop hostapd #systemctl disable dnsmasq #systemctl stop dnsmasq -#systemctl daemon-reload -#systemctl restart dhcpcd +systemctl daemon-reload +systemctl restart dhcpcd #systemctl restart networking 6/15/2019 TFM removed # Temporary promiscuous-mode workaround for RPi's WiFi "10SEC disease" # Set wlan0 to promiscuous when AP's OFF (for possible WiFi gateway) # SEE ALSO iiab-hotspot-on + /usr/libexec/iiab-startup.sh # https://github.com/iiab/iiab/issues/638#issuecomment-355455454 -#if grep -qi raspbian /etc/*release; then -# ip link set dev wlan0 promisc on -#fi +if grep -qi raspbian /etc/*release; then + ip link set dev wlan0 promisc on +fi {% endif %} sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=False/" {{ iiab_env_file }} diff --git a/roles/network/templates/network/iiab-hotspot-on b/roles/network/templates/network/iiab-hotspot-on index 8630c7fdf..9ec78af82 100755 --- a/roles/network/templates/network/iiab-hotspot-on +++ b/roles/network/templates/network/iiab-hotspot-on @@ -6,13 +6,15 @@ echo " If you want hotspot on/off function please set wifi_up_down and run /opt exit 0 {% else %} -#cp -f /etc/hostapd/hostapd.conf.iiab /etc/hostapd/hostapd.conf -#sed -i -e "s/^#denyinterfaces/denyinterfaces/" /etc/dhcpcd.conf +# just do what we have always done in hotspot-on +cp -f /etc/hostapd/hostapd.conf.iiab /etc/hostapd/hostapd.conf +sed -i -e "s/^#denyinterfaces/denyinterfaces/" /etc/dhcpcd.conf # shut down wlan0 in case connected to network -#ip link set wlan0 down +ip link set wlan0 down systemctl enable hostapd #systemctl daemon-reload -#systemctl restart dhcpcd +systemctl daemon-reload +systemctl restart dhcpcd systemctl start hostapd systemctl start dnsmasq @@ -20,9 +22,9 @@ systemctl start dnsmasq # Disable "promiscuous" on wlan0 when AP (i.e. no WiFi gateway) # SEE ALSO iiab-hotspot-off + /usr/libexec/iiab-startup.sh # https://github.com/iiab/iiab/issues/638#issuecomment-355455454 -#if grep -qi raspbian /etc/*release; then -# ip link set dev wlan0 promisc off -#fi +if grep -qi raspbian /etc/*release; then + ip link set dev wlan0 promisc off +fi {% endif %} sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=True/" {{ iiab_env_file }} From 13d7c38a730f6a9dd65bf9f14d614cf0d887dafc Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 13 Apr 2020 04:33:38 -0500 Subject: [PATCH 50/93] on|off for wifi_up_down --- roles/network/templates/network/iiab-hotspot-off | 15 ++++++++------- roles/network/templates/network/iiab-hotspot-on | 15 ++++++++------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/roles/network/templates/network/iiab-hotspot-off b/roles/network/templates/network/iiab-hotspot-off index 449b0ac0b..8b7eb5bbc 100755 --- a/roles/network/templates/network/iiab-hotspot-off +++ b/roles/network/templates/network/iiab-hotspot-off @@ -1,8 +1,10 @@ #!/bin/bash {% if wifi_up_down %} -echo "Iiab-hotspot-up/down only functions when /etc/iiab/wifi_up_down is set to False" -echo " If you want hotspot on/off function please set wifi_up_down and run /opt/iiab/iiab/iiab-network" +systemctl disable hostapd +systemctl stop hostapd +sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=False/" {{ iiab_env_file }} +echo " IIAB hotspot access point Disabled" exit 0 {% else %} @@ -15,14 +17,13 @@ systemctl stop hostapd systemctl daemon-reload systemctl restart dhcpcd #systemctl restart networking 6/15/2019 TFM removed +sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=False/" {{ iiab_env_file }} # Temporary promiscuous-mode workaround for RPi's WiFi "10SEC disease" # Set wlan0 to promiscuous when AP's OFF (for possible WiFi gateway) # SEE ALSO iiab-hotspot-on + /usr/libexec/iiab-startup.sh # https://github.com/iiab/iiab/issues/638#issuecomment-355455454 -if grep -qi raspbian /etc/*release; then - ip link set dev wlan0 promisc on -fi +#if grep -qi raspbian /etc/*release; then +# ip link set dev wlan0 promisc on +#fi {% endif %} - -sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=False/" {{ iiab_env_file }} diff --git a/roles/network/templates/network/iiab-hotspot-on b/roles/network/templates/network/iiab-hotspot-on index 9ec78af82..47250ce56 100755 --- a/roles/network/templates/network/iiab-hotspot-on +++ b/roles/network/templates/network/iiab-hotspot-on @@ -1,8 +1,9 @@ #!/bin/bash {% if wifi_up_down %} -echo "Iiab-hotspot-up/down only functions when /etc/iiab/wifi_up_down is set to False" -echo " If you want hotspot on/off function please set wifi_up_down and run /opt/iiab/iiab/iiab-network" +systemctl enable hostapd +sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=True/" {{ iiab_env_file }} +echo -e "\nPlease reboot to activate hostapd feature.\n" exit 0 {% else %} @@ -17,16 +18,16 @@ systemctl daemon-reload systemctl restart dhcpcd systemctl start hostapd systemctl start dnsmasq +sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=True/" {{ iiab_env_file }} + # Temporary promiscuous-mode workaround for RPi's WiFi "10SEC disease" # Disable "promiscuous" on wlan0 when AP (i.e. no WiFi gateway) # SEE ALSO iiab-hotspot-off + /usr/libexec/iiab-startup.sh # https://github.com/iiab/iiab/issues/638#issuecomment-355455454 -if grep -qi raspbian /etc/*release; then - ip link set dev wlan0 promisc off -fi +#if grep -qi raspbian /etc/*release; then +# ip link set dev wlan0 promisc off +#fi {% endif %} -sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=True/" {{ iiab_env_file }} - echo -e "\nPlease consider rebooting now.\n" From 0d9321a363fd16478a65333c20e42d7380106853 Mon Sep 17 00:00:00 2001 From: George Hunt Date: Sun, 12 Apr 2020 19:31:16 +0100 Subject: [PATCH 51/93] partial of 720c285... typo iiab_wireless_an_iface --- roles/network/tasks/hostapd.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 1e6326258..4cd3672dc 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -118,11 +118,11 @@ - name: Remove networkd-dispatcher hook for hostapd on RPi hardware and not up/down file: - path: "{{ item.dest}} + path: "{{ item.dest}}" status: absent with_items: - - { src: 'hostapd/netd-disp', dest: '/etc/networkd-dispatcher/carrier.d/iiab-wifi' } - - { src: 'hostapd/netd-disp', dest: '/etc/networkd-dispatcher/no-carrier.d/iiab-wifi' } + - { dest: '/etc/networkd-dispatcher/carrier.d/iiab-wifi' } + - { dest: '/etc/networkd-dispatcher/no-carrier.d/iiab-wifi' } when: systemd_networkd_active and discovered_wireless_iface != "none" and rpi_model != "none" and not wifi_up_down - name: Disable the Access Point 'hostapd' service From fc0b4586de693aa95b415941f6fbe37863f818fb Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 11 Apr 2020 00:39:16 -0400 Subject: [PATCH 52/93] default_vars.yml updated (to match local_vars_min.yml) --- vars/default_vars.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vars/default_vars.yml b/vars/default_vars.yml index 90fbf7ca8..dca8245ed 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -98,6 +98,8 @@ hostapd_enabled: True # Above is forcibly set to False (in roles/network/tasks/main.yml) if IIAB is # being WiFi-installed (run "iiab-hotspot-on" AFTER ./iiab-install completes # and content is downloaded, to enable the internal WiFi Access Point / AP!) +wifi_up_down: True # Creates a second virtual wifi adapter for WiFi upstream to internet + # as well as classroom hotspot, use iiab_gateway_enabled for pass through reboot_to_AP: False # For those installing IIAB over WiFi: "reboot_to_AP: True" overrides the above # detection of WiFi-as-gateway, forcing "hostapd_enabled: True" regardless. From ed01d0584d05d6203cebd8379da3666db8d6f4e5 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 13 Apr 2020 08:27:08 -0500 Subject: [PATCH 53/93] netplan - 01-iiab exclude wireless devices --- roles/network/tasks/netplan.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/network/tasks/netplan.yml b/roles/network/tasks/netplan.yml index 98b8e4656..801b64658 100644 --- a/roles/network/tasks/netplan.yml +++ b/roles/network/tasks/netplan.yml @@ -44,6 +44,7 @@ dest: /etc/netplan/01-iiab-config.yaml src: network/netplan.j2 backup: no + when: iiab_wan_iface != discovered_wireless_iface # should blow up here if we messed up the yml file #- name: Generate netplan config From 10eb7e76d9982266fc1a48c2dc3fb93d0b9f1f5c Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 13 Apr 2020 08:29:47 -0500 Subject: [PATCH 54/93] sysd-netd drop wired device count --- roles/network/tasks/sysd-netd-debian.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/tasks/sysd-netd-debian.yml b/roles/network/tasks/sysd-netd-debian.yml index 3126da053..a5a56a802 100644 --- a/roles/network/tasks/sysd-netd-debian.yml +++ b/roles/network/tasks/sysd-netd-debian.yml @@ -18,7 +18,7 @@ dest: /etc/systemd/network/IIAB-Slave-{{ item|trim }}.network with_items: - "{{ lan_list_result.stdout_lines }}" - when: iiab_wired_lan_iface is defined and num_lan_interfaces|int >= 2 and not network_manager_active + when: iiab_wired_lan_iface is defined and num_lan_interfaces|int >= 1 and not network_manager_active - name: Remove static WAN template file: From 0bc294bbba5bc41c9346a955e9d6cbc713f515fa Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 13 Apr 2020 13:43:15 -0500 Subject: [PATCH 55/93] Update roles/network/tasks/hostapd.yml Co-Authored-By: A Holt --- roles/network/tasks/hostapd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 4cd3672dc..c09b7e8e9 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -11,7 +11,7 @@ - name: Setting WiFi channel to {{ current_host_channel.stdout }} on RPi hardware set_fact: host_channel: "{{ current_host_channel.stdout }}" - when: current_host_channel.stdout != "" and current_host_channel.stdout|int <= 13 and discovered_wireless_iface != "none" and rpi_model != "none" + when: current_host_channel.stdout is defined and current_host_channel.stdout != "" and current_host_channel.stdout|int <= 13 and discovered_wireless_iface != "none" and rpi_model != "none" - name: Create /etc/hostapd/hostapd.conf from template template: From 0249c3a1003abfa49b7fe7a6072fdb258e9ce600 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 14 Apr 2020 07:56:31 -0500 Subject: [PATCH 56/93] turn off hostapd in Appliance mode --- roles/network/tasks/computed_services.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/network/tasks/computed_services.yml b/roles/network/tasks/computed_services.yml index 1c4ee95ba..26523cd1c 100644 --- a/roles/network/tasks/computed_services.yml +++ b/roles/network/tasks/computed_services.yml @@ -3,6 +3,7 @@ dansguardian_enabled: False squid_enabled: False wondershaper_enabled: False + hostapd_enabled: False iiab_network_mode: "Appliance" when: iiab_lan_iface == "none" or user_lan_iface == "none" From ab8de54e24dc3c1f903bcb5c96e06e41710dd2ba Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 14 Apr 2020 07:59:27 -0500 Subject: [PATCH 57/93] restart - hostapd use wifi gateway as test --- roles/network/tasks/restart.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/tasks/restart.yml b/roles/network/tasks/restart.yml index 459400326..61274c625 100644 --- a/roles/network/tasks/restart.yml +++ b/roles/network/tasks/restart.yml @@ -2,7 +2,7 @@ systemd: name: hostapd state: restarted - when: iiab_wireless_lan_iface is defined and hostapd_enabled and iiab_network_mode != "Appliance" + when: iiab_wireless_lan_iface is defined and hostapd_enabled and discovered_wireless_iface != iiab_wan_iface - name: Start named service systemd: From 2089a0c91804434c6835927caa70166f899413c3 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 14 Apr 2020 08:03:00 -0500 Subject: [PATCH 58/93] don't set hostapd_enabled: False with wifi gateway --- roles/network/tasks/main.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/roles/network/tasks/main.yml b/roles/network/tasks/main.yml index dcff50019..4071d53f3 100644 --- a/roles/network/tasks/main.yml +++ b/roles/network/tasks/main.yml @@ -2,12 +2,11 @@ - name: IF WIFI IS PRIMARY GATEWAY, PLEASE RUN 'iiab-hotspot-on' MANUALLY set_fact: - hostapd_enabled: False # used in (1) hostapd.yml, (2) rpi_debian.yml + - # (3) its dhcpcd.conf.j2, (4) restart.yml no_net_restart: True # used below in (1) sysd-netd-debian.yml, # (2) debian.yml, (3) rpi_debian.yml, # (4) NM-debian.yml - when: discovered_wireless_iface == iiab_wan_iface and not reboot_to_AP + when: discovered_wireless_iface == iiab_wan_iface + # EITHER WAY: hostapd_enabled's state is RECORDED into {{ iiab_env_file }} # in hostapd.yml for later use by... # /usr/libexec/iiab-startup.sh, iiab-hotspot-off & iiab-hotspot-on From 3912e6a1ef94c788ba1615545e2135c50a00391c Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 14 Apr 2020 08:07:07 -0500 Subject: [PATCH 59/93] remove reboot_to_AP --- roles/network/defaults/main.yml | 12 ++---------- vars/default_vars.yml | 3 --- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/roles/network/defaults/main.yml b/roles/network/defaults/main.yml index 867ab89f6..d1928bdb2 100644 --- a/roles/network/defaults/main.yml +++ b/roles/network/defaults/main.yml @@ -25,16 +25,8 @@ # # hostapd_install: True # 2020-01-21: do not rely on this var for now (might be implemented in future) # hostapd_enabled: True -# Above is forcibly set to False (in roles/network/tasks/main.yml) if IIAB is -# being WiFi-installed (run "iiab-hotspot-on" AFTER ./iiab-install completes -# and content is downloaded, to enable the internal WiFi Access Point / AP!) -# -# reboot_to_AP: False -# For those installing IIAB over WiFi: "reboot_to_AP: True" overrides the above -# detection of WiFi-as-gateway, forcing "hostapd_enabled: True" regardless. -# -# Above 2 vars set in /opt/iiab/iiab/vars/default_vars.yml -# +# Above set in /opt/iiab/iiab/vars/default_vars.yml + hostapd_wait: 5 host_wireless_n: False driver_name: nl80211 diff --git a/vars/default_vars.yml b/vars/default_vars.yml index dca8245ed..953e7d51c 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -100,9 +100,6 @@ hostapd_enabled: True # and content is downloaded, to enable the internal WiFi Access Point / AP!) wifi_up_down: True # Creates a second virtual wifi adapter for WiFi upstream to internet # as well as classroom hotspot, use iiab_gateway_enabled for pass through -reboot_to_AP: False -# For those installing IIAB over WiFi: "reboot_to_AP: True" overrides the above -# detection of WiFi-as-gateway, forcing "hostapd_enabled: True" regardless. # Gateway mode iiab_lan_enabled: True From 09c7c3e252bef7dd56dcc29bd8c35d54819dde73 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 14 Apr 2020 10:37:00 -0500 Subject: [PATCH 60/93] legacy support should not boot to AP on mode --- roles/network/tasks/hostapd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index c09b7e8e9..feb2f5523 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -1,7 +1,7 @@ -- name: Turn off hostapd when no wifi interface present or in "Appliance Mode" +- name: Turn off hostapd when not using ap0 and wifi gateway present set_fact: hostapd_enabled: False - when: iiab_wireless_lan_iface is undefined or iiab_network_mode == "Appliance" + when: not wifi_up_down and discovered_wireless_iface == iiab_wan_iface - name: Detect current Wifi channel shell: iw {{ discovered_wireless_iface }} info | grep channel | cut -d' ' -f2 From 7db1464b769265a5f337a8df29bea24c5e9ad9bc Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 14 Apr 2020 10:52:52 -0500 Subject: [PATCH 61/93] don't check for wifi slaves if wifi gateway --- roles/network/tasks/restart.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/tasks/restart.yml b/roles/network/tasks/restart.yml index 61274c625..6c106804c 100644 --- a/roles/network/tasks/restart.yml +++ b/roles/network/tasks/restart.yml @@ -65,7 +65,7 @@ - name: Checking if WiFi slave is active shell: brctl show br0 | grep {{ iiab_wireless_lan_iface }} | wc -l - when: hostapd_enabled and iiab_wireless_lan_iface is defined and iiab_lan_iface == "br0" + when: hostapd_enabled and discovered_wireless_iface != iiab_wan_iface and iiab_lan_iface == "br0" register: wifi_slave - name: Restart hostapd if WiFi slave is inactive From 7e5ce367a22fead2c9a4156c81a118bd70cd6e47 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 15 Apr 2020 06:18:31 -0500 Subject: [PATCH 62/93] don't stall boot if br0 has no slaves --- roles/network/templates/network/systemd-br0-network.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/network/templates/network/systemd-br0-network.j2 b/roles/network/templates/network/systemd-br0-network.j2 index b3eb787cc..21dd6e1d2 100644 --- a/roles/network/templates/network/systemd-br0-network.j2 +++ b/roles/network/templates/network/systemd-br0-network.j2 @@ -5,6 +5,7 @@ Name=br0 [Network] Address={{ lan_ip }}/19 LinkLocalAddressing=no +ConfigureWithoutCarrier=yes # Commenting the below line as it has been causing race/looping issues between dnsmasq and systemd-resolved # IIAB ticket #1747 #DNS={{ lan_ip }} From 37259696868fadbfacb1af0479b0c108ae2da265 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 15 Apr 2020 06:31:05 -0500 Subject: [PATCH 63/93] remove dnsmasq workaround for br0 being down at boot --- roles/network/tasks/enable_services.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/roles/network/tasks/enable_services.yml b/roles/network/tasks/enable_services.yml index b0df14178..60d28a9f4 100644 --- a/roles/network/tasks/enable_services.yml +++ b/roles/network/tasks/enable_services.yml @@ -79,23 +79,23 @@ #- debug: # var: nd_enabled -- name: Check if /etc/networkd-dispatcher/routable.d exists - stat: - path: /etc/networkd-dispatcher/routable.d - register: nd_dir +#- name: Check if /etc/networkd-dispatcher/routable.d exists +# stat: +# path: /etc/networkd-dispatcher/routable.d +# register: nd_dir #- debug: # var: nd_dir #- name: To restart dnsmasq whenever br0 comes up, install /etc/networkd-dispatcher/routable.d/dnsmasq.sh from template (if isn't Appliance, and networkd-dispatcher is enabled, and directory /etc/networkd-dispatcher/routable.d exists, i.e. OS's like Ubuntu 18.04) -- name: To restart dnsmasq whenever br0 comes up, install /etc/networkd-dispatcher/routable.d/dnsmasq.sh from template (if isn't Appliance, and directory /etc/networkd-dispatcher/routable.d exists, i.e. OS's like Ubuntu 18.04) - template: - src: roles/network/templates/network/dnsmasq.sh.j2 - dest: /etc/networkd-dispatcher/routable.d/dnsmasq.sh - mode: 0755 - owner: root - group: root - when: dnsmasq_install and dnsmasq_enabled and nd_dir.stat.exists and nd_dir.stat.isdir and (iiab_network_mode != "Appliance") +#- name: To restart dnsmasq whenever br0 comes up, install /etc/networkd-dispatcher/routable.d/dnsmasq.sh from template (if isn't Appliance, and directory /etc/networkd-dispatcher/routable.d exists, i.e. OS's like Ubuntu 18.04) +# template: +# src: roles/network/templates/network/dnsmasq.sh.j2 +# dest: /etc/networkd-dispatcher/routable.d/dnsmasq.sh +# mode: 0755 +# owner: root +# group: root +# when: dnsmasq_install and dnsmasq_enabled and nd_dir.stat.exists and nd_dir.stat.isdir and (iiab_network_mode != "Appliance") #when: dnsmasq_install and dnsmasq_enabled and nd_enabled is defined and nd_enabled.stdout == "enabled" and nd_dir.stat.exists and nd_dir.stat.isdir and (iiab_network_mode != "Appliance") #when: dnsmasq_install and dnsmasq_enabled and systemd_out.status.UnitFileState == "enabled" and networkd_dir.stat.exists and networkd_dir.stat.isdir and (iiab_network_mode != "Appliance") From bb487777fae50b54ab4b7f6899a916bacce1c316 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 15 Apr 2020 08:10:22 -0500 Subject: [PATCH 64/93] start hostapd before NM --- roles/network/templates/hostapd/hostapd.service.j2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/network/templates/hostapd/hostapd.service.j2 b/roles/network/templates/hostapd/hostapd.service.j2 index 9aca337b0..fc1f1985d 100644 --- a/roles/network/templates/hostapd/hostapd.service.j2 +++ b/roles/network/templates/hostapd/hostapd.service.j2 @@ -7,6 +7,9 @@ Before=dhcpcd.service {% endif %} Before=wpa_supplicant.service Before=wpa_supplicant@{{ discovered_wireless_iface }}.service +{% if network_manager_active %} +Before=network-manager.service +{% endif %} {% if is_ubuntu and netplan.stdout.find("yaml") != -1 %} Before=netplan-wpa@{{ discovered_wireless_iface }}.service {% endif %} From 14bed5f2fc4be942c0eea82deb9d8f3cab20bd5e Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 15 Apr 2020 14:03:26 -0500 Subject: [PATCH 65/93] bad idea NM uses dbus to to call wpa_supplicant --- roles/network/tasks/NM-debian.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/roles/network/tasks/NM-debian.yml b/roles/network/tasks/NM-debian.yml index 0c095a4bb..625741e09 100644 --- a/roles/network/tasks/NM-debian.yml +++ b/roles/network/tasks/NM-debian.yml @@ -58,16 +58,6 @@ mode: 0600 when: wan_ip != "dhcp" -- name: Stop wpa_supplicant service - service: - name: wpa_supplicant - state: stopped - when: iiab_wireless_lan_iface is defined and hostapd_enabled and iiab_network_mode != "Appliance" - -- name: Mask wpa_supplicant - shell: systemctl mask wpa_supplicant - when: iiab_wireless_lan_iface is defined and hostapd_enabled and iiab_network_mode != "Appliance" - - name: Reload systemd systemd: daemon_reload: yes From 24624c6e6f1131dc349072245063cb033ac73316 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 18 Apr 2020 12:13:23 -0500 Subject: [PATCH 66/93] hostapd is masked force override --- roles/network/tasks/hostapd.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index feb2f5523..3a49d0c30 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -136,6 +136,7 @@ systemd: name: hostapd enabled: yes + force: yes when: hostapd_enabled - name: Record HOSTAPD_ENABLED to {{ iiab_env_file }} From 776b983e3d813b68a0710996f3f2bd0babe5e1cf Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 18 Apr 2020 12:21:33 -0500 Subject: [PATCH 67/93] documented force does not work use masked no --- roles/network/tasks/hostapd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 3a49d0c30..0f4001a6b 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -135,8 +135,8 @@ - name: Enable the Access Point 'hostapd' service systemd: name: hostapd + masked: no enabled: yes - force: yes when: hostapd_enabled - name: Record HOSTAPD_ENABLED to {{ iiab_env_file }} From b8cf8712c23dd0e1fd552ffd48134ca483b1a0d5 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 22 Apr 2020 19:25:49 -0500 Subject: [PATCH 68/93] netd-disp tuning --- roles/network/tasks/hostapd.yml | 1 + roles/network/templates/hostapd/netd-disp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 0f4001a6b..9c32bf144 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -114,6 +114,7 @@ with_items: - { src: 'hostapd/netd-disp', dest: '/etc/networkd-dispatcher/carrier.d/iiab-wifi' } - { src: 'hostapd/netd-disp', dest: '/etc/networkd-dispatcher/no-carrier.d/iiab-wifi' } + - { src: 'hostapd/netd-disp', dest: '/etc/networkd-dispatcher/routeable.d/iiab-wifi' } when: systemd_networkd_active and discovered_wireless_iface != "none" and rpi_model != "none" and wifi_up_down - name: Remove networkd-dispatcher hook for hostapd on RPi hardware and not up/down diff --git a/roles/network/templates/hostapd/netd-disp b/roles/network/templates/hostapd/netd-disp index 5b13d4167..af9a7977b 100644 --- a/roles/network/templates/hostapd/netd-disp +++ b/roles/network/templates/hostapd/netd-disp @@ -2,6 +2,6 @@ if [ "$IFACE" == "{{ discovered_wireless_iface }}" ]; then echo "NET-DISP-WiFi $IFACE $STATE" - /usr/sbin/ip link set up ap0 + /usr/sbin/ip link set ap0 up fi From d34e7053b9480a6cf5e9f1edf81f2b13ea86ca13 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 22 Apr 2020 12:59:47 -0500 Subject: [PATCH 69/93] netplan - Disable cloud-init the easy way - bugfix --- roles/network/tasks/netplan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/tasks/netplan.yml b/roles/network/tasks/netplan.yml index 801b64658..04bef0e45 100644 --- a/roles/network/tasks/netplan.yml +++ b/roles/network/tasks/netplan.yml @@ -1,6 +1,6 @@ - name: Disable cloud-init the easy way shell: touch /etc/cloud/cloud-init.disabled - when: ("item" == "50-cloud-init.yaml") + when: item|trim == "50-cloud-init.yaml" with_items: - "{{ netplan.stdout_lines }}" From 40cbebca4644d59eb4f6c3afd84ee3cde9d22d06 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 22 Apr 2020 21:43:03 -0500 Subject: [PATCH 70/93] hostapd - netplan @ -> - --- roles/network/templates/hostapd/hostapd.service.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/templates/hostapd/hostapd.service.j2 b/roles/network/templates/hostapd/hostapd.service.j2 index fc1f1985d..a6ec1f79b 100644 --- a/roles/network/templates/hostapd/hostapd.service.j2 +++ b/roles/network/templates/hostapd/hostapd.service.j2 @@ -11,7 +11,7 @@ Before=wpa_supplicant@{{ discovered_wireless_iface }}.service Before=network-manager.service {% endif %} {% if is_ubuntu and netplan.stdout.find("yaml") != -1 %} -Before=netplan-wpa@{{ discovered_wireless_iface }}.service +Before=netplan-wpa-{{ discovered_wireless_iface }}.service {% endif %} Before=network.target From 6f1ef6ec831f978d745c55c4b86b9586faeade54 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 23 Apr 2020 01:46:35 -0500 Subject: [PATCH 71/93] hostapd.yml typo no 'e' --- roles/network/tasks/hostapd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 9c32bf144..bc1b19a28 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -114,7 +114,7 @@ with_items: - { src: 'hostapd/netd-disp', dest: '/etc/networkd-dispatcher/carrier.d/iiab-wifi' } - { src: 'hostapd/netd-disp', dest: '/etc/networkd-dispatcher/no-carrier.d/iiab-wifi' } - - { src: 'hostapd/netd-disp', dest: '/etc/networkd-dispatcher/routeable.d/iiab-wifi' } + - { src: 'hostapd/netd-disp', dest: '/etc/networkd-dispatcher/routable.d/iiab-wifi' } when: systemd_networkd_active and discovered_wireless_iface != "none" and rpi_model != "none" and wifi_up_down - name: Remove networkd-dispatcher hook for hostapd on RPi hardware and not up/down From fa886874b0b9b08d12982d93398dd5354053a8b6 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 23 Apr 2020 10:51:00 -0500 Subject: [PATCH 72/93] iiab-wifi cleanup routable.d when not wifi_up_down --- roles/network/tasks/hostapd.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index bc1b19a28..825c8226f 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -124,6 +124,7 @@ with_items: - { dest: '/etc/networkd-dispatcher/carrier.d/iiab-wifi' } - { dest: '/etc/networkd-dispatcher/no-carrier.d/iiab-wifi' } + - { dest: '/etc/networkd-dispatcher/routable.d/iiab-wifi' } when: systemd_networkd_active and discovered_wireless_iface != "none" and rpi_model != "none" and not wifi_up_down - name: Disable the Access Point 'hostapd' service From 5a538cbdd20d875cf4fd4849224da54e5969a035 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 23 Apr 2020 10:57:50 -0500 Subject: [PATCH 73/93] netplan.yml - use item|trim for delete test --- roles/network/tasks/netplan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/tasks/netplan.yml b/roles/network/tasks/netplan.yml index 04bef0e45..a9f977faf 100644 --- a/roles/network/tasks/netplan.yml +++ b/roles/network/tasks/netplan.yml @@ -8,7 +8,7 @@ file: state: absent path: /etc/netplan/{{ item }} - when: netplan.stdout.find("yaml") != -1 and (item != "02-iiab-config.yaml") + when: netplan.stdout.find("yaml") != -1 and item|trim != "02-iiab-config.yaml" with_items: - "{{ netplan.stdout_lines }}" From 3b26b4c59461c18cc88df72f45d8282a3896cec8 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 26 Apr 2020 16:44:41 -0500 Subject: [PATCH 74/93] don't call netplan apply --- roles/network/tasks/restart.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/roles/network/tasks/restart.yml b/roles/network/tasks/restart.yml index 6c106804c..0634bdc63 100644 --- a/roles/network/tasks/restart.yml +++ b/roles/network/tasks/restart.yml @@ -53,9 +53,10 @@ creates: /etc/sysconfig/olpc-scripts/setup.d/installed/gateway when: iiab_network_mode == "Gateway" -- name: Reload netplan when Wifi is present on Ubuntu 18+ - shell: netplan apply - when: not no_net_restart and is_ubuntu and netplan.stdout.find("yaml") != -1 +#netplan de-configures pre-created bridged interfaces +#- name: Reload netplan when Wifi is not gateway on Ubuntu 18+ +# shell: netplan apply +# when: not no_net_restart and is_ubuntu and netplan.stdout.find("yaml") != -1 - name: Waiting {{ hostapd_wait }} seconds for network to stabilize (dnsmasq will fail if br0 isn't in a 'up' state!) shell: sleep {{ hostapd_wait }} From 4f4e7f5cc5899ec43a1592c121934bb98d8572b1 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 27 Apr 2020 15:48:38 -0500 Subject: [PATCH 75/93] file status -> state think0 --- roles/network/tasks/hostapd.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 825c8226f..8e12593c7 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -118,9 +118,9 @@ when: systemd_networkd_active and discovered_wireless_iface != "none" and rpi_model != "none" and wifi_up_down - name: Remove networkd-dispatcher hook for hostapd on RPi hardware and not up/down - file: - path: "{{ item.dest}}" - status: absent + file: + path: "{{ item.dest }}" + state: absent with_items: - { dest: '/etc/networkd-dispatcher/carrier.d/iiab-wifi' } - { dest: '/etc/networkd-dispatcher/no-carrier.d/iiab-wifi' } From e741ba35eadbb325850400eb8edb319c3786ed01 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 27 Apr 2020 17:03:50 -0500 Subject: [PATCH 76/93] revert the rest of 5a70c9feead4b56a5dd2153d741b0b312575d74b --- roles/network/tasks/sysd-netd-debian.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/network/tasks/sysd-netd-debian.yml b/roles/network/tasks/sysd-netd-debian.yml index a5a56a802..2bcfd86bb 100644 --- a/roles/network/tasks/sysd-netd-debian.yml +++ b/roles/network/tasks/sysd-netd-debian.yml @@ -55,4 +55,5 @@ name: systemd-networkd enabled: yes state: restarted - when: (netplan.stdout is undefined or netplan.stdout.find("yaml") == -1) and not no_net_restart + #when: (netplan.stdout is undefined or netplan.stdout.find("yaml") == -1) and not no_net_restart + when: not no_net_restart From 73079620674436a3da7efd07454fe1e221225a89 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 30 Apr 2020 00:56:38 -0500 Subject: [PATCH 77/93] manage.conf.j2 --- roles/network/tasks/NM-debian.yml | 13 ++++++------- roles/network/templates/network/manage.conf.j2 | 4 ++++ 2 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 roles/network/templates/network/manage.conf.j2 diff --git a/roles/network/tasks/NM-debian.yml b/roles/network/tasks/NM-debian.yml index 625741e09..565a5d42e 100644 --- a/roles/network/tasks/NM-debian.yml +++ b/roles/network/tasks/NM-debian.yml @@ -11,19 +11,18 @@ set_fact: gen_uuid: "{{ uuid_response.stdout_lines[0] }}" -# NM might have a watcher on this path and we don't have to restart NM -- name: Copy the bridge script for NetworkManager +- name: Copy manage.conf for NetworkManager template: - dest: /etc/NetworkManager/system-connections/ - src: network/bridge-br0 - mode: 0600 - when: iiab_network_mode != "Appliance" + dest: /etc/NetworkManager/conf.d/wifi-manage.conf + src: network/manage.conf.j2 + mode: 0644 + when: discovered_wireless_iface != "none" and not wifi_up_down - name: Remove br0 in Appliance Mode for NetworkManager file: dest: /etc/NetworkManager/system-connections/bridge-br0 state: absent - when: iiab_network_mode == "Appliance" +# when: iiab_network_mode == "Appliance" - name: Removing static for NetworkManager file: diff --git a/roles/network/templates/network/manage.conf.j2 b/roles/network/templates/network/manage.conf.j2 new file mode 100644 index 000000000..fb5c25f55 --- /dev/null +++ b/roles/network/templates/network/manage.conf.j2 @@ -0,0 +1,4 @@ +# IIAB WiFi +[device] +match-device=interface-name:{{ discovered_wireless_iface }} +managed=0 From 5dd283f84e14ee098d9a4b05084df4efb2105e7a Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 30 Apr 2020 00:58:24 -0500 Subject: [PATCH 78/93] hotspots --- .../templates/network/iiab-hotspot-off | 23 +++++++++++-------- .../network/templates/network/iiab-hotspot-on | 23 +++++++++++-------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/roles/network/templates/network/iiab-hotspot-off b/roles/network/templates/network/iiab-hotspot-off index 8b7eb5bbc..7cc396dac 100755 --- a/roles/network/templates/network/iiab-hotspot-off +++ b/roles/network/templates/network/iiab-hotspot-off @@ -1,13 +1,5 @@ #!/bin/bash - -{% if wifi_up_down %} -systemctl disable hostapd -systemctl stop hostapd -sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=False/" {{ iiab_env_file }} -echo " IIAB hotspot access point Disabled" -exit 0 - -{% else %} +{% if is_raspbian %} # hotspot-off before ap0_updown sed -i -e "s/^denyinterfaces/#denyinterfaces/" /etc/dhcpcd.conf systemctl disable hostapd @@ -18,7 +10,6 @@ systemctl daemon-reload systemctl restart dhcpcd #systemctl restart networking 6/15/2019 TFM removed sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=False/" {{ iiab_env_file }} - # Temporary promiscuous-mode workaround for RPi's WiFi "10SEC disease" # Set wlan0 to promiscuous when AP's OFF (for possible WiFi gateway) # SEE ALSO iiab-hotspot-on + /usr/libexec/iiab-startup.sh @@ -26,4 +17,16 @@ sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=False/" {{ iiab_env_file }} #if grep -qi raspbian /etc/*release; then # ip link set dev wlan0 promisc on #fi +{% else %} +systemctl disable hostapd +systemctl stop hostapd +sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=False/" {{ iiab_env_file }} +echo " IIAB hotspot access point Disabled" +{% if wifi_up_down %} +exit 0 +{% else %} +sed -i -e "s|managed=0|managed=1|" /etc/NetworkManager/conf.d/wifi-manage.conf +echo -e "\nPlease reboot to enable upstream WiFi access.\n" +exit 0 +{% endif %} {% endif %} diff --git a/roles/network/templates/network/iiab-hotspot-on b/roles/network/templates/network/iiab-hotspot-on index 47250ce56..03c038197 100755 --- a/roles/network/templates/network/iiab-hotspot-on +++ b/roles/network/templates/network/iiab-hotspot-on @@ -1,12 +1,6 @@ #!/bin/bash -{% if wifi_up_down %} -systemctl enable hostapd -sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=True/" {{ iiab_env_file }} -echo -e "\nPlease reboot to activate hostapd feature.\n" -exit 0 - -{% else %} +{% if is_raspbian %} # just do what we have always done in hotspot-on cp -f /etc/hostapd/hostapd.conf.iiab /etc/hostapd/hostapd.conf sed -i -e "s/^#denyinterfaces/denyinterfaces/" /etc/dhcpcd.conf @@ -20,7 +14,6 @@ systemctl start hostapd systemctl start dnsmasq sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=True/" {{ iiab_env_file }} - # Temporary promiscuous-mode workaround for RPi's WiFi "10SEC disease" # Disable "promiscuous" on wlan0 when AP (i.e. no WiFi gateway) # SEE ALSO iiab-hotspot-off + /usr/libexec/iiab-startup.sh @@ -28,6 +21,16 @@ sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=True/" {{ iiab_env_file }} #if grep -qi raspbian /etc/*release; then # ip link set dev wlan0 promisc off #fi -{% endif %} -echo -e "\nPlease consider rebooting now.\n" +{% else %} +systemctl enable hostapd +sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=True/" {{ iiab_env_file }} +{% if wifi_up_down %} +echo -e "\nPlease reboot to activate hostapd feature.\n" +exit 0 +{% else %} +sed -i -e "s|managed=1|managed=0|" /etc/NetworkManager/conf.d/wifi-manage.conf +echo -e "\nPlease reboot to activate hostapd feature.\n" +exit 0 +{% endif %} +{% endif %} From 56ba4d0d1984c9c04186a527ff4835bace1f0207 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 30 Apr 2020 00:59:54 -0500 Subject: [PATCH 79/93] static ip systemd-networkd --- roles/network/tasks/sysd-netd-debian.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/network/tasks/sysd-netd-debian.yml b/roles/network/tasks/sysd-netd-debian.yml index 2bcfd86bb..c10b015fb 100644 --- a/roles/network/tasks/sysd-netd-debian.yml +++ b/roles/network/tasks/sysd-netd-debian.yml @@ -36,11 +36,12 @@ wan_cidr: "{{ CIDR.stdout }}" when: wan_ip != "dhcp" -- name: Supply static WAN template (ubuntu-16) +- name: Supply static WAN template when network_manager_active is False template: dest: /etc/systemd/network/IIAB-Static.network src: network/systemd-static-net.j2 - when: wan_ip != "dhcp" and is_ubuntu_16 + when: wan_ip != "dhcp" and ( is_ubuntu_16 or not network_manager_active ) + #when: wan_ip != "dhcp" and not is_ubuntu_18 - name: Stopping services @@ -54,6 +55,7 @@ systemd: name: systemd-networkd enabled: yes + masked: no state: restarted #when: (netplan.stdout is undefined or netplan.stdout.find("yaml") == -1) and not no_net_restart when: not no_net_restart From f83e615b407c63659a516e90ebc0133245f34e1e Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 30 Apr 2020 01:00:58 -0500 Subject: [PATCH 80/93] netplan --- roles/network/tasks/netplan.yml | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/roles/network/tasks/netplan.yml b/roles/network/tasks/netplan.yml index a9f977faf..0d8663848 100644 --- a/roles/network/tasks/netplan.yml +++ b/roles/network/tasks/netplan.yml @@ -4,11 +4,9 @@ with_items: - "{{ netplan.stdout_lines }}" -- name: Remove stock netplan template - file: - state: absent - path: /etc/netplan/{{ item }} - when: netplan.stdout.find("yaml") != -1 and item|trim != "02-iiab-config.yaml" +- name: Moving 50-cloud-init.yaml to 02-iiab-config.yaml + shell: mv /etc/netplan/50-cloud-init.yaml /etc/netplan/02-iiab-config.yaml + when: netplan.stdout.find("yaml") != -1 and item|trim == "50-cloud-init.yaml" with_items: - "{{ netplan.stdout_lines }}" @@ -25,6 +23,11 @@ - systemd-networkd-wait-online when: systemd_networkd_active | bool +- name: Ensure systemd-networkd gets enabled for br0 + set_fact: + systemd_networkd_active: True + when: network_manager_active | bool and iiab_lan_iface == "br0" + # ICO will always set gui_static_wan_ip away from the default of 'unset' while # gui_static_wan turns dhcp on/off through wan_ip in computed_network and # overrides gui_static_wan_ip that is present. Changing wan_ip in local_vars @@ -39,12 +42,20 @@ wan_cidr: "{{ CIDR.stdout }}" when: wan_ip != "dhcp" -- name: Supply netplan template - template: - dest: /etc/netplan/01-iiab-config.yaml - src: network/netplan.j2 - backup: no - when: iiab_wan_iface != discovered_wireless_iface +- name: Remove stock netplan template + file: + state: absent + path: /etc/netplan/{{ item }} + when: netplan.stdout.find("yaml") != -1 and item|trim != "02-iiab-config.yaml" and wan_ip != "dhcp" + with_items: + - "{{ netplan.stdout_lines }}" + +#- name: Supply netplan template +# template: +# dest: /etc/netplan/01-iiab-config.yaml +# src: network/netplan.j2 +# backup: no +# when: iiab_wan_iface != discovered_wireless_iface and wan_ip != "dhcp" # should blow up here if we messed up the yml file #- name: Generate netplan config From 8751b33271fb56bc1817424b992dec5ad9e62b55 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 30 Apr 2020 10:32:09 -0500 Subject: [PATCH 81/93] can't start hostapd when ap0 is in use needs reboot --- roles/network/tasks/restart.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/roles/network/tasks/restart.yml b/roles/network/tasks/restart.yml index 0634bdc63..6cecec5c4 100644 --- a/roles/network/tasks/restart.yml +++ b/roles/network/tasks/restart.yml @@ -2,7 +2,8 @@ systemd: name: hostapd state: restarted - when: iiab_wireless_lan_iface is defined and hostapd_enabled and discovered_wireless_iface != iiab_wan_iface +# when: iiab_wireless_lan_iface is defined and hostapd_enabled and discovered_wireless_iface != iiab_wan_iface + when: hostapd_enabled and iiab_wireless_lan_iface is defined and discovered_wireless_iface == iiab_wireless_lan_iface - name: Start named service systemd: @@ -79,6 +80,6 @@ systemd: name: "{{ dhcp_service2 }}" state: restarted - when: not no_net_restart + when: not no_net_restart and discovered_wireless_iface == "none" #when: (iiab_network_mode != "Appliance") # Sufficient b/c br0 exists thanks to /etc/network/interfaces.d/iiab #when: iiab_network_mode != "Appliance" and iiab_wan_iface != discovered_wireless_iface From 3d4b23f2fe59f66dfc12ae441098ce6557762d14 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 30 Apr 2020 19:28:51 -0500 Subject: [PATCH 82/93] exclude NM from touching ap0 --- roles/network/tasks/NM-debian.yml | 33 +++++++++++++------ .../network/templates/network/ap0-manage.conf | 3 ++ 2 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 roles/network/templates/network/ap0-manage.conf diff --git a/roles/network/tasks/NM-debian.yml b/roles/network/tasks/NM-debian.yml index 565a5d42e..7b3a356f5 100644 --- a/roles/network/tasks/NM-debian.yml +++ b/roles/network/tasks/NM-debian.yml @@ -3,26 +3,39 @@ include_tasks: down-debian.yml # provide keyfile layout like the XO's used way back. -- name: Create uuid for NM's keyfile store - shell: uuidgen - register: uuid_response +#- name: Create uuid for NM's keyfile store +# shell: uuidgen +# register: uuid_response -- name: Put the uuid in place - set_fact: - gen_uuid: "{{ uuid_response.stdout_lines[0] }}" +#- name: Put the uuid in place +# set_fact: +# gen_uuid: "{{ uuid_response.stdout_lines[0] }}" -- name: Copy manage.conf for NetworkManager +# systemd-networkd handles br0 except for Raspbian +- name: Remove stale br0 for NetworkManager + file: + dest: /etc/NetworkManager/system-connections/bridge-br0 + state: absent + +- name: Copy ap0-manage.conf for NetworkManager + template: + dest: /etc/NetworkManager/conf.d/ap0-manage.conf + src: network/ap0-manage.conf + mode: 0644 + when: wifi_up_down + +- name: Copy manage.conf for NetworkManager when wifi_up_down False template: dest: /etc/NetworkManager/conf.d/wifi-manage.conf src: network/manage.conf.j2 mode: 0644 when: discovered_wireless_iface != "none" and not wifi_up_down -- name: Remove br0 in Appliance Mode for NetworkManager +- name: Remove manage.conf for NetworkManager when wifi_up_down True file: - dest: /etc/NetworkManager/system-connections/bridge-br0 + dest: /etc/NetworkManager/conf.d/wifi-manage.conf state: absent -# when: iiab_network_mode == "Appliance" + when: wifi_up_down - name: Removing static for NetworkManager file: diff --git a/roles/network/templates/network/ap0-manage.conf b/roles/network/templates/network/ap0-manage.conf new file mode 100644 index 000000000..400832df1 --- /dev/null +++ b/roles/network/templates/network/ap0-manage.conf @@ -0,0 +1,3 @@ +# IIAB WiFi +[keyfile] +unmanaged-devices=interface-name:ap0 From 4ab0e6321419e67d84e2b4dc2caff778e1e0d8fc Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 30 Apr 2020 19:31:51 -0500 Subject: [PATCH 83/93] wifi routines needed on non-rpi hardware --- roles/network/tasks/hostapd.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 8e12593c7..2905e6159 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -1,4 +1,4 @@ -- name: Turn off hostapd when not using ap0 and wifi gateway present +- name: Disable hostapd when not using ap0 and wifi gateway present set_fact: hostapd_enabled: False when: not wifi_up_down and discovered_wireless_iface == iiab_wan_iface @@ -8,10 +8,10 @@ register: current_host_channel when: discovered_wireless_iface != "none" -- name: Setting WiFi channel to {{ current_host_channel.stdout }} on RPi hardware +- name: Setting WiFi channel to {{ current_host_channel.stdout }} set_fact: host_channel: "{{ current_host_channel.stdout }}" - when: current_host_channel.stdout is defined and current_host_channel.stdout != "" and current_host_channel.stdout|int <= 13 and discovered_wireless_iface != "none" and rpi_model != "none" + when: current_host_channel.stdout is defined and current_host_channel.stdout != "" and current_host_channel.stdout|int <= 13 - name: Create /etc/hostapd/hostapd.conf from template template: @@ -104,7 +104,7 @@ - { src: 'hostapd/00-iiab-debug', dest: '/etc/networkd-dispatcher/routable.d/00-iiab-debug' } when: systemd_networkd_active and discovered_wireless_iface != "none" -- name: Create networkd-dispatcher hook for hostapd on RPi hardware +- name: Create networkd-dispatcher hook for hostapd template: owner: root group: root @@ -115,7 +115,7 @@ - { src: 'hostapd/netd-disp', dest: '/etc/networkd-dispatcher/carrier.d/iiab-wifi' } - { src: 'hostapd/netd-disp', dest: '/etc/networkd-dispatcher/no-carrier.d/iiab-wifi' } - { src: 'hostapd/netd-disp', dest: '/etc/networkd-dispatcher/routable.d/iiab-wifi' } - when: systemd_networkd_active and discovered_wireless_iface != "none" and rpi_model != "none" and wifi_up_down + when: systemd_networkd_active and discovered_wireless_iface != "none" and wifi_up_down - name: Remove networkd-dispatcher hook for hostapd on RPi hardware and not up/down file: From 325db43473557569797994c9c4e3d9cd82e10ba1 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 30 Apr 2020 19:33:00 -0500 Subject: [PATCH 84/93] netplan - let backends handle static ip --- roles/network/tasks/netplan.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/roles/network/tasks/netplan.yml b/roles/network/tasks/netplan.yml index 0d8663848..41d017180 100644 --- a/roles/network/tasks/netplan.yml +++ b/roles/network/tasks/netplan.yml @@ -32,15 +32,15 @@ # gui_static_wan turns dhcp on/off through wan_ip in computed_network and # overrides gui_static_wan_ip that is present. Changing wan_ip in local_vars # is a oneway street to static. -- name: Static IP computing CIDR - shell: netmask {{ wan_ip }}/{{ wan_netmask }} | awk -F "/" '{print $2}' - register: CIDR - when: wan_ip != "dhcp" +#- name: Static IP computing CIDR +# shell: netmask {{ wan_ip }}/{{ wan_netmask }} | awk -F "/" '{print $2}' +# register: CIDR +# when: wan_ip != "dhcp" -- name: Static IP setting CIDR - set_fact: - wan_cidr: "{{ CIDR.stdout }}" - when: wan_ip != "dhcp" +#- name: Static IP setting CIDR +# set_fact: +# wan_cidr: "{{ CIDR.stdout }}" +# when: wan_ip != "dhcp" - name: Remove stock netplan template file: From 63c64271af0def50caae76605c473605e7db1a13 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 30 Apr 2020 19:35:15 -0500 Subject: [PATCH 85/93] move netplan before hostapd to pick up set_fact sysd-netd-active --- roles/network/tasks/main.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/roles/network/tasks/main.yml b/roles/network/tasks/main.yml index 4071d53f3..fe61a9c0f 100644 --- a/roles/network/tasks/main.yml +++ b/roles/network/tasks/main.yml @@ -47,6 +47,11 @@ include_tasks: squid.yml when: squid_install and FQDN_changed and iiab_stage|int == 9 +#preprep for backends +- name: Netplan in use on Ubuntu 18.04+ + include_tasks: netplan.yml + when: is_ubuntu and not is_ubuntu_16 + #### Start services - include_tasks: avahi.yml @@ -63,12 +68,6 @@ when: is_redhat | bool #and not installing -- name: Netplan in use on Ubuntu 18.04+ - include_tasks: netplan.yml - when: is_ubuntu and not is_ubuntu_16 - #when: is_ubuntu_18 | bool - #and not installing - - name: NetworkManager in use include_tasks: NM-debian.yml when: is_debuntu and network_manager_active From 117e40f5bc97a5ba8464aaa426558ba95dde4dfe Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Fri, 1 May 2020 00:05:35 -0500 Subject: [PATCH 86/93] hostapd.yml - missed rpi_model != 'none', touchups --- roles/network/tasks/hostapd.yml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 2905e6159..8800edc95 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -1,3 +1,9 @@ +- name: Unmask the Access Point 'hostapd' service + systemd: + name: hostapd + enabled: no + masked: no + - name: Disable hostapd when not using ap0 and wifi gateway present set_fact: hostapd_enabled: False @@ -73,7 +79,7 @@ group: root mode: 0755 -- name: Create dhcpcd hook for hostapd +- name: Create dhcpcd hook for hostapd and ap0 when wifi_up_down True template: src: hostapd/50-hostapd dest: /lib/dhcpcd/dhcpcd-hooks/50-hostapd @@ -82,7 +88,7 @@ mode: 0644 when: is_raspbian and wifi_up_down -- name: Remove dhcpcd hook for hostapd if WiFi is not split +- name: Remove dhcpcd hook for hostapd if WiFi is not split using ap0 file: path: /lib/dhcpcd/dhcpcd-hooks/50-hostapd state: absent @@ -104,7 +110,7 @@ - { src: 'hostapd/00-iiab-debug', dest: '/etc/networkd-dispatcher/routable.d/00-iiab-debug' } when: systemd_networkd_active and discovered_wireless_iface != "none" -- name: Create networkd-dispatcher hook for hostapd +- name: Create networkd-dispatcher hook for hostapd wifi_up_down True template: owner: root group: root @@ -117,7 +123,7 @@ - { src: 'hostapd/netd-disp', dest: '/etc/networkd-dispatcher/routable.d/iiab-wifi' } when: systemd_networkd_active and discovered_wireless_iface != "none" and wifi_up_down -- name: Remove networkd-dispatcher hook for hostapd on RPi hardware and not up/down +- name: Remove networkd-dispatcher hook wifi_up_down False file: path: "{{ item.dest }}" state: absent @@ -125,19 +131,11 @@ - { dest: '/etc/networkd-dispatcher/carrier.d/iiab-wifi' } - { dest: '/etc/networkd-dispatcher/no-carrier.d/iiab-wifi' } - { dest: '/etc/networkd-dispatcher/routable.d/iiab-wifi' } - when: systemd_networkd_active and discovered_wireless_iface != "none" and rpi_model != "none" and not wifi_up_down - -- name: Disable the Access Point 'hostapd' service - systemd: - name: hostapd - enabled: no -# cheap workaround for when /etc/init.d is populated -# when: not hostapd_enabled + when: systemd_networkd_active and discovered_wireless_iface != "none" and not wifi_up_down - name: Enable the Access Point 'hostapd' service systemd: name: hostapd - masked: no enabled: yes when: hostapd_enabled From f8a59b46bb0b17c77b5f941ab580dc0cb2541346 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Fri, 1 May 2020 20:02:05 -0500 Subject: [PATCH 87/93] legacy wifi installs needs iiab_wireless_lan_iface set also --- roles/network/tasks/detected_network.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/tasks/detected_network.yml b/roles/network/tasks/detected_network.yml index 05c329dbe..c6d73192f 100644 --- a/roles/network/tasks/detected_network.yml +++ b/roles/network/tasks/detected_network.yml @@ -149,7 +149,7 @@ - name: Set iiab_wireless_lan_iface to {{ discovered_wireless_iface }} if not none set_fact: iiab_wireless_lan_iface: "{{ discovered_wireless_iface }}" - when: discovered_wireless_iface != "none" and discovered_wireless_iface != iiab_wan_iface + when: discovered_wireless_iface != "none" and not wifi_up_down - name: Set iiab_wireless_lan_iface to ap0 if WiFi device is present set_fact: From 784d89d3a9390962f68ac1588e1a4f6911a994c8 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Fri, 1 May 2020 20:51:28 -0500 Subject: [PATCH 88/93] default manage.conf to enabled for wifi installs --- roles/network/templates/network/manage.conf.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/templates/network/manage.conf.j2 b/roles/network/templates/network/manage.conf.j2 index fb5c25f55..ddd857e52 100644 --- a/roles/network/templates/network/manage.conf.j2 +++ b/roles/network/templates/network/manage.conf.j2 @@ -1,4 +1,4 @@ # IIAB WiFi [device] match-device=interface-name:{{ discovered_wireless_iface }} -managed=0 +managed=1 From 9ee93d7e0178bab9bd23ce6af804ffc7a561c916 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Fri, 1 May 2020 21:22:41 -0500 Subject: [PATCH 89/93] sysd-netd-debian - split unmask/enable and restart --- roles/network/tasks/sysd-netd-debian.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/roles/network/tasks/sysd-netd-debian.yml b/roles/network/tasks/sysd-netd-debian.yml index c10b015fb..c153f2116 100644 --- a/roles/network/tasks/sysd-netd-debian.yml +++ b/roles/network/tasks/sysd-netd-debian.yml @@ -1,4 +1,10 @@ # sysd-netd-debian.yml +- name: Unmask and enable the systemd-networkd service + systemd: + name: systemd-networkd + enabled: yes + masked: no + - name: Copy the bridge script - Creates br0 template: dest: /etc/systemd/network/IIAB-Bridge.netdev @@ -54,8 +60,6 @@ - name: Restart the systemd-networkd service systemd: name: systemd-networkd - enabled: yes - masked: no state: restarted #when: (netplan.stdout is undefined or netplan.stdout.find("yaml") == -1) and not no_net_restart when: not no_net_restart From e9f9364a90bf77b79012cdbd12d613010a3d0e0d Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Fri, 1 May 2020 21:35:49 -0500 Subject: [PATCH 90/93] netplan needs the unmasking|enable for sysd-netd --- roles/network/tasks/netplan.yml | 7 +++++++ roles/network/tasks/sysd-netd-debian.yml | 6 ------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/roles/network/tasks/netplan.yml b/roles/network/tasks/netplan.yml index 41d017180..0eb96166b 100644 --- a/roles/network/tasks/netplan.yml +++ b/roles/network/tasks/netplan.yml @@ -23,6 +23,13 @@ - systemd-networkd-wait-online when: systemd_networkd_active | bool +- name: Unmask and enable the systemd-networkd service for br0 + systemd: + name: systemd-networkd + enabled: yes + masked: no + when: network_manager_active | bool and iiab_lan_iface == "br0" + - name: Ensure systemd-networkd gets enabled for br0 set_fact: systemd_networkd_active: True diff --git a/roles/network/tasks/sysd-netd-debian.yml b/roles/network/tasks/sysd-netd-debian.yml index c153f2116..a1a904cfa 100644 --- a/roles/network/tasks/sysd-netd-debian.yml +++ b/roles/network/tasks/sysd-netd-debian.yml @@ -1,10 +1,4 @@ # sysd-netd-debian.yml -- name: Unmask and enable the systemd-networkd service - systemd: - name: systemd-networkd - enabled: yes - masked: no - - name: Copy the bridge script - Creates br0 template: dest: /etc/systemd/network/IIAB-Bridge.netdev From e027dbe2507656fb1fe87ec3a7d401ba21f7e515 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 2 May 2020 03:21:59 -0400 Subject: [PATCH 91/93] Update local_vars_big.yml --- vars/local_vars_big.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vars/local_vars_big.yml b/vars/local_vars_big.yml index 24f67e278..e69e4c303 100644 --- a/vars/local_vars_big.yml +++ b/vars/local_vars_big.yml @@ -46,8 +46,8 @@ host_wifi_mode: g host_channel: 6 hostapd_secure: False hostapd_password: changeme -wifi_up_down: True # Creates a second virtual wifi adapter for WiFi upstream to internet - # as well as classroom hotspot, use iiab_gateway_enabled for pass through +wifi_up_down: True # Creates a second virtual wifi adapter for WiFi upstream to internet + # as well as classroom hotspot, use iiab_gateway_enabled for pass through # See "How do I set a static IP address?" for Ethernet, in http://FAQ.IIAB.IO wan_ip: dhcp # wan_ip: 192.168.1.99 From a38eaabd093037ebdb7681b8627176335cdfbc5e Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 2 May 2020 03:22:46 -0400 Subject: [PATCH 92/93] Update local_vars_medium.yml --- vars/local_vars_medium.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vars/local_vars_medium.yml b/vars/local_vars_medium.yml index d43af20dc..d2a33a1a6 100644 --- a/vars/local_vars_medium.yml +++ b/vars/local_vars_medium.yml @@ -46,8 +46,8 @@ host_wifi_mode: g host_channel: 6 hostapd_secure: False hostapd_password: changeme -wifi_up_down: True # Creates a second virtual wifi adapter for WiFi upstream to internet - # as well as classroom hotspot, use iiab_gateway_enabled for pass through +wifi_up_down: True # Creates a second virtual wifi adapter for WiFi upstream to internet + # as well as classroom hotspot, use iiab_gateway_enabled for pass through # See "How do I set a static IP address?" for Ethernet, in http://FAQ.IIAB.IO wan_ip: dhcp # wan_ip: 192.168.1.99 From 8eed1c0c25812a3ee41768a0f4140b8426508b9a Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 2 May 2020 03:23:14 -0400 Subject: [PATCH 93/93] Update local_vars_min.yml --- vars/local_vars_min.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vars/local_vars_min.yml b/vars/local_vars_min.yml index 2f982d59b..eb8cb8ca3 100644 --- a/vars/local_vars_min.yml +++ b/vars/local_vars_min.yml @@ -46,8 +46,8 @@ host_wifi_mode: g host_channel: 6 hostapd_secure: False hostapd_password: changeme -wifi_up_down: True # Creates a second virtual wifi adapter for WiFi upstream to internet - # as well as classroom hotspot, use iiab_gateway_enabled for pass through +wifi_up_down: True # Creates a second virtual wifi adapter for WiFi upstream to internet + # as well as classroom hotspot, use iiab_gateway_enabled for pass through # See "How do I set a static IP address?" for Ethernet, in http://FAQ.IIAB.IO wan_ip: dhcp # wan_ip: 192.168.1.99