add option for dnsmasq dhcp-host(s)

This commit is contained in:
David Rose 2024-06-12 17:08:31 -05:00
parent 71d74937df
commit 8ac2bb1a3e
2 changed files with 11 additions and 2 deletions

View File

@ -640,6 +640,7 @@ GATEWAY=192.168.12.1
WPA_VERSION=2
ETC_HOSTS=0
ADDN_HOSTS=
DHCP_HOSTS=
DHCP_DNS=gateway
NO_DNS=0
NO_DNSMASQ=0
@ -672,7 +673,7 @@ REDIRECT_TO_LOCALHOST=0
CONFIG_OPTS=(CHANNEL GATEWAY WPA_VERSION ETC_HOSTS DHCP_DNS NO_DNS NO_DNSMASQ HIDDEN MAC_FILTER MAC_FILTER_ACCEPT ISOLATE_CLIENTS
SHARE_METHOD IEEE80211N IEEE80211AC IEEE80211AX HT_CAPAB VHT_CAPAB DRIVER NO_VIRT COUNTRY FREQ_BAND
NEW_MACADDR DAEMONIZE DAEMON_PIDFILE DAEMON_LOGFILE DNS_LOGFILE NO_HAVEGED WIFI_IFACE INTERNET_IFACE
SSID PASSPHRASE USE_PSK ADDN_HOSTS)
SSID PASSPHRASE USE_PSK ADDN_HOSTS DHCP_HOSTS)
FIX_UNMANAGED=0
LIST_RUNNING=0
@ -1074,7 +1075,7 @@ for ((i=0; i<$#; i++)); do
fi
done
GETOPT_ARGS=$(getopt -o hc:w:g:de:nm: -l "help","hidden","hostapd-debug:","hostapd-timestamps","redirect-to-localhost","mac-filter","mac-filter-accept:","isolate-clients","ieee80211n","ieee80211ac","ieee80211ax","ht_capab:","vht_capab:","driver:","no-virt","fix-unmanaged","country:","freq-band:","mac:","dhcp-dns:","daemon","pidfile:","logfile:","dns-logfile:","stop:","list","list-running","list-clients:","version","psk","no-haveged","no-dns","no-dnsmasq","mkconfig:","config:" -n "$PROGNAME" -- "$@")
GETOPT_ARGS=$(getopt -o hc:w:g:de:nm: -l "help","hidden","hostapd-debug:","hostapd-timestamps","redirect-to-localhost","mac-filter","mac-filter-accept:","isolate-clients","ieee80211n","ieee80211ac","ieee80211ax","ht_capab:","vht_capab:","driver:","no-virt","fix-unmanaged","country:","freq-band:","mac:","dhcp-dns:","daemon","pidfile:","logfile:","dns-logfile:","stop:","list","list-running","list-clients:","version","psk","no-haveged","no-dns","no-dnsmasq","mkconfig:","config:","dhcp-hosts:" -n "$PROGNAME" -- "$@")
[[ $? -ne 0 ]] && exit 1
eval set -- "$GETOPT_ARGS"
@ -1130,6 +1131,11 @@ while :; do
ADDN_HOSTS="$1"
shift
;;
--dhcp-hosts)
shift
DHCP_HOSTS="$1"
shift
;;
-n)
shift
SHARE_METHOD=none
@ -1796,6 +1802,7 @@ EOF
[[ -n "$MTU" ]] && echo "dhcp-option-force=option:mtu,${MTU}" >> $CONFDIR/dnsmasq.conf
[[ $ETC_HOSTS -eq 0 ]] && echo no-hosts >> $CONFDIR/dnsmasq.conf
[[ -n "$ADDN_HOSTS" ]] && echo "addn-hosts=${ADDN_HOSTS}" >> $CONFDIR/dnsmasq.conf
[[ -n "$DHCP_HOSTS" ]] && echo $DHCP_HOSTS >> $CONFDIR/dnsmaq.conf
if [[ -n "$DNS_LOGFILE" ]]; then
cat << EOF >> $CONFDIR/dnsmasq.conf
log-queries

View File

@ -27,3 +27,5 @@ INTERNET_IFACE=eth0
SSID=MyAccessPoint
PASSPHRASE=12345678
USE_PSK=0
DHCP_HOSTS="dhcp-host=foo,bar\ndhcp-host=bar,foo"