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 %}