-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mdns minimal mode #89
base: master
Are you sure you want to change the base?
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great if the PR updated docs a little and adjusted function names to match the project.
@@ -78,14 +78,17 @@ addresses via mDNS, most people will want to use | |||
`libnss_mdns.so.2` or `libnss_mdns6.so.2` in such a | |||
situation causes long timeouts when resolving hosts since most modern | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.allow
file. Handling of .local domain were already the same. This change improves readability a bit and does similar thing for reverse addresses lookups. Somdns4
behaves exactly likemdns4_minimal
, with an exception it tries to open /etc/mdns.allow first.