+mDNSlocal void mDNSCoreStoreProxyRR(mDNS *const m, const mDNSInterfaceID InterfaceID, AuthRecord *const rr)
+ {
+ NetworkInterfaceInfo *intf = FirstInterfaceForID(m, InterfaceID);
+ AuthRecord *newRR = mDNSPlatformMemAllocate(sizeof(AuthRecord));
+
+ if ((intf == mDNSNULL) || (newRR == mDNSNULL))
+ return;
+ mDNSPlatformMemZero(newRR, sizeof(AuthRecord));
+ mDNS_SetupResourceRecord(newRR, mDNSNULL, InterfaceID, rr->resrec.rrtype,
+ rr->resrec.rroriginalttl, rr->resrec.RecordType,
+ rr->ARType, mDNSNULL, mDNSNULL);
+ AssignDomainName(&newRR->namestorage, &rr->namestorage);
+ newRR->resrec.rdlength = DomainNameLength(rr->resrec.name);
+ newRR->resrec.rdata->u.name.c[0] = 0;
+ AssignDomainName(&newRR->resrec.rdata->u.name, rr->resrec.name);
+ newRR->resrec.namehash = DomainNameHashValue(newRR->resrec.name);
+ newRR->resrec.rrclass = rr->resrec.rrclass;
+ if (intf->ip.type == mDNSAddrType_IPv4)
+ newRR->resrec.rdata->u.ipv4 = rr->resrec.rdata->u.ipv4;
+ else
+ newRR->resrec.rdata->u.ipv6 = rr->resrec.rdata->u.ipv6;
+ SetNewRData(&newRR->resrec, mDNSNULL, 0);
+ // Insert the new node at the head of the list.
+ newRR->next = intf->SPSRRSet;
+ intf->SPSRRSet = newRR;
+ }
+
+mDNSlocal void SPSInitRecordsBeforeUpdate(mDNS *const m, mDNSOpaque64 updateIntID)
+ {
+ AuthRecord *ar;
+ LogSPS("SPSInitRecordsBeforeUpdate: UpdateIntID 0x%x 0x%x", updateIntID.l[1], updateIntID.l[0]);
+
+ // Before we store the A and AAAA records that we are going to register with the sleep proxy,
+ // make sure that the old sleep proxy records are removed.
+ mDNSCoreFreeProxyRR(m);
+
+ for (ar = m->ResourceRecords; ar; ar=ar->next)
+ {
+ if (AuthRecord_uDNS(ar))
+ continue;
+ // Store the A and AAAA records that we registered with the sleep proxy.
+ // We will use this to prevent spurious name conflicts that may occur when we wake up
+ if (ar->resrec.rrtype == kDNSType_A || ar->resrec.rrtype == kDNSType_AAAA)
+ {
+ mDNSCoreStoreProxyRR(m, ar->resrec.InterfaceID, ar);
+ }
+ }
+ }
+