int tc = p && !!(avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS) & AVAHI_DNS_FLAG_TC);
while ((r = avahi_record_list_next(s->record_list, &flush_cache, &unicast_response, &auxiliary))) {
-
- if (!avahi_interface_post_response(i, r, flush_cache, a, immediately || (flush_cache && !tc && !auxiliary)) && unicast_response) {
- append_aux_records_to_list(s, i, r, unicast_response);
-
+ int im = immediately;
+
+ /* Only send the response immediately if it contains a
+ * unique entry AND it is not in reply to a truncated
+ * packet AND it is not an auxiliary record AND all other
+ * responses for this record are unique too. */
+
+ if (flush_cache && !tc && !auxiliary && avahi_record_list_all_flush_cache(s->record_list))
+ im = 1;
+
+ if (!avahi_interface_post_response(i, r, flush_cache, a, im) && unicast_response) {
+
/* Due to some reasons the record has not been scheduled.
* The client requested an unicast response in that
* case. Therefore we prepare such a response */
+ append_aux_records_to_list(s, i, r, unicast_response);
+
for (;;) {
if (!reply) {
for (j = s->monitor->interfaces; j; j = j->interface_next)
if (j != i && (s->config.reflect_ipv || j->protocol == i->protocol)) {
/* Post the query to other networks */
- avahi_interface_post_query(j, k, 1);
+ avahi_interface_post_query(j, k, 1, NULL);
/* Reply from caches of other network. This is needed to
* "work around" known answer suppression. */
/* Fill in HINFO rr */
if ((r = avahi_record_new_full(s->host_name_fqdn, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_HINFO, AVAHI_DEFAULT_TTL_HOST_NAME))) {
- uname(&utsname);
- r->data.hinfo.cpu = avahi_strdup(avahi_strup(utsname.machine));
- r->data.hinfo.os = avahi_strdup(avahi_strup(utsname.sysname));
- if (avahi_server_add(s, s->hinfo_entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_PUBLISH_UNIQUE, r) < 0) {
- avahi_log_warn("Failed to add HINFO RR: %s", avahi_strerror(s->error));
- return;
+ if (uname(&utsname) < 0)
+ avahi_log_warn("uname() failed: %s\n", avahi_strerror(errno));
+ else {
+
+ r->data.hinfo.cpu = avahi_strdup(avahi_strup(utsname.machine));
+ r->data.hinfo.os = avahi_strdup(avahi_strup(utsname.sysname));
+
+ avahi_log_info("Registering HINFO record with values '%s'/'%s'.", r->data.hinfo.cpu, r->data.hinfo.os);
+
+ if (avahi_server_add(s, s->hinfo_entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_PUBLISH_UNIQUE, r) < 0) {
+ avahi_log_warn("Failed to add HINFO RR: %s", avahi_strerror(s->error));
+ return;
+ }
}
avahi_record_unref(r);