diff --git a/scripts/js/settings-dhcp.js b/scripts/js/settings-dhcp.js index ac773205..b60e05cc 100644 --- a/scripts/js/settings-dhcp.js +++ b/scripts/js/settings-dhcp.js @@ -430,3 +430,25 @@ $(document).on("click", ".copy-to-static", function () { const val = textarea.val(); textarea.val(val ? val + "\n" + line : line).trigger("input"); }); + +// Add line numbers to the textarea for static DHCP hosts +document.addEventListener("DOMContentLoaded", function () { + const textarea = document.getElementById("dhcp-hosts"); + const linesElem = document.getElementById("dhcp-hosts-lines"); + function updateLineNumbers() { + const lines = textarea.value.split("\n").length || 1; + linesElem.innerHTML = Array.from({ length: lines }, function (_, i) { + return i + 1; + }).join("
"); + } + + function syncScroll() { + linesElem.scrollTop = textarea.scrollTop; + } + + if (textarea && linesElem) { + textarea.addEventListener("input", updateLineNumbers); + textarea.addEventListener("scroll", syncScroll); + updateLineNumbers(); + } +}); diff --git a/settings-dhcp.lp b/settings-dhcp.lp index 5c4af11c..5d8780ea 100644 --- a/settings-dhcp.lp +++ b/settings-dhcp.lp @@ -193,7 +193,10 @@ mg.include('scripts/lua/settings_header.lp','r')

Specify per host parameters for the DHCP server. This allows a machine with a particular hardware address to be always allocated the same hostname, IP address and lease time. A hostname specified like this overrides any supplied by the DHCP client on the machine. It is also allowable to omit the hardware address and include the hostname, in which case the IP address and lease times will apply to any machine claiming that name.

- +
+ + +

Each entry should be on a separate line, and should be of the form:

[<hwaddr>][,id:<client_id>|*][,set:<tag>][,tag:<tag>][,<ipaddr>][,<hostname>][,<lease_time>][,ignore]

Only one entry per MAC address is allowed. IPv6 addresses must be enclosed in square brackets like [2001:db8::1].