diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2013-11-04 22:40:56 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2013-11-04 22:40:56 +0000 |
commit | 5db9587b5f5d3a64fbd5f4c4a1f74f1a4fa65177 (patch) | |
tree | e20ceb08693417ba66addb650fa3f1ce626af4f1 /package/network/services/dnsmasq/files/dnsmasq.init | |
parent | d5555de5b0f65140791594ea485cd9528a58b560 (diff) | |
download | upstream-5db9587b5f5d3a64fbd5f4c4a1f74f1a4fa65177.tar.gz upstream-5db9587b5f5d3a64fbd5f4c4a1f74f1a4fa65177.tar.bz2 upstream-5db9587b5f5d3a64fbd5f4c4a1f74f1a4fa65177.zip |
dnsmasq: fix backward compatibility with existing configs
Changeset r36943 ("dnsmasq: use host-record instead of address") removed
the automatic domain expansion for config domain sections, this breaks
existing setups and alters the old behaviour in unexpected ways, therfore
restore behaviour of the current stable release.
Additionally handle fully qualified hostnames properly when setting up the
own hostrecord by stripping the local domain part form the given name
instead of unconditionally appending it, so that "example.lan" results
in "example example.lan" and not "example.lan example.lan.lan".
SVN-Revision: 38648
Diffstat (limited to 'package/network/services/dnsmasq/files/dnsmasq.init')
-rw-r--r-- | package/network/services/dnsmasq/files/dnsmasq.init | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init index 561f89d33d..ca3bb5248e 100644 --- a/package/network/services/dnsmasq/files/dnsmasq.init +++ b/package/network/services/dnsmasq/files/dnsmasq.init @@ -408,6 +408,9 @@ dhcp_domain_add() { [ -n "$ip" ] || return 0 for name in $names; do + [ "${name%.*}" == "$name" ] && \ + name="$name${DOMAIN:+.$DOMAIN}" + record="${record:+$record/}$name" done @@ -531,7 +534,7 @@ start_service() { # add own hostname [ $ADD_LOCAL_HOSTNAME -eq 1 ] && [ -n "$lanaddr" ] && { local hostname="$(uci_get system @system[0] hostname OpenWrt)" - dhcp_hostrecord_add "" "$hostname${DOMAIN:+.$DOMAIN $hostname}" "$lanaddr" + dhcp_hostrecord_add "" "${hostname%.$DOMAIN}${DOMAIN:+.$DOMAIN ${hostname%.$DOMAIN}}" "$lanaddr" } echo >> $CONFIGFILE |