summaryrefslogtreecommitdiff
blob: 5b56b3b714f0b080b570afc8b6aa85ba6eafba0c (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
Index: avahi-core/socket.c
===================================================================
--- avahi-core/socket.c	(revision 1360)
+++ avahi-core/socket.c	(revision 1361)
@@ -635,6 +635,9 @@
         goto fail;
     }
 
+    if (ms <= 0)
+        goto fail;
+
     p = avahi_dns_packet_new(ms + AVAHI_DNS_PACKET_EXTRA_SIZE);
 
     io.iov_base = AVAHI_DNS_PACKET_DATA(p);
@@ -650,7 +653,14 @@
     msg.msg_flags = 0;
     
     if ((l = recvmsg(fd, &msg, 0)) < 0) {
-        avahi_log_warn("recvmsg(): %s", strerror(errno));
+        /* Linux returns EAGAIN when an invalid IP packet has been
+        recieved. We suppress warnings in this case because this might
+        create quite a bit of log traffic on machines with unstable
+        links. (See #60) */
+
+        if (errno != EAGAIN)
+            avahi_log_warn("recvmsg(): %s", strerror(errno));
+
         goto fail;
     }
 
@@ -768,6 +778,9 @@
         avahi_log_warn("ioctl(): %s", strerror(errno));
         goto fail;
     }
+
+    if (ms <= 0)
+        goto fail;
     
     p = avahi_dns_packet_new(ms + AVAHI_DNS_PACKET_EXTRA_SIZE);
 
@@ -785,7 +798,14 @@
     msg.msg_flags = 0;
     
     if ((l = recvmsg(fd, &msg, 0)) < 0) {
-        avahi_log_warn("recvmsg(): %s", strerror(errno));
+        /* Linux returns EAGAIN when an invalid IP packet has been
+        recieved. We suppress warnings in this case because this might
+        create quite a bit of log traffic on machines with unstable
+        links. (See #60) */
+
+        if (errno != EAGAIN)
+            avahi_log_warn("recvmsg(): %s", strerror(errno));
+        
         goto fail;
     }