Report comment

Hi there,

I have firewalld on my raspi3, and it did not wanted to play nice with the iptables commands on the script. So i translated them to firewall-cmd.

createAdHocNetwork()
{
... Line 42 onwards
#iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
firewall-cmd --direct -add-rule ipv4 nat POSTROUTING 0 -o eth0 -j MASQUERADE
#iptables -A FORWARD -i eth0 -o "$wifidev" -m state --state RELATED,ESTABLISHED -j ACCEPT
firewall-cmd --direct --add-rule ipv4 filter FORWARD 0 -i eth0 -o "$wifidev" -m state --state RELATED,ESTABLISHED -j ACCEPT
#iptables -A FORWARD -i "$wifidev" -o eth0 -j ACCEPT
firewall-cmd --direct --add-rule ipv4 filter FORWARD 0 -i "$wifidev" -o eth0 -j ACCEPT
...
}

KillHotSpot()
{
... Line 56 or 60 (may vary depending on lines above)
firewall-cmd --direct --remove-rule ipv4 nat POSTROUTING 0 -o eth0 -j MASQUERADE
#iptables -D FORWARD -i eth0 -o "$wifidev" -m state --state RELATED,ESTABLISHED -j ACCEPT
firewall-cmd --direct --remove-rule ipv4 filter FORWARD 0 -i eth0 -o "$wifidev" -m state --state RELATED,ESTABLISHED -j ACCEPT
#iptables -D FORWARD -i "$wifidev" -o eth0 -j ACCEPT
firewall-cmd --direct --remove-rule ipv4 filter FORWARD 0 -i "$wifidev" -o eth0 -j ACCEPT
...
}

Added the removal of MASQUERADE otherwise throws a warning that rule already exists when hotspot -> wifi client -> hotspot dance.

Hope it helps.