openwrt/package/utils/busybox/patches/530-nslookup-ensure-unique-transaction-IDs-for-the-DNS-queries.patch

43 lines
1.4 KiB
Diff
Raw Normal View History

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
busybox: update to 1.37.0 Add a patch to fix non-x86 builds, refresh patches and update/fix the configuration as described in 98b09ba250 (cited here for future reference). Config refresh: Refresh commands, run after busybox is first built once: cd package/utils/busybox/config/ ../convert_menuconfig.pl ../../../../build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/busybox-default/busybox-1.37.0 cd .. ./convert_defaults.pl ../../../build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/busybox-default/busybox-1.37.0/.config > Config-defaults.in Manual edits needed after config refresh: * Config-defaults.in: OpenWrt config symbol IPV6 logic applied to BUSYBOX_DEFAULT_FEATURE_IPV6 * Config-defaults.in: OpenWrt config TARGET_bcm53xx logic applied to BUSYBOX_DEFAULT_TRUNCATE (commit 547f1ec) * Config-defaults.in: OpenWrt logic applied to BUSYBOX_DEFAULT_LOGIN_SESSION_AS_CHILD (commit dc92917) * Config-defaults.in: correct the default ports that get reset BUSYBOX_DEFAULT_FEATURE_HTTPD_PORT_DEFAULT 80 BUSYBOX_DEFAULT_FEATURE_TELNETD_PORT_DEFAULT 23 * config/editors/Config.in: Add USE_GLIBC dependency to BUSYBOX_CONFIG_FEATURE_VI_REGEX_SEARCH (commit f141090) * config/shell/Config.in: change at "Options common to all shells" the conditional symbol SHELL_ASH --> BUSYBOX_CONFIG_SHELL_ASH (discussion in http://lists.openwrt.org/pipermail/openwrt-devel/2021-January/033140.html Apparently our script does not see the hidden option while prepending config options with "BUSYBOX_CONFIG_" which leads to a missed dependency when the options are later evaluated.) * Edit a few Config.in files by adding quotes to sourced items in config/Config.in, config/networking/Config.in and config/util-linux/Config.in (commit 1da014fcca) Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com> [rebased with the change download line commit] [corrected version in the refresh example in commit message] Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi> Link: https://github.com/openwrt/openwrt/pull/17107 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2024-11-28 18:41:37 +00:00
@@ -1370,6 +1370,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;