Mdns minimal mode#89
Open
pemensik wants to merge 3 commits into
Open
Conversation
Attempt to make nss code more readable by moving some conditional stuff to separate functions. Reduces ifdefs inside the resolution functions. Use file path to signal when minimal or full variant is being compiled. Move file opening only after it has correct mode.
8684b7b to
cb00179
Compare
For .local domain mdns plugin behaved the same way as mdns_minimal, when configuration file were not present. Extend such behaviour to reverse queries as well. Because currently they are not changed by configuration, just add a check whether the config file is present in gethostbyaddr queries. That should allow to reduce used plugins to just non-minimal variants, which have minimal mode activated by not present config file. It adds single extra fopen compared to pure minimal plugins resolution call.
cb00179 to
eea9179
Compare
zdohnal
suggested changes
Aug 2, 2023
zdohnal
left a comment
There was a problem hiding this comment.
It would be great if the PR updated docs a little and adjusted function names to match the project.
| Unix/Linux applications check for IPv6 addresses first, followed by a | ||
| lookup for IPv4. | ||
| lookup for IPv4. When these plugins cannot open mdns.allow config file, | ||
| they will behave like minimal version below. |
There was a problem hiding this comment.
Mention the downside of having mdns.allow as well.
| /* Reverse addresses are not supported in config file. | ||
| * They just check if config is missing to enable minimal mode | ||
| * from non-minimal plugins. */ | ||
| static int avahi_is_file_present(const char *path) { |
There was a problem hiding this comment.
What about rather call it _nss_mdns_file_exists() and _nss_mdns_is_link_local() (and switch logic in the function to match the name) . They are static functions for this module with no relevance to avahi.
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.
After discussion on Fedora mailing list we have come to conclusion that non-minimal mdns plugin version might be sufficient, if it were able to mimick mdns_minimal version in case of missing or unreadable
/etc/mdns.allowfile. Handling of .local domain were already the same. This change improves readability a bit and does similar thing for reverse addresses lookups. Somdns4behaves exactly likemdns4_minimal, with an exception it tries to open /etc/mdns.allow first.