[dnsmasq] Update to version 2.49
[openwrt-10.03/.git] / package / dnsmasq / patches / 103-ipv6_fix.patch
1 --- a/src/netlink.c
2 +++ b/src/netlink.c
3 @@ -129,6 +129,7 @@ int iface_enumerate(void *parm, int (*ip
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 @@ -207,9 +208,12 @@ int iface_enumerate(void *parm, int (*ip
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 @@ -225,7 +229,7 @@ int iface_enumerate(void *parm, int (*ip
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 @@ -296,7 +296,7 @@ static int create_ipv6_listener(struct l
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;