    "milan")
      ssid="attwifi"
      mac=d8:6c:e9:f3:eb:96
      country=DE
      name="DONT UsE THis ONE!"
;;

  esac
}

# networkmanager often leaves a lock on the wireless hardware, remove it
rfkill unblock wifi

# set up parameters
InitZone $1

# give our wifi device a static IP address in the correct range so hostapd can associate with it
/sbin/ifconfig $zone hw ether $mac
/sbin/ifconfig $zone 192.168.23.1 up

# start dnsmasq
dnsmasq -i $zone --dhcp-range=192.168.23.50,192.168.23.150,255.255.255.0,12h

# enable IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward

# set basic routes so that our associated devices can reach the web
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
iptables --table nat --append POSTROUTING --out-interface $world -j MASQUERADE
iptables --append FORWARD --in-interface $zone -j ACCEPT

sysctl -w net.ipv4.ip_forward=1

# start hostapd, spawn a temporary file
TMPDIR=`mktemp -d`
tmpfile=$TMPDIR/nztmp
echo $tmpfile
trap "rm -rf $TMPDIR" EXIT

echo "interface=${zone}" >> $tmpfile
echo "driver=nl80211" >> $tmpfile
echo "channel=1" >> $tmpfile
echo "ssid=${ssid}" >> $tmpfile
echo "auth_algs=1" >> $tmpfile
echo "wpa=0" >> $tmpfile
echo "country_code=${country}" >> $tmpfile
# uncomment the following two lines if you want MAC filtering
#echo "macaddr_acl=1" >> $tmpfile
#echo "accept_mac_file=/home/ms/hostapd/hostapd_mac_file" >> $tmpfile

echo "Starting Nintendo Zone hotspot, using config ''${name}''"
echo "SSID: ${ssid}"
echo "Country: ${country}"

hostapd $tmpfile -B -d > /dev/null 2> /dev/null

rm -rf $TMPDIR
