Changeset a814950 in rtems-libbsd


Ignore:
Timestamp:
Sep 19, 2018, 6:55:35 AM (13 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
c1e05b9ea378b2971e3d7704779112b4bc4296da, 4a77611a223ea883fb548679b516d326a020d447
Children:
4c086a2
Parents:
7d33d36
git-author:
Sebastian Huber <sebastian.huber@…> (09/19/18 06:55:35)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/20/18 09:23:33)
Message:

mDNSResponder: Update to v765.50.9

The sources can be obtained via:

https://opensource.apple.com/tarballs/mDNSResponder/mDNSResponder-765.50.9.tar.gz

Update #3522.

Location:
mDNSResponder
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • mDNSResponder/Makefile

    r7d33d36 ra814950  
    1717include $(MAKEFILEPATH)/pb_makefiles/platform.make
    1818
    19 MVERS = "mDNSResponder-765.30.11"
     19MVERS = "mDNSResponder-765.50.9"
    2020
    2121DDNSWRITECONFIG = "$(DSTROOT)/Library/Application Support/Bonjour/ddnswriteconfig"
  • mDNSResponder/mDNSCore/DNSCommon.c

    r7d33d36 ra814950  
    514514        length += mDNS_snprintf(buffer+length, RemSpc, "\t%s  %s  %d  %d  %s  %s  %d  %##s ",
    515515                                DNSTypeName(swap16(rrsig->typeCovered)), DNSSECAlgName(rrsig->alg), rrsig->labels, swap32(rrsig->origTTL),
    516                                 expTimeBuf, inceptTimeBuf, swap16(rrsig->keyTag), ((domainname *)(&rrsig->signerName))->c);
     516                                expTimeBuf, inceptTimeBuf, swap16(rrsig->keyTag), rrsig->signerName);
    517517
    518518        len = DomainNameLength((domainname *)&rrsig->signerName);
  • mDNSResponder/mDNSCore/dnsproxy.c

    r7d33d36 ra814950  
    495495}
    496496
    497 mDNSlocal void SendError(mDNS *const m, void *socket, void *const pkt, const mDNSu8 *const end, const mDNSAddr *dstaddr,
     497mDNSlocal void SendError(mDNS *const m, void *socket, DNSMessage *const msg, const mDNSu8 *const end, const mDNSAddr *dstaddr,
    498498    const mDNSIPPort dstport, const mDNSInterfaceID InterfaceID, mDNSBool tcp, void *context, mDNSu8 rcode)
    499499{
    500     int pktlen = (int)(end - (mDNSu8 *)pkt);
    501     DNSMessage  *msg  = (DNSMessage *)pkt;
     500    int pktlen = (int)(end - (mDNSu8 *)msg);
    502501
    503502    // RFC 1035 requires that we copy the question back and RFC 2136 is okay with sending nothing
     
    572571}
    573572
    574 mDNSlocal void ProxyCallbackCommon(mDNS *const m, void *socket, void *const pkt, const mDNSu8 *const end, const mDNSAddr *const srcaddr,
     573mDNSlocal void ProxyCallbackCommon(mDNS *const m, void *socket, DNSMessage *const msg, const mDNSu8 *const end, const mDNSAddr *const srcaddr,
    575574    const mDNSIPPort srcport, const mDNSAddr *dstaddr, const mDNSIPPort dstport, const mDNSInterfaceID InterfaceID, mDNSBool tcp, void *context)
    576575{
    577     DNSMessage  *msg  = (DNSMessage *)pkt;
    578576    mDNSu8 QR_OP;
    579577    const mDNSu8 *ptr;
     
    595593    }
    596594   
    597     if ((unsigned)(end - (mDNSu8 *)pkt) < sizeof(DNSMessageHeader))
    598     {
    599         debugf("ProxyCallbackCommon: DNS Message from %#a:%d to %#a:%d length %d too short", srcaddr, mDNSVal16(srcport), dstaddr, mDNSVal16(dstport), end - (mDNSu8 *)pkt);
     595    if ((unsigned)(end - (mDNSu8 *)msg) < sizeof(DNSMessageHeader))
     596    {
     597        debugf("ProxyCallbackCommon: DNS Message from %#a:%d to %#a:%d length %d too short", srcaddr, mDNSVal16(srcport), dstaddr, mDNSVal16(dstport), (int)(end - (mDNSu8 *)msg));
    600598        return;
    601599    }
     
    605603    {
    606604        LogInfo("ProxyCallbackCommon: Not a query(%d) for pkt from %#a:%d", QR_OP, srcaddr, mDNSVal16(srcport));
    607         SendError(m, socket, pkt, end, srcaddr, srcport, InterfaceID, tcp, context, kDNSFlag1_RC_NotImpl);
     605        SendError(m, socket, msg, end, srcaddr, srcport, InterfaceID, tcp, context, kDNSFlag1_RC_NotImpl);
    608606        return;
    609607    }
     
    620618        LogInfo("ProxyCallbackCommon: Malformed pkt from %#a:%d, Q:%d, An:%d, Au:%d", srcaddr, mDNSVal16(srcport),
    621619            msg->h.numQuestions, msg->h.numAnswers, msg->h.numAuthorities);
    622         SendError(m, socket, pkt, end, srcaddr, srcport, InterfaceID, tcp, context, kDNSFlag1_RC_FormErr);
     620        SendError(m, socket, msg, end, srcaddr, srcport, InterfaceID, tcp, context, kDNSFlag1_RC_FormErr);
    623621        return;
    624622    }
     
    628626    {
    629627        LogInfo("ProxyCallbackCommon: Question cannot be parsed for pkt from %#a:%d", srcaddr, mDNSVal16(srcport));
    630         SendError(m, socket, pkt, end, srcaddr, srcport, InterfaceID, tcp, context, kDNSFlag1_RC_FormErr);
     628        SendError(m, socket, msg, end, srcaddr, srcport, InterfaceID, tcp, context, kDNSFlag1_RC_FormErr);
    631629        return;
    632630    }
     
    733731}
    734732
    735 mDNSexport void ProxyUDPCallback(mDNS *const m, void *socket, void *const pkt, const mDNSu8 *const end, const mDNSAddr *const srcaddr,
     733mDNSexport void ProxyUDPCallback(mDNS *const m, void *socket, DNSMessage *const msg, const mDNSu8 *const end, const mDNSAddr *const srcaddr,
    736734    const mDNSIPPort srcport, const mDNSAddr *dstaddr, const mDNSIPPort dstport, const mDNSInterfaceID InterfaceID, void *context)
    737735{
    738     LogInfo("ProxyUDPCallback: DNS Message from %#a:%d to %#a:%d length %d", srcaddr, mDNSVal16(srcport), dstaddr, mDNSVal16(dstport), end - (mDNSu8 *)pkt);
    739     ProxyCallbackCommon(m, socket, pkt, end, srcaddr, srcport, dstaddr, dstport, InterfaceID, mDNSfalse, context);
    740 }
    741 
    742 mDNSexport void ProxyTCPCallback(mDNS *const m, void *socket, void *const pkt, const mDNSu8 *const end, const mDNSAddr *const srcaddr,
     736    LogInfo("ProxyUDPCallback: DNS Message from %#a:%d to %#a:%d length %d", srcaddr, mDNSVal16(srcport), dstaddr, mDNSVal16(dstport), (int)(end - (mDNSu8 *)msg));
     737    ProxyCallbackCommon(m, socket, msg, end, srcaddr, srcport, dstaddr, dstport, InterfaceID, mDNSfalse, context);
     738}
     739
     740mDNSexport void ProxyTCPCallback(mDNS *const m, void *socket, DNSMessage *const msg, const mDNSu8 *const end, const mDNSAddr *const srcaddr,
    743741    const mDNSIPPort srcport, const mDNSAddr *dstaddr, const mDNSIPPort dstport, const mDNSInterfaceID InterfaceID, void *context)
    744742{
    745     LogInfo("ProxyTCPCallback: DNS Message from %#a:%d to %#a:%d length %d", srcaddr, mDNSVal16(srcport), dstaddr, mDNSVal16(dstport), end - (mDNSu8 *)pkt);
     743    LogInfo("ProxyTCPCallback: DNS Message from %#a:%d to %#a:%d length %d", srcaddr, mDNSVal16(srcport), dstaddr, mDNSVal16(dstport), (int)(end - (mDNSu8 *)msg));
    746744   
    747745    // If the connection was closed from the other side or incoming packet does not match stored input interface list, locate the client
    748746    // state and free it.
    749     if (((end - (mDNSu8 *)pkt) == 0) || (!CheckDNSProxyIpIntf(m, InterfaceID)))
     747    if (((end - (mDNSu8 *)msg) == 0) || (!CheckDNSProxyIpIntf(m, InterfaceID)))
    750748    {
    751749        DNSProxyClient **ppc = &DNSProxyClients;
     
    770768        return;
    771769    }
    772     ProxyCallbackCommon(m, socket, pkt, end, srcaddr, srcport, dstaddr, dstport, InterfaceID, mDNStrue, context);
     770    ProxyCallbackCommon(m, socket, msg, end, srcaddr, srcport, dstaddr, dstport, InterfaceID, mDNStrue, context);
    773771}
    774772
     
    800798#else // UNICAST_DISABLED
    801799
    802 mDNSexport void ProxyUDPCallback(mDNS *const m, void *socket, void *const pkt, const mDNSu8 *const end, const mDNSAddr *const srcaddr, const mDNSIPPort srcport, const mDNSAddr *dstaddr, const mDNSIPPort dstport, const mDNSInterfaceID InterfaceID, void *context)
     800mDNSexport void ProxyUDPCallback(mDNS *const m, void *socket, DNSMessage *const msg, const mDNSu8 *const end, const mDNSAddr *const srcaddr, const mDNSIPPort srcport, const mDNSAddr *dstaddr, const mDNSIPPort dstport, const mDNSInterfaceID InterfaceID, void *context)
    803801{
    804802    (void) m;
    805803    (void) socket;
    806     (void) pkt;
     804    (void) msg;
    807805    (void) end;
    808806    (void) srcaddr;
     
    814812}
    815813
    816 mDNSexport void ProxyTCPCallback(mDNS *const m, void *socket, void *const pkt, const mDNSu8 *const end, const mDNSAddr *const srcaddr, const mDNSIPPort srcport, const mDNSAddr *dstaddr, const mDNSIPPort dstport, const mDNSInterfaceID InterfaceID, void *context)
     814mDNSexport void ProxyTCPCallback(mDNS *const m, void *socket, DNSMessage *const msg, const mDNSu8 *const end, const mDNSAddr *const srcaddr, const mDNSIPPort srcport, const mDNSAddr *dstaddr, const mDNSIPPort dstport, const mDNSInterfaceID InterfaceID, void *context)
    817815{
    818816    (void) m;
    819817    (void) socket;
    820     (void) pkt;
     818    (void) msg;
    821819    (void) end;
    822820    (void) srcaddr;
  • mDNSResponder/mDNSCore/dnsproxy.h

    r7d33d36 ra814950  
    2222#include "DNSCommon.h"
    2323
    24 extern void ProxyUDPCallback(mDNS *const m, void *socket, void *const pkt, const mDNSu8 *const end, const mDNSAddr *const srcaddr,
     24extern void ProxyUDPCallback(mDNS *const m, void *socket, DNSMessage *const msg, const mDNSu8 *const end, const mDNSAddr *const srcaddr,
    2525                             const mDNSIPPort srcport, const mDNSAddr *dstaddr, const mDNSIPPort dstport, const mDNSInterfaceID InterfaceID, void *context);
    26 extern void ProxyTCPCallback(mDNS *const m, void *socket, void *const pkt, const mDNSu8 *const end, const mDNSAddr *const srcaddr,
     26extern void ProxyTCPCallback(mDNS *const m, void *socket, DNSMessage *const msg, const mDNSu8 *const end, const mDNSAddr *const srcaddr,
    2727                             const mDNSIPPort srcport, const mDNSAddr *dstaddr, const mDNSIPPort dstport, const mDNSInterfaceID InterfaceID, void *context);                         
    2828extern void DNSProxyInit(mDNS *const m, mDNSu32 IpIfArr[MaxIp], mDNSu32 OpIf);
  • mDNSResponder/mDNSCore/mDNS.c

    r7d33d36 ra814950  
    66296629                    // mDNSCoreReadyForSleep() will conclude correctly that all the updates have already completed
    66306630
     6631                    // Setting this flag activates the SleepLimit which delays sleep by 5 seconds and
     6632                    // will allow the system to deregister any BTMM records.
     6633                    m->NextScheduledSPRetry  = m->timenow + (5 * mDNSPlatformOneSecond);
    66316634                    registeredIntfIDS[registeredCount] = intf->InterfaceID;
    66326635                    registeredCount++;
     
    1052510528}
    1052610529
    10527 mDNSexport void mDNSCoreReceive(mDNS *const m, void *const pkt, const mDNSu8 *const end,
     10530mDNSexport void mDNSCoreReceive(mDNS *const m, DNSMessage *const msg, const mDNSu8 *const end,
    1052810531                                const mDNSAddr *const srcaddr, const mDNSIPPort srcport, const mDNSAddr *dstaddr, const mDNSIPPort dstport,
    1052910532                                const mDNSInterfaceID InterfaceID)
    1053010533{
    1053110534    mDNSInterfaceID ifid = InterfaceID;
    10532     DNSMessage  *msg  = (DNSMessage *)pkt;
     10535    const mDNSu8 *const pkt = (mDNSu8 *)msg;
    1053310536    const mDNSu8 StdQ = kDNSFlag0_QR_Query    | kDNSFlag0_OP_StdQuery;
    1053410537    const mDNSu8 StdR = kDNSFlag0_QR_Response | kDNSFlag0_OP_StdQuery;
     
    1054710550        {
    1054810551            mDNS_Lock(m);
    10549             LNT_ConfigureRouterInfo(m, InterfaceID, pkt, (mDNSu16)(end - (mDNSu8 *)pkt));
     10552            LNT_ConfigureRouterInfo(m, InterfaceID, (mDNSu8 *)msg, (mDNSu16)(end - pkt));
    1055010553            mDNS_Unlock(m);
    1055110554            return;
     
    1055510558        {
    1055610559            mDNS_Lock(m);
    10557             uDNS_ReceiveNATPacket(m, InterfaceID, pkt, (mDNSu16)(end - (mDNSu8 *)pkt));
     10560            uDNS_ReceiveNATPacket(m, InterfaceID, (mDNSu8 *)msg, (mDNSu16)(end - pkt));
    1055810561            mDNS_Unlock(m);
    1055910562            return;
     
    1056510568
    1056610569#endif
    10567     if ((unsigned)(end - (mDNSu8 *)pkt) < sizeof(DNSMessageHeader))
    10568     {
    10569         LogMsg("DNS Message from %#a:%d to %#a:%d length %d too short", srcaddr, mDNSVal16(srcport), dstaddr, mDNSVal16(dstport), end - (mDNSu8 *)pkt);
     10570    if ((unsigned)(end - pkt) < sizeof(DNSMessageHeader))
     10571    {
     10572        LogMsg("DNS Message from %#a:%d to %#a:%d length %d too short", srcaddr, mDNSVal16(srcport), dstaddr, mDNSVal16(dstport), (int)(end - pkt));
    1057010573        return;
    1057110574    }
     
    1062510628                int i = 0;
    1062610629                LogInfo("Unknown DNS packet type %02X%02X from %#-15a:%-5d to %#-15a:%-5d length %d on %p (ignored)",
    10627                         msg->h.flags.b[0], msg->h.flags.b[1], srcaddr, mDNSVal16(srcport), dstaddr, mDNSVal16(dstport), end - (mDNSu8 *)pkt, InterfaceID);
    10628                 while (i<end - (mDNSu8 *)pkt)
     10630                        msg->h.flags.b[0], msg->h.flags.b[1], srcaddr, mDNSVal16(srcport), dstaddr, mDNSVal16(dstport), (int)(end - pkt), InterfaceID);
     10631                while (i < (int)(end - pkt))
    1062910632                {
    1063010633                    char buffer[128];
    1063110634                    char *p = buffer + mDNS_snprintf(buffer, sizeof(buffer), "%04X", i);
    10632                     do if (i<end - (mDNSu8 *)pkt) p += mDNS_snprintf(p, sizeof(buffer), " %02X", ((mDNSu8 *)pkt)[i]);while (++i & 15);
     10635                    do if (i < (int)(end - pkt)) p += mDNS_snprintf(p, sizeof(buffer), " %02X", pkt[i]);while (++i & 15);
    1063310636                    LogInfo("%s", buffer);
    1063410637                }
     
    1382713830                                        (rr->AnnounceCount == InitialAnnounceCount)     ? msg2 :
    1382813831                                        mDNSSameEthAddress(&arp->sha, &intf->MAC)       ? msg3 : msg4;
    13829                 LogSPS("%-7s %s %.6a %.4a for %.4a -- H-MAC %.6a I-MAC %.6a %s",
    13830                        intf->ifname, msg, &arp->sha, &arp->spa, &arp->tpa, &rr->WakeUp.HMAC, &rr->WakeUp.IMAC, ARDisplayString(m, rr));
     13832                LogMsg("Arp %-7s %s %.6a %.4a for %.4a -- H-MAC %.6a I-MAC %.6a %s",
     13833                       intf->ifname, msg, arp->sha.b, arp->spa.b, arp->tpa.b,
     13834                       &rr->WakeUp.HMAC, &rr->WakeUp.IMAC, ARDisplayString(m, rr));
    1383113835                if (msg == msg1)
    1383213836                {
     
    1384213846                else if (msg == msg4)
    1384313847                {
    13844                     SendARP(m, 2, rr, &arp->tpa, &arp->sha, &arp->spa, &arp->sha);
     13848                    SendARP(m, 2, rr, (mDNSv4Addr *)arp->tpa.b, &arp->sha, (mDNSv4Addr *)arp->spa.b, &arp->sha);
    1384513849                }
    1384613850            }
     
    1385613860    //   If the sender hardware address is *not* the original owner, then this is a conflict, and we need to wake the sleeping machine to handle it.
    1385713861    if (mDNSSameEthAddress(&arp->sha, &intf->MAC))
    13858         debugf("ARP from self for %.4a", &arp->tpa);
     13862        debugf("ARP from self for %.4a", arp->tpa.b);
    1385913863    else
    1386013864    {
     
    1386613870                    if (mDNSSameEthAddress(&zeroEthAddr, &rr->WakeUp.HMAC))
    1386713871                    {
    13868                         LogSPS("%-7s ARP from %.6a %.4a for %.4a -- Invalid H-MAC %.6a I-MAC %.6a %s", intf->ifname,
    13869                                 &arp->sha, &arp->spa, &arp->tpa, &rr->WakeUp.HMAC, &rr->WakeUp.IMAC, ARDisplayString(m, rr));
     13872                        LogMsg("%-7s ARP from %.6a %.4a for %.4a -- Invalid H-MAC %.6a I-MAC %.6a %s", intf->ifname,
     13873                                arp->sha.b, arp->spa.b, arp->tpa.b, &rr->WakeUp.HMAC, &rr->WakeUp.IMAC, ARDisplayString(m, rr));
    1387013874                    }
    1387113875                    else
     
    1387413878                        if (mDNSSameEthAddress(&arp->sha, &rr->WakeUp.IMAC))
    1387513879                        {
    13876                             LogSPS("%-7s ARP %s from owner %.6a %.4a for %-15.4a -- re-starting probing for %s", intf->ifname,
     13880                            LogMsg("%-7s ARP %s from owner %.6a %.4a for %-15.4a -- re-starting probing for %s", intf->ifname,
    1387713881                                    mDNSSameIPv4Address(arp->spa, arp->tpa) ? "Announcement " : mDNSSameOpaque16(arp->op, ARP_op_request) ? "Request      " : "Response     ",
    13878                                     &arp->sha, &arp->spa, &arp->tpa, ARDisplayString(m, rr));
     13882                                    arp->sha.b, arp->spa.b, arp->tpa.b, ARDisplayString(m, rr));
    1387913883                        }
    1388013884                        else
    1388113885                        {
    1388213886                            LogMsg("%-7s Conflicting ARP from %.6a %.4a for %.4a -- waking H-MAC %.6a I-MAC %.6a %s", intf->ifname,
    13883                                     &arp->sha, &arp->spa, &arp->tpa, &rr->WakeUp.HMAC, &rr->WakeUp.IMAC, ARDisplayString(m, rr));
     13887                                    arp->sha.b, arp->spa.b, arp->tpa.b, &rr->WakeUp.HMAC, &rr->WakeUp.IMAC, ARDisplayString(m, rr));
    1388413888                            ScheduleWakeup(m, rr->resrec.InterfaceID, &rr->WakeUp.HMAC);
    1388513889                        }
     
    1457714581                     cr->resrec.rrtype     == kDNSType_A ||
    1457814582                     cr->resrec.rrtype     == kDNSType_AAAA ||
    14579                      cr->resrec.rrtype     == kDNSType_SRV;
     14583                     cr->resrec.rrtype     == kDNSType_SRV ||
     14584                     cr->resrec.rrtype     == kDNSType_CNAME;
    1458014585
    1458114586    (void) lameduck;
  • mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h

    r7d33d36 ra814950  
    483483#define mDNS_numUpdates numAuthorities
    484484
    485 typedef packedstruct
     485typedef struct
    486486{
    487487    mDNSOpaque16 id;
     
    500500#endif
    501501#define NormalMaxDNSMessageData 1440
    502 typedef packedstruct
     502typedef struct
    503503{
    504504    DNSMessageHeader h;                     // Note: Size 12 bytes
     
    618618} UDPHeader;                // 8 bytes; IP protocol type 0x11
    619619
    620 typedef packedstruct
     620typedef struct
    621621{
    622622    mDNSu8 type;            // 0x87 == Neighbor Solicitation, 0x88 == Neighbor Advertisement
     
    817817//size of rdataRRSIG excluding signerName and signature (which are variable fields)
    818818#define RRSIG_FIXED_SIZE      18
    819 typedef packedstruct
     819typedef struct
    820820{
    821821    mDNSu16 typeCovered;
     
    826826    mDNSu32 sigInceptTime;
    827827    mDNSu16 keyTag;
    828     mDNSu8 *signerName;
     828    mDNSu8  signerName[1]; // signerName is a dynamically-sized array
    829829    // mDNSu8 *signature
    830830} rdataRRSig;
     
    939939
    940940// Note: rdataOPT format may be repeated an arbitrary number of times in a single resource record
    941 typedef packedstruct
     941typedef struct
    942942{
    943943    mDNSu16 opt;
     
    11831183} PCPResult_t;
    11841184
    1185 typedef packedstruct
     1185typedef struct
    11861186{
    11871187    mDNSu8       version;
     
    11981198} PCPMapRequest;
    11991199
    1200 typedef packedstruct
     1200typedef struct
    12011201{
    12021202    mDNSu8     version;
     
    32973297extern void     mDNS_DeregisterInterface(mDNS *const m, NetworkInterfaceInfo *set, mDNSBool flapping);
    32983298extern void     mDNSCoreInitComplete(mDNS *const m, mStatus result);
    3299 extern void     mDNSCoreReceive(mDNS *const m, void *const msg, const mDNSu8 *const end,
     3299extern void     mDNSCoreReceive(mDNS *const m, DNSMessage *const msg, const mDNSu8 *const end,
    33003300                                const mDNSAddr *const srcaddr, const mDNSIPPort srcport,
    33013301                                const mDNSAddr *dstaddr, const mDNSIPPort dstport, const mDNSInterfaceID InterfaceID);
     
    33673367#endif
    33683368
    3369 typedef void ProxyCallback (mDNS *const m, void *socket, void *const msg, const mDNSu8 *const end, const mDNSAddr *const srcaddr,
     3369typedef void ProxyCallback (mDNS *const m, void *socket, DNSMessage *const msg, const mDNSu8 *const end, const mDNSAddr *const srcaddr,
    33703370    const mDNSIPPort srcport, const mDNSAddr *dstaddr, const mDNSIPPort dstport, const mDNSInterfaceID InterfaceID, void *context);
    33713371extern void mDNSPlatformInitDNSProxySkts(mDNS *const m, ProxyCallback *UDPCallback, ProxyCallback *TCPCallback);
     
    35873587    char assertL[(sizeof(IKEHeader     )   ==   28                         ) ? 1 : -1];
    35883588    char assertM[(sizeof(TCPHeader     )   ==   20                         ) ? 1 : -1];
     3589        char assertN[(sizeof(rdataOPT)             ==   24                         ) ? 1 : -1];
     3590        char assertO[(sizeof(rdataRRSig)           ==   20                         ) ? 1 : -1];
     3591        char assertP[(sizeof(PCPMapRequest)    ==   60                         ) ? 1 : -1];
     3592        char assertQ[(sizeof(PCPMapReply)      ==   60                         ) ? 1 : -1];
     3593
    35893594
    35903595    // Check our structures are reasonable sizes. Including overly-large buffers, or embedding
  • mDNSResponder/mDNSCore/uDNS.c

    r7d33d36 ra814950  
    41104110    else
    41114111    {
     4112        q->dnsPushState = DNSPUSH_NOSERVER;
    41124113        StartLLQPolling(m,q);
    41134114        if (err == mStatus_NoSuchNameErr)
     
    41164117            q->servAddr.type  = mDNSAddrType_IPv4;
    41174118            q->servAddr.ip.v4 = onesIPv4Addr;
    4118             q->dnsPushState   = DNSPUSH_NOSERVER;
    41194119        }
    41204120    }
  • mDNSResponder/mDNSMacOSX/daemon.c

    r7d33d36 ra814950  
    3333#include <err.h>
    3434#include <sysexits.h>
     35#include <dlfcn.h>
    3536
    3637#include "uDNS.h"
     
    14411442#endif
    14421443
     1444#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
     1445mDNSlocal mDNSBool initialize_networkserviceproxy(void)
     1446{
     1447    void *NSPImage = dlopen("/System/Library/PrivateFrameworks/NetworkServiceProxy.framework/NetworkServiceProxy", RTLD_LAZY | RTLD_LOCAL);
     1448    if (NSPImage == NULL) {
     1449        os_log_error(OS_LOG_DEFAULT, "dlopen NetworkServiceProxy.framework failed");
     1450        return mDNSfalse;
     1451    }
     1452    return mDNStrue;
     1453}
     1454#endif
     1455
    14431456mDNSexport int main(int argc, char **argv)
    14441457{
     
    16121625    UpdateDebugState();
    16131626
     1627#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
     1628    if (initialize_networkserviceproxy() == mDNSfalse) {
     1629        LogMsg("Failed to initialize NetworkServiceProxy");
     1630    }
     1631#endif
     1632
    16141633#ifdef MDNSRESPONDER_USES_LIB_DISPATCH_AS_PRIMARY_EVENT_LOOP_MECHANISM
    16151634    LogInfo("Daemon Start: Using LibDispatch");
  • mDNSResponder/mDNSMacOSX/mDNSMacOSX.c

    r7d33d36 ra814950  
    19261926        s = (src ? src->ss : m->p->permanentsockets).sktv4;
    19271927
    1928         if (info)   // Specify outgoing interface
    1929         {
    1930             if (!mDNSAddrIsDNSMulticast(dst))
     1928        if (!mDNSAddrIsDNSMulticast(dst))
     1929        {
     1930        #ifdef IP_BOUND_IF
     1931            const mDNSu32 ifindex = info ? info->scope_id : IFSCOPE_NONE;
     1932            setsockopt(s, IPPROTO_IP, IP_BOUND_IF, &ifindex, sizeof(ifindex));
     1933        #else
     1934            static int displayed = 0;
     1935            if (displayed < 1000)
    19311936            {
    1932                 #ifdef IP_BOUND_IF
    1933                 if (info->scope_id == 0)
    1934                     LogInfo("IP_BOUND_IF socket option not set -- info %p (%s) scope_id is zero", info, ifa_name);
    1935                 else
    1936                     setsockopt(s, IPPROTO_IP, IP_BOUND_IF, &info->scope_id, sizeof(info->scope_id));
    1937                 #else
    1938                 {
    1939                     static int displayed = 0;
    1940                     if (displayed < 1000)
    1941                     {
    1942                         displayed++;
    1943                         LogInfo("IP_BOUND_IF socket option not defined -- cannot specify interface for unicast packets");
    1944                     }
    1945                 }
    1946                 #endif
     1937                displayed++;
     1938                LogInfo("IP_BOUND_IF socket option not defined -- cannot specify interface for unicast packets");
    19471939            }
    1948             else
    1949                 #ifdef IP_MULTICAST_IFINDEX
     1940        #endif
     1941        }
     1942        else if (info)
     1943        {
     1944        #ifdef IP_MULTICAST_IFINDEX
     1945            err = setsockopt(s, IPPROTO_IP, IP_MULTICAST_IFINDEX, &info->scope_id, sizeof(info->scope_id));
     1946            // We get an error when we compile on a machine that supports this option and run the binary on
     1947            // a different machine that does not support it
     1948            if (err < 0)
    19501949            {
    1951                 err = setsockopt(s, IPPROTO_IP, IP_MULTICAST_IFINDEX, &info->scope_id, sizeof(info->scope_id));
    1952                 // We get an error when we compile on a machine that supports this option and run the binary on
    1953                 // a different machine that does not support it
    1954                 if (err < 0)
    1955                 {
    1956                     if (errno != ENOPROTOOPT) LogInfo("mDNSPlatformSendUDP: setsockopt: IP_MUTLTICAST_IFINDEX returned %d", errno);
    1957                     err = setsockopt(s, IPPROTO_IP, IP_MULTICAST_IF, &info->ifa_v4addr, sizeof(info->ifa_v4addr));
    1958                     if (err < 0 && !m->NetworkChanged)
    1959                         LogMsg("setsockopt - IP_MULTICAST_IF error %.4a %d errno %d (%s)", &info->ifa_v4addr, err, errno, strerror(errno));
    1960                 }
    1961             }
    1962                 #else
    1963             {
     1950                if (errno != ENOPROTOOPT) LogInfo("mDNSPlatformSendUDP: setsockopt: IP_MUTLTICAST_IFINDEX returned %d", errno);
    19641951                err = setsockopt(s, IPPROTO_IP, IP_MULTICAST_IF, &info->ifa_v4addr, sizeof(info->ifa_v4addr));
    19651952                if (err < 0 && !m->NetworkChanged)
    19661953                    LogMsg("setsockopt - IP_MULTICAST_IF error %.4a %d errno %d (%s)", &info->ifa_v4addr, err, errno, strerror(errno));
    1967 
    19681954            }
    1969                 #endif
    1970         }
    1971     }
    1972 
     1955        #else
     1956            err = setsockopt(s, IPPROTO_IP, IP_MULTICAST_IF, &info->ifa_v4addr, sizeof(info->ifa_v4addr));
     1957            if (err < 0 && !m->NetworkChanged)
     1958                LogMsg("setsockopt - IP_MULTICAST_IF error %.4a %d errno %d (%s)", &info->ifa_v4addr, err, errno, strerror(errno));
     1959        #endif
     1960        }
     1961    }
    19731962    else if (dst->type == mDNSAddrType_IPv6)
    19741963    {
     
    22742263        if (ss->proxy)
    22752264        {
    2276             m->p->UDPProxyCallback(m, &m->p->UDPProxy, (unsigned char *)&m->imsg, (unsigned char*)&m->imsg + err, &senderAddr,
     2265            m->p->UDPProxyCallback(m, &m->p->UDPProxy, &m->imsg.m, (unsigned char*)&m->imsg + err, &senderAddr,
    22772266                senderPort, &destAddr, ss->port, InterfaceID, NULL);
    22782267        }
    22792268        else
    22802269        {
    2281             mDNSCoreReceive(m, &m->imsg, (unsigned char*)&m->imsg + err, &senderAddr, senderPort, &destAddr, ss->port, InterfaceID);
     2270            mDNSCoreReceive(m, &m->imsg.m, (unsigned char*)&m->imsg + err, &senderAddr, senderPort, &destAddr, ss->port, InterfaceID);
    22822271        }
    22832272
  • mDNSResponder/mDNSMacOSX/mDNSResponder-entitlements.plist

    r7d33d36 ra814950  
    2121    <key>com.apple.private.necp.match</key>
    2222    <true/>
     23    <key>com.apple.private.necp.policies</key>
     24    <true/>
    2325    <key>com.apple.security.network.server</key>
    2426    <true/>
     
    3335    <key>com.apple.BTServer.appleMfgDataScanner</key>
    3436    <true/>
     37    <key>com.apple.developer.networking.networkextension</key>
     38    <array>
     39      <string>app-proxy-provider-system</string>
     40    </array>
     41    <key>com.apple.private.neagent</key>
     42    <true/>
     43    <key>com.apple.private.nehelper.privileged</key>
     44    <true/>
    3545</dict>
    3646</plist>
  • mDNSResponder/mDNSMacOSX/mDNSResponder.sb

    r7d33d36 ra814950  
    7373       (global-name "com.apple.blued")
    7474       (global-name "com.apple.mobilegestalt.xpc")
    75        (global-name "com.apple.snhelper"))
     75       (global-name "com.apple.snhelper")
     76       (global-name "com.apple.nehelper")
     77       (global-name "com.apple.networkserviceproxy"))
    7678
    7779(allow mach-register
  • mDNSResponder/mDNSShared/dns_sd.h

    r7d33d36 ra814950  
    6767
    6868#ifndef _DNS_SD_H
    69 #define _DNS_SD_H 7653011
     69#define _DNS_SD_H 7655009
    7070
    7171#ifdef  __cplusplus
  • mDNSResponder/mDNSShared/dnsextd.c

    r7d33d36 ra814950  
    23562356        qptr = getQuestion(&pkt->msg, qptr, end, 0, &q);
    23572357        if (!qptr) { Log("Malformatted LLQ from %s: cannot read question %d", addr, i); goto end; }
    2358         llq = (LLQOptData *)&opt.r.resrec.rdata->u.opt[0].u.llq + i; // point into OptData at index i
     2358        llq = &opt.r.resrec.rdata->u.opt[i].u.llq; // point into OptData at index i
    23592359        if (llq->vers != kLLQ_Vers) { Log("LLQ from %s contains bad version %d (expected %d)", addr, llq->vers, kLLQ_Vers); goto end; }
    23602360
     
    30953095void mDNS_ConfigChanged(mDNS *const m)  { ( void ) m; }
    30963096void mDNSCoreMachineSleep(mDNS * const m, mDNSBool wake) { ( void ) m; ( void ) wake; }
    3097 void mDNSCoreReceive(mDNS *const m, void *const msg, const mDNSu8 *const end,
     3097void mDNSCoreReceive(mDNS *const m, DNSMessage *const msg, const mDNSu8 *const end,
    30983098                     const mDNSAddr *const srcaddr, const mDNSIPPort srcport,
    30993099                     const mDNSAddr *const dstaddr, const mDNSIPPort dstport, const mDNSInterfaceID iid)
  • mDNSResponder/mDNSShared/uds_daemon.c

    r7d33d36 ra814950  
    12841284{
    12851285    mStatus err = mStatus_BadParamErr;
     1286
     1287    if (request->terminate != connection_termination)
     1288    { LogMsg("%3d: DNSServiceRegisterRecord(not a shared connection ref)", request->sd); return(err); }
     1289
    12861290    AuthRecord *rr = read_rr_from_ipc_msg(request, 1, 1);
    12871291    if (rr)
     
    41744178    socklen_t len;
    41754179
     4180    LogOperation("%3d: DNSServiceCreateDelegateConnection START PID[%d](%s)",
     4181                 request->sd, request->process_id, request->pid_name);
     4182    request->terminate = connection_termination;
     4183
    41764184    len = 0;
    41774185    pid = get_uint32(&request->msgptr, request->msgend);
     
    49564964            return;
    49574965        }
    4958         if (req->hdr.version != VERSION)
    4959         {
    4960             LogMsg("request_callback: ERROR: client IPC version %d incompatible with daemon IPC version %d PID[%d][%s]",
    4961                    req->hdr.version, VERSION, req->process_id, req->pid_name);
    4962             AbortUnlinkAndFree(req);
    4963             return;
    4964         }
    49654966
    49664967        switch(req->hdr.op)            //          Interface       + other data
     
    50635064                            req->terminate = connection_termination;
    50645065                            break;
    5065                 case connection_delegate_request:
    5066                             LogOperation("%3d: DNSServiceCreateDelegateConnection START PID[%d](%s)",
    5067                                 req->sd, req->process_id, req->pid_name);
    5068                             req->terminate = connection_termination;
    5069                             handle_connection_delegate_request(req);
    5070                             break;
     5066                case connection_delegate_request:        handle_connection_delegate_request(req); break;
    50715067                case resolve_request:              err = handle_resolve_request     (req);  break;
    50725068                case query_request:                err = handle_queryrecord_request (req);  break;
Note: See TracChangeset for help on using the changeset viewer.