+ [ "$broadcast" = "0" ] && broadcast= || broadcast=",set:needs-broadcast"
+
+ hosttag="${networkid:+,set:${networkid}}${tag:+,set:${tag}}$broadcast"
+ nametime="${name:+,$name}${leasetime:+,$leasetime}"
+
+ 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"
+ fi
+}
+
+dhcp_this_host_add() {
+ local net="$1"
+ local ifname="$2"
+ local mode="$3"
+ local routerstub routername ifdashname
+ local lanaddr lanaddr6 lanaddrs6 ulaprefix
+
+ if [ "$mode" -gt 0 ] ; then
+ ifdashname="${ifname//./-}"
+ routerstub="$( md5sum /etc/os-release )"
+ routerstub="router-${routerstub// */}"
+ routername="$( uci_get system @system[0] hostname $routerstub )"
+
+ if [ "$mode" -gt 1 ] ; then
+ if [ "$mode" -gt 2 ] ; then
+ if [ "$mode" -gt 3 ] ; then
+ append_interface_name "$ifdashname.$routername.$DOMAIN" "$ifname"
+ fi
+
+ append_interface_name "$routername.$DOMAIN" "$ifname"
+ fi
+
+ # All IP addresses discovered by dnsmasq will be labeled (except fe80::)
+ append_interface_name "$routername" "$ifname"
+
+ else
+ # This uses a static host file entry for only limited addresses.
+ # Use dnsmasq option "--expandhosts" to enable FQDN on host files.
+ ulaprefix="$(uci_get network @globals[0] ula_prefix)"
+ network_get_ipaddr lanaddr "$net"
+ network_get_ipaddrs6 lanaddrs6 "$net"
+
+ if [ -n "$lanaddr" ] ; then
+ dhcp_domain_add "" "$routername" "$lanaddr"
+ fi
+
+ if [ -n "$ulaprefix" -a -n "$lanaddrs6" ] ; then
+ for lanaddr6 in $lanaddrs6 ; do
+ case "$lanaddr6" in
+ "${ulaprefix%%:/*}"*)
+ dhcp_domain_add "" "$routername" "$lanaddr6"
+ ;;
+ esac
+ done
+ fi
+ fi
+ fi