Skip to content
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

Debian #751288: Avahi-daemon is noisy #10

Closed
lathiat opened this issue Jul 30, 2015 · 9 comments
Closed

Debian #751288: Avahi-daemon is noisy #10

lathiat opened this issue Jul 30, 2015 · 9 comments

Comments

@lathiat
Copy link
Contributor

lathiat commented Jul 30, 2015

Package: avahi-daemon
Version: 0.6.31-4

Avahi-daemon fills my logs with

Jun 11 07:38:57 lanthane avahi-daemon[2502]: Invalid response packet from host 172.23.36.97.
Jun 11 07:39:56 lanthane avahi-daemon[2502]: Invalid response packet from host 172.23.43.78.
Jun 11 07:39:56 lanthane avahi-daemon[2502]: Invalid response packet from host 172.23.36.97.

This will become a big problem as apparently Windows 10 causes this.

See also https://bugs.launchpad.net/ubuntu/+source/avahi/+bug/1342400
which references a patch that would help (haven't tested it myself yet,
may do today).

Maybe this bug needs to be merged with #639163
(which is already merged with #688061, although IMHO that's a different
problem).

Paul

@jmaggard10
Copy link

The patch in that bug deals with OSX mDNS response packets that include Additional RRs, but do not include Answer RRs.

Windows 10 does something different. It sends responses to all mDNS queries, whether or not it has any records for those requests. That is, it responds with a mDNS packet containing 0 Answer RRs and 0 Additional RRs. This appears to me to be in violation of RFC 6762 (Multicast DNS) Section 6, which states "A Multicast DNS responder MUST only respond when it has a positive, non-null response to send, or it authoritatively knows that a particular record does not exist." I don't know how to file a bug with Microsoft, but IMHO this should probably be addressed on their side.

@jmaggard10
Copy link

Maybe something like this makes sense?

diff --git a/avahi-core/server.c b/avahi-core/server.c
index e87f035..18b1c84 100644
--- a/avahi-core/server.c
+++ b/avahi-core/server.c
@@ -972,8 +972,14 @@ static void dispatch_packet(AvahiServer *s, AvahiDnsPacket *p, const AvahiAddres
             return;
         }

+        if (avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ANCOUNT) == 0 &&
+            avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ARCOUNT) == 0) {
+
+            avahi_log_debug("Received empty response packet from host %s.", avahi_address_snprint(t, sizeof(t), src_address));
+            return;
+        }
+
         if (avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_QDCOUNT) != 0 ||
