Revert "libnet: setupDNS: don't overwrite user-modified resolv.conf"#51615
Revert "libnet: setupDNS: don't overwrite user-modified resolv.conf"#51615thaJeztah merged 3 commits intomoby:masterfrom
Conversation
This reverts commit 7639e19. Signed-off-by: Albin Kerouanton <[email protected]>
This reverts commit eb18b39. Signed-off-by: Albin Kerouanton <[email protected]>
…solver" This reverts commit 937246a. Signed-off-by: Albin Kerouanton <[email protected]>
|
@akerouanton is it planed to add an regression test for this? |
|
@b-reich We don't have a proper way to write regression tests for upgrades unfortunately. But yeah, we talked about that and it's not the first time we missed that capability. We'd like to add it eventually. At least, with this PR we're going back to a known-good state. |
I rolled back the code and tested the above steps, and found that it works normally. Are there any other steps that can be reproduced? |
Hi @zhangguanzhang - I'm not sure whether you're asking about verifying the revert, or reproducing the issue? But, to repro the issue (in 29.1.0, without the revert) ... it's enough to create a container on a user-defined network, modify its |
Thanks for the answer. So, if you're only using version 29.1.0 to reproduce the issue, you can use the following steps: |
- What I did
On upgrade to v29.1.0, the Engine would consider that containers'
/etc/resolv.confwere user-modified because hash files were out-of-sync with file contents written by a prior Engine version. This was caused bysb.rebuildDNS()never updating the hash file along with the file content.In #51507, we fixed that (see commit eb18b39), and we added an extra check in
sb.setupDNS()to ensure that user-modified/etc/resolv.confaren't overwritten.But, when a new Sandbox is created (as when a container is restarted),
sb.setupDNS()is called first to copy the host's/etc/resolv.confinto the sandbox, and thensb.rebuildDNS()is used to setnameserver 127.0.0.11and extract the list of upstream nameservers that should be configured on the embedded DNS server.Prior to v29.1.0,
sb.setupDNS()was called unconditionally — ensuring the/etc/resolv.confand its hash file were in sync. Then,sb.rebuildDNS()would be called and always proceed — extracting the list of upstream nameservers.With v29.1.0,
sb.setupDNS()is skipped because of the out-of-sync hash file, which causessb.rebuildDNS()to be skipped too, and the list of upstream nameservers to never be extracted.Revert the whole PR.
- How to verify it
Both
digshould work properly:- Human readable description for the release notes