Support specifying instance name in JSON file So far we were using host label as the instance name for every service. This change allows specifying it manually and fallbacks to the label for backward compatibility. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Acked-by: John Crispin <john@phrozen.org>
Support PTR queries for a specific service We should check if queried name starts with a _ to see if it is about a specific service + domain. Fixes: 70c66fbbcde86 ("Fix sending replies to PTR questions") Reported-by: Cristian Morales Vega <cristian@samknows.com> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Rename mdns_hostname variable to the umdns_host_label In the whole RFC 6762 document "host name" means a fully qualified domain name. The value we store in this variable is just a first label of the name so rename it properly to make the code just a bit easier to follow. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Keep source sockaddr for every cached DNS record This will be required for sending questions on TTL timeouts. When that happens we want to send unicast question but it's currently broken as we don't know original IP address. This change stores whole sockaddr (using struct sockaddr_storage). In theory it'd be sufficient to store struct in_addr or struct in6_addr but 1) There isn't helper struct for storing IP version agnostic address 2) interface_send_packet already expects struct sockaddr It hopefully won't hurt memory usage that bad to store a bit more info. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Fix replying to "QU" questions received on unicast interface We may receive questions on unicast interface, e.g. when another client is refreshing its entries. "QU" questions are "questions requesting unicast responses" which means we should obviously send unicast replies. Old code wasn't setting "to" variable correctly so IP address wasn't passed back to the interface layer. It means replies were never sent. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Fix refreshing cached A(AAA) records that expire Old code was trying to refresh record after it has already expired. Now it tries after 50% of TTL has passed - we do the same for other records. Fixes: 80dd24602480 ("Refresh DNS records A and AAAA directly") Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Acked-by: John Crispin <john@phrozen.org>