-            avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ANCOUNT) == 0 ||
             avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_NSCOUNT) != 0) {

             avahi_log_warn("Invalid response packet from host %s.", avahi_address_snprint(t, sizeof(t), src_address));

@jgkamat
Copy link

jgkamat commented Oct 1, 2015

Is this eventually going to be fixed? This has become a huge problem on the network I am on...

@StuntsPT
Copy link

StuntsPT commented Oct 7, 2015

I second that.
My logs are getting hammered with 20+ of these lines per second...

@da2x
Copy link

da2x commented Oct 9, 2015

Steps to reproduce in Windows 10:

  1. Open Settings app: Devices: Printers and scanners
  2. Click Add printers and scanners

Trivia: mDNS is used by printer network stack, and the API is also exposed to WinJS apps (JavaScript based “modern” apps) only. Also available on Windows 10 Mobile.

@lathiat lathiat closed this as completed in de7cde8 Oct 9, 2015
@bcomnes
Copy link

bcomnes commented Oct 10, 2015

Yay! Thanks for solving this long running issue! Any ideas when it will make it into a release?

@da2x
Copy link

da2x commented Oct 10, 2015

@bcomnes check the project website at http://avahi.org/

@da2x
Copy link

da2x commented Oct 21, 2015

The bug have also been fixed in the latest Windows Insider build. No idea when this stuff will roll out to regular Windows 10 users.

Update: Fix should have been deployed to all users on Windows Update now.

@bcomnes
Copy link

bcomnes commented Oct 22, 2015

As I still have windows 7-8 systems on the networks I'm still happy to see this fixed :). Journalctl will be a lot less noisy

evverx referenced this issue in evverx/avahi Oct 22, 2023
It fixes the crash spotted
avahi#490 (comment).
The fuzz target was updated to exercise those code paths (among other
things). Without this commit it crashes with
```
fuzz-consume-record: malloc.c:250: void *avahi_memdup(const void *, size_t): Assertion `s' failed.
==72869== ERROR: libFuzzer: deadly signal
    #0 0x5031b5 in __sanitizer_print_stack_trace (avahi/out/fuzz-consume-record+0x5031b5) (BuildId: 69840d811c9ba9f74eea21e34786a2005c5dcc06)
    #1 0x45cd6c in fuzzer::PrintStackTrace() (avahi/out/fuzz-consume-record+0x45cd6c) (BuildId: 69840d811c9ba9f74eea21e34786a2005c5dcc06)
    #2 0x441c47 in fuzzer::Fuzzer::CrashCallback() (out/fuzz-consume-record+0x441c47) (BuildId: 69840d811c9ba9f74eea21e34786a2005c5dcc06)
    #3 0x7f189e97ebaf  (/lib64/libc.so.6+0x3dbaf) (BuildId: 3ebe8d97a0ed3e1f13476a02665c5a9442adcd78)
    #4 0x7f189e9cf883 in __pthread_kill_implementation (/lib64/libc.so.6+0x8e883) (BuildId: 3ebe8d97a0ed3e1f13476a02665c5a9442adcd78)
    #5 0x7f189e97eafd in gsignal (/lib64/libc.so.6+0x3dafd) (BuildId: 3ebe8d97a0ed3e1f13476a02665c5a9442adcd78)
    #6 0x7f189e96787e in abort (/lib64/libc.so.6+0x2687e) (BuildId: 3ebe8d97a0ed3e1f13476a02665c5a9442adcd78)
    #7 0x7f189e96779a in __assert_fail_base.cold (/lib64/libc.so.6+0x2679a) (BuildId: 3ebe8d97a0ed3e1f13476a02665c5a9442adcd78)
    #8 0x7f189e977186 in __assert_fail (/lib64/libc.so.6+0x36186) (BuildId: 3ebe8d97a0ed3e1f13476a02665c5a9442adcd78)
    #9 0x557bfc in avahi_memdup avahi/avahi-common/malloc.c:250:5
    #10 0x54895c in avahi_record_copy avahi/avahi-core/rr.c:469:45
```
evverx referenced this issue in evverx/avahi Jan 27, 2024
When avahi-daemon fails under ASan/UBSan the tests trying to reach it
via D-Bus start to fail too with cryptic error messages and without ASan
reports it's hard to tell what exactly fails.

This patch is prompted by avahi#551 where
the smoke test failed with
```
** (process:23892): WARNING **: 10:26:43.529: Error initializing Avahi: Daemon not running
glib-integration: client.c:626: void avahi_client_free(AvahiClient *): Assertion `client' failed.
```
without any way to figure out what went wrong.

With this patch applied the following backtrace would have been shown:
```
avahi-daemon[23694]: browse.c: Found CNAME loop on interface 2, proto 1, query cname0.local        IN        AAAA
avahi-daemon[23694]: browse.c: Found CNAME loop on interface 2, proto 1, query cname0.local        IN        AAAA
avahi-daemon[23694]: =================================================================
avahi-daemon[23694]: ==23694==ERROR: AddressSanitizer: heap-use-after-free on address 0x60b000000f70 at pc 0x7f5aac154542 bp 0x7ffe59141be0 sp 0x7ffe59141bd8
avahi-daemon[23694]: READ of size 4 at 0x60b000000f70 thread T0
avahi-daemon[23694]:     #0 0x7f5aac154541 in lookup_multicast_callback /home/runner/work/avahi/avahi/avahi-core/browse.c:268:12
avahi-daemon[23694]:     #1 0x7f5aac1bfa0a in avahi_multicast_lookup_engine_notify /home/runner/work/avahi/avahi/avahi-core/multicast-lookup.c:317:21
avahi-daemon[23694]:     #2 0x7f5aac115808 in avahi_cache_update /home/runner/work/avahi/avahi/avahi-core/cache.c:363:13
avahi-daemon[23694]:     #3 0x7f5aac0e9621 in handle_response_packet /home/runner/work/avahi/avahi/avahi-core/server.c:720:21
avahi-daemon[23694]:     #4 0x7f5aac0e3cf6 in dispatch_packet /home/runner/work/avahi/avahi/avahi-core/server.c:1032:9
avahi-daemon[23694]:     #5 0x7f5aac0e2116 in mcast_socket_event /home/runner/work/avahi/avahi/avahi-core/server.c:1093:13
avahi-daemon[23694]:     #6 0x7f5aac464b6c in avahi_simple_poll_dispatch /home/runner/work/avahi/avahi/avahi-common/simple-watch.c:585:13
avahi-daemon[23694]:     #7 0x7f5aac4651a8 in avahi_simple_poll_iterate /home/runner/work/avahi/avahi/avahi-common/simple-watch.c:605:14
avahi-daemon[23694]:     #8 0x5592a3ed3884 in run_server /home/runner/work/avahi/avahi/avahi-daemon/main.c:1279:18
avahi-daemon[23694]:     #9 0x5592a3ec4132 in main /home/runner/work/avahi/avahi/avahi-daemon/main.c:1708:13
avahi-daemon[23694]:     #10 0x7f5aabc29d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
avahi-daemon[23694]:     #11 0x7f5aabc29e3f in __libc_start_main csu/../csu/libc-start.c:392:3
avahi-daemon[23694]:     #12 0x5592a3e05054 in _start (/usr/sbin/avahi-daemon+0x71054) (BuildId: 0aa9e5ea43ef010d5f42e9109eabd1434ff1b3db)
...
```
evverx referenced this issue in evverx/avahi Jan 27, 2024
When avahi-daemon fails under ASan/UBSan the tests trying to reach it
via D-Bus start to fail too with cryptic error messages and without ASan
reports it's hard to tell what exactly fails.

This patch is prompted by avahi#551 where
the smoke test failed with
```
** (process:23892): WARNING **: 10:26:43.529: Error initializing Avahi: Daemon not running
glib-integration: client.c:626: void avahi_client_free(AvahiClient *): Assertion `client' failed.
```
without any way to figure out what went wrong.

With this patch applied the following backtrace would have been shown:
```
avahi-daemon[23694]: browse.c: Found CNAME loop on interface 2, proto 1, query cname0.local        IN        AAAA
avahi-daemon[23694]: browse.c: Found CNAME loop on interface 2, proto 1, query cname0.local        IN        AAAA
avahi-daemon[23694]: =================================================================
avahi-daemon[23694]: ==23694==ERROR: AddressSanitizer: heap-use-after-free on address 0x60b000000f70 at pc 0x7f5aac154542 bp 0x7ffe59141be0 sp 0x7ffe59141bd8
avahi-daemon[23694]: READ of size 4 at 0x60b000000f70 thread T0
avahi-daemon[23694]:     #0 0x7f5aac154541 in lookup_multicast_callback /home/runner/work/avahi/avahi/avahi-core/browse.c:268:12
avahi-daemon[23694]:     #1 0x7f5aac1bfa0a in avahi_multicast_lookup_engine_notify /home/runner/work/avahi/avahi/avahi-core/multicast-lookup.c:317:21
avahi-daemon[23694]:     #2 0x7f5aac115808 in avahi_cache_update /home/runner/work/avahi/avahi/avahi-core/cache.c:363:13
avahi-daemon[23694]:     #3 0x7f5aac0e9621 in handle_response_packet /home/runner/work/avahi/avahi/avahi-core/server.c:720:21
avahi-daemon[23694]:     #4 0x7f5aac0e3cf6 in dispatch_packet /home/runner/work/avahi/avahi/avahi-core/server.c:1032:9
avahi-daemon[23694]:     #5 0x7f5aac0e2116 in mcast_socket_event /home/runner/work/avahi/avahi/avahi-core/server.c:1093:13
avahi-daemon[23694]:     #6 0x7f5aac464b6c in avahi_simple_poll_dispatch /home/runner/work/avahi/avahi/avahi-common/simple-watch.c:585:13
avahi-daemon[23694]:     #7 0x7f5aac4651a8 in avahi_simple_poll_iterate /home/runner/work/avahi/avahi/avahi-common/simple-watch.c:605:14
avahi-daemon[23694]:     #8 0x5592a3ed3884 in run_server /home/runner/work/avahi/avahi/avahi-daemon/main.c:1279:18
avahi-daemon[23694]:     #9 0x5592a3ec4132 in main /home/runner/work/avahi/avahi/avahi-daemon/main.c:1708:13
avahi-daemon[23694]:     #10 0x7f5aabc29d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
avahi-daemon[23694]:     #11 0x7f5aabc29e3f in __libc_start_main csu/../csu/libc-start.c:392:3
avahi-daemon[23694]:     #12 0x5592a3e05054 in _start (/usr/sbin/avahi-daemon+0x71054) (BuildId: 0aa9e5ea43ef010d5f42e9109eabd1434ff1b3db)
...
```
evverx added a commit that referenced this issue Jan 27, 2024
When avahi-daemon fails under ASan/UBSan the tests trying to reach it
via D-Bus start to fail too with cryptic error messages and without ASan
reports it's hard to tell what exactly fails.

This patch is prompted by #551 where
the smoke test failed with
```
** (process:23892): WARNING **: 10:26:43.529: Error initializing Avahi: Daemon not running
glib-integration: client.c:626: void avahi_client_free(AvahiClient *): Assertion `client' failed.
```
without any way to figure out what went wrong.

With this patch applied the following backtrace would have been shown:
```
avahi-daemon[23694]: browse.c: Found CNAME loop on interface 2, proto 1, query cname0.local        IN        AAAA
avahi-daemon[23694]: browse.c: Found CNAME loop on interface 2, proto 1, query cname0.local        IN        AAAA
avahi-daemon[23694]: =================================================================
avahi-daemon[23694]: ==23694==ERROR: AddressSanitizer: heap-use-after-free on address 0x60b000000f70 at pc 0x7f5aac154542 bp 0x7ffe59141be0 sp 0x7ffe59141bd8
avahi-daemon[23694]: READ of size 4 at 0x60b000000f70 thread T0
avahi-daemon[23694]:     #0 0x7f5aac154541 in lookup_multicast_callback /home/runner/work/avahi/avahi/avahi-core/browse.c:268:12
avahi-daemon[23694]:     #1 0x7f5aac1bfa0a in avahi_multicast_lookup_engine_notify /home/runner/work/avahi/avahi/avahi-core/multicast-lookup.c:317:21
avahi-daemon[23694]:     #2 0x7f5aac115808 in avahi_cache_update /home/runner/work/avahi/avahi/avahi-core/cache.c:363:13
avahi-daemon[23694]:     #3 0x7f5aac0e9621 in handle_response_packet /home/runner/work/avahi/avahi/avahi-core/server.c:720:21
avahi-daemon[23694]:     #4 0x7f5aac0e3cf6 in dispatch_packet /home/runner/work/avahi/avahi/avahi-core/server.c:1032:9
avahi-daemon[23694]:     #5 0x7f5aac0e2116 in mcast_socket_event /home/runner/work/avahi/avahi/avahi-core/server.c:1093:13
avahi-daemon[23694]:     #6 0x7f5aac464b6c in avahi_simple_poll_dispatch /home/runner/work/avahi/avahi/avahi-common/simple-watch.c:585:13
avahi-daemon[23694]:     #7 0x7f5aac4651a8 in avahi_simple_poll_iterate /home/runner/work/avahi/avahi/avahi-common/simple-watch.c:605:14
avahi-daemon[23694]:     #8 0x5592a3ed3884 in run_server /home/runner/work/avahi/avahi/avahi-daemon/main.c:1279:18
avahi-daemon[23694]:     #9 0x5592a3ec4132 in main /home/runner/work/avahi/avahi/avahi-daemon/main.c:1708:13
avahi-daemon[23694]:     #10 0x7f5aabc29d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
avahi-daemon[23694]:     #11 0x7f5aabc29e3f in __libc_start_main csu/../csu/libc-start.c:392:3
avahi-daemon[23694]:     #12 0x5592a3e05054 in _start (/usr/sbin/avahi-daemon+0x71054) (BuildId: 0aa9e5ea43ef010d5f42e9109eabd1434ff1b3db)
...
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants