diff --git a/create_ap b/create_ap old mode 100644 new mode 100755 index bb06883..9d6115d --- a/create_ap +++ b/create_ap @@ -9,8 +9,6 @@ # iw # iwconfig (you only need this if 'iw' can not recognize your adapter) # haveged (optional) - -# dependencies for 'nat' or 'none' Internet sharing method # dnsmasq # iptables @@ -69,8 +67,8 @@ usage() { echo " For an you can put the PID of create_ap or the WiFi interface." echo " If virtual WiFi interface was created, then use that one." echo " You can get them with --list-running" - echo " --mkconfig Store configs in conf_file" - echo " --config Load configs from conf_file" + #echo " --mkconfig Store configs in conf_file" + #echo " --config Load configs from conf_file" echo echo "Non-Bridging Options:" echo " --no-dns Disable dnsmasq DNS server" @@ -636,8 +634,6 @@ LIST_RUNNING=0 STOP_ID= LIST_CLIENTS_ID= -STORE_CONFIG= -LOAD_CONFIG= CONFDIR= WIFI_IFACE= @@ -711,7 +707,7 @@ _cleanup() { iptables -w -t nat -D POSTROUTING -s ${GATEWAY%.*}.0/24 ! -o ${WIFI_IFACE} -j MASQUERADE iptables -w -D FORWARD -i ${WIFI_IFACE} -s ${GATEWAY%.*}.0/24 -j ACCEPT iptables -w -D FORWARD -i ${INTERNET_IFACE} -d ${GATEWAY%.*}.0/24 -j ACCEPT - + fi fi @@ -912,76 +908,9 @@ send_stop() { mutex_unlock } -# Storing configs -write_config() { - local i=1 - - if ! eval 'echo -n > "$STORE_CONFIG"' > /dev/null 2>&1; then - echo "ERROR: Unable to create config file $STORE_CONFIG" >&2 - exit 1 - fi - - WIFI_IFACE=$1 - if [[ "$SHARE_METHOD" == "none" ]]; then - SSID="$2" - PASSPHRASE="$3" - else - INTERNET_IFACE="$2" - SSID="$3" - PASSPHRASE="$4" - fi - - for config_opt in "${CONFIG_OPTS[@]}"; do - eval echo $config_opt=\$$config_opt - done >> "$STORE_CONFIG" - - echo -e "Config options written to '$STORE_CONFIG'" - exit 0 -} - -is_config_opt() { - local elem opt="$1" - - for elem in "${CONFIG_OPTS[@]}"; do - if [[ "$elem" == "$opt" ]]; then - return 0 - fi - done - return 1 -} - -# Load options from config file -read_config() { - local opt_name opt_val line - - while read line; do - # Read switches and their values - opt_name="${line%%=*}" - opt_val="${line#*=}" - if is_config_opt "$opt_name" ; then - eval $opt_name="\$opt_val" - else - echo "WARN: Unrecognized configuration entry $opt_name" >&2 - fi - done < "$LOAD_CONFIG" -} - ARGS=( "$@" ) -# Preprocessing for --config before option-parsing starts -for ((i=0; i<$#; i++)); do - if [[ "${ARGS[i]}" = "--config" ]]; then - if [[ -f "${ARGS[i+1]}" ]]; then - LOAD_CONFIG="${ARGS[i+1]}" - read_config - else - echo "ERROR: No config file found at given location" >&2 - exit 1 - fi - break - fi -done GETOPT_ARGS=$(getopt -o hc:w:g:de:nm: -l "help","hidden","hostapd-debug:","redirect-to-localhost","mac-filter","mac-filter-accept:","isolate-clients","ieee80211n","ieee80211ac","ht_capab:","vht_capab:","driver:","no-virt","fix-unmanaged","country:","freq-band:","mac:","dhcp-dns:","daemon","stop:","list","list-running","list-clients:","version","psk","no-haveged","no-dns","no-dnsmasq","mkconfig:","config:" -n "$PROGNAME" -- "$@") [[ $? -ne 0 ]] && exit 1 @@ -1154,15 +1083,6 @@ while :; do fi shift ;; - --mkconfig) - shift - STORE_CONFIG="$1" - shift - ;; - --config) - shift - shift - ;; --) shift break @@ -1209,7 +1129,6 @@ trap "clean_exit" SIGINT SIGUSR1 # if we get USR2 signal then run die(). trap "die" SIGUSR2 -[[ -n "$STORE_CONFIG" ]] && write_config "$@" if [[ $LIST_RUNNING -eq 1 ]]; then echo -e "List of running $PROGNAME instances:\n" @@ -1670,7 +1589,7 @@ if [[ "$SHARE_METHOD" != "none" ]]; then # to enable clients to establish PPTP connections we must # load nf_nat_pptp module modprobe nf_nat_pptp > /dev/null 2>&1 - + fi else echo "No Internet sharing" fi @@ -1737,10 +1656,3 @@ if ! wait $HOSTAPD_PID; then fi clean_exit - -# Local Variables: -# tab-width: 4 -# indent-tabs-mode: nil -# End: - -# vim: et sts=4 sw=4