|
@@ -1,3 +1,6 @@
|
|
1
|
+diff --git a/.gitignore b/.gitignore
|
|
2
|
+new file mode 100644
|
|
3
|
+index 0000000..920cdfc
|
1
|
4
|
--- /dev/null
|
2
|
5
|
+++ b/.gitignore
|
3
|
6
|
@@ -0,0 +1,4 @@
|
|
@@ -5,6 +8,21 @@
|
5
|
8
|
+mDNSPosix/build
|
6
|
9
|
+mDNSPosix/objects
|
7
|
10
|
+
|
|
11
|
+diff --git a/Clients/Makefile b/Clients/Makefile
|
|
12
|
+index 383af31..925c20e 100755
|
|
13
|
+--- a/Clients/Makefile
|
|
14
|
++++ b/Clients/Makefile
|
|
15
|
+@@ -34,7 +34,7 @@ TARGETS = build/dns-sd build/dns-sd64
|
|
16
|
+ LIBS =
|
|
17
|
+ else
|
|
18
|
+ TARGETS = build/dns-sd
|
|
19
|
+-LIBS = -L../mDNSPosix/build/prod/ -ldns_sd
|
|
20
|
++LIBS ?= -L../mDNSPosix/build/prod/ -ldns_sd
|
|
21
|
+ endif
|
|
22
|
+
|
|
23
|
+ all: $(TARGETS)
|
|
24
|
+diff --git a/mDNSPosix/PosixDaemon.c b/mDNSPosix/PosixDaemon.c
|
|
25
|
+index 88b3292..e86a6c7 100644
|
8
|
26
|
--- a/mDNSPosix/PosixDaemon.c
|
9
|
27
|
+++ b/mDNSPosix/PosixDaemon.c
|
10
|
28
|
@@ -37,6 +37,11 @@
|
|
@@ -70,9 +88,11 @@
|
70
|
88
|
if (mStatus_NoError == err)
|
71
|
89
|
err = MainLoop(&mDNSStorage);
|
72
|
90
|
|
|
91
|
+diff --git a/mDNSPosix/Responder.c b/mDNSPosix/Responder.c
|
|
92
|
+index 3996b7b..e58d8eb 100755
|
73
|
93
|
--- a/mDNSPosix/Responder.c
|
74
|
94
|
+++ b/mDNSPosix/Responder.c
|
75
|
|
-@@ -603,7 +603,8 @@ static mStatus RegisterServicesInFile(co
|
|
95
|
+@@ -603,7 +603,8 @@ static mStatus RegisterServicesInFile(const char *filePath)
|
76
|
96
|
status = mStatus_UnknownErr;
|
77
|
97
|
}
|
78
|
98
|
|
|
@@ -82,9 +102,11 @@
|
82
|
102
|
|
83
|
103
|
return status;
|
84
|
104
|
}
|
|
105
|
+diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c
|
|
106
|
+index 6effa12..d3acf99 100755
|
85
|
107
|
--- a/mDNSPosix/mDNSPosix.c
|
86
|
108
|
+++ b/mDNSPosix/mDNSPosix.c
|
87
|
|
-@@ -138,7 +138,7 @@ mDNSlocal void SockAddrTomDNSAddr(const
|
|
109
|
+@@ -138,7 +138,7 @@ mDNSlocal void SockAddrTomDNSAddr(const struct sockaddr *const sa, mDNSAddr *ipA
|
88
|
110
|
|
89
|
111
|
// mDNS core calls this routine when it needs to send a packet.
|
90
|
112
|
mDNSexport mStatus mDNSPlatformSendUDP(const mDNS *const m, const void *const msg, const mDNSu8 *const end,
|
|
@@ -93,7 +115,7 @@
|
93
|
115
|
mDNSIPPort dstPort, mDNSBool useBackgroundTrafficClass)
|
94
|
116
|
{
|
95
|
117
|
int err = 0;
|
96
|
|
-@@ -583,9 +583,17 @@ mDNSlocal void FreePosixNetworkInterface
|
|
118
|
+@@ -583,9 +583,17 @@ mDNSlocal void FreePosixNetworkInterface(PosixNetworkInterface *intf)
|
97
|
119
|
{
|
98
|
120
|
assert(intf != NULL);
|
99
|
121
|
if (intf->intfName != NULL) free((void *)intf->intfName);
|
|
@@ -113,7 +135,7 @@
|
113
|
135
|
#endif
|
114
|
136
|
|
115
|
137
|
// Move interface to the RecentInterfaces list for a minute
|
116
|
|
-@@ -724,6 +732,29 @@ mDNSlocal int SetupSocket(struct sockadd
|
|
138
|
+@@ -724,6 +732,29 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interf
|
117
|
139
|
if (err < 0) { err = errno; perror("setsockopt - IP_MULTICAST_TTL"); }
|
118
|
140
|
}
|
119
|
141
|
|
|
@@ -143,7 +165,7 @@
|
143
|
165
|
// And start listening for packets
|
144
|
166
|
if (err == 0)
|
145
|
167
|
{
|
146
|
|
-@@ -805,6 +836,29 @@ mDNSlocal int SetupSocket(struct sockadd
|
|
168
|
+@@ -805,6 +836,29 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interf
|
147
|
169
|
if (err < 0) { err = errno; perror("setsockopt - IPV6_MULTICAST_HOPS"); }
|
148
|
170
|
}
|
149
|
171
|
|
|
@@ -173,7 +195,7 @@
|
173
|
195
|
// And start listening for packets
|
174
|
196
|
if (err == 0)
|
175
|
197
|
{
|
176
|
|
-@@ -836,7 +890,12 @@ mDNSlocal int SetupSocket(struct sockadd
|
|
198
|
+@@ -836,7 +890,12 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interf
|
177
|
199
|
}
|
178
|
200
|
|
179
|
201
|
// Clean up
|
|
@@ -187,7 +209,7 @@
|
187
|
209
|
assert((err == 0) == (*sktPtr != -1));
|
188
|
210
|
return err;
|
189
|
211
|
}
|
190
|
|
-@@ -1026,7 +1085,7 @@ mDNSlocal mStatus OpenIfNotifySocket(int
|
|
212
|
+@@ -1026,7 +1085,7 @@ mDNSlocal mStatus OpenIfNotifySocket(int *pFD)
|
191
|
213
|
/* Subscribe the socket to Link & IP addr notifications. */
|
192
|
214
|
mDNSPlatformMemZero(&snl, sizeof snl);
|
193
|
215
|
snl.nl_family = AF_NETLINK;
|
|
@@ -196,7 +218,7 @@
|
196
|
218
|
ret = bind(sock, (struct sockaddr *) &snl, sizeof snl);
|
197
|
219
|
if (0 == ret)
|
198
|
220
|
*pFD = sock;
|
199
|
|
-@@ -1104,11 +1163,18 @@ mDNSlocal mDNSu32 ProcessRoutingNo
|
|
221
|
+@@ -1104,11 +1163,18 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd)
|
200
|
222
|
PrintNetLinkMsg(pNLMsg);
|
201
|
223
|
#endif
|
202
|
224
|
|
|
@@ -217,7 +239,7 @@
|
217
|
239
|
|
218
|
240
|
// Advance pNLMsg to the next message in the buffer
|
219
|
241
|
if ((pNLMsg->nlmsg_flags & NLM_F_MULTI) != 0 && pNLMsg->nlmsg_type != NLMSG_DONE)
|
220
|
|
-@@ -1279,8 +1345,12 @@ mDNSexport mStatus mDNSPlatformInit(mDNS
|
|
242
|
+@@ -1279,8 +1345,12 @@ mDNSexport mStatus mDNSPlatformInit(mDNS *const m)
|
221
|
243
|
if (err == mStatus_NoError) err = SetupSocket(&sa, zeroIPPort, 0, &m->p->unicastSocket6);
|
222
|
244
|
#endif
|
223
|
245
|
|
|
@@ -230,7 +252,7 @@
|
230
|
252
|
|
231
|
253
|
// Tell mDNS core about DNS Servers
|
232
|
254
|
mDNS_Lock(m);
|
233
|
|
-@@ -1313,9 +1383,17 @@ mDNSexport void mDNSPlatformClose(mDNS *
|
|
255
|
+@@ -1313,9 +1383,17 @@ mDNSexport void mDNSPlatformClose(mDNS *const m)
|
234
|
256
|
{
|
235
|
257
|
assert(m != NULL);
|
236
|
258
|
ClearInterfaceList(m);
|
|
@@ -250,7 +272,7 @@
|
250
|
272
|
#endif
|
251
|
273
|
}
|
252
|
274
|
|
253
|
|
-@@ -1571,14 +1649,14 @@ mDNSexport mStatus mDNSPlatformClearS
|
|
275
|
+@@ -1571,14 +1649,14 @@ mDNSexport mStatus mDNSPlatformClearSPSMACAddr(void)
|
254
|
276
|
mDNSexport mDNSu16 mDNSPlatformGetUDPPort(UDPSocket *sock)
|
255
|
277
|
{
|
256
|
278
|
(void) sock; // unused
|
|
@@ -267,257 +289,63 @@
|
267
|
289
|
return mDNSfalse;
|
268
|
290
|
}
|
269
|
291
|
|
|
292
|
+diff --git a/mDNSPosix/mDNSUNP.c b/mDNSPosix/mDNSUNP.c
|
|
293
|
+index b392fc7..fe800af 100755
|
270
|
294
|
--- a/mDNSPosix/mDNSUNP.c
|
271
|
295
|
+++ b/mDNSPosix/mDNSUNP.c
|
272
|
|
-@@ -61,154 +61,86 @@
|
273
|
|
- #endif
|
274
|
|
-
|
|
296
|
+@@ -63,6 +63,7 @@
|
275
|
297
|
#if defined(AF_INET6) && HAVE_IPV6 && HAVE_LINUX
|
276
|
|
--#include <netdb.h>
|
277
|
|
--#include <arpa/inet.h>
|
278
|
|
-+#include <sys/types.h>
|
279
|
|
-+#include <ifaddrs.h>
|
280
|
|
-
|
281
|
|
--/* Converts a prefix length to IPv6 network mask */
|
282
|
|
--void plen_to_mask(int plen, char *addr) {
|
283
|
|
-- int i;
|
284
|
|
-- int colons=7; /* Number of colons in IPv6 address */
|
285
|
|
-- int bits_in_block=16; /* Bits per IPv6 block */
|
286
|
|
-- for(i=0; i<=colons; i++) {
|
287
|
|
-- int block, ones=0xffff, ones_in_block;
|
288
|
|
-- if (plen>bits_in_block) ones_in_block=bits_in_block;
|
289
|
|
-- else ones_in_block=plen;
|
290
|
|
-- block = ones & (ones << (bits_in_block-ones_in_block));
|
291
|
|
-- i==0 ? sprintf(addr, "%x", block) : sprintf(addr, "%s:%x", addr, block);
|
292
|
|
-- plen -= ones_in_block;
|
293
|
|
-- }
|
294
|
|
--}
|
295
|
|
-
|
296
|
|
--/* Gets IPv6 interface information from the /proc filesystem in linux*/
|
297
|
|
--struct ifi_info *get_ifi_info_linuxv6(int family, int doaliases)
|
298
|
|
-+/* Correct way to deal with this is just to use getifaddrs (glibc
|
299
|
|
-+ * 2.3.3+ and various BSDs, but BSDs are 'slightly different' just to
|
300
|
|
-+ * make life interesting). We assume Linux getifaddrs is available,
|
301
|
|
-+ * and if not, please upgrade. */
|
302
|
|
-+struct ifi_info *get_ifi_info_linuxv6(int doaliases)
|
303
|
|
- {
|
304
|
|
-- struct ifi_info *ifi, *ifihead, **ifipnext, *ifipold, **ifiptr;
|
305
|
|
-- FILE *fp;
|
306
|
|
-- char addr[8][5];
|
307
|
|
-- int flags, myflags, index, plen, scope;
|
|
298
|
+ #include <netdb.h>
|
|
299
|
+ #include <arpa/inet.h>
|
|
300
|
++#include <linux/if_addr.h>
|
|
301
|
+
|
|
302
|
+ /* Converts a prefix length to IPv6 network mask */
|
|
303
|
+ void plen_to_mask(int plen, char *addr) {
|
|
304
|
+@@ -86,7 +87,7 @@ struct ifi_info *get_ifi_info_linuxv6(int family, int doaliases)
|
|
305
|
+ FILE *fp;
|
|
306
|
+ char addr[8][5];
|
|
307
|
+ int flags, myflags, index, plen, scope;
|
308
|
308
|
- char ifname[9], lastname[IFNAMSIZ];
|
309
|
|
-- char addr6[32+7+1]; /* don't forget the seven ':' */
|
310
|
|
-- struct addrinfo hints, *res0;
|
311
|
|
-- struct sockaddr_in6 *sin6;
|
312
|
|
-- struct in6_addr *addrptr;
|
313
|
|
-- int err;
|
314
|
|
-- int sockfd = -1;
|
315
|
|
-- struct ifreq ifr;
|
|
309
|
++ char ifname[IFNAMSIZ], lastname[IFNAMSIZ];
|
|
310
|
+ char addr6[32+7+1]; /* don't forget the seven ':' */
|
|
311
|
+ struct addrinfo hints, *res0;
|
|
312
|
+ struct sockaddr_in6 *sin6;
|
|
313
|
+@@ -94,7 +95,8 @@ struct ifi_info *get_ifi_info_linuxv6(int family, int doaliases)
|
|
314
|
+ int err;
|
|
315
|
+ int sockfd = -1;
|
|
316
|
+ struct ifreq ifr;
|
316
|
317
|
-
|
317
|
|
-- res0=NULL;
|
318
|
|
-- ifihead = NULL;
|
319
|
|
-- ifipnext = &ifihead;
|
320
|
|
-- lastname[0] = 0;
|
321
|
|
--
|
322
|
|
-- if ((fp = fopen(PROC_IFINET6_PATH, "r")) != NULL) {
|
323
|
|
-- sockfd = socket(AF_INET6, SOCK_DGRAM, 0);
|
324
|
|
-- if (sockfd < 0) {
|
325
|
|
-- goto gotError;
|
326
|
|
-- }
|
327
|
|
-- while (fscanf(fp,
|
|
318
|
++ char mask[64] = "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %";
|
|
319
|
++ sprintf(mask+strlen(mask), "%ds\n", IFNAMSIZ);
|
|
320
|
+ res0=NULL;
|
|
321
|
+ ifihead = NULL;
|
|
322
|
+ ifipnext = &ifihead;
|
|
323
|
+@@ -106,11 +108,12 @@ struct ifi_info *get_ifi_info_linuxv6(int family, int doaliases)
|
|
324
|
+ goto gotError;
|
|
325
|
+ }
|
|
326
|
+ while (fscanf(fp,
|
328
|
327
|
- "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %8s\n",
|
329
|
|
-- addr[0],addr[1],addr[2],addr[3],
|
330
|
|
-- addr[4],addr[5],addr[6],addr[7],
|
331
|
|
-- &index, &plen, &scope, &flags, ifname) != EOF) {
|
332
|
|
--
|
333
|
|
-- myflags = 0;
|
334
|
|
-- if (strncmp(lastname, ifname, IFNAMSIZ) == 0) {
|
335
|
|
-- if (doaliases == 0)
|
336
|
|
-- continue; /* already processed this interface */
|
337
|
|
-- myflags = IFI_ALIAS;
|
338
|
|
-- }
|
339
|
|
-- memcpy(lastname, ifname, IFNAMSIZ);
|
340
|
|
-- ifi = (struct ifi_info*)calloc(1, sizeof(struct ifi_info));
|
341
|
|
-- if (ifi == NULL) {
|
342
|
|
-- goto gotError;
|
343
|
|
-- }
|
344
|
|
--
|
345
|
|
-- ifipold = *ifipnext; /* need this later */
|
346
|
|
-- ifiptr = ifipnext;
|
347
|
|
-- *ifipnext = ifi; /* prev points to this new one */
|
348
|
|
-- ifipnext = &ifi->ifi_next; /* pointer to next one goes here */
|
349
|
|
--
|
350
|
|
-- sprintf(addr6, "%s:%s:%s:%s:%s:%s:%s:%s",
|
351
|
|
-- addr[0],addr[1],addr[2],addr[3],
|
352
|
|
-- addr[4],addr[5],addr[6],addr[7]);
|
353
|
|
--
|
354
|
|
-- /* Add address of the interface */
|
355
|
|
-- memset(&hints, 0, sizeof(hints));
|
356
|
|
-- hints.ai_family = AF_INET6;
|
357
|
|
-- hints.ai_flags = AI_NUMERICHOST;
|
358
|
|
-- err = getaddrinfo(addr6, NULL, &hints, &res0);
|
359
|
|
-- if (err) {
|
360
|
|
-- goto gotError;
|
361
|
|
-- }
|
362
|
|
-- ifi->ifi_addr = calloc(1, sizeof(struct sockaddr_in6));
|
363
|
|
-- if (ifi->ifi_addr == NULL) {
|
364
|
|
-- goto gotError;
|
365
|
|
-- }
|
366
|
|
-- memcpy(ifi->ifi_addr, res0->ai_addr, sizeof(struct sockaddr_in6));
|
367
|
|
--
|
368
|
|
-- /* Add netmask of the interface */
|
369
|
|
-- char ipv6addr[INET6_ADDRSTRLEN];
|
370
|
|
-- plen_to_mask(plen, ipv6addr);
|
371
|
|
-- ifi->ifi_netmask = calloc(1, sizeof(struct sockaddr_in6));
|
372
|
|
-- if (ifi->ifi_addr == NULL) {
|
373
|
|
-- goto gotError;
|
374
|
|
-- }
|
375
|
|
-- sin6=calloc(1, sizeof(struct sockaddr_in6));
|
376
|
|
-- addrptr=calloc(1, sizeof(struct in6_addr));
|
377
|
|
-- inet_pton(family, ipv6addr, addrptr);
|
378
|
|
-- sin6->sin6_family=family;
|
379
|
|
-- sin6->sin6_addr=*addrptr;
|
380
|
|
-- sin6->sin6_scope_id=scope;
|
381
|
|
-- memcpy(ifi->ifi_netmask, sin6, sizeof(struct sockaddr_in6));
|
382
|
|
-- free(sin6);
|
383
|
|
--
|
384
|
|
--
|
385
|
|
-- /* Add interface name */
|
386
|
|
-- memcpy(ifi->ifi_name, ifname, IFI_NAME);
|
387
|
|
--
|
388
|
|
-- /* Add interface index */
|
389
|
|
-- ifi->ifi_index = index;
|
390
|
|
--
|
391
|
|
-- /* Add interface flags*/
|
392
|
|
-- memcpy(ifr.ifr_name, ifname, IFNAMSIZ);
|
393
|
|
-- if (ioctl(sockfd, SIOCGIFFLAGS, &ifr) < 0) {
|
394
|
|
-- if (errno == EADDRNOTAVAIL) {
|
395
|
|
-- /*
|
396
|
|
-- * If the main interface is configured with no IP address but
|
397
|
|
-- * an alias interface exists with an IP address, you get
|
398
|
|
-- * EADDRNOTAVAIL for the main interface
|
399
|
|
-- */
|
400
|
|
-- free(ifi->ifi_addr);
|
401
|
|
-- free(ifi);
|
402
|
|
-- ifipnext = ifiptr;
|
403
|
|
-- *ifipnext = ifipold;
|
404
|
|
-- continue;
|
405
|
|
-- } else {
|
406
|
|
-- goto gotError;
|
407
|
|
-- }
|
408
|
|
-- }
|
409
|
|
-- ifi->ifi_flags = ifr.ifr_flags;
|
410
|
|
-- freeaddrinfo(res0);
|
411
|
|
-- res0=NULL;
|
412
|
|
-- }
|
413
|
|
-- }
|
414
|
|
-- goto done;
|
415
|
|
-+ struct ifaddrs *ifap, *ifa;
|
416
|
|
-+ struct ifi_info *ifi = NULL, *head = NULL;
|
417
|
|
-
|
418
|
|
--gotError:
|
419
|
|
-- if (ifihead != NULL) {
|
420
|
|
-- free_ifi_info(ifihead);
|
421
|
|
-- ifihead = NULL;
|
422
|
|
-- }
|
423
|
|
-- if (res0 != NULL) {
|
424
|
|
-- freeaddrinfo(res0);
|
425
|
|
-- res0=NULL;
|
426
|
|
-+ /* doaliases seems always true in the calls in current code */
|
427
|
|
-+ assert(doaliases);
|
428
|
|
-+
|
429
|
|
-+ if (getifaddrs(&ifap) < 0)
|
430
|
|
-+ {
|
431
|
|
-+ return NULL;
|
|
328
|
++ mask,
|
|
329
|
+ addr[0],addr[1],addr[2],addr[3],
|
|
330
|
+ addr[4],addr[5],addr[6],addr[7],
|
|
331
|
+ &index, &plen, &scope, &flags, ifname) != EOF) {
|
|
332
|
+
|
|
333
|
++ if (flags & IFA_F_DEPRECATED) continue;
|
|
334
|
+ myflags = 0;
|
|
335
|
+ if (strncmp(lastname, ifname, IFNAMSIZ) == 0) {
|
|
336
|
+ if (doaliases == 0)
|
|
337
|
+@@ -205,7 +208,8 @@ gotError:
|
432
|
338
|
}
|
433
|
|
--done:
|
434
|
|
-- if (sockfd != -1) {
|
|
339
|
+ done:
|
|
340
|
+ if (sockfd != -1) {
|
435
|
341
|
- assert(close(sockfd) == 0);
|
436
|
|
-+ for (ifa = ifap ; ifa ; ifa = ifa->ifa_next)
|
437
|
|
-+ {
|
438
|
|
-+ /* Care only about IPv6 addresses on non-point-to-point links. */
|
439
|
|
-+ if (!ifa->ifa_addr
|
440
|
|
-+ || ifa->ifa_addr->sa_family != AF_INET6)
|
441
|
|
-+ continue;
|
442
|
|
-+ ifi = calloc(1, sizeof(*ifi));
|
443
|
|
-+ if (!ifi)
|
444
|
|
-+ break;
|
445
|
|
-+ strncpy(ifi->ifi_name, ifa->ifa_name, IFI_NAME);
|
446
|
|
-+ /* We ignore ifi_{haddr,hlen}, everyone else does too */
|
447
|
|
-+ ifi->ifi_flags = ifa->ifa_flags;
|
448
|
|
-+ /* We ignore ifi_myflags; IFI_ALIAS isn't used anywhere */
|
449
|
|
-+ ifi->ifi_index = if_nametoindex(ifa->ifa_name);
|
450
|
|
-+ if (!(ifi->ifi_addr = malloc(sizeof(struct sockaddr_in6))))
|
451
|
|
-+ break;
|
452
|
|
-+ memcpy(ifi->ifi_addr, ifa->ifa_addr, sizeof(struct sockaddr_in6));
|
453
|
|
-+
|
454
|
|
-+ if (ifa->ifa_netmask)
|
455
|
|
-+ {
|
456
|
|
-+ if (!(ifi->ifi_netmask = malloc(sizeof(struct sockaddr_in6))))
|
457
|
|
-+ break;
|
458
|
|
-+ memcpy(ifi->ifi_netmask, ifa->ifa_netmask,
|
459
|
|
-+ sizeof(struct sockaddr_in6));
|
460
|
|
-+ }
|
461
|
|
-+
|
462
|
|
-+ if (!(ifi->ifi_addr = malloc(sizeof(struct sockaddr_in6))))
|
463
|
|
-+ break;
|
464
|
|
-+ memcpy(ifi->ifi_addr, ifa->ifa_addr, sizeof(struct sockaddr_in6));
|
465
|
|
-+
|
466
|
|
-+
|
467
|
|
-+ if (ifa->ifa_flags & IFF_POINTOPOINT && ifa->ifa_dstaddr)
|
468
|
|
-+ {
|
469
|
|
-+ if (!(ifi->ifi_dstaddr = malloc(sizeof(struct sockaddr_in6))))
|
470
|
|
-+ break;
|
471
|
|
-+ memcpy(ifi->ifi_dstaddr, ifa->ifa_dstaddr,
|
472
|
|
-+ sizeof(struct sockaddr_in6));
|
473
|
|
-+ }
|
474
|
|
-+ else if (ifa->ifa_broadaddr)
|
475
|
|
-+ {
|
476
|
|
-+ if (!(ifi->ifi_brdaddr = malloc(sizeof(struct sockaddr_in6))))
|
477
|
|
-+ break;
|
478
|
|
-+ memcpy(ifi->ifi_brdaddr, ifa->ifa_broadaddr,
|
479
|
|
-+ sizeof(struct sockaddr_in6));
|
480
|
|
-+ }
|
481
|
|
-+ ifi->ifi_next = head;
|
482
|
|
-+ head = ifi;
|
483
|
|
-+ ifi = NULL;
|
484
|
|
-+ };
|
485
|
|
-+ if (ifi)
|
486
|
|
-+ {
|
487
|
|
-+ /* An error occurred. Let's bail out. */
|
488
|
|
-+ ifi->ifi_next = head;
|
489
|
|
-+ free_ifi_info(head);
|
490
|
|
-+ return NULL;
|
|
342
|
++ int rv = close(sockfd);
|
|
343
|
++ assert(rv == 0);
|
491
|
344
|
}
|
492
|
|
-- return(ifihead); /* pointer to first structure in linked list */
|
493
|
|
-+ freeifaddrs(ifap);
|
494
|
|
-+ return head;
|
|
345
|
+ return(ifihead); /* pointer to first structure in linked list */
|
495
|
346
|
}
|
496
|
|
-+
|
497
|
|
- #endif // defined(AF_INET6) && HAVE_IPV6 && HAVE_LINUX
|
498
|
|
-
|
499
|
|
- struct ifi_info *get_ifi_info(int family, int doaliases)
|
500
|
|
-@@ -229,7 +161,7 @@ struct ifi_info *get_ifi_info(int family
|
501
|
|
- #endif
|
502
|
|
-
|
503
|
|
- #if defined(AF_INET6) && HAVE_IPV6 && HAVE_LINUX
|
504
|
|
-- if (family == AF_INET6) return get_ifi_info_linuxv6(family, doaliases);
|
505
|
|
-+ if (family == AF_INET6) return get_ifi_info_linuxv6(doaliases);
|
506
|
|
- #endif
|
507
|
|
-
|
508
|
|
- sockfd = -1;
|
509
|
|
---- a/mDNSPosix/mDNSUNP.h
|
510
|
|
-+++ b/mDNSPosix/mDNSUNP.h
|
511
|
|
-@@ -97,8 +97,7 @@ struct ifi_info {
|
512
|
|
- };
|
513
|
|
-
|
514
|
|
- #if defined(AF_INET6) && HAVE_IPV6 && HAVE_LINUX
|
515
|
|
--#define PROC_IFINET6_PATH "/proc/net/if_inet6"
|
516
|
|
--extern struct ifi_info *get_ifi_info_linuxv6(int family, int doaliases);
|
517
|
|
-+extern struct ifi_info *get_ifi_info_linuxv6(int doaliases);
|
518
|
|
- #endif
|
519
|
|
-
|
520
|
|
- #if defined(AF_INET6) && HAVE_IPV6
|
|
347
|
+diff --git a/mDNSShared/dnsextd_parser.y b/mDNSShared/dnsextd_parser.y
|
|
348
|
+index 18c5990..d4b63ce 100644
|
521
|
349
|
--- a/mDNSShared/dnsextd_parser.y
|
522
|
350
|
+++ b/mDNSShared/dnsextd_parser.y
|
523
|
351
|
@@ -15,6 +15,8 @@
|