create_ap

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

commit 7aa5398548df58bf24d55ad029a5ce8e5cd4bd89
parent dd7f801f736c679666c24030d91a80f624ef5a19
Author: Marco Bartoli <marco.bartoli.dev@gmail.com>
Date:   Mon, 21 Sep 2015 11:22:14 +0200

DHCP DNS option forced for no-dns or custom dns servers

Diffstat:
Mbash_completion | 3+++
Mcreate_ap | 15+++++++++++++--
2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/bash_completion b/bash_completion @@ -135,6 +135,9 @@ _create_ap() { --no-dns) # No Options ;; + --dhcp-dns) + # Not going to implement + ;; --mkconfig) _use_filedir && return 0 ;; diff --git a/create_ap b/create_ap @@ -53,6 +53,7 @@ usage() { echo " close create_ap, then use this option to switch your interface" echo " back to managed" echo " --mac <MAC> Set MAC address" + echo " --dhcp-dns <IP1[,IP2]> Set DNS returned by DHCP" echo " --daemon Run create_ap in the background" echo " --stop <id> Send stop command to an already running create_ap. For an <id>" echo " you can put the PID of create_ap or the WiFi interface. You can" @@ -581,6 +582,7 @@ CHANNEL=default GATEWAY=192.168.12.1 WPA_VERSION=1+2 ETC_HOSTS=0 +DHCP_DNS=gateway NO_DNS=0 HIDDEN=0 SHARE_METHOD=nat @@ -596,7 +598,7 @@ NO_HAVEGED=0 USE_PSK=0 -CONFIG_OPTS=(CHANNEL GATEWAY WPA_VERSION ETC_HOSTS NO_DNS HIDDEN SHARE_METHOD +CONFIG_OPTS=(CHANNEL GATEWAY WPA_VERSION ETC_HOSTS DHCP_DNS 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) @@ -984,7 +986,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","no-dns","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:","dhcp-dns:","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" @@ -1068,6 +1070,11 @@ while :; do NEW_MACADDR="$1" shift ;; + --dhcp-dns) + shift + DHCP_DNS="$1" + shift + ;; --daemon) shift DAEMONIZE=1 @@ -1528,11 +1535,15 @@ else else DNSMASQ_BIND=bind-dynamic fi + if [[ "$DHCP_DNS" == "gateway" ]]; then + DHCP_DNS="$GATEWAY" + fi cat << EOF > $CONFDIR/dnsmasq.conf listen-address=${GATEWAY} ${DNSMASQ_BIND} dhcp-range=${GATEWAY%.*}.1,${GATEWAY%.*}.254,255.255.255.0,24h dhcp-option-force=option:router,${GATEWAY} +dhcp-option-force=option:dns-server,${DHCP_DNS} EOF MTU=$(get_mtu $INTERNET_IFACE) [[ -n "$MTU" ]] && echo "dhcp-option-force=option:mtu,${MTU}" >> $CONFDIR/dnsmasq.conf