Skip to content

Commit 7f5840e

Browse files
committed
Fix dhcpcd.conf removing clientid, make hotspot more rubust by checking masquerade and making sure hotspot is master (AP)
1 parent 1c03b23 commit 7f5840e

4 files changed

Lines changed: 21 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
ethdev=$1
3+
4+
if ! iptables-save | grep MASQUERADE | grep eth0 | grep -q MASQUERADE; then
5+
echo "Masquerade missing, adding 🎭"
6+
iptables -t nat -A POSTROUTING -o "${ethdev}" -j MASQUERADE
7+
fi

src/modules/auto-hotspot/filesystem/root/usr/bin/autohotspotN

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ createAdHocNetwork()
5959
fi
6060
systemctl start dnsmasq
6161
systemctl start hostapd
62+
# We need dhcpcd in host mode for ipv6
63+
systemctl restart dhcpcd
6264
echo 1 > /proc/sys/net/ipv4/ip_forward
6365
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
6466
}
@@ -209,6 +211,9 @@ else #ssid or MAC address not in range
209211
if systemctl status hostapd | grep "(running)" >/dev/null 2>&1
210212
then
211213
echo "Hostspot already active"
214+
# Extra tools to handle hotspot not working
215+
add_masquerade "${ethdev}"
216+
make_sure_master "${wifidev}"
212217
elif { wpa_cli status | grep "$wifidev"; } >/dev/null 2>&1
213218
then
214219
echo "Cleaning wifi files and Activating Hotspot"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
wifidev=$1
3+
4+
if ! iw wlan0 info | grep type | grep -q AP; then
5+
echo "Access point missing, adding 📶"
6+
systemctl restart hostapd.service
7+
fi

src/modules/auto-hotspot/start_chroot_script

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ interface eth0
4646
ia_pd 2 wlan0/1/64 # request prefixes for VLANs
4747
" >> /etc/dhcpcd.conf
4848

49+
sed -i 's/clientid/# clientid/g' /etc/dhcpcd.conf
50+
4951
echo "
5052
# Auto-hotspot Config
5153
# Interface to use

0 commit comments

Comments
 (0)