aboutsummaryrefslogtreecommitdiffstats
path: root/package/utils/busybox
diff options
context:
space:
mode:
authorUwe Kleine-König <uwe@kleine-koenig.org>2022-10-14 12:23:07 +0200
committerChristian Marangi <ansuelsmth@gmail.com>2022-10-14 21:10:54 +0200
commitbc8e24c654050d7fcafd8d6f179bf1ffdf6045fa (patch)
treeec6b7a3b8c286522a9700be4065067cc3fe26798 /package/utils/busybox
parentf1de43d0a045a154c74281bc60bf1c44c990071b (diff)
downloadupstream-bc8e24c654050d7fcafd8d6f179bf1ffdf6045fa.tar.gz
upstream-bc8e24c654050d7fcafd8d6f179bf1ffdf6045fa.tar.bz2
upstream-bc8e24c654050d7fcafd8d6f179bf1ffdf6045fa.zip
busybox: nslookup: ensure unique transaction IDs for the DNS queries
On machines with a coarse monotonic clock (here: TP-Link RE200 powered by a MediaTek MT7620A) it can happen that the two DNS requests (for A and AAAA) share the same transaction ID. If this happens the second reply is wrongly dropped and nslookup reports "No answer". Fix this by ensuring that the transaction IDs are unique. Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org> (cherry picked from commit 63e5ba8e69f03a584b707520db0a0821eda3024f) Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Diffstat (limited to 'package/utils/busybox')
-rw-r--r--package/utils/busybox/patches/530-nslookup-ensure-unique-transaction-IDs-for-the-DNS-queries.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/package/utils/busybox/patches/530-nslookup-ensure-unique-transaction-IDs-for-the-DNS-queries.patch b/package/utils/busybox/patches/530-nslookup-ensure-unique-transaction-IDs-for-the-DNS-queries.patch
new file mode 100644
index 0000000000..caa5ee78f3
--- /dev/null
+++ b/package/utils/busybox/patches/530-nslookup-ensure-unique-transaction-IDs-for-the-DNS-queries.patch
@@ -0,0 +1,42 @@
+From: Uwe Kleine-König <uwe@kleine-koenig.org>
+Date: Sat, 8 Oct 2022 19:22:52 +0200
+Subject: [PATCH] nslookup: ensure unique transaction IDs for the DNS queries
+
+The transaction IDs generated by res_mkquery() for both glibc and musl only
+depends on the state of the monotonic clock.
+For some machines (here: a TP-Link RE200 powered by a MediaTek MT7620A)
+the monotonic clock has a coarse resolution (here: 20 µs) and it can happen
+that the requests for A and AAAA share the same transaction ID.
+
+In that case the mapping from received responses to the sent queries
+doesn't work and name resolution fails as follows:
+
+ # /bin/busybox nslookup heise.de
+ Server: 127.0.0.1
+ Address: 127.0.0.1:53
+
+ Non-authoritative answer:
+ Name: heise.de
+ Address: 193.99.144.80
+
+ *** Can't find heise.de: No answer
+
+because the AAAA reply is dropped as a duplicate reply to the A query.
+
+To prevent this make sure the transaction IDs are unique.
+
+Forwarded: http://lists.busybox.net/pipermail/busybox/2022-October/089911.html
+---
+--- a/networking/nslookup.c
++++ b/networking/nslookup.c
+@@ -978,6 +978,10 @@ int nslookup_main(int argc UNUSED_PARAM,
+ }
+ }
+
++ /* Ensure the Transaction IDs are unique */
++ for (rc = 1; rc < G.query_count; rc++)
++ G.query[rc].query[1] = G.query[rc - 1].query[1] + 1;
++
+ for (rc = 0; rc < G.serv_count;) {
+ int c;
+