Annotate

tools/dnsregistry.lua @ 12468:353836684009

net.connect: Fix accumulation of connection attempt references Connection attempts that failed the Happy Eyeballs race were not unreferenced and would accumulate. Tested by inspecting the 'pending_connections_map' after establishing s2s with a s2s target where the IPv6 port has a -j DROP rule causing it to time out and the IPv4 attempt wins the race. Expected is that the losing connection stays around until net.server timeouts kick in where it should be removed. The map table should tend towards being empty during idle times.
author Kim Alvefur <zash@zash.se>
date Wed, 20 Apr 2022 22:41:54 +0200
parent 12271:f31bb79f51d7
child 12855:3306807c0619
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12237
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
1 -- Generate util/dnsregistry.lua from IANA HTTP status code registry
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
2 local xml = require "util.xml";
12271
f31bb79f51d7 tools: Allow processing instructions in some XML parsing tools
Kim Alvefur <zash@zash.se>
parents: 12237
diff changeset
3 local registries = xml.parse(io.read("*a"), { allow_processing_instructions = true });
12237
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
4
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
5 print("-- Source: https://www.iana.org/assignments/dns-parameters/dns-parameters.xml");
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
6 print(os.date("-- Generated on %Y-%m-%d"))
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
7
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
8 local registry_mapping = {
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
9 ["dns-parameters-2"] = "classes";
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
10 ["dns-parameters-4"] = "types";
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
11 ["dns-parameters-6"] = "errors";
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
12 };
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
13
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
14 print("return {");
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
15 for registry in registries:childtags("registry") do
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
16 local registry_name = registry_mapping[registry.attr.id];
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
17 if registry_name then
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
18 print("\t" .. registry_name .. " = {");
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
19 for record in registry:childtags("record") do
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
20 local record_name = record:get_child_text("name");
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
21 local record_type = record:get_child_text("type");
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
22 local record_desc = record:get_child_text("description");
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
23 local record_code = tonumber(record:get_child_text("value"));
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
24
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
25 if tostring(record):lower():match("reserved") or tostring(record):lower():match("reserved") then
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
26 record_code = nil;
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
27 end
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
28
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
29 if registry_name == "classes" and record_code then
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
30 record_type = record_desc and record_desc:match("%((%w+)%)$")
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
31 if record_type then
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
32 print(("\t\t[%q] = %d; [%d] = %q;"):format(record_type, record_code, record_code, record_type))
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
33 end
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
34 elseif registry_name == "types" and record_type and record_code then
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
35 print(("\t\t[%q] = %d; [%d] = %q;"):format(record_type, record_code, record_code, record_type))
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
36 elseif registry_name == "errors" and record_code and record_name then
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
37 print(("\t\t[%d] = %q; [%q] = %q;"):format(record_code, record_name, record_name, record_desc or record_name));
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
38 end
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
39 end
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
40 print("\t};");
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
41 end
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
42 end
b35714c57442 tools.dnsregistry: For converting IANA DNS registry data to Lua table
Kim Alvefur <zash@zash.se>
parents:
diff changeset
43 print("};");