libnet: setupDNS: don't overwrite user-modified resolv.conf#51507
libnet: setupDNS: don't overwrite user-modified resolv.conf#51507robmry merged 3 commits intomoby:masterfrom
Conversation
d187d2c to
d039da2
Compare
a5dc7fc to
ce131f7
Compare
ce131f7 to
06522cc
Compare
06522cc to
aa97511
Compare
aa97511 to
5b41476
Compare
|
Can someone help me take a look? |
5b41476 to
a269852
Compare
a269852 to
8cd48c7
Compare
|
@akerouanton @thaJeztah moby/daemon/libnetwork/sandbox_dns_unix_test.go Lines 31 to 60 in 8cd48c7
It seems we still need some kind of flag to determine whether sandbox was created after a restart. 🤔 |
|
Looks like you're hitting this: moby/daemon/libnetwork/sandbox_dns_unix.go Lines 332 to 340 in 6e52828 Since the 2nd argument is an empty string, I'll discuss that TODO with @robmry to see if we can fix it. This would avoid the need to add a sandbox option to tell libnetwork whether it should consider the hash file. |
Thank you for the detailed feedback. |
When ep.needResolver() is true, sb.startResolver() calls sb.rebuildDNS() which doesn't update the resolv.conf hash file. Subsequent calls to sb.updateDNS() (which is only called by populateNetworkResourcesOS) won't have any effect since it'll compare the hash file and consider that the file was manually modified. Make this explicit by gating the call to updateDNS() on !needResolver(). Signed-off-by: Albin Kerouanton <[email protected]>
8cd48c7 to
7dc8ee2
Compare
|
@zhangguanzhang I went ahead and force-pushed your branch. It contains two new commits that address the TODO in CI should be green this time. |
Signed-off-by: Albin Kerouanton <[email protected]>
7dc8ee2 to
b148837
Compare
b148837 to
c1c9f29
Compare
robmry
left a comment
There was a problem hiding this comment.
Thank you - just a couple of comments on the tests ...
1218915 to
00246ea
Compare
Call resolvconf.UserModified() in sandbox.setupDNS() to check if resolv.conf was manually modified before regenerating it during container restart for non-host network modes. Signed-off-by: zhangguanzhang <[email protected]> Signed-off-by: Albin Kerouanton <[email protected]>
00246ea to
7639e19
Compare
|
Merged - thank you @zhangguanzhang. |
- What I did
When restarting containers with non-host networks,
sandbox.setupDNS()now callsresolvconf.UserModified()to check if resolv.conf was manually modified, preventing unintended overwrites.- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)
