create_ap

create a nat-ed wifi ap
git clone git://git.2f30.org/create_ap.git
Log | Files | Refs | LICENSE

commit b359b899e863a030e2d73550bc9c664062fd3cec
parent d19aaa2f5697e787214b1762a710fd05e3fc28d0
Author: oblique <psyberbits@gmail.com>
Date:   Mon Aug 31 14:52:59 +0300

Merge pull request #100 from wsxarcher/master

Option to disable DNS server
Diffstat:
bash_completion | 3+++
create_ap | 23+++++++++++++++++------
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/bash_completion b/bash_completion @@ -132,6 +132,9 @@ _create_ap() { local clients_awk_cmd='$1 ~ /^[0-9]+$/' opts=$("$1" --list-running | awk "$clients_awk_cmd") ;; + --no-dns) + # No Options + ;; --mkconfig) _use_filedir && return 0 ;; diff --git a/create_ap b/create_ap @@ -66,6 +66,7 @@ usage() { echo " --config <conf_file> Load configs from conf_file" echo echo "Non-Bridging Options:" + echo " --no-dns Disable dnsmasq DNS server" echo " -g <gateway> IPv4 Gateway for the Access Point (default: 192.168.12.1)" echo " -d DNS server will take into account /etc/hosts" echo @@ -575,6 +576,7 @@ CHANNEL=default GATEWAY=192.168.12.1 WPA_VERSION=1+2 ETC_HOSTS=0 +NO_DNS=0 HIDDEN=0 SHARE_METHOD=nat IEEE80211N=0 @@ -589,7 +591,7 @@ NO_HAVEGED=0 USE_PSK=0 -CONFIG_OPTS=(CHANNEL GATEWAY WPA_VERSION ETC_HOSTS HIDDEN SHARE_METHOD +CONFIG_OPTS=(CHANNEL GATEWAY WPA_VERSION ETC_HOSTS NO_DNS HIDDEN SHARE_METHOD IEEE80211N HT_CAPAB DRIVER NO_VIRT COUNTRY FREQ_BAND NEW_MACADDR DAEMONIZE NO_HAVEGED WIFI_IFACE INTERNET_IFACE SSID PASSPHRASE USE_PSK) @@ -977,7 +979,7 @@ for ((i=0; i<$#; i++)); do fi done -GETOPT_ARGS=$(getopt -o hc:w:g:dnm: -l "help","hidden","ieee80211n","ht_capab:","driver:","no-virt","fix-unmanaged","country:","freq-band:","mac:","daemon","stop:","list","list-running","list-clients:","version","psk","no-haveged","mkconfig:","config:" -n "$PROGNAME" -- "$@") +GETOPT_ARGS=$(getopt -o hc:w:g:dnm: -l "help","hidden","ieee80211n","ht_capab:","driver:","no-virt","fix-unmanaged","country:","freq-band:","mac:","daemon","stop:","list","list-running","list-clients:","version","psk","no-haveged","no-dns","mkconfig:","config:" -n "$PROGNAME" -- "$@") [[ $? -ne 0 ]] && exit 1 eval set -- "$GETOPT_ARGS" @@ -1092,6 +1094,10 @@ while :; do shift USE_PSK=1 ;; + --no-dns) + shift + NO_DNS=1 + ;; --mkconfig) shift STORE_CONFIG="$1" @@ -1631,13 +1637,18 @@ else echo "No Internet sharing" fi -# start dns + dhcp server +# start dhcp + dns (optional) if [[ "$SHARE_METHOD" != "bridge" ]]; then - iptables -I INPUT -p tcp -m tcp --dport 53 -j ACCEPT || die - iptables -I INPUT -p udp -m udp --dport 53 -j ACCEPT || die + if [[ $NO_DNS -eq 0 ]]; then + DNS_PORT=53 + iptables -I INPUT -p tcp -m tcp --dport $DNS_PORT -j ACCEPT || die + iptables -I INPUT -p udp -m udp --dport $DNS_PORT -j ACCEPT || die + else + DNS_PORT=0 + fi iptables -I INPUT -p udp -m udp --dport 67 -j ACCEPT || die umask 0033 - dnsmasq -C $CONFDIR/dnsmasq.conf -x $CONFDIR/dnsmasq.pid -l $CONFDIR/dnsmasq.leases || die + dnsmasq -C $CONFDIR/dnsmasq.conf -x $CONFDIR/dnsmasq.pid -l $CONFDIR/dnsmasq.leases -p $DNS_PORT || die umask $SCRIPT_UMASK fi