From 207cc98255868f92e8fd1befeece7e1821a1764e Mon Sep 17 00:00:00 2001 From: George Hunt Date: Sun, 12 Apr 2020 17:43:20 +0100 Subject: [PATCH] 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 }}