summaryrefslogtreecommitdiff
path: root/print/hplip/files/patch-protocol_discovery_mdns.c
blob: 909ceaa8a2bb2a1d096a20c17cb8d649ec09905f (plain) (blame)
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
--- protocol/discovery/mdns.c.orig	2016-08-26 10:04:47 UTC
+++ protocol/discovery/mdns.c
@@ -24,7 +24,11 @@
  Author: Sanjay Kumar
  \*****************************************************************************/
 
-//#include <stdio.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/select.h>
 #include <string.h>
 #include <syslog.h>
 #include <sys/socket.h>
@@ -89,6 +93,11 @@ static int mdns_open_socket(int *psocket
         BUG("unable to setsockopt: %m\n");
         goto bugout;
     }
+    if (setsockopt(udp_socket, SOL_SOCKET, SO_REUSEPORT, &yes, sizeof(yes)) == -1)
+    {
+        BUG("unable to setsockopt: %m\n");
+        goto bugout;
+    }
 
     /* Bind the socket to port and IP equal to INADDR_ANY. */
     bzero(&recv_addr, sizeof(recv_addr));