From f619b1d354bace5dfc14aa26a4fa0958c981d8e5 Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Mon, 20 Jan 2025 14:19:53 +0900 Subject: [PATCH 1/6] fix(ext/net): enable EDNS0 for Deno.resolveDns --- ext/net/ops.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/net/ops.rs b/ext/net/ops.rs index 768dd33135..c4eb56af2f 100644 --- a/ext/net/ops.rs +++ b/ext/net/ops.rs @@ -646,7 +646,7 @@ where cancel_rid, } = args; - let (config, opts) = if let Some(name_server) = + let (config, mut opts) = if let Some(name_server) = options.as_ref().and_then(|o| o.name_server.as_ref()) { let group = NameServerConfigGroup::from_ips_clear( @@ -662,6 +662,8 @@ where system_conf::read_system_conf()? }; + opts.edns0 = true; + { let mut s = state.borrow_mut(); let perm = s.borrow_mut::(); From a4e46000f5d31da92a3a7ddad38ee1277c3d3cd6 Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Mon, 20 Jan 2025 14:33:16 +0900 Subject: [PATCH 2/6] add test --- tests/unit/net_test.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/unit/net_test.ts b/tests/unit/net_test.ts index 9c2819c30a..bbf7647bb9 100644 --- a/tests/unit/net_test.ts +++ b/tests/unit/net_test.ts @@ -9,6 +9,7 @@ import { execCode2, tmpUnixSocketPath, } from "./test_util.ts"; +import dns2 from "npm:dns2@2.1.0"; // Since these tests may run in parallel, ensure this port is unique to this file const listenPort = 4503; @@ -1327,3 +1328,34 @@ Deno.test( // calling [Symbol.dispose] after manual close is a no-op }, ); + +Deno.test({ permissions: { net: true } }, async function resolveDnsEdns0() { + // With EDNS0 enabled, Deno.resolveDns can handle 44 A records. + const NUM_RECORD = 44; + const { Packet } = dns2; + const server = dns2.createServer({ + udp: true, + // deno-lint-ignore no-explicit-any + handle(request: any, send: any) { + const response = Packet.createResponseFromRequest(request); + const { name } = request.questions[0]; + for (const i of [...Array(NUM_RECORD).keys()]) { + response.answers.push({ + name, + type: Packet.TYPE.A, + class: Packet.CLASS.IN, + ttl: 300, + address: "1.2.3." + i, + }); + } + send(response); + }, + }); + const { udp: { port } } = await server.listen({ + udp: { port: 0, address: "127.0.0.1", type: "udp4" }, + }); + const addr = await Deno.resolveDns("example.com", "A", { + nameServer: { ipAddr: "127.0.0.1", port }, + }); + await server.close(); +}); From e36fa4b6650c2fb6f7a81b9c440b3956c3f03374 Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Mon, 20 Jan 2025 14:49:08 +0900 Subject: [PATCH 3/6] fix lint error --- tests/unit/net_test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/net_test.ts b/tests/unit/net_test.ts index bbf7647bb9..c16bc1fdec 100644 --- a/tests/unit/net_test.ts +++ b/tests/unit/net_test.ts @@ -1357,5 +1357,6 @@ Deno.test({ permissions: { net: true } }, async function resolveDnsEdns0() { const addr = await Deno.resolveDns("example.com", "A", { nameServer: { ipAddr: "127.0.0.1", port }, }); + assertEquals(addr.length, NUM_RECORD); await server.close(); }); From 69bab0352e2e409040dc72280eae540d2951e6cb Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Mon, 20 Jan 2025 15:53:06 +0900 Subject: [PATCH 4/6] add dns2 dep --- tests/registry/npm/dns2/dns2-2.1.0.tgz | Bin 0 -> 21758 bytes tests/registry/npm/dns2/registry.json | 72 +++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 tests/registry/npm/dns2/dns2-2.1.0.tgz create mode 100644 tests/registry/npm/dns2/registry.json diff --git a/tests/registry/npm/dns2/dns2-2.1.0.tgz b/tests/registry/npm/dns2/dns2-2.1.0.tgz new file mode 100644 index 0000000000000000000000000000000000000000..1f825e4b1d1b171ed2bbc5ae7a7b09fe986a9b26 GIT binary patch literal 21758 zcmV(}K+wM*iwFP!00002|Lwi$V&cXUFnWIT6rD*LiIGUNm(RUO3iNjkzzCfumYW-jTF7J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r`r6=hv|+>sdTWu$<^zi;e0XcIggT02h%; z#SIdAiF&i75=nTVmJG=eWRBQ;GQ6TSa{Q5qnd4D9kVB=H&Y8eIAethAYTi{rIW##= z>WPR<0?I-*e~;IcPE>XC^k3x&_3l*pok%`@%|GOL*Ixk$jPm=`c1doy=4~Q*WRupVd`NCqLym(kC)b= z+xSoT_I_dag^!G5!A5rl%LCi=xA>F)xeoT@>*o7opiH7?nj7zppT{WZkHrxN1n#}u zm$a^soH>)hb!gtS7PIw)*Q0VKh3|hM;h$;-n@2Ds+_#>&Q4|i3Cl~r6oyqqK$Sk(? zRqVdOhiaAKGI8o36d^~jm;LUfWb8(5{7*GqDa-u>YH9lB!F;D>chYeiGHToJg&3eA z@ZfXq9t(g(Ouhm>^>q0n17E)nxEkx~$A`l3^d(_)?isZJ64sai08BhEwm6lF$Qnt+ z&B#s?KE!4SxVr4;?f)Sj6IBrHrG@z}%y;a;c-pP~d^1@nT`lc|?{XByE=%G*e)20- z+N~0{v5xfYP81?qeL!-82{50!d#YjwPk9mueGt(?Q?!c}TSOJEt~KG$E`^=nnLsE5 r1Fd4iSk+DRI{Fxc9(AN9^nEk=dlhio5qfu5fM*X1*0urU-2?nTWsG`z literal 0 HcmV?d00001 diff --git a/tests/registry/npm/dns2/registry.json b/tests/registry/npm/dns2/registry.json new file mode 100644 index 0000000000..875e7edc30 --- /dev/null +++ b/tests/registry/npm/dns2/registry.json @@ -0,0 +1,72 @@ +{ + "name": "dns2", + "description": "A DNS Server and Client Implementation in Pure JavaScript with no dependencies.", + "dist-tags": { + "latest": "2.1.0" + }, + "versions": { + "2.1.0": { + "name": "dns2", + "version": "2.1.0", + "description": "A DNS Server and Client Implementation in Pure JavaScript with no dependencies.", + "main": "index.js", + "scripts": { + "test": "node test", + "lint": "eslint .", + "example-server-udp": "node example/server/udp.js", + "example-server-tcp": "node example/server/tcp.js", + "example-server-doh": "node example/server/doh.js", + "example-client-doh": "node example/client/doh.js", + "example-client-udp": "node example/client/udp.js", + "example-client-tcp": "node example/client/tcp.js", + "example-client-google": "node example/client/google.js", + "example-client-udp-subnet": "node example/client/udp-subnet.js" + }, + "author": { + "name": "Liu Song", + "email": "song940@gmail.com" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/song940/node-dns.git" + }, + "bugs": { + "url": "https://github.com/song940/node-dns/issues" + }, + "devDependencies": { + "eslint": "^7.28.0", + "eslint-config-semistandard": "^15.0.1", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-promise": "^4.2.1" + }, + "gitHead": "28fd77405b98081ac1efb41d0c800e827c1cf6ff", + "_id": "dns2@2.1.0", + "_nodeVersion": "19.3.0", + "_npmVersion": "9.2.0", + "dist": { + "integrity": "sha512-m27K11aQalRbmUs7RLaz6aPyceLjAoqjPRNTdE7qUouQpl+PC8Bi67O+i9SuJUPbQC8dxFrczAxfmTPuTKHNkw==", + "shasum": "15b07567befb2b914aedbb55a9ea0862c63c3d73", + "tarball": "https://registry.npmjs.org/dns2/-/dns2-2.1.0.tgz", + "fileCount": 37, + "unpackedSize": 75538 + }, + "directories": {}, + "_hasShrinkwrap": false + } + }, + "homepage": "https://github.com/song940/node-dns#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/song940/node-dns.git" + }, + "author": { + "name": "Liu Song", + "email": "song940@gmail.com" + }, + "bugs": { + "url": "https://github.com/song940/node-dns/issues" + }, + "license": "MIT", + "readmeFilename": "README.md" +} From 7d3c4ac956b674c1bc99c384605d9fb1edac9a33 Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Mon, 20 Jan 2025 18:10:38 +0900 Subject: [PATCH 5/6] move test case to tests/specs as NPM_CONFIG_REGISTRY is not set in js unit test --- .../run/resolve_dns_edns0/__test__.jsonc | 9 +++++ tests/specs/run/resolve_dns_edns0/test.out | 6 ++++ tests/specs/run/resolve_dns_edns0/test.ts | 36 +++++++++++++++++++ tests/unit/net_test.ts | 33 ----------------- 4 files changed, 51 insertions(+), 33 deletions(-) create mode 100644 tests/specs/run/resolve_dns_edns0/__test__.jsonc create mode 100644 tests/specs/run/resolve_dns_edns0/test.out create mode 100644 tests/specs/run/resolve_dns_edns0/test.ts diff --git a/tests/specs/run/resolve_dns_edns0/__test__.jsonc b/tests/specs/run/resolve_dns_edns0/__test__.jsonc new file mode 100644 index 0000000000..9124ee2593 --- /dev/null +++ b/tests/specs/run/resolve_dns_edns0/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "tests": { + "resolve_dns": { + "args": "test --allow-net=127.0.0.1 test.ts", + "output": "test.out", + "exitCode": 0 + } + } +} diff --git a/tests/specs/run/resolve_dns_edns0/test.out b/tests/specs/run/resolve_dns_edns0/test.out new file mode 100644 index 0000000000..6a1929401e --- /dev/null +++ b/tests/specs/run/resolve_dns_edns0/test.out @@ -0,0 +1,6 @@ +[WILDCARD] +running 1 test from ./test.ts +EDNS0 enabled ... ok ([WILDCARD]s) + +ok | 1 passed | 0 failed ([WILDCARD]s) + diff --git a/tests/specs/run/resolve_dns_edns0/test.ts b/tests/specs/run/resolve_dns_edns0/test.ts new file mode 100644 index 0000000000..070b4dbaeb --- /dev/null +++ b/tests/specs/run/resolve_dns_edns0/test.ts @@ -0,0 +1,36 @@ +// Copyright 2018-2025 the Deno authors. MIT license. +import dns2 from "npm:dns2@2.1.0"; + +Deno.test("EDNS0 enabled", async () => { + // With EDNS0 enabled, Deno.resolveDns can handle 44 A records. + const NUM_RECORD = 44; + const { Packet } = dns2; + const server = dns2.createServer({ + udp: true, + // deno-lint-ignore no-explicit-any + handle(request: any, send: any) { + const response = Packet.createResponseFromRequest(request); + const { name } = request.questions[0]; + for (const i of [...Array(NUM_RECORD).keys()]) { + response.answers.push({ + name, + type: Packet.TYPE.A, + class: Packet.CLASS.IN, + ttl: 300, + address: "1.2.3." + i, + }); + } + send(response); + }, + }); + const { udp: { port } } = await server.listen({ + udp: { port: 0, address: "127.0.0.1", type: "udp4" }, + }); + const addr = await Deno.resolveDns("example.com", "A", { + nameServer: { ipAddr: "127.0.0.1", port }, + }); + if (addr.length !== NUM_RECORD) { + throw new Error(`Expected ${NUM_RECORD} records, got ${addr.length}`); + } + await server.close(); +}); diff --git a/tests/unit/net_test.ts b/tests/unit/net_test.ts index c16bc1fdec..9c2819c30a 100644 --- a/tests/unit/net_test.ts +++ b/tests/unit/net_test.ts @@ -9,7 +9,6 @@ import { execCode2, tmpUnixSocketPath, } from "./test_util.ts"; -import dns2 from "npm:dns2@2.1.0"; // Since these tests may run in parallel, ensure this port is unique to this file const listenPort = 4503; @@ -1328,35 +1327,3 @@ Deno.test( // calling [Symbol.dispose] after manual close is a no-op }, ); - -Deno.test({ permissions: { net: true } }, async function resolveDnsEdns0() { - // With EDNS0 enabled, Deno.resolveDns can handle 44 A records. - const NUM_RECORD = 44; - const { Packet } = dns2; - const server = dns2.createServer({ - udp: true, - // deno-lint-ignore no-explicit-any - handle(request: any, send: any) { - const response = Packet.createResponseFromRequest(request); - const { name } = request.questions[0]; - for (const i of [...Array(NUM_RECORD).keys()]) { - response.answers.push({ - name, - type: Packet.TYPE.A, - class: Packet.CLASS.IN, - ttl: 300, - address: "1.2.3." + i, - }); - } - send(response); - }, - }); - const { udp: { port } } = await server.listen({ - udp: { port: 0, address: "127.0.0.1", type: "udp4" }, - }); - const addr = await Deno.resolveDns("example.com", "A", { - nameServer: { ipAddr: "127.0.0.1", port }, - }); - assertEquals(addr.length, NUM_RECORD); - await server.close(); -}); From 563e07df5461cb09d9358daecf5549f95bf9bc24 Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Mon, 20 Jan 2025 23:53:12 +0900 Subject: [PATCH 6/6] fix registry entry --- tests/registry/npm/dns2/registry.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/registry/npm/dns2/registry.json b/tests/registry/npm/dns2/registry.json index 875e7edc30..9397b42d39 100644 --- a/tests/registry/npm/dns2/registry.json +++ b/tests/registry/npm/dns2/registry.json @@ -47,7 +47,7 @@ "dist": { "integrity": "sha512-m27K11aQalRbmUs7RLaz6aPyceLjAoqjPRNTdE7qUouQpl+PC8Bi67O+i9SuJUPbQC8dxFrczAxfmTPuTKHNkw==", "shasum": "15b07567befb2b914aedbb55a9ea0862c63c3d73", - "tarball": "https://registry.npmjs.org/dns2/-/dns2-2.1.0.tgz", + "tarball": "http://localhost:4260/dns2/dns2-2.1.0.tgz", "fileCount": 37, "unpackedSize": 75538 },