aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/avahi/files/0001-Don-t-log-warnings-about-invalid-packets-Fixes-lathi.patch
blob: 25a0a0e40fd0dc9f2c338763eeb6f8001f5d1389 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
From de7cde877e4daa5d9d4fb5b1a349299eaa94969d Mon Sep 17 00:00:00 2001
From: Trent Lloyd <trent@lloyd.id.au>
Date: Sat, 10 Oct 2015 06:20:46 +0800
Subject: [PATCH] Don't log warnings about invalid packets (Fixes
 lathiat/avahi#10)

Various invalid packets would generate a warning, in particular
Windows 10 generates response packets with no answer records and
generally seemingly empty.  Unsure why at this stage.

This results in spamming syslog quite a lot on busy networks,
similar issues like this have occured over time due to changes
in various operating systems and specs (e.g. Avahi #284, #282)

Rather than just disable this single message or case, I have
pre-emptively turned the majority of these bad packet messages
into debug messages.  They can still be output on production
builds if reuqired using the --debug option (no rebuild required).

External References:
https://bugs.launchpad.net/ubuntu/+source/avahi/+bug/1342400
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=794145
https://bugzilla.redhat.com/show_bug.cgi?id=1240711

Pulled from git://github.com/lathiat/avahi de7cde87, which
is slated for avahi 0.6.32.

Signed-off-by: Brad Mouring <brad.mouring@ni.com>
Upstream-Status: Backport

---
 avahi-core/server.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/avahi-core/server.c b/avahi-core/server.c
index e87f035..a2cb19a 100644
--- a/avahi-core/server.c
+++ b/avahi-core/server.c
@@ -587,7 +587,7 @@ static void handle_query_packet(AvahiServer *s, AvahiDnsPacket *p, AvahiInterfac
         int unicast_response = 0;
 
         if (!(key = avahi_dns_packet_consume_key(p, &unicast_response))) {
-            avahi_log_warn(__FILE__": Packet too short or invalid while reading question key. (Maybe a UTF-8 problem?)");
+            avahi_log_debug(__FILE__": Packet too short or invalid while reading question key. (Maybe a UTF-8 problem?)");
             goto fail;
         }
 
@@ -615,7 +615,7 @@ static void handle_query_packet(AvahiServer *s, AvahiDnsPacket *p, AvahiInterfac
             int unique = 0;
 
             if (!(record = avahi_dns_packet_consume_record(p, &unique))) {
-                avahi_log_warn(__FILE__": Packet too short or invalid while reading known answer record. (Maybe a UTF-8 problem?)");
+                avahi_log_debug(__FILE__": Packet too short or invalid while reading known answer record. (Maybe a UTF-8 problem?)");
                 goto fail;
             }
 
@@ -632,7 +632,7 @@ static void handle_query_packet(AvahiServer *s, AvahiDnsPacket *p, AvahiInterfac
             int unique = 0;
 
             if (!(record = avahi_dns_packet_consume_record(p, &unique))) {
-                avahi_log_warn(__FILE__": Packet too short or invalid while reading probe record. (Maybe a UTF-8 problem?)");
+                avahi_log_debug(__FILE__": Packet too short or invalid while reading probe record. (Maybe a UTF-8 problem?)");
                 goto fail;
             }
 
@@ -669,7 +669,7 @@ static void handle_response_packet(AvahiServer *s, AvahiDnsPacket *p, AvahiInter
         int cache_flush = 0;
 
         if (!(record = avahi_dns_packet_consume_record(p, &cache_flush))) {
-            avahi_log_warn(__FILE__": Packet too short or invalid while reading response record. (Maybe a UTF-8 problem?)");
+            avahi_log_debug(__FILE__": Packet too short or invalid while reading response record. (Maybe a UTF-8 problem?)");
             break;
         }
 
@@ -901,13 +901,13 @@ static void dispatch_packet(AvahiServer *s, AvahiDnsPacket *p, const AvahiAddres
 
     if (!(i = avahi_interface_monitor_get_interface(s->monitor, iface, src_address->proto)) ||
         !i->announcing) {
-        avahi_log_warn("Received packet from invalid interface.");
+        avahi_log_debug("Received packet from invalid interface.");
         return;
     }
 
     if (port <= 0) {
         /* This fixes RHBZ #475394 */
-        avahi_log_warn("Received packet from invalid source port %u.", (unsigned) port);
+        avahi_log_debug("Received packet from invalid source port %u.", (unsigned) port);
         return;
     }
 
@@ -924,7 +924,7 @@ static void dispatch_packet(AvahiServer *s, AvahiDnsPacket *p, const AvahiAddres
         from_local_iface = originates_from_local_iface(s, iface, src_address, port);
 
     if (avahi_dns_packet_check_valid_multicast(p) < 0) {
-        avahi_log_warn("Received invalid packet.");
+        avahi_log_debug("Received invalid packet.");
         return;
     }
 
@@ -940,7 +940,7 @@ static void dispatch_packet(AvahiServer *s, AvahiDnsPacket *p, const AvahiAddres
 
             if ((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 legacy unicast query packet.");
+                avahi_log_debug("Invalid legacy unicast query packet.");
                 return;
             }
 
@@ -956,19 +956,19 @@ static void dispatch_packet(AvahiServer *s, AvahiDnsPacket *p, const AvahiAddres
         char t[AVAHI_ADDRESS_STR_MAX];
 
         if (port != AVAHI_MDNS_PORT) {
-            avahi_log_warn("Received response from host %s with invalid source port %u on interface '%s.%i'", avahi_address_snprint(t, sizeof(t), src_address), port, i->hardware->name, i->protocol);
+            avahi_log_debug("Received response from host %s with invalid source port %u on interface '%s.%i'", avahi_address_snprint(t, sizeof(t), src_address), port, i->hardware->name, i->protocol);
             return;
         }
 
         if (ttl != 255 && s->config.check_response_ttl) {
-            avahi_log_warn("Received response from host %s with invalid TTL %u on interface '%s.%i'.", avahi_address_snprint(t, sizeof(t), src_address), ttl, i->hardware->name, i->protocol);
+            avahi_log_debug("Received response from host %s with invalid TTL %u on interface '%s.%i'.", avahi_address_snprint(t, sizeof(t), src_address), ttl, i->hardware->name, i->protocol);
             return;
         }
 
         if (!is_mdns_mcast_address(dst_address) &&
             !avahi_interface_address_on_link(i, src_address)) {
 
-            avahi_log_warn("Received non-local response from host %s on interface '%s.%i'.", avahi_address_snprint(t, sizeof(t), src_address), i->hardware->name, i->protocol);
+            avahi_log_debug("Received non-local response from host %s on interface '%s.%i'.", avahi_address_snprint(t, sizeof(t), src_address), i->hardware->name, i->protocol);
             return;
         }
 
@@ -976,7 +976,7 @@ static void dispatch_packet(AvahiServer *s, AvahiDnsPacket *p, const AvahiAddres
             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));
+            avahi_log_debug("Invalid response packet from host %s.", avahi_address_snprint(t, sizeof(t), src_address));
             return;
         }
 
@@ -992,12 +992,12 @@ static void dispatch_legacy_unicast_packet(AvahiServer *s, AvahiDnsPacket *p) {
     assert(p);
 
     if (avahi_dns_packet_check_valid(p) < 0 || avahi_dns_packet_is_query(p)) {
-        avahi_log_warn("Received invalid packet.");
+        avahi_log_debug("Received invalid packet.");
         return;
     }
 
     if (!(slot = find_slot(s, avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ID)))) {
-        avahi_log_warn("Received legacy unicast response with unknown id");
+        avahi_log_debug("Received legacy unicast response with unknown id");
         return;
     }
 
-- 
2.6.4