From 7ed1bbad49b46667a4a7fa09eca78b95c49dc66a Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 22 Feb 2017 14:43:07 +0100 Subject: [PATCH] Add host-record option --- advanced/Scripts/webpage.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index fd882bd3..3487190c 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -127,6 +127,12 @@ trust-anchor=.,19036,8,2,49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE3 " >> "${dnsmasqconfig}" fi + delete_dnsmasq_setting "host-record" + + if [ -n "${#HOSTRECORD}" ]; then + add_dnsmasq_setting "host-record" "${HOSTRECORD}" + fi + } SetDNSServers(){ @@ -313,6 +319,7 @@ ResolutionSettings() { elif [[ "${typ}" == "clients" ]]; then change_setting "API_GET_CLIENT_HOSTNAME" "${state}" fi + } AddDHCPStaticAddress() { @@ -331,6 +338,7 @@ AddDHCPStaticAddress() { # Full info given echo "dhcp-host=${mac},${ip},${host}" >> "${dhcpstaticconfig}" fi + } RemoveDHCPStaticAddress() { @@ -340,6 +348,23 @@ RemoveDHCPStaticAddress() { } +SetHostRecord(){ + + if [ -n "${args[3]}" ]; then + change_setting "HOSTRECORD" "${args[2]},${args[3]}" + echo "Setting host record for ${args[2]} -> ${args[3]}" + else + change_setting "HOSTRECORD" "" + echo "Removing host record" + fi + + ProcessDNSSettings + + # Restart dnsmasq to load new configuration + RestartDNS + +} + main() { args=("$@") @@ -363,6 +388,7 @@ main() { "resolve" ) ResolutionSettings;; "addstaticdhcp" ) AddDHCPStaticAddress;; "removestaticdhcp" ) RemoveDHCPStaticAddress;; + "hostrecord" ) SetHostRecord;; * ) helpFunc;; esac