diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init index b6197f7a1..18d66e135 100644 --- a/package/network/services/dnsmasq/files/dnsmasq.init +++ b/package/network/services/dnsmasq/files/dnsmasq.init @@ -19,7 +19,7 @@ BASEDHCPSTAMPFILE="/var/run/dnsmasq" DHCPBOGUSHOSTNAMEFILE="/usr/share/dnsmasq/dhcpbogushostname.conf" RFC6761FILE="/usr/share/dnsmasq/rfc6761.conf" DHCPSCRIPT="/usr/lib/dnsmasq/dhcp-script.sh" -CONFIGFILE_COMMENTS="/tmp/dhcp_comments.conf" + DNSMASQ_DHCP_VER=4 xappend() { @@ -28,12 +28,6 @@ xappend() { echo "${value#--}" >> $CONFIGFILE_TMP } -cappend() { - local value="$1" - - echo "${value#--}" >> $CONFIGFILE_COMMENTS -} - hex_to_hostid() { local var="$1" local hex="${2#0x}" # strip optional "0x" prefix @@ -283,8 +277,7 @@ dhcp_match_add() { dhcp_host_add() { local cfg="$1" - local hosttag nametime addrs duids macs tags - local comment_mac comment_ip + local hosttag nametime addrs duids macs tags config_get_bool force "$cfg" force 0 @@ -295,17 +288,10 @@ dhcp_host_add() { [ "$enable" = "0" ] && return 0 config_get name "$cfg" name - config_get comments "$cfg" comments config_get ip "$cfg" ip config_get hostid "$cfg" hostid - - if [ -z "$ip" -a -z "$name" -a -z "$hostid" ]; then - [ -n "$comments" ] || return 0 - config_get mac "$cfg" mac - [ -n "$ip" ] || ip="-" - cappend "$comments $mac $ip" - return 0 - fi + + [ -n "$ip" -o -n "$name" -o -n "$hostid" ] || return 0 config_get_bool dns "$cfg" dns 0 [ "$dns" = "1" -a -n "$ip" -a -n "$name" ] && { @@ -321,7 +307,6 @@ dhcp_host_add() { # many MAC are possible to track a laptop ON/OFF dock for m in $mac; do append macs "$m" ","; done fi - if [ $DNSMASQ_DHCP_VER -eq 6 -a -n "$duid" ]; then # --dhcp-host=id:00:03:00:01:12:00:00:01:02:03,[::beef],lap @@ -351,27 +336,12 @@ dhcp_host_add() { hosttag="${networkid:+,set:${networkid}}${tags:+,set:${tags}}$broadcast" nametime="${name:+,$name}${leasetime:+,$leasetime}" - - [ -n "$comments" ] || comments="-" - - if [ -n "$macs" ]; then - comment_mac=$mac - else - comment_mac="-" - fi - - if [ -n "$ip" ]; then - comment_ip=${ip:+$ip} - else - comment_ip="-" - fi - + if [ $DNSMASQ_DHCP_VER -eq 6 ]; then addrs="${ip:+,$ip}${hostid:+,[::$hostid]}" xappend "--dhcp-host=$macs${duids:+,$duids}$hosttag$addrs$nametime" else xappend "--dhcp-host=$macs$hosttag${ip:+,$ip}$nametime" - cappend "$comments $comment_mac $comment_ip" fi } @@ -783,7 +753,6 @@ dnsmasq_start() chown dnsmasq:dnsmasq /var/run/dnsmasq echo "# auto-generated config file from /etc/config/dhcp" > $CONFIGFILE_TMP - rm $CONFIGFILE_COMMENTS echo "# auto-generated config file from /etc/config/dhcp" > $HOSTFILE_TMP local dnsmasqconffile="/etc/dnsmasq.${cfg}.conf"