From 726300dcd9b8f74b2f4e5776e22492366729fa9d Mon Sep 17 00:00:00 2001 From: Tim Wilkinson Date: Sun, 1 Dec 2024 15:56:42 -0800 Subject: [PATCH] Add rapid-commit (dhcp) option. (#1733) Although it looks like OpenWRT document this, they dont implement it yet. --- files/app/main/status/e/dhcp.ut | 7 +------ files/usr/local/bin/node-setup | 4 ++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/files/app/main/status/e/dhcp.ut b/files/app/main/status/e/dhcp.ut index 44f9f9b9..07e90dea 100755 --- a/files/app/main/status/e/dhcp.ut +++ b/files/app/main/status/e/dhcp.ut @@ -212,7 +212,7 @@ const dhcpOptionTypes = { "71": ["nntp-server", "ips"], "74": ["irc-server", "ips"], "77": ["user-class", "text"], - "80": ["rapid-commit", "(empty)"], // FIXME also needs --dhcp-rapid-commit + "80": ["rapid-commit", "flag"], "93": ["client-arch", "uint16"], "94": ["client-interface-id", "^1(?:,(?:\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){2}$", "1,0...255,0...255"], "97": ["client-machine-id", "^0,(?:[0-9A-Fa-f]{2}:?\\b){16}$", "0,xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"], @@ -612,7 +612,6 @@ const dhcpOptionTypes = { const dhcpOptionTypes = {%print(dhcpOptionTypes);%}; const dhcpOptionTypesPatterns = { "?": [".*",], - "(empty)": ["^$", "(empty)"], ip: ["^(?:(?:25[0-5]|(?:2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4}$", "IP Address"], ips: ["^(?:(?:(?:25[0-5]|(?:2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4},?\\b)+$", "IP Addresses"], ipips: ["^(?:(?:(?:(?:(?:25[0-5]|(?:2[0-4]|1[0-9]|[1-9]|)[0-9])\\.?\\b){4}),?\\b){2})+$", "IP,IP pairs"], @@ -652,10 +651,6 @@ const dhcpOptionTypes = { value.min = pat[2]; value.max = pat[3]; break; - case "^$": // (empty) - value.value = ""; - value.disabled = true; - // fall through... default: value.type = "text"; value.pattern = pat[0]; diff --git a/files/usr/local/bin/node-setup b/files/usr/local/bin/node-setup index 02207ddc..13145004 100755 --- a/files/usr/local/bin/node-setup +++ b/files/usr/local/bin/node-setup @@ -884,6 +884,10 @@ do then -- place unforced options in the anonymous section for _, option in ipairs(forcelist[UNFORCED]) do table.insert(dhcp_option_list, option_item(tag, option)) + -- If we detect a rapid-commit option to enable the necessary config flag + if option.num == "80" and option.val == "1" then + nc:set("dhcp", "@dhcp[0]", "rapidcommit", "1") + end end forcelist[UNFORCED] = nil end