-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Support mDNS responder probing #84483
base: main
Are you sure you want to change the base?
Support mDNS responder probing #84483
Conversation
Ignore any EALREADY return code as that is not really an error in this case. Signed-off-by: Jukka Rissanen <[email protected]>
Feed the dispatcher context to dispatcher callbacks instead of resolver or responder context. The callback can then use the proper context because the dispatcher context contains those two context. This allows dispatcher callback to utilize all the information (like interface etc) stored in dispatcher context. Signed-off-by: Jukka Rissanen <[email protected]>
Introduce dns_resolve_name_internal() that allows resolving a name and not use DNS cache if caching is enabled. This is needed in mDNS probing (RFC 6762 chapter 8.1) which needs to send a mDNS query and not get any results from cache. Signed-off-by: Jukka Rissanen <[email protected]>
Allow user to specify socket service struct and port number so that DNS servers specified in Kconfig etc are not used. This way we can send a DNS query to arbitrary address without it affecting the system configuration. This is used in mDNS probing so that that mDNS responder can send probe message and not change / configure system global DNS config. Signed-off-by: Jukka Rissanen <[email protected]>
Do not set answer_offset if the offset would be outside of DNS message. Signed-off-by: Jukka Rissanen <[email protected]>
Make sure we have a compile test in CI for probing support. Signed-off-by: Jukka Rissanen <[email protected]>
The DNS_EAI_SYSTEM error value tells that the errno value contains the actual system error value. So set the errno properly when there is a system error. Signed-off-by: Jukka Rissanen <[email protected]>
Just ignore any EALREADY error returned when trying to register a DNS dispatcher. This could happen if trying to init things when the interface comes up and we have already initialized the dispatcher. Signed-off-by: Jukka Rissanen <[email protected]>
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.
Looks reasonalby so far, just one concern regarding connection manager use up for discussion.
uint32_t mgmt_event, struct net_if *iface) | ||
|
||
{ | ||
if (mgmt_event == NET_EVENT_L4_CONNECTED) { |
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.
I'm not sure if connection manager events are a good choice here, note that the events are not tightly bound to a specific interface, I. e. if there are for example two interfaces in the system, one remains up and running, and the other one toggles up and down, there will be no event triggered. And if I understand correctly, the second interface should send a probe whenever it changes its state. Perhaps sticking to NET_IF_UP/DOWN events would be a better choice here?
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 is just that if up/down is probably not good here because the network interface needs to have IP address before the probing can be done. Connection manager has these IPv6/IPv4 connected events, perhaps I could utilize those here.
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.
After some initial testing, the L4_IPVx_CONNECTED
is not good either as it is only triggered once. I will need to figure out something else for this, probably need to listen the IP address add signals and work from there.
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.
Maybe monitor NET_IF_UP/DOWN and IP_ADDR_ADD/REMOVE events, but check net_if_ipv4/6_get_global_addr()
and send probe only if it gives non-NULL result? Too bad we've dropped the idea of interface-specific connectivity events some time ago.
The mDNS probing is described in RFC 6762 chapter 8.1. The code will send an unsolicited mDNS query to network and will check if there are existing hosts with the same name. If there are, then the mDNS responder will not respond to queries it is configured to use. Signed-off-by: Jukka Rissanen <[email protected]>
After probing, send two unsolicited mDNS response messages for our name. Signed-off-by: Jukka Rissanen <[email protected]>
8a8904a
to
786b67a
Compare
|
The mDNS probing is described in RFC 6762 chapter 8.1. The code will send an unsolicited mDNS query to network and will check if there are existing hosts with the same name. If there are, then the mDNS responder will not respond to queries it is configured to use.