Repository navigation
Accept tab-separated nameserver lines in resolv.conf - #7882
Open
johnkaram02 wants to merge 1 commit into
Open
johnkaram02 wants to merge 1 commit into
johnkaram02 wants to merge 1 commit into
Conversation
ResolvConf.GetServers split each line on spaces only, so a line such as "nameserver<TAB>10.0.0.1" produced a single token and the server was skipped. resolv.conf allows any white space between the keyword and its value, and the system resolver accepts tabs. Split on all white space so tab-separated entries are read.
Author
|
@dotnet-policy-service agree |
Collaborator
🎉 Good job! The coverage increased 🎉
Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1647322&view=codecoverage-tab |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7881
ResolvConf.GetServerssplit each/etc/resolv.confline on the space character only. A line such asnameserver<TAB>10.0.0.1became a single token, so that server was skipped without a warning. The resolv.conf format allows any white space between the keyword and its value, and the glibc resolver accepts tabs.This change splits on all white space, the same way
DiskStatsReadersplits/proclines in this repository.Changes
ResolvConf.GetServerssplits withArray.Empty<char>()instead of' '.ResolvConfTests.GetServers_TabSeparated, which reads threenameserverlines (tab, mixed, and space separated) and expects all three servers in order.Testing
dotnet test test/Libraries/Microsoft.Extensions.ServiceDiscovery.Dns.Tests -f net10.0GetServers_TabSeparatedfails: the result is[10.96.0.11:53, 10.96.0.12:53]and the tab-separated10.96.0.10:53is missing.Microsoft Reviewers: Open in CodeFlow