diff options
| author | Chaitanya Vadrevu <chaitanya.vadrevu@ni.com> | 2023-11-08 12:23:50 -0600 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2023-11-28 05:00:32 -1000 |
| commit | f19d7f427e44cc1018759bd0f9d86f984b6d6a98 (patch) | |
| tree | 9b687a5494661ec4d0cdbc82453ca7446b47140a | |
| parent | c8fa08b01cb32fc643fbd194a6dd967b41ab4e04 (diff) | |
| download | poky-f19d7f427e44cc1018759bd0f9d86f984b6d6a98.tar.gz | |
go: Fix issue in DNS resolver
This change adds a patch that is a partial backport of an upstream
commit[1].
It fixes a bug in go's DNS resolver that was causing a docker issue
where the first "docker pull" always fails after system boot if docker
daemon is started before networking is completely up.
[1] https://github.com/golang/go/commit/d52883f443e1d564b0300acdd382af1769bf0477
(From OE-Core rev: 8c8b01e84844a7e721c668d5ffbc7161e67f0862)
Signed-off-by: Chaitanya Vadrevu <chaitanya.vadrevu@ni.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
| -rw-r--r-- | meta/recipes-devtools/go/go-1.17.13.inc | 1 | ||||
| -rw-r--r-- | meta/recipes-devtools/go/go-1.20/0010-net-Fix-issue-with-DNS-not-being-updated.patch | 51 |
2 files changed, 52 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-1.17.13.inc b/meta/recipes-devtools/go/go-1.17.13.inc index a0974629fb..330f571d22 100644 --- a/meta/recipes-devtools/go/go-1.17.13.inc +++ b/meta/recipes-devtools/go/go-1.17.13.inc | |||
| @@ -16,6 +16,7 @@ SRC_URI += "\ | |||
| 16 | file://0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch \ | 16 | file://0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch \ |
| 17 | file://0001-exec.go-do-not-write-linker-flags-into-buildids.patch \ | 17 | file://0001-exec.go-do-not-write-linker-flags-into-buildids.patch \ |
| 18 | file://0001-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch \ | 18 | file://0001-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch \ |
| 19 | file://0010-net-Fix-issue-with-DNS-not-being-updated.patch \ | ||
| 19 | file://CVE-2022-27664.patch \ | 20 | file://CVE-2022-27664.patch \ |
| 20 | file://0001-net-http-httputil-avoid-query-parameter-smuggling.patch \ | 21 | file://0001-net-http-httputil-avoid-query-parameter-smuggling.patch \ |
| 21 | file://CVE-2022-41715.patch \ | 22 | file://CVE-2022-41715.patch \ |
diff --git a/meta/recipes-devtools/go/go-1.20/0010-net-Fix-issue-with-DNS-not-being-updated.patch b/meta/recipes-devtools/go/go-1.20/0010-net-Fix-issue-with-DNS-not-being-updated.patch new file mode 100644 index 0000000000..6ead518843 --- /dev/null +++ b/meta/recipes-devtools/go/go-1.20/0010-net-Fix-issue-with-DNS-not-being-updated.patch | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | From 20176b390e28daa86b4552965cb7bd9181983c4d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Chaitanya Vadrevu <chaitanya.vadrevu@ni.com> | ||
| 3 | Date: Mon, 6 Nov 2023 20:11:19 -0600 | ||
| 4 | Subject: [PATCH] net: Fix issue with DNS not being updated | ||
| 5 | |||
| 6 | When dns requests are made, go's native DNS resolver only reads | ||
| 7 | /etc/resolv.conf if the previous request is older than 5 seconds. | ||
| 8 | |||
| 9 | On first network call, an initialization code runs that is | ||
| 10 | supposed to initialize DNS data and set lastChecked time. There is a bug | ||
| 11 | in this code that causes /etc/resolv.conf to not be read during | ||
| 12 | initialization and the DNS data from program startup ends up being used | ||
| 13 | until the next 5 seconds. This means that if /etc/resolv.conf changed | ||
| 14 | between program startup and the first network call, old DNS data is | ||
| 15 | still used until the next 5 seconds. | ||
| 16 | |||
| 17 | This causes "docker pull" to fail the first time if docker daemon is | ||
| 18 | started before networking is up. | ||
| 19 | |||
| 20 | Upstream commit d52883f443e1d564b0300acdd382af1769bf0477 made lot of | ||
| 21 | improvements to DNS resolver to fix some issues which also fixes this | ||
| 22 | issue. | ||
| 23 | This patch picks the relevant changes from it to fix this particular | ||
| 24 | issue. | ||
| 25 | |||
| 26 | Upstream-Status: Backport [https://github.com/golang/go/commit/d52883f443e1d564b0300acdd382af1769bf0477] | ||
| 27 | |||
| 28 | Signed-off-by: Chaitanya Vadrevu <chaitanya.vadrevu@ni.com> | ||
| 29 | --- | ||
| 30 | src/net/dnsclient_unix.go | 5 +---- | ||
| 31 | 1 file changed, 1 insertion(+), 4 deletions(-) | ||
| 32 | |||
| 33 | diff --git a/src/net/dnsclient_unix.go b/src/net/dnsclient_unix.go | ||
| 34 | index 6dfd4af..520ffe6 100644 | ||
| 35 | --- a/src/net/dnsclient_unix.go | ||
| 36 | +++ b/src/net/dnsclient_unix.go | ||
| 37 | @@ -337,10 +337,7 @@ var resolvConf resolverConfig | ||
| 38 | func (conf *resolverConfig) init() { | ||
| 39 | // Set dnsConfig and lastChecked so we don't parse | ||
| 40 | // resolv.conf twice the first time. | ||
| 41 | - conf.dnsConfig = systemConf().resolv | ||
| 42 | - if conf.dnsConfig == nil { | ||
| 43 | - conf.dnsConfig = dnsReadConfig("/etc/resolv.conf") | ||
| 44 | - } | ||
| 45 | + conf.dnsConfig = dnsReadConfig("/etc/resolv.conf") | ||
| 46 | conf.lastChecked = time.Now() | ||
| 47 | |||
| 48 | // Prepare ch so that only one update of resolverConfig may | ||
| 49 | -- | ||
| 50 | 2.34.1 | ||
| 51 | |||
