summaryrefslogtreecommitdiffstats
path: root/package/dnsmasq/patches/103-ipv6_fix.patch
blob: 28a272f84b7736fba5affd94ae4a476d1033f037 (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
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -116,6 +116,7 @@
   ssize_t len;
   static unsigned int seq = 0;
   int family = AF_INET;
+  int ipv4_done = 0;
 
   struct {
     struct nlmsghdr nlh;
@@ -187,9 +188,12 @@
 		    rta = RTA_NEXT(rta, len1);
 		  }
 		
-		if (addr.s_addr && ipv4_callback)
+		if (addr.s_addr && ipv4_callback) {
 		  if (!((*ipv4_callback)(addr, ifa->ifa_index, netmask, broadcast, parm)))
 		    return 0;
+		  else
+		    ipv4_done = 1;
+		}
 	      }
 #ifdef HAVE_IPV6
 	    else if (ifa->ifa_family == AF_INET6)
@@ -205,7 +209,7 @@
 		
 		if (addrp && ipv6_callback)
 		  if (!((*ipv6_callback)(addrp, ifa->ifa_index, ifa->ifa_index, parm)))
-		    return 0;
+		    return ipv4_done;
 	      }
 #endif
 	  }
--- a/src/network.c
+++ b/src/network.c
@@ -278,7 +278,7 @@
       bind(tcpfd, (struct sockaddr *)&addr, sa_len(&addr)) == -1 ||
       listen(tcpfd, 5) == -1 ||
       bind(fd, (struct sockaddr *)&addr, sa_len(&addr)) == -1) 
-    return 0;
+    return 1;
       
   l = safe_malloc(sizeof(struct listener));
   l->fd = fd;