fix dnsmasq errors that occur on linux 2.4 if ipv6 is compiled as module, but not...
[openwrt-10.03/.git] / package / dnsmasq / patches / 103-ipv6_fix.patch
1 --- a/src/netlink.c
2 +++ b/src/netlink.c
3 @@ -116,6 +116,7 @@
4    ssize_t len;
5    static unsigned int seq = 0;
6    int family = AF_INET;
7 +  int ipv4_done = 0;
8  
9    struct {
10      struct nlmsghdr nlh;
11 @@ -187,9 +188,12 @@
12                     rta = RTA_NEXT(rta, len1);
13                   }
14                 
15 -               if (addr.s_addr && ipv4_callback)
16 +               if (addr.s_addr && ipv4_callback) {
17                   if (!((*ipv4_callback)(addr, ifa->ifa_index, netmask, broadcast, parm)))
18                     return 0;
19 +                 else
20 +                   ipv4_done = 1;
21 +               }
22               }
23  #ifdef HAVE_IPV6
24             else if (ifa->ifa_family == AF_INET6)
25 @@ -205,7 +209,7 @@
26                 
27                 if (addrp && ipv6_callback)
28                   if (!((*ipv6_callback)(addrp, ifa->ifa_index, ifa->ifa_index, parm)))
29 -                   return 0;
30 +                   return ipv4_done;
31               }
32  #endif
33           }
34 --- a/src/network.c
35 +++ b/src/network.c
36 @@ -278,7 +278,7 @@
37        bind(tcpfd, (struct sockaddr *)&addr, sa_len(&addr)) == -1 ||
38        listen(tcpfd, 5) == -1 ||
39        bind(fd, (struct sockaddr *)&addr, sa_len(&addr)) == -1) 
40 -    return 0;
41 +    return 1;
42        
43    l = safe_malloc(sizeof(struct listener));
44    l->fd = fd;