Magellan Linux

Annotation of /trunk/busybox/patches/busybox-1.10.2-dnsd.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 626 - (hide annotations) (download)
Sat May 31 10:33:24 2008 UTC (15 years, 11 months ago) by niro
File size: 2532 byte(s)
-added more official fixes

1 niro 626 --- busybox-1.10.2/libbb/udp_io.c Sat Apr 19 05:50:33 2008
2     +++ busybox-1.10.2-dnsd/libbb/udp_io.c Thu May 22 19:40:32 2008
3     @@ -36,11 +36,12 @@
4     #else
5     struct iovec iov[1];
6     struct msghdr msg;
7     - char cbuf[sizeof(struct in_pktinfo)
8     + union {
9     + char cmsg[CMSG_SPACE(sizeof(struct in_pktinfo))];
10     #if ENABLE_FEATURE_IPV6 && defined(IPV6_PKTINFO)
11     - | sizeof(struct in6_pktinfo) /* (a|b) is poor man's max(a,b) */
12     + char cmsg6[CMSG_SPACE(sizeof(struct in6_pktinfo))];
13     #endif
14     - ];
15     + } u;
16     struct cmsghdr* cmsgptr;
17    
18     if (from->sa_family != AF_INET
19     @@ -57,15 +58,15 @@
20     iov[0].iov_base = buf;
21     iov[0].iov_len = len;
22    
23     - memset(cbuf, 0, sizeof(cbuf));
24     + memset(&u, 0, sizeof(u));
25    
26     memset(&msg, 0, sizeof(msg));
27     msg.msg_name = (void *)(struct sockaddr *)to; /* or compiler will annoy us */
28     msg.msg_namelen = tolen;
29     msg.msg_iov = iov;
30     msg.msg_iovlen = 1;
31     - msg.msg_control = cbuf;
32     - msg.msg_controllen = sizeof(cbuf);
33     + msg.msg_control = &u;
34     + msg.msg_controllen = sizeof(u);
35     msg.msg_flags = flags;
36    
37     cmsgptr = CMSG_FIRSTHDR(&msg);
38     @@ -89,6 +90,8 @@
39     pktptr->ipi6_addr = ((struct sockaddr_in6*)from)->sin6_addr;
40     }
41     #endif
42     + msg.msg_controllen = cmsgptr->cmsg_len;
43     +
44     return sendmsg(fd, &msg, flags);
45     #endif
46     }
47     @@ -109,7 +112,9 @@
48     struct iovec iov[1];
49     union {
50     char cmsg[CMSG_SPACE(sizeof(struct in_pktinfo))];
51     +#if ENABLE_FEATURE_IPV6 && defined(IPV6_PKTINFO)
52     char cmsg6[CMSG_SPACE(sizeof(struct in6_pktinfo))];
53     +#endif
54     } u;
55     struct cmsghdr *cmsgptr;
56     struct msghdr msg;
57     --- busybox-1.10.2/networking/dnsd.c Sat Apr 19 05:50:27 2008
58     +++ busybox-1.10.2-dnsd/networking/dnsd.c Thu May 22 19:40:32 2008
59     @@ -194,7 +194,8 @@
60     for (i = 1; i <= (int)(d->name[0]); i++)
61     if (tolower(qs[i]) != d->name[i])
62     break;
63     - if (i > (int)(d->name[0])) {
64     + if (i > (int)(d->name[0]) ||
65     + (d->name[0] == 1 && d->name[1] == '*')) {
66     strcpy((char *)as, d->ip);
67     #if DEBUG
68     fprintf(stderr, " OK as:%s\n", as);
69     @@ -202,7 +203,8 @@
70     return 0;
71     }
72     } else if (type == REQ_PTR) { /* search by IP-address */
73     - if (!strncmp((char*)&d->rip[1], (char*)&qs[1], strlen(d->rip)-1)) {
74     + if ((d->name[0] != 1 || d->name[1] != '*') &&
75     + !strncmp((char*)&d->rip[1], (char*)&qs[1], strlen(d->rip)-1)) {
76     strcpy((char *)as, d->name);
77     return 0;
78     }
79     @@ -401,7 +403,7 @@
80     r = process_packet(buf);
81     if (r <= 0)
82     continue;
83     - send_to_from(udps, buf, r, 0, &to->u.sa, &from->u.sa, lsa->len);
84     + send_to_from(udps, buf, r, 0, &from->u.sa, &to->u.sa, lsa->len);
85     }
86     return 0;
87     }