Add rapid-commit (dhcp) option. (#1733)

Although it looks like OpenWRT document this, they dont implement it yet.
This commit is contained in:
Tim Wilkinson 2024-12-01 15:56:42 -08:00 committed by GitHub
parent 2bc77ce449
commit 726300dcd9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 6 deletions

View File

@ -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];

View File

@ -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