Changeset 49ebc73 in rtems-libbsd


Ignore:
Timestamp:
Sep 20, 2018, 9:12:30 AM (7 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
647dd08ae2aa69b935c2847ea450fb824322ecae, c6261f97870562d4c797cfb1ff1ba0affb85a916
Children:
f761b29
Parents:
e36ca10
git-author:
Sebastian Huber <sebastian.huber@…> (09/20/18 09:12:30)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/20/18 09:23:31)
Message:

mDNSResponder: Update to v576.30.4

The sources can be obtained via:

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

Update #3522.

Location:
mDNSResponder
Files:
2 deleted
22 edited
1 moved

Legend:

Unmodified
Added
Removed
  • mDNSResponder/Clients/dns-sd.c

    re36ca10 r49ebc73  
    16181618        break;
    16191619
     1620
    16201621    case 'P':   if (argc < opi+6) goto Fail;
    16211622        err = DNSServiceCreateConnection(&client_pa);
     
    16321633        uint16_t rrtype, rrclass;
    16331634        flags |= kDNSServiceFlagsReturnIntermediates;
    1634         if (operation == 'q') 
     1635        if (operation == 'q')
    16351636            flags |= kDNSServiceFlagsSuppressUnusable;
    16361637        if (argc < opi+1)
  • mDNSResponder/Clients/dnsctl.c

    re36ca10 r49ebc73  
    1919
    2020#include <dispatch/dispatch.h>
    21 #include "dns_services_mdns.h"
     21#include "dns_services.h"
    2222
    2323//*************************************************************************************************************
  • mDNSResponder/Makefile

    re36ca10 r49ebc73  
    1717include $(MAKEFILEPATH)/pb_makefiles/platform.make
    1818
    19 MVERS = "mDNSResponder-567"
     19MVERS = "mDNSResponder-576.30.4"
    2020
    2121DDNSWRITECONFIG = "$(DSTROOT)/Library/Application Support/Bonjour/ddnswriteconfig"
  • mDNSResponder/mDNSCore/DNSCommon.c

    re36ca10 r49ebc73  
    14681468    q->ReturnIntermed      = mDNSfalse;
    14691469    q->SuppressUnusable    = mDNSfalse;
     1470    q->DenyOnCellInterface = mDNSfalse;
     1471    q->DenyOnExpInterface  = mDNSfalse;
    14701472    q->SearchListIndex     = 0;
    14711473    q->AppendSearchDomains = 0;
  • mDNSResponder/mDNSCore/mDNS.c

    re36ca10 r49ebc73  
    467467    const mDNSBool selfref = SameDomainName(&q->qname, &rr->rdata->u.name);
    468468    if (q->CNAMEReferrals >= 10 || selfref)
     469    {
    469470        LogMsg("AnswerQuestionByFollowingCNAME: %p %##s (%s) NOT following CNAME referral %d%s for %s",
    470471               q, q->qname.c, DNSTypeName(q->qtype), q->CNAMEReferrals, selfref ? " (Self-Referential)" : "", RRDisplayString(m, rr));
     472    }
    471473    else
    472474    {
     
    12521254                   rr->resrec.name->c, DNSTypeName(rr->resrec.rrtype), rr->DependentOn->resrec.RecordType);
    12531255            return(mStatus_Invalid);
    1254         }
    1255     }
    1256 
    1257     // If this resource record is referencing a specific interface, make sure it exists.
    1258     // Skip checks for LocalOnly and P2P as they are not valid InterfaceIDs. Also, for scoped
    1259     // entries in /etc/hosts skip that check as that interface may not be valid at this time.
    1260     if (rr->resrec.InterfaceID && rr->ARType != AuthRecordLocalOnly && rr->ARType != AuthRecordP2P)
    1261     {
    1262         NetworkInterfaceInfo *intf = FirstInterfaceForID(m, rr->resrec.InterfaceID);
    1263         if (!intf)
    1264         {
    1265             debugf("mDNS_Register_internal: Bogus InterfaceID %p in resource record", rr->resrec.InterfaceID);
    1266             return(mStatus_BadReferenceErr);
    12671256        }
    12681257    }
     
    28222811        {
    28232812            if (rr->ARType != AuthRecordLocalOnly && rr->ARType != AuthRecordP2P)
    2824                 LogMsg("SendResponses: No active interface %p to send: %p %02X %s", rr->SendRNow, rr->resrec.InterfaceID, rr->resrec.RecordType, ARDisplayString(m, rr));
     2813                LogInfo("SendResponses: No active interface %d to send: %d %02X %s",
     2814                     (uint32_t)rr->SendRNow, (uint32_t)rr->resrec.InterfaceID, rr->resrec.RecordType, ARDisplayString(m, rr));
    28252815            rr->SendRNow = mDNSNULL;
    28262816        }
     
    34683458                if (ar->AddressProxy.type == mDNSAddrType_IPv4)
    34693459                {
     3460                        // There's a problem here. If a host is waking up, and we probe to see if it responds, then
     3461                        // it will see those ARP probes as signalling intent to use the address, so it picks a different one.
     3462                        // A more benign way to find out if a host is responding to ARPs might be send a standard ARP *request*
     3463                        // (using our sender IP address) instead of an ARP *probe* (using all-zero sender IP address).
     3464                        // A similar concern may apply to the NDP Probe too. -- SC
    34703465                    LogSPS("SendQueries ARP Probe %d %s %s", ar->ProbeCount, InterfaceNameForID(m, ar->resrec.InterfaceID), ARDisplayString(m,ar));
    34713466                    SendARP(m, 1, ar, &zerov4Addr, &zeroEthAddr, &ar->AddressProxy.ip.v4, &ar->WakeUp.IMAC);
     
    37483743        {
    37493744            if (ar->ARType != AuthRecordLocalOnly && ar->ARType != AuthRecordP2P)
    3750                 LogMsg("SendQueries: No active interface %p to send probe: %p %s", ar->SendRNow, ar->resrec.InterfaceID, ARDisplayString(m, ar));
     3745                LogInfo("SendQueries: No active interface %d to send probe: %d %s",
     3746                    (uint32_t)ar->SendRNow, (uint32_t)ar->resrec.InterfaceID, ARDisplayString(m, ar));
    37513747            ar->SendRNow = mDNSNULL;
    37523748        }
     
    37793775            DNSQuestion *x;
    37803776            for (x = m->NewQuestions; x; x=x->next) if (x == q) break;  // Check if this question is a NewQuestion
    3781             LogMsg("SendQueries: No active interface %p to send %s question: %p %##s (%s)", q->SendQNow, x ? "new" : "old", q->InterfaceID, q->qname.c, DNSTypeName(q->qtype));
     3777            LogInfo("SendQueries: No active interface %d to send %s question: %d %##s (%s)",
     3778                (uint32_t)q->SendQNow, x ? "new" : "old", (uint32_t)q->InterfaceID, q->qname.c, DNSTypeName(q->qtype));
    37823779            q->SendQNow = mDNSNULL;
    37833780        }
     
    1034810345// for multicast questions, we don't want to treat LongLived as anything special
    1034910346#define IsLLQ(Q) ((Q)->LongLived && !mDNSOpaque16IsZero((Q)->TargetQID))
     10347#define IsAWDLIncluded(Q) (((Q)->flags & kDNSServiceFlagsIncludeAWDL) != 0)
    1035010348
    1035110349mDNSlocal DNSQuestion *FindDuplicateQuestion(const mDNS *const m, const DNSQuestion *const question)
     
    1037010368            (q->BrowseThreshold == question->BrowseThreshold) &&  // browse thresholds must match
    1037110369            q->qnamehash  == question->qnamehash    &&
     10370            (IsAWDLIncluded(q) == IsAWDLIncluded(question)) &&  // Inclusion of AWDL interface must match
    1037210371            SameDomainName(&q->qname, &question->qname))        // and name
    1037310372            return(q);
     
    1133511334        NetworkInterfaceInfo *intf = FirstInterfaceForID(m, question->InterfaceID);
    1133611335        if (!intf)
    11337             LogMsg("ValidateParameters: Note: InterfaceID %p for question %##s (%s) not currently found in active interface list",
    11338                     question->InterfaceID, question->qname.c, DNSTypeName(question->qtype));
     11336            LogInfo("ValidateParameters: Note: InterfaceID %d for question %##s (%s) not currently found in active interface list",
     11337                    (uint32_t)question->InterfaceID, question->qname.c, DNSTypeName(question->qtype));
    1133911338    }
    1134011339   
     
    1144611445    question->FlappingInterface1 = mDNSNULL;
    1144711446    question->FlappingInterface2 = mDNSNULL;
    11448 
    11449     question->ServiceID = mDNSPlatformGetServiceID(m, question);
    11450    
     11447       
     11448        // if kDNSServiceFlagsServiceIndex flag is SET by the client, then do NOT call mDNSPlatformGetServiceID()
     11449        // since we would already have the question->ServiceID in that case.
     11450        if (!(question->flags & kDNSServiceFlagsServiceIndex))
     11451                question->ServiceID = mDNSPlatformGetServiceID(m, question);
     11452        else
     11453                LogInfo("InitCommonState: Query for %##s (%s), PID[%d], ServiceID %d is already set by client", question->qname.c,
     11454                           DNSTypeName(question->qtype), question->pid, question->ServiceID);
     11455       
    1145111456    InitDNSConfig(m, question);
    1145211457
     
    1146011465    question->DisallowPID       = (question->ServiceID == 0 || (mDNSPlatformAllowPID(m, question) == 0));
    1146111466    if (question->DisallowPID)
    11462     {
    1146311467        LogInfo("InitCommonState: Query suppressed for %##s (%s), PID %d/ServiceID %d not allowed", question->qname.c,
    11464             DNSTypeName(question->qtype), question->pid, question->ServiceID);
    11465     }
     11468                                        DNSTypeName(question->qtype), question->pid, question->ServiceID);
    1146611469
    1146711470    question->NextInDQList      = mDNSNULL;
     
    1198411987    question->ReturnIntermed   = mDNSfalse;
    1198511988    question->SuppressUnusable = mDNSfalse;
     11989    question->DenyOnCellInterface = mDNSfalse;
     11990    question->DenyOnExpInterface  = mDNSfalse;
    1198611991    question->SearchListIndex  = 0;
    1198711992    question->AppendSearchDomains = 0;
     
    1218012185    query->qSRV.ReturnIntermed      = mDNSfalse;
    1218112186    query->qSRV.SuppressUnusable    = mDNSfalse;
     12187    query->qSRV.DenyOnCellInterface = mDNSfalse;
     12188    query->qSRV.DenyOnExpInterface  = mDNSfalse;
    1218212189    query->qSRV.SearchListIndex     = 0;
    1218312190    query->qSRV.AppendSearchDomains = 0;
     
    1220612213    query->qTXT.ReturnIntermed      = mDNSfalse;
    1220712214    query->qTXT.SuppressUnusable    = mDNSfalse;
     12215    query->qTXT.DenyOnCellInterface = mDNSfalse;
     12216    query->qTXT.DenyOnExpInterface  = mDNSfalse;
    1220812217    query->qTXT.SearchListIndex     = 0;
    1220912218    query->qTXT.AppendSearchDomains = 0;
     
    1223212241    query->qAv4.ReturnIntermed      = mDNSfalse;
    1223312242    query->qAv4.SuppressUnusable    = mDNSfalse;
     12243    query->qAv4.DenyOnCellInterface = mDNSfalse;
     12244    query->qAv4.DenyOnExpInterface  = mDNSfalse;
    1223412245    query->qAv4.SearchListIndex     = 0;
    1223512246    query->qAv4.AppendSearchDomains = 0;
     
    1225812269    query->qAv6.ReturnIntermed      = mDNSfalse;
    1225912270    query->qAv6.SuppressUnusable    = mDNSfalse;
     12271    query->qAv6.DenyOnCellInterface = mDNSfalse;
     12272    query->qAv6.DenyOnExpInterface  = mDNSfalse;
    1226012273    query->qAv6.SearchListIndex     = 0;
    1226112274    query->qAv6.AppendSearchDomains = 0;
     
    1231912332    question->ReturnIntermed   = mDNSfalse;
    1232012333    question->SuppressUnusable = mDNSfalse;
     12334    question->DenyOnCellInterface = mDNSfalse;
     12335    question->DenyOnExpInterface  = mDNSfalse;
    1232112336    question->SearchListIndex  = 0;
    1232212337    question->AppendSearchDomains = 0;
     
    1281812833        AdvertiseInterface(m, set);
    1281912834
    12820     LogInfo("mDNS_RegisterInterface: InterfaceID %p %s (%#a) %s", set->InterfaceID, set->ifname, &set->ip,
     12835    LogInfo("mDNS_RegisterInterface: InterfaceID %d %s (%#a) %s",
     12836            (uint32_t)set->InterfaceID, set->ifname, &set->ip,
    1282112837            set->InterfaceActive ?
    1282212838            "not represented in list; marking active and retriggering queries" :
     
    1296212978        if (intf)
    1296312979        {
    12964             LogInfo("mDNS_DeregisterInterface: Another representative of InterfaceID %p %s (%#a) exists;"
    12965                     " making it active", set->InterfaceID, set->ifname, &set->ip);
     12980            LogInfo("mDNS_DeregisterInterface: Another representative of InterfaceID %d %s (%#a) exists;"
     12981                    " making it active", (uint32_t)set->InterfaceID, set->ifname, &set->ip);
    1296612982            if (intf->InterfaceActive)
    1296712983                LogMsg("mDNS_DeregisterInterface: ERROR intf->InterfaceActive already set for %s (%#a)", set->ifname, &set->ip);
     
    1298513001            DNSQuestion *q;
    1298613002
    12987             LogInfo("mDNS_DeregisterInterface: Last representative of InterfaceID %p %s (%#a) deregistered;"
    12988                     " marking questions etc. dormant", set->InterfaceID, set->ifname, &set->ip);
     13003            LogInfo("mDNS_DeregisterInterface: Last representative of InterfaceID %d %s (%#a) deregistered;"
     13004                    " marking questions etc. dormant", (uint32_t)set->InterfaceID, set->ifname, &set->ip);
    1298913005
    1299013006            m->mDNSStats.InterfaceDown++;
  • mDNSResponder/mDNSCore/mDNSEmbeddedAPI.h

    re36ca10 r49ebc73  
    19841984    mDNSBool ReturnIntermed;                // Set by client to request callbacks for intermediate CNAME/NXDOMAIN results
    19851985    mDNSBool SuppressUnusable;              // Set by client to suppress unusable queries to be sent on the wire
     1986    mDNSBool DenyOnCellInterface;           // Set by client to suppress uDNS queries on cellular interface
     1987    mDNSBool DenyOnExpInterface;            // Set by client to suppress uDNS queries on expensive interface
    19861988    mDNSu8 RetryWithSearchDomains;          // Retry with search domains if there is no entry in the cache or AuthRecords
    19871989    mDNSu8 TimeoutQuestion;                 // Timeout this question if there is no reply in configured time
    19881990    mDNSu8 WakeOnResolve;                   // Send wakeup on resolve
    1989     mDNSu8 UseBackgroundTrafficClass;       // Use background traffic class for request
     1991    mDNSu8 UseBackgroundTrafficClass;       // Set by client to use background traffic class for request
    19901992    mDNSs8 SearchListIndex;                 // Index into SearchList; Used by the client layer but not touched by core
    19911993    mDNSs8 AppendSearchDomains;             // Search domains can be appended for this query
     
    33373339extern mDNSBool mDNSPlatformAllowPID(mDNS *const m, DNSQuestion *q);
    33383340extern mDNSs32 mDNSPlatformGetServiceID(mDNS *const m, DNSQuestion *q);
    3339 extern void mDNSPlatformSetDelegatePID(UDPSocket *src, const mDNSAddr *dst, DNSQuestion *q);
     3341extern void mDNSPlatformSetuDNSSocktOpt(UDPSocket *src, const mDNSAddr *dst, DNSQuestion *q);
    33403342extern mDNSs32 mDNSPlatformGetPID(void);
    33413343
  • mDNSResponder/mDNSCore/uDNS.c

    re36ca10 r49ebc73  
    18811881    zd->question.ReturnIntermed      = mDNStrue;
    18821882    zd->question.SuppressUnusable    = mDNSfalse;
     1883    zd->question.DenyOnCellInterface = mDNSfalse;
     1884    zd->question.DenyOnExpInterface  = mDNSfalse;
    18831885    zd->question.SearchListIndex     = 0;
    18841886    zd->question.AppendSearchDomains = 0;
     
    25682570    q->ReturnIntermed   = mDNStrue;
    25692571    q->SuppressUnusable = mDNSfalse;
     2572    q->DenyOnCellInterface = mDNSfalse;
     2573    q->DenyOnExpInterface  = mDNSfalse;
    25702574    q->SearchListIndex  = 0;
    25712575    q->AppendSearchDomains = 0;
     
    47924796                        q->LocalSocket = mDNSPlatformUDPSocket(m, zeroIPPort);
    47934797                        if (q->LocalSocket)
    4794                             mDNSPlatformSetDelegatePID(q->LocalSocket, &q->qDNSServer->addr, q);
     4798                            mDNSPlatformSetuDNSSocktOpt(q->LocalSocket, &q->qDNSServer->addr, q);
    47954799                    }
    47964800                    if (!q->LocalSocket) err = mStatus_NoMemoryErr; // If failed to make socket (should be very rare), we'll try again next time
  • mDNSResponder/mDNSMacOSX/CUPolicy.c

    re36ca10 r49ebc73  
    5353        else
    5454        {
    55             allowed = (mDNSBool) cellular_usage_policy_is_data_allowed_for_uuid(m->p->handle, q->uuid);
    56             if (!allowed)
    57             {
    58                 xpc_object_t uuidx = xpc_uuid_create(q->uuid);
    59                 if (uuidx)
    60                 {
    61                     network_config_cellular_blocked_notify(NULL, uuidx, NULL);
    62                     LogInfo("mDNSPlaformAllowPID: Notified UUID for %##s (%s)", q->qname.c, DNSTypeName(q->qtype));
    63                     xpc_release(uuidx);
    64                 }
    65             }
    66         }
     55           xpc_object_t uuidx = xpc_uuid_create(q->uuid);
     56           if (uuidx)
     57           {
     58               allowed = (mDNSBool) cellular_usage_policy_is_data_allowed_for_uuid(m->p->handle, uuidx);
     59               if (!allowed)
     60               {
     61                   network_config_cellular_blocked_notify(NULL, uuidx, NULL);
     62                   LogInfo("mDNSPlaformAllowPID: Notified UUID for %##s (%s)", q->qname.c, DNSTypeName(q->qtype));
     63               }
     64               xpc_release(uuidx);
     65           }
     66           else
     67           {
     68               allowed = false;
     69           }
     70       }
    6771        return allowed;
    6872    }
  • mDNSResponder/mDNSMacOSX/LaunchDaemonInfo.helper.plist

    re36ca10 r49ebc73  
    44<dict>
    55  <key>Label</key>
    6   <string>com.apple.mDNSResponderHelper</string>
     6  <string>com.apple.mDNSResponderHelper.reloaded</string>
    77  <key>OnDemand</key>
    88  <true/>
  • mDNSResponder/mDNSMacOSX/LaunchDaemonInfo.plist

    re36ca10 r49ebc73  
    44<dict>
    55        <key>Label</key>
    6         <string>com.apple.networking.mDNSResponder</string>
    7     <key>Disabled</key>
    8     <true/>
     6        <string>com.apple.mDNSResponder.reloaded</string>
    97        <key>OnDemand</key>
    108        <false/>
  • mDNSResponder/mDNSMacOSX/Private/dns_services.c

    re36ca10 r49ebc73  
    77 */
    88
    9 #include "dns_services_mdns.h"
     9#include "dns_services.h"
    1010#include "dns_xpc.h"
    1111#include <xpc/xpc.h>
  • mDNSResponder/mDNSMacOSX/VPNService.c

    re36ca10 r49ebc73  
    2424
    2525    if (q->pid)
    26     {
    2726        sid = VPNAppLayerGetMatchingServiceIdentifier(q->pid, NULL);
    28     }
    2927    else
    30     {
    3128        sid = VPNAppLayerGetMatchingServiceIdentifier(0, q->uuid);
    32     }
     29   
    3330    LogInfo("mDNSPlatformGetServiceID: returning %d for %##s (%s)", sid, q->qname.c, DNSTypeName(q->qtype));
     31   
    3432    return sid;
    3533}
  • mDNSResponder/mDNSMacOSX/daemon.c

    re36ca10 r49ebc73  
    24752475
    24762476        m->SleepState = SleepState_Sleeping;
    2477         // We used to clear our interface list to empty state here before going to sleep.
    2478         // The applications that try to connect to an external server during maintenance wakes, saw
    2479         // DNS resolution errors as we don't have any interfaces (most queries use SuppressUnusable
    2480         // flag). Thus, we don't remove our interfaces anymore on sleep.
     2477                // Clear our interface list to empty state, ready to go to sleep
     2478                // As a side effect of doing this, we'll also cancel any outstanding SPS Resolve calls that didn't complete
     2479        mDNSMacOSXNetworkChanged(m);
    24812480    }
    24822481
  • mDNSResponder/mDNSMacOSX/mDNSMacOSX.c

    re36ca10 r49ebc73  
    116116#endif // APPLE_OSX_mDNSResponder && !TARGET_OS_EMBEDDED
    117117
    118 
    119118#define kInterfaceSpecificOption "interface="
    120119
     
    10381037// to run up the user's bill sending multicast traffic over a link where there's only a single device at the
    10391038// other end, and that device (e.g. a modem bank) is probably not answering Multicast DNS queries anyway.
     1039
     1040// We also don't want to use multicast on *any* interface on very constrained devices.
     1041#if TARGET_OS_NANO
     1042#define MulticastInterface(i) (mDNSfalse)
     1043#else
    10401044#define MulticastInterface(i) (((i)->ifa_flags & IFF_MULTICAST) && !((i)->ifa_flags & IFF_POINTOPOINT))
     1045#endif
    10411046
    10421047mDNSexport void NotifyOfElusiveBug(const char *title, const char *msg)  // Both strings are UTF-8 text
     
    16931698}
    16941699
    1695 mDNSexport void mDNSPlatformSetDelegatePID(UDPSocket *src, const mDNSAddr *dst, DNSQuestion *q)
     1700mDNSexport void mDNSPlatformSetuDNSSocktOpt(UDPSocket *src, const mDNSAddr *dst, DNSQuestion *q)
    16961701{
    16971702    if (src)
     
    17001705
    17011706        if (dst->type == mDNSAddrType_IPv4)
    1702         {
    17031707            s = src->ss.sktv4;
    1704         }
    17051708        else
    1706         {
    17071709            s = src->ss.sktv6;
    1708         }
    17091710
    17101711        if (q->pid)
    17111712        {
    17121713            if (setsockopt(s, SOL_SOCKET, SO_DELEGATED, &q->pid, sizeof(q->pid)) == -1)
     1714                LogInfo("mDNSPlatformSetuDNSSocktOpt: Delegate PID failed %s for PID %d", strerror(errno), q->pid);
     1715        }
     1716        else
     1717        {
     1718            if (setsockopt(s, SOL_SOCKET, SO_DELEGATED_UUID, &q->uuid, sizeof(q->uuid)) == -1)
     1719                LogInfo("mDNSPlatformSetuDNSSocktOpt: Delegate UUID failed %s", strerror(errno));
     1720        }
     1721               
     1722#if defined(SO_NOWAKEFROMSLEEP)
     1723        int nowake = 1;
     1724        if (setsockopt(s, SOL_SOCKET, SO_NOWAKEFROMSLEEP, &nowake, sizeof(nowake)) == -1)
     1725            LogInfo("mDNSPlatformSetuDNSSocktOpt: SO_NOWAKEFROMSLEEP failed %s", strerror(errno));
     1726#endif
     1727       
     1728        if (q->DenyOnCellInterface || q->DenyOnExpInterface)
     1729        {
     1730#if defined(SO_RESTRICT_DENY_CELLULAR)
     1731            if (q->DenyOnCellInterface)
    17131732            {
    1714                 LogInfo("mDNSPlatformSetDelegatePID: Delegate PID failed %s for PID %d", strerror(errno), q->pid);
     1733                int restrictions = 0;
     1734                restrictions = SO_RESTRICT_DENY_CELLULAR;
     1735                if (setsockopt(s, SOL_SOCKET, SO_RESTRICTIONS, &restrictions, sizeof(restrictions)) == -1)
     1736                    LogInfo("mDNSPlatformSetuDNSSocktOpt: SO_RESTRICT_DENY_CELLULAR failed %s", strerror(errno));
    17151737            }
    1716         }
    1717         else
    1718         {
    1719             if (setsockopt(s, SOL_SOCKET, SO_DELEGATED_UUID, &q->uuid, sizeof(q->uuid)) == -1)
     1738#endif
     1739#if defined(SO_RESTRICT_DENY_EXPENSIVE)
     1740            if (q->DenyOnExpInterface)
    17201741            {
    1721                 LogInfo("mDNSPlatformSetDelegatePID: Delegate UUID failed %s", strerror(errno));
     1742                int restrictions = 0;
     1743                restrictions = SO_RESTRICT_DENY_EXPENSIVE;
     1744                if (setsockopt(s, SOL_SOCKET, SO_RESTRICTIONS, &restrictions, sizeof(restrictions)) == -1)
     1745                    LogInfo("mDNSPlatformSetuDNSSocktOpt: SO_RESTRICT_DENY_EXPENSIVE failed %s", strerror(errno));
    17221746            }
    1723         }
     1747#endif
     1748                }
     1749               
    17241750    }
    17251751}
     
    51655191    p->q.ReturnIntermed   = mDNStrue;
    51665192    p->q.SuppressUnusable = mDNSfalse;
     5193    p->q.DenyOnCellInterface = mDNSfalse;
     5194    p->q.DenyOnExpInterface  = mDNSfalse;
    51675195    p->q.SearchListIndex  = 0;
    51685196    p->q.AppendSearchDomains = 0;
     
    52025230    if (InfoSocket < 3 && errno != EAFNOSUPPORT)
    52035231        LogMsg("UpdateInterfaceList: InfoSocket error %d errno %d (%s)", InfoSocket, errno, strerror(errno));
     5232
     5233    if (m->SleepState == SleepState_Sleeping) ifa = NULL;
    52045234
    52055235    while (ifa)
     
    79117941
    79127942// Called with KQueueLock & mDNS lock
     7943// SetNetworkChanged is allowed to extend (but not reduce) the pause while we wait for configuration changes to settle
    79137944mDNSlocal void SetNetworkChanged(mDNS *const m, mDNSs32 delay)
    79147945{
     
    79167947    {
    79177948        m->p->NetworkChanged = NonZeroTime(m->timenow + delay);
    7918         LogInfo("SetNetworkChanged: scheduling in %d msec", delay);
    7919     }
     7949        LogInfo("SetNetworkChanged: Scheduling in %d msec", delay);
     7950    }
     7951    else
     7952        LogInfo("SetNetworkChanged: *NOT* reducing delay from %d to %d", m->p->NetworkChanged - m->timenow, delay);
    79207953}
    79217954
     
    79497982// Whether a key from a network change notification corresponds to
    79507983// an IP service that is explicitly configured for IPv4 Link Local
    7951 mDNSlocal mDNSBool ChangedKeysHaveIPv4LL(CFArrayRef inkeys)
     7984mDNSlocal int ChangedKeysHaveIPv4LL(CFArrayRef inkeys)
    79527985{
    79537986    SCDynamicStoreRef store = NULL;
     
    79577990    CFStringRef pattern = NULL;
    79587991    int i, ic, j, jc;
    7959     mDNSBool found = mDNSfalse;
     7992    int found = 0;
    79607993
    79617994    jc = CFArrayGetCount(inkeys);
     
    79948027    CFDictionaryGetKeysAndValues(dict, keys, vals);
    79958028
    7996     for (j = 0; j < jc && !found; j++)
     8029    // For each key we were given...
     8030    for (j = 0; j < jc; j++)
    79978031    {
    79988032        CFStringRef key = CFArrayGetValueAtIndex(inkeys, j);
     
    80118045        }
    80128046
     8047        // Loop over the interfaces to find matching the ifname, and see if that one has kSCValNetIPv4ConfigMethodLinkLocal
    80138048        for (i = 0; i < ic; i++)
    80148049        {
     
    80508085            }
    80518086
    8052             if (CFEqual(configmethod, kSCValNetIPv4ConfigMethodLinkLocal)) { found = mDNStrue; break; }
     8087            if (CFEqual(configmethod, kSCValNetIPv4ConfigMethodLinkLocal)) { found++; break; }
    80538088        }
    80548089
     
    80688103{
    80698104    (void)store;        // Parameter not used
    8070     mDNSBool changeNow = mDNSfalse;
    80718105    mDNS *const m = (mDNS *const)context;
    80728106    KQueueLock(m);
     
    80798113    int c1 = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_Hostnames   ) != 0);
    80808114    int c2 = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_Computername) != 0);
    8081     int c3 = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_DynamicDNS  ) != 0);
    8082     int c4 = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_DNS         ) != 0);
    8083     if (c && c - c1 - c2 - c3 - c4 == 0)
    8084         delay = mDNSPlatformOneSecond/10;  // If these were the only changes, shorten delay
     8115    int c3 = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_DNS         ) != 0);
     8116    int c4 = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_DynamicDNS  ) != 0);
     8117    int c5 = (CFArrayContainsValue(changedKeys, range, NetworkChangedKey_BackToMyMac ) != 0);
     8118    int c6 = ChangedKeysHaveIPv4LL(changedKeys);
     8119    int c7 = 0;
    80858120
    80868121    // Do immediate network changed processing for "p2p*" interfaces and
     
    81178152                    && (strstr(buf, "p2p") || (getExtendedFlags(buf) & IFEF_DIRECTLINK)))
    81188153                {
    8119                     LogInfo("NetworkChanged: interface %s, not delaying network change", buf);
    8120                     changeNow = mDNStrue;
     8154                    LogInfo("NetworkChanged: interface %s qualifies for reduced change handling delay", buf);
     8155                    c7++;
    81218156                    CFRelease(labels);
    81228157                    break;
     
    81278162    }
    81288163
    8129     mDNSBool btmmChanged = CFArrayContainsValue(changedKeys, range, NetworkChangedKey_BackToMyMac);
    8130     if (btmmChanged) delay = 0;
     8164    if (c && c - c1 - c2 - c3 - c4 - c5 - c6 - c7 == 0)
     8165        delay = mDNSPlatformOneSecond/10;  // If these were the only changes, shorten delay
     8166
     8167    // Immediately force a reconfig (esp. cache flush) if any of the following is true:
     8168    // 1. DNS Settings changed.
     8169    // 2  An interface changed that is explicitly IPv4 link local
     8170    // 3. There are P2P/IFEF_DIRECTLINK/IsCarPlaySSID changes
     8171    if (c3 || ChangedKeysHaveIPv4LL(changedKeys) || c7)
     8172    {
     8173        LogInfo("NetworkChanged: %s : Handling this change immediately",
     8174                c3 ? "DNS Settings Changed" :
     8175                c7 ? "P2P/IFEF_DIRECTLINK/IsCarPlaySSID Changed" :
     8176                "An interface changed that is explicitly IPv4 link local");
     8177        m->p->NetworkChanged = NonZeroTime(m->timenow);
     8178        delay = 0; // for the logs below.
     8179    }
    81318180
    81328181    if (mDNS_LoggingEnabled)
     
    81398188            LogInfo("***   NetworkChanged SC key: %s", buf);
    81408189        }
    8141         LogInfo("***   NetworkChanged   *** %d change%s %s%s%s%sdelay %d",
     8190        LogInfo("***   NetworkChanged   *** %d change%s %s%s%s%s%s%s%sdelay %d%s",
    81428191                c, c>1 ? "s" : "",
    81438192                c1 ? "(Local Hostname) " : "",
    81448193                c2 ? "(Computer Name) "  : "",
    8145                 c3 ? "(DynamicDNS) "     : "",
    8146                 c4 ? "(DNS) "            : "",
    8147                 changeNow ? 0 : delay);
    8148     }
    8149 
    8150     if (!changeNow)
    8151         SetNetworkChanged(m, delay);
     8194                c3 ? "(DNS) "            : "",
     8195                c4 ? "(DynamicDNS) "     : "",
     8196                c5 ? "(BTMM) "           : "",
     8197                c6 ? "(kSCValNetIPv4ConfigMethodLinkLocal) " : "",
     8198                c7 ? "(P2P/IFEF_DIRECTLINK/IsCarPlaySSID) "  : "",
     8199                delay,
     8200                (c4 || c5) ? " + SetKeyChainTimer" : "");
     8201    }
     8202
     8203    SetNetworkChanged(m, delay);
    81528204
    81538205    // Other software might pick up these changes to register or browse in WAB or BTMM domains,
     
    81568208    // If we don't, then we will first try to register services in the clear, then later setup the
    81578209    // DomainAuthInfo, which is incorrect.
    8158     if (c3 || btmmChanged)
     8210    if (c4 || c5)
    81598211        SetKeyChainTimer(m, delay);
    81608212
    81618213    mDNS_Unlock(m);
    8162 
    8163     // If DNS settings changed, immediately force a reconfig (esp. cache flush)
    8164     // Similarly, if an interface changed that is explicitly IPv4 link local, immediately force a reconfig
    8165     if (c4 || ChangedKeysHaveIPv4LL(changedKeys) || changeNow) mDNSMacOSXNetworkChanged(m);
    81668214
    81678215    KQueueUnlock(m, "NetworkChanged");
     
    87828830        // to receive some time shortly after the kIOMessageSystemWillPowerOn message
    87838831        mDNS_Lock(m);
    8784         if (!m->p->NetworkChanged ||
    8785             m->p->NetworkChanged - NonZeroTime(m->timenow + mDNSPlatformOneSecond * 2) < 0)
    8786             m->p->NetworkChanged = NonZeroTime(m->timenow + mDNSPlatformOneSecond * 2);
     8832        SetNetworkChanged(m, mDNSPlatformOneSecond * 2);
    87878833        mDNS_Unlock(m);
    87888834
     
    88408886        }
    88418887        LogSPS("SnowLeopardPowerChanged: Waking up, Acking Wakeup, SleepLimit %d SleepState %d", m->SleepLimit, m->SleepState);
    8842         // If the network notifications have already come before we got the wakeup, we ignored them and
    8843         // in case we get no more, we need to trigger one.
    8844         mDNS_Lock(m);
    8845         SetNetworkChanged(m, 2 * mDNSPlatformOneSecond);
    8846         mDNS_Unlock(m);
    88478888        // CPU Waking. Note: Can get this message repeatedly, as other subsystems power up or down.
    8848         if (m->SleepState != SleepState_Awake) PowerOn(m);
     8889        if (m->SleepState != SleepState_Awake)
     8890        {
     8891                        PowerOn(m);
     8892                        // If the network notifications have already come before we got the wakeup, we ignored them and
     8893                        // in case we get no more, we need to trigger one.
     8894                        mDNS_Lock(m);
     8895                        SetNetworkChanged(m, mDNSPlatformOneSecond * 2);
     8896                        mDNS_Unlock(m);
     8897        }
    88498898        IOPMConnectionAcknowledgeEvent(connection, token);
    88508899    }
     
    1041610465#define VER_NUM_LEN     2  // 2 digits of version number added to base string
    1041710466
     10467#define MODEL_COLOR           "ecolor="
     10468#define MODEL_COLOR_LEN       strlen(MODEL_COLOR)
     10469#define MODEL_RGB_VALUE_LEN   strlen("255,255,255") // 'r,g,b'
     10470
    1041810471// Bytes available in TXT record for model name after subtracting space for other
    1041910472// fixed size strings and their length bytes.
    10420 #define MAX_MODEL_NAME_LEN   (256 - (DEVINFO_MODEL_LEN + 1) - (OSX_VER_LEN + VER_NUM_LEN + 1))
     10473#define MAX_MODEL_NAME_LEN   (256 - (DEVINFO_MODEL_LEN + 1) - (OSX_VER_LEN + VER_NUM_LEN + 1) - (MODEL_COLOR_LEN + MODEL_RGB_VALUE_LEN + 1))
     10474
     10475mDNSlocal mDNSBool getModelIconColors(char *color)
     10476{
     10477        mDNSBool hasColor = mDNSfalse;
     10478        mDNSPlatformMemZero(color, MODEL_RGB_VALUE_LEN + 1);
     10479       
     10480#if !TARGET_OS_EMBEDDED && defined(kIOPlatformDeviceEnclosureColorKey)
     10481        mDNSu8   red      = 0;
     10482        mDNSu8   green    = 0;
     10483        mDNSu8   blue     = 0;
     10484
     10485        IOReturn rGetDeviceColor = IOPlatformGetDeviceColor(kIOPlatformDeviceEnclosureColorKey,
     10486                                                                                                                &red, &green, &blue);
     10487        if (kIOReturnSuccess == rGetDeviceColor)
     10488        {
     10489                // IOKit was able to get enclosure color for the current device.
     10490                hasColor = true;
     10491                snprintf(color, MODEL_RGB_VALUE_LEN + 1, "%d,%d,%d", red, green, blue);
     10492        }
     10493#endif // !TARGET_OS_EMBEDDED && defined(kIOPlatformDeviceEnclosureColorKey)
     10494       
     10495        return hasColor;
     10496}
     10497
    1042110498
    1042210499// Initialize device-info TXT record contents and return total length of record data.
     
    1044510522        mDNSPlatformMemCopy(ptr, ver_num, VER_NUM_LEN);
    1044610523        ptr += VER_NUM_LEN;
     10524               
     10525                char rgb[MODEL_RGB_VALUE_LEN + 1]; // RGB value + null written by snprintf
     10526                if (getModelIconColors(rgb))
     10527                {
     10528                        len = strlen(rgb);
     10529                        *ptr = MODEL_COLOR_LEN + len; // length byte
     10530                        ptr++;
     10531               
     10532                        mDNSPlatformMemCopy(ptr, MODEL_COLOR, MODEL_COLOR_LEN);
     10533                        ptr += MODEL_COLOR_LEN;
     10534                       
     10535                        mDNSPlatformMemCopy(ptr, rgb, len);
     10536                        ptr += len;
     10537                }
    1044710538    }
    1044810539
    1044910540    return (ptr - bufferStart);
    1045010541}
     10542
     10543
     10544
  • mDNSResponder/mDNSMacOSX/mDNSResponder-entitlements.plist

    re36ca10 r49ebc73  
    2121    <key>com.apple.telephony.cupolicy-monitor-access</key>
    2222    <true/>
     23    <key>com.apple.private.necp.match</key>
     24    <true/>
     25    <key>com.apple.security.network.server</key>
     26    <true/>
     27    <key>com.apple.security.network.client</key>
     28    <true/>
     29    <key>com.apple.private.network.awdl.restricted</key>
     30    <true/>
    2331</dict>
    2432</plist>
  • mDNSResponder/mDNSMacOSX/mDNSResponder.sb

    re36ca10 r49ebc73  
    4747(allow mach-lookup
    4848       (global-name "com.apple.bsd.dirhelper")
     49       (global-name "com.apple.CoreServices.coreservicesd")
    4950       (global-name "com.apple.distributed_notifications.2")
    5051       (global-name "com.apple.ocspd")
     
    136137
    137138       ; Required on 10.5 and 10.6
    138        (regex #"^/private/var/folders/[^/]+/[^/]+/-Caches-/mds(/|$)"))
     139       (regex #"^/private/var/folders/[^/]+/[^/]+/-Caches-/mds(/|$)")
     140
     141       ; Required on 10.10.4
     142       (regex #"^/private/var/folders/[^/]+/[^/]+/[0-9]+(/|$)"))
    139143
    140144; CRL Cache for SSL/TLS connections
  • mDNSResponder/mDNSMacOSX/mDNSResponder.xcodeproj/project.pbxproj

    re36ca10 r49ebc73  
    2626                        buildConfigurationList = 03067D730C83A3CB0022BE1F /* Build configuration list for PBXAggregateTarget "Build Some" */;
    2727                        buildPhases = (
     28                                FF045B6A0C7E4AA600448140 /* ShellScript */,
    2829                        );
    2930                        dependencies = (
    3031                                217A4C49138EE14C000A5BA8 /* PBXTargetDependency */,
     32                                03067D680C83A3830022BE1F /* PBXTargetDependency */,
     33                                03067D6A0C83A3890022BE1F /* PBXTargetDependency */,
    3134                                03067D6C0C83A3920022BE1F /* PBXTargetDependency */,
     35                                03067D6E0C83A39C0022BE1F /* PBXTargetDependency */,
    3236                                84C5B3411665544B00C324A8 /* PBXTargetDependency */,
     37                                BD7833F01ABA5E3500EC51ED /* PBXTargetDependency */,
    3338                        );
    3439                        name = "Build Some";
     
    6065                        productName = SystemLibrariesStatic;
    6166                };
    62                 3F2EAA9F1A5B85FF007F5A52 /* Build Deprecated */ = {
    63                         isa = PBXAggregateTarget;
    64                         buildConfigurationList = 3F2EAAA11A5B85FF007F5A52 /* Build configuration list for PBXAggregateTarget "Build Deprecated" */;
    65                         buildPhases = (
    66                         );
    67                         dependencies = (
    68                                 3F2EAAA71A5B861D007F5A52 /* PBXTargetDependency */,
    69                                 3F2EAAA51A5B861C007F5A52 /* PBXTargetDependency */,
    70                                 3F2EAAA91A5B861E007F5A52 /* PBXTargetDependency */,
    71                         );
    72                         name = "Build Deprecated";
    73                         productName = "Build Deprecated";
    74                 };
    7567                FFA572650AF190F10055A0F1 /* SystemLibrariesDynamic */ = {
    7668                        isa = PBXAggregateTarget;
     
    9385                        dependencies = (
    9486                                FFB7657D0AEED97F00583A2C /* PBXTargetDependency */,
    95                                 3F2EAAA31A5B8608007F5A52 /* PBXTargetDependency */,
    9687                                2141DCFD123FFB7D0086D23E /* PBXTargetDependency */,
    9788                        );
     
    211202                848DA5D716547F7200D2E8B4 /* dns_xpc.h in Headers */ = {isa = PBXBuildFile; fileRef = 848DA5D516547F7200D2E8B4 /* dns_xpc.h */; };
    212203                84C5B33C166553F100C324A8 /* dns_services.c in Sources */ = {isa = PBXBuildFile; fileRef = 84C5B339166553AF00C324A8 /* dns_services.c */; };
    213                 84F4C090188F050200D1E1DE /* dns_services_mdns.h in Headers */ = {isa = PBXBuildFile; fileRef = 84F4C08F188F04CF00D1E1DE /* dns_services_mdns.h */; settings = {ATTRIBUTES = (Private, ); }; };
     204                84F4C090188F050200D1E1DE /* dns_services.h in Headers */ = {isa = PBXBuildFile; fileRef = 84F4C08F188F04CF00D1E1DE /* dns_services.h */; settings = {ATTRIBUTES = (Private, ); }; };
    214205                D284BE530ADD80740027CCDF /* DNSServiceDiscoveryDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 6575FBFF022EAFBA00000109 /* DNSServiceDiscoveryDefines.h */; };
    215206                D284BE540ADD80740027CCDF /* dnssd_ipc.h in Headers */ = {isa = PBXBuildFile; fileRef = F5E11B5B04A28126019798ED /* dnssd_ipc.h */; };
     
    348339
    349340/* Begin PBXContainerItemProxy section */
     341                03067D670C83A3830022BE1F /* PBXContainerItemProxy */ = {
     342                        isa = PBXContainerItemProxy;
     343                        containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
     344                        proxyType = 1;
     345                        remoteGlobalIDString = D284BE500ADD80740027CCDF;
     346                        remoteInfo = mDNSResponder;
     347                };
     348                03067D690C83A3890022BE1F /* PBXContainerItemProxy */ = {
     349                        isa = PBXContainerItemProxy;
     350                        containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
     351                        proxyType = 1;
     352                        remoteGlobalIDString = D284BE750ADD80800027CCDF;
     353                        remoteInfo = "mDNSResponder debug";
     354                };
    350355                03067D6B0C83A3920022BE1F /* PBXContainerItemProxy */ = {
    351356                        isa = PBXContainerItemProxy;
     
    355360                        remoteInfo = "dns-sd tool";
    356361                };
     362                03067D6D0C83A39C0022BE1F /* PBXContainerItemProxy */ = {
     363                        isa = PBXContainerItemProxy;
     364                        containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
     365                        proxyType = 1;
     366                        remoteGlobalIDString = 2E0405EF0C31955500F13B59;
     367                        remoteInfo = mDNSResponderHelper;
     368                };
    357369                03067D850C849CC30022BE1F /* PBXContainerItemProxy */ = {
    358370                        isa = PBXContainerItemProxy;
     
    411423                        remoteInfo = BonjourEvents;
    412424                };
    413                 3F2EAAA21A5B8608007F5A52 /* PBXContainerItemProxy */ = {
    414                         isa = PBXContainerItemProxy;
    415                         containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
    416                         proxyType = 1;
    417                         remoteGlobalIDString = 3F2EAA9F1A5B85FF007F5A52;
    418                         remoteInfo = "Build Deprecated";
    419                 };
    420                 3F2EAAA41A5B861C007F5A52 /* PBXContainerItemProxy */ = {
    421                         isa = PBXContainerItemProxy;
    422                         containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
    423                         proxyType = 1;
    424                         remoteGlobalIDString = D284BE750ADD80800027CCDF;
    425                         remoteInfo = "mDNSResponder debug";
    426                 };
    427                 3F2EAAA61A5B861D007F5A52 /* PBXContainerItemProxy */ = {
    428                         isa = PBXContainerItemProxy;
    429                         containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
    430                         proxyType = 1;
    431                         remoteGlobalIDString = D284BE500ADD80740027CCDF;
    432                         remoteInfo = mDNSResponder;
    433                 };
    434                 3F2EAAA81A5B861E007F5A52 /* PBXContainerItemProxy */ = {
    435                         isa = PBXContainerItemProxy;
    436                         containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
    437                         proxyType = 1;
    438                         remoteGlobalIDString = 2E0405EF0C31955500F13B59;
    439                         remoteInfo = mDNSResponderHelper;
    440                 };
    441425                4AE471690EAFF83800A6C5AD /* PBXContainerItemProxy */ = {
    442426                        isa = PBXContainerItemProxy;
     
    452436                        remoteGlobalIDString = 84C5B3341665529800C324A8;
    453437                        remoteInfo = dns_services;
     438                };
     439                BD7833EF1ABA5E3500EC51ED /* PBXContainerItemProxy */ = {
     440                        isa = PBXContainerItemProxy;
     441                        containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
     442                        proxyType = 1;
     443                        remoteGlobalIDString = 72FB545E166D5FB00090B2D9;
     444                        remoteInfo = dnsctl;
    454445                };
    455446                D284BF2B0ADD815A0027CCDF /* PBXContainerItemProxy */ = {
     
    680671                848DA5C9165477EB00D2E8B4 /* xpc_services.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = xpc_services.h; path = Private/xpc_services.h; sourceTree = "<group>"; };
    681672                848DA5D516547F7200D2E8B4 /* dns_xpc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dns_xpc.h; path = Private/dns_xpc.h; sourceTree = "<group>"; };
    682                 84C5B3351665529800C324A8 /* libdns_services_mdns.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libdns_services_mdns.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
     673                84C5B3351665529800C324A8 /* libdns_services.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libdns_services.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
    683674                84C5B339166553AF00C324A8 /* dns_services.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = dns_services.c; path = Private/dns_services.c; sourceTree = "<group>"; };
    684                 84F4C08F188F04CF00D1E1DE /* dns_services_mdns.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dns_services_mdns.h; path = Private/dns_services_mdns.h; sourceTree = "<group>"; };
     675                84F4C08F188F04CF00D1E1DE /* dns_services.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dns_services.h; path = Private/dns_services.h; sourceTree = "<group>"; };
    685676                D284BE730ADD80740027CCDF /* mDNSResponder */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = mDNSResponder; sourceTree = BUILT_PRODUCTS_DIR; };
    686677                D284BE950ADD80800027CCDF /* mDNSResponder.debug */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = mDNSResponder.debug; sourceTree = BUILT_PRODUCTS_DIR; };
     
    931922                        isa = PBXGroup;
    932923                        children = (
    933                                 84F4C08F188F04CF00D1E1DE /* dns_services_mdns.h */,
     924                                84F4C08F188F04CF00D1E1DE /* dns_services.h */,
    934925                                216D9ACD1720C9F5008066E1 /* VPNService.c */,
    935926                                2120ABD416B71614007089B6 /* CUPolicy.c */,
     
    10471038                                2141DD24123FFD0F0086D23E /* libdns_sd_debug.a */,
    10481039                                2141DD2A123FFD2C0086D23E /* libdns_sd_profile.a */,
    1049                                 84C5B3351665529800C324A8 /* libdns_services_mdns.dylib */,
     1040                                84C5B3351665529800C324A8 /* libdns_services.dylib */,
    10501041                                72FB545F166D5FB00090B2D9 /* dnsctl */,
    10511042                        );
     
    11821173                        buildActionMask = 2147483647;
    11831174                        files = (
    1184                                 84F4C090188F050200D1E1DE /* dns_services_mdns.h in Headers */,
     1175                                84F4C090188F050200D1E1DE /* dns_services.h in Headers */,
    11851176                        );
    11861177                        runOnlyForDeploymentPostprocessing = 0;
     
    14331424                        name = dns_services;
    14341425                        productName = dns_services;
    1435                         productReference = 84C5B3351665529800C324A8 /* libdns_services_mdns.dylib */;
     1426                        productReference = 84C5B3351665529800C324A8 /* libdns_services.dylib */;
    14361427                        productType = "com.apple.product-type.library.dynamic";
    14371428                };
     
    16431634                        isa = PBXProject;
    16441635                        attributes = {
    1645                                 TargetAttributes = {
    1646                                         3F2EAA9F1A5B85FF007F5A52 = {
    1647                                                 CreatedOnToolsVersion = 6.3;
    1648                                         };
    1649                                 };
    16501636                        };
    16511637                        buildConfigurationList = D284BE2B0ADD78180027CCDF /* Build configuration list for PBXProject "mDNSResponder" */;
     
    16651651                                00AD62BB032D7A0C0CCA2C71 /* Build More */,
    16661652                                03067D640C83A3700022BE1F /* Build Some */,
    1667                                 3F2EAA9F1A5B85FF007F5A52 /* Build Deprecated */,
    16681653                                FFB7657B0AEED96B00583A2C /* Build All */,
    16691654                                D284BE500ADD80740027CCDF /* mDNSResponder */,
     
    18421827                        runOnlyForDeploymentPostprocessing = 1;
    18431828                        shellPath = /bin/bash;
    1844                         shellScript = "# Install mDNSResponder.bundle containing language localizations\nmkdir -p ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices\ncp -R ${SRCROOT}/mDNSResponder-bundle ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices/mDNSResponder.bundle\n\n# Remove unwanted CVS directories\nfind ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices/mDNSResponder.bundle -depth -name CVS -exec rm -rf {} \\;\n\n# Expand UTF-8 files to UTF-16 (at one time this appeared to be necessary, but it's not, so we don't do it any more)\n#foreach file (`find ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices/mDNSResponder.bundle -name Localizable.strings`)\n#iconv -f utf-8 -t utf-16 ${file} > ${file}.new\n#mv -f ${file}.new ${file}\n#end\n\n# Remove French localization (not wanted for Apple B&I builds)\nrm -rf ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices/mDNSResponder.bundle/Resources/French.lproj\n\n# Copy Sandbox profile\nif [ ! -z \"${IPHONEOS_DEPLOYMENT_TARGET}\" ] ; then\n  SANDBOXDST=\"${DSTROOT}/usr/local/share/sandbox/profiles/embedded/builtin\"\nelse\n  SANDBOXDST=\"${DSTROOT}/usr/share/sandbox\"\nfi\n(umask 022; mkdir -p -m 0755 \"$SANDBOXDST\")\ncp \"${SRCROOT}/mDNSResponder.sb\" \"${SANDBOXDST}/mDNSResponder.sb\"\n";
     1829                        shellScript = "# Install mDNSResponder.bundle containing language localizations\nmkdir -p ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices\ncp -R ${SRCROOT}/mDNSResponder-bundle ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices/mDNSResponder.bundle\n\n# Remove unwanted CVS directories\nfind ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices/mDNSResponder.bundle -depth -name CVS -exec rm -rf {} \\;\n\n# Expand UTF-8 files to UTF-16 (at one time this appeared to be necessary, but it's not, so we don't do it any more)\n#foreach file (`find ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices/mDNSResponder.bundle -name Localizable.strings`)\n#iconv -f utf-8 -t utf-16 ${file} > ${file}.new\n#mv -f ${file}.new ${file}\n#end\n\n# Remove French localization (not wanted for Apple B&I builds)\nrm -rf ${DSTROOT}${SYSTEM_LIBRARY_DIR}/CoreServices/mDNSResponder.bundle/Resources/French.lproj\n\n# Copy Sandbox profile\nif [ -z \"${IPHONEOS_DEPLOYMENT_TARGET}\" -a -z \"${TVOS_DEPLOYMENT_TARGET}\"  ] ; then\n    SANDBOXDST=\"${DSTROOT}/usr/share/sandbox\"\nelse\n    SANDBOXDST=\"${DSTROOT}/usr/local/share/sandbox/profiles/embedded/builtin\"\nfi\n(umask 022; mkdir -p -m 0755 \"$SANDBOXDST\")\ncp \"${SRCROOT}/mDNSResponder.sb\" \"${SANDBOXDST}/mDNSResponder.sb\"\n";
    18451830                };
    18461831                D284BE760ADD80800027CCDF /* ShellScript */ = {
     
    18521837                        shellPath = /bin/sh;
    18531838                        shellScript = "if [ -e \"${SDKROOT}/usr/local/include/dnsinfo.h\" ]\nthen\nrm -f \"${CONFIGURATION_TEMP_DIR}/dnsinfo.h\"\nrm -f \"${CONFIGURATION_TEMP_DIR}/libdnsinfo.a\"\nelse\necho \"#define MDNS_NO_DNSINFO 1\" > ${CONFIGURATION_TEMP_DIR}/dnsinfo.h\ntouch \"${CONFIGURATION_TEMP_DIR}/empty.c\"\nfor i in ${ARCHS}\ndo\nccflags=\"-arch $i $ccflags\"\ndone\ncc ${ccflags} \"${CONFIGURATION_TEMP_DIR}/empty.c\" -c -o \"${CONFIGURATION_TEMP_DIR}/libdnsinfo.a\"\nrm -f \"${CONFIGURATION_TEMP_DIR}/empty.c\"\nfi\n\nif [ -e \"${SDKROOT}/usr/include/sandbox.h\" ]\nthen\nrm -f \"${CONFIGURATION_TEMP_DIR}/sandbox.h\"\nelse\necho \"#define MDNS_NO_SANDBOX 1\" > \"${CONFIGURATION_TEMP_DIR}/sandbox.h\"\nfi\n\nif [ -e \"${SDKROOT}/usr/local/include/vproc.h\" -o -e \"${SDKROOT}/usr/include/vproc.h\" ]\nthen\nrm -f \"${CONFIGURATION_TEMP_DIR}/vproc.h\"\nelse\ntouch \"${CONFIGURATION_TEMP_DIR}/vproc.h\"\nfi\n\nif [ -e \"${SDKROOT}/System/Library/Frameworks/IOKit.framework/PrivateHeaders/pwr_mgt/IOPMLibPrivate.h\" ]\nthen\nrm -rf \"${CONFIGURATION_TEMP_DIR}/IOKit\"\nelse\nmkdir -p \"${CONFIGURATION_TEMP_DIR}/IOKit/pwr_mgt\"\ntouch \"${CONFIGURATION_TEMP_DIR}/IOKit/pwr_mgt/IOPMLibPrivate.h\"\nfi\n\nif [ -e \"${SDKROOT}/System/Library/PrivateFrameworks/DeviceToDeviceManager.framework/Headers/DeviceToDeviceManager.h\" ]\nthen\nrm -rf \"${CONFIGURATION_TEMP_DIR}/DeviceToDeviceManager\"\nelse\nmkdir -p \"${CONFIGURATION_TEMP_DIR}/DeviceToDeviceManager\"\necho \"#define NO_D2D 1\" > \"${CONFIGURATION_TEMP_DIR}/DeviceToDeviceManager/DeviceToDeviceManager.h\"\nfi\n\nif [ -e \"${SDKROOT}/System/Library/PrivateFrameworks/WebFilterDNS.framework/Headers/WebFilterDNS.h\" ]\nthen\nrm -rf \"${CONFIGURATION_TEMP_DIR}/WebFilterDNS\"\nelse\nmkdir -p \"${CONFIGURATION_TEMP_DIR}/WebFilterDNS\"\necho \"#define NO_WCF 1\" > \"${CONFIGURATION_TEMP_DIR}/WebFilterDNS/WebFilterDNS.h\"\nfi\n\nif [ -e \"${SDKROOT}/usr/local/include/AWACS.h\" ]\nthen\nrm -f \"${CONFIGURATION_TEMP_DIR}/AWACS.h\"\nrm -f \"${CONFIGURATION_TEMP_DIR}/libAWACS.a\"\nelse\necho \"#define NO_AWACS 1\" > \"${CONFIGURATION_TEMP_DIR}/AWACS.h\"\ntouch \"${CONFIGURATION_TEMP_DIR}/AWACSempty.c\"\nfor i in ${ARCHS}\ndo\nccflags=\"-arch $i $ccflags\"\ndone\ncc ${ccflags} \"${CONFIGURATION_TEMP_DIR}/AWACSempty.c\" -c -o \"${CONFIGURATION_TEMP_DIR}/libAWACS.a\"\nrm -f \"${CONFIGURATION_TEMP_DIR}/AWACSempty.c\"\nfi";
     1839                };
     1840                FF045B6A0C7E4AA600448140 /* ShellScript */ = {
     1841                        isa = PBXShellScriptBuildPhase;
     1842                        buildActionMask = 8;
     1843                        files = (
     1844                        );
     1845                        inputPaths = (
     1846                        );
     1847                        outputPaths = (
     1848                        );
     1849                        runOnlyForDeploymentPostprocessing = 1;
     1850                        shellPath = /bin/sh;
     1851                        shellScript = "# Install plists to tell launchd how to start mDNSResponder and mDNSResponderHelper\nmkdir -p ${DSTROOT}${SYSTEM_LIBRARY_DIR}/LaunchDaemons\n\nif [ \"${MACOSX_DEPLOYMENT_TARGET}\" == \"10.4\" ] ; then\ncp ${SRCROOT}/LaunchDaemonInfo-Tiger.plist        ${DSTROOT}${SYSTEM_LIBRARY_DIR}/LaunchDaemons/com.apple.mDNSResponder.plist\ncp ${SRCROOT}/LaunchDaemonInfo-Tiger.helper.plist ${DSTROOT}${SYSTEM_LIBRARY_DIR}/LaunchDaemons/com.apple.mDNSResponderHelper.plist\nelse\ncp ${SRCROOT}/LaunchDaemonInfo.plist              ${DSTROOT}${SYSTEM_LIBRARY_DIR}/LaunchDaemons/com.apple.mDNSResponder.plist\ncp ${SRCROOT}/LaunchDaemonInfo.helper.plist       ${DSTROOT}${SYSTEM_LIBRARY_DIR}/LaunchDaemons/com.apple.mDNSResponderHelper.plist\nfi\n\nif [ ! -z \"${IPHONEOS_DEPLOYMENT_TARGET}\" ] ; then\nplutil -convert binary1 ${DSTROOT}${SYSTEM_LIBRARY_DIR}/LaunchDaemons/com.apple.mDNSResponder.plist\nplutil -convert binary1 ${DSTROOT}${SYSTEM_LIBRARY_DIR}/LaunchDaemons/com.apple.mDNSResponderHelper.plist\nfi\n";
    18541852                };
    18551853                FF37FAAD0BC581780044A5CF /* ShellScript */ = {
     
    21062104
    21072105/* Begin PBXTargetDependency section */
     2106                03067D680C83A3830022BE1F /* PBXTargetDependency */ = {
     2107                        isa = PBXTargetDependency;
     2108                        target = D284BE500ADD80740027CCDF /* mDNSResponder */;
     2109                        targetProxy = 03067D670C83A3830022BE1F /* PBXContainerItemProxy */;
     2110                };
     2111                03067D6A0C83A3890022BE1F /* PBXTargetDependency */ = {
     2112                        isa = PBXTargetDependency;
     2113                        target = D284BE750ADD80800027CCDF /* mDNSResponder debug */;
     2114                        targetProxy = 03067D690C83A3890022BE1F /* PBXContainerItemProxy */;
     2115                };
    21082116                03067D6C0C83A3920022BE1F /* PBXTargetDependency */ = {
    21092117                        isa = PBXTargetDependency;
     
    21112119                        targetProxy = 03067D6B0C83A3920022BE1F /* PBXContainerItemProxy */;
    21122120                };
     2121                03067D6E0C83A39C0022BE1F /* PBXTargetDependency */ = {
     2122                        isa = PBXTargetDependency;
     2123                        target = 2E0405EF0C31955500F13B59 /* mDNSResponderHelper */;
     2124                        targetProxy = 03067D6D0C83A39C0022BE1F /* PBXContainerItemProxy */;
     2125                };
    21132126                03067D860C849CC30022BE1F /* PBXTargetDependency */ = {
    21142127                        isa = PBXTargetDependency;
     
    21512164                        targetProxy = 217A4C48138EE14C000A5BA8 /* PBXContainerItemProxy */;
    21522165                };
    2153                 3F2EAAA31A5B8608007F5A52 /* PBXTargetDependency */ = {
    2154                         isa = PBXTargetDependency;
    2155                         target = 3F2EAA9F1A5B85FF007F5A52 /* Build Deprecated */;
    2156                         targetProxy = 3F2EAAA21A5B8608007F5A52 /* PBXContainerItemProxy */;
    2157                 };
    2158                 3F2EAAA51A5B861C007F5A52 /* PBXTargetDependency */ = {
    2159                         isa = PBXTargetDependency;
    2160                         target = D284BE750ADD80800027CCDF /* mDNSResponder debug */;
    2161                         targetProxy = 3F2EAAA41A5B861C007F5A52 /* PBXContainerItemProxy */;
    2162                 };
    2163                 3F2EAAA71A5B861D007F5A52 /* PBXTargetDependency */ = {
    2164                         isa = PBXTargetDependency;
    2165                         target = D284BE500ADD80740027CCDF /* mDNSResponder */;
    2166                         targetProxy = 3F2EAAA61A5B861D007F5A52 /* PBXContainerItemProxy */;
    2167                 };
    2168                 3F2EAAA91A5B861E007F5A52 /* PBXTargetDependency */ = {
    2169                         isa = PBXTargetDependency;
    2170                         target = 2E0405EF0C31955500F13B59 /* mDNSResponderHelper */;
    2171                         targetProxy = 3F2EAAA81A5B861E007F5A52 /* PBXContainerItemProxy */;
    2172                 };
    21732166                4AE4716A0EAFF83800A6C5AD /* PBXTargetDependency */ = {
    21742167                        isa = PBXTargetDependency;
     
    21802173                        target = 84C5B3341665529800C324A8 /* dns_services */;
    21812174                        targetProxy = 84C5B3401665544B00C324A8 /* PBXContainerItemProxy */;
     2175                };
     2176                BD7833F01ABA5E3500EC51ED /* PBXTargetDependency */ = {
     2177                        isa = PBXTargetDependency;
     2178                        target = 72FB545E166D5FB00090B2D9 /* dnsctl */;
     2179                        targetProxy = BD7833EF1ABA5E3500EC51ED /* PBXContainerItemProxy */;
    21822180                };
    21832181                D284BF2C0ADD815A0027CCDF /* PBXTargetDependency */ = {
     
    23882386                                PRODUCT_NAME = mDNSResponderHelper;
    23892387                                PROVISIONING_PROFILE = "";
    2390                         };
    2391                         name = Development;
    2392                 };
    2393                 3F2EAAA01A5B85FF007F5A52 /* Development */ = {
    2394                         isa = XCBuildConfiguration;
    2395                         buildSettings = {
    2396                                 PRODUCT_NAME = "$(TARGET_NAME)";
    23972388                        };
    23982389                        name = Development;
     
    24392430                                GCC_WARN_UNINITIALIZED_AUTOS = YES;
    24402431                                GCC_WARN_UNUSED_VARIABLE = YES;
    2441                                 INSTALL_PATH = /usr/bin;
     2432                                INSTALL_PATH = /usr/local/bin;
    24422433                                MACOSX_DEPLOYMENT_TARGET = 10.9;
    24432434                                ONLY_ACTIVE_ARCH = NO;
     
    24762467                                MACOSX_DEPLOYMENT_TARGET = 10.8;
    24772468                                ONLY_ACTIVE_ARCH = NO;
    2478                                 PRODUCT_NAME = "$(TARGET_NAME)_mdns";
     2469                                PRODUCT_NAME = "$(TARGET_NAME)";
    24792470                                SDKROOT = macosx;
    24802471                        };
     
    29772968                        defaultConfigurationName = Development;
    29782969                };
    2979                 3F2EAAA11A5B85FF007F5A52 /* Build configuration list for PBXAggregateTarget "Build Deprecated" */ = {
    2980                         isa = XCConfigurationList;
    2981                         buildConfigurations = (
    2982                                 3F2EAAA01A5B85FF007F5A52 /* Development */,
    2983                         );
    2984                         defaultConfigurationIsVisible = 0;
    2985                         defaultConfigurationName = Development;
    2986                 };
    29872970                4AE471770EAFF84000A6C5AD /* Build configuration list for PBXLegacyTarget "dns_sd.jar" */ = {
    29882971                        isa = XCConfigurationList;
  • mDNSResponder/mDNSPosix/mDNSPosix.c

    re36ca10 r49ebc73  
    916916    // and skip the probe phase of the probe/announce packet sequence.
    917917    intf->coreIntf.DirectLink = mDNSfalse;
     918#ifdef DIRECTLINK_INTERFACE_NAME
     919        if (strcmp(intfName, STRINGIFY(DIRECTLINK_INTERFACE_NAME)) == 0)
     920                intf->coreIntf.DirectLink = mDNStrue;
     921#endif
    918922
    919923    // The interface is all ready to go, let's register it with the mDNS core.
  • mDNSResponder/mDNSShared/dns_sd.h

    re36ca10 r49ebc73  
    6767
    6868#ifndef _DNS_SD_H
    69 #define _DNS_SD_H 5670000
     69#define _DNS_SD_H 5763004
    7070
    7171#ifdef  __cplusplus
     
    19621962);
    19631963
     1964
    19641965/*********************************************************************************************
    19651966*
  • mDNSResponder/mDNSShared/dnssd_clientshim.c

    re36ca10 r49ebc73  
    818818}
    819819
     820
    820821#endif  // !MDNS_BUILDINGSTUBLIBRARY
  • mDNSResponder/mDNSShared/dnssd_clientstub.c

    re36ca10 r49ebc73  
    20942094}
    20952095
     2096
    20962097static void handle_port_mapping_response(DNSServiceOp *const sdr, const CallbackHeader *const cbh, const char *data, const char *const end)
    20972098{
  • mDNSResponder/mDNSShared/uds_daemon.c

    re36ca10 r49ebc73  
    19651965}
    19661966
     1967// Returns true if the interfaceIndex value matches one of the pre-defined
     1968// special values listed in the switch statement below.
     1969mDNSlocal mDNSBool PreDefinedInterfaceIndex(mDNSu32 interfaceIndex)
     1970{
     1971    switch(interfaceIndex)
     1972    {
     1973        case kDNSServiceInterfaceIndexAny:
     1974        case kDNSServiceInterfaceIndexLocalOnly:
     1975        case kDNSServiceInterfaceIndexUnicast:
     1976        case kDNSServiceInterfaceIndexP2P:
     1977            return mDNStrue;
     1978            break;
     1979        default:
     1980            return mDNSfalse;
     1981    }
     1982}
     1983
    19671984mDNSlocal mStatus handle_regservice_request(request_state *request)
    19681985{
     
    19882005
    19892006    InterfaceID = mDNSPlatformInterfaceIDfromInterfaceIndex(&mDNSStorage, interfaceIndex);
     2007
     2008    // The registration is scoped to a specific interface index, but the
     2009    // interface is not currently in our list.
    19902010    if (interfaceIndex && !InterfaceID)
    1991     { LogMsg("ERROR: handle_regservice_request - Couldn't find interfaceIndex %d", interfaceIndex); return(mStatus_BadParamErr); }
     2011    {
     2012        // If it's one of the specially defined inteface index values, just return an error.
     2013        if (PreDefinedInterfaceIndex(interfaceIndex))
     2014        {
     2015            LogMsg("ERROR: handle_regservice_request: bad interfaceIndex %d", interfaceIndex);
     2016            return(mStatus_BadParamErr);
     2017        }
     2018
     2019        // Otherwise, use the specified interface index value and the registration will
     2020        // be applied to that interface when it comes up.
     2021        InterfaceID = (mDNSInterfaceID)(uintptr_t)interfaceIndex;
     2022        LogInfo("handle_regservice_request: registration pending for interface index %d", interfaceIndex);
     2023    }
    19922024
    19932025    if (get_string(&request->msgptr, request->msgend, name, sizeof(name)) < 0 ||
     
    25632595    mDNSu32 interfaceIndex = get_uint32(&request->msgptr, request->msgend);
    25642596    mDNSInterfaceID InterfaceID = mDNSPlatformInterfaceIDfromInterfaceIndex(&mDNSStorage, interfaceIndex);
    2565     if (interfaceIndex && !InterfaceID) return(mStatus_BadParamErr);
     2597
     2598    // The browse is scoped to a specific interface index, but the
     2599    // interface is not currently in our list.
     2600    if (interfaceIndex && !InterfaceID)
     2601    {
     2602        // If it's one of the specially defined inteface index values, just return an error.
     2603        if (PreDefinedInterfaceIndex(interfaceIndex))
     2604        {
     2605            LogMsg("ERROR: handle_browse_request: bad interfaceIndex %d", interfaceIndex);
     2606            return(mStatus_BadParamErr);
     2607        }
     2608
     2609        // Otherwise, use the specified interface index value and the browse will
     2610        // be applied to that interface when it comes up.
     2611        InterfaceID = (mDNSInterfaceID)(uintptr_t)interfaceIndex;
     2612        LogInfo("handle_browse_request: browse pending for interface index %d", interfaceIndex);
     2613    }
    25662614
    25672615    if (get_string(&request->msgptr, request->msgend, regtype, MAX_ESCAPED_DOMAIN_NAME) < 0 ||
     
    27452793
    27462794    InterfaceID = mDNSPlatformInterfaceIDfromInterfaceIndex(&mDNSStorage, interfaceIndex);
     2795
     2796    // The operation is scoped to a specific interface index, but the
     2797    // interface is not currently in our list.
    27472798    if (interfaceIndex && !InterfaceID)
    2748     { LogMsg("ERROR: handle_resolve_request bad interfaceIndex %d", interfaceIndex); return(mStatus_BadParamErr); }
     2799    {
     2800        // If it's one of the specially defined inteface index values, just return an error.
     2801        if (PreDefinedInterfaceIndex(interfaceIndex))
     2802        {
     2803            LogMsg("ERROR: handle_resolve_request: bad interfaceIndex %d", interfaceIndex);
     2804            return(mStatus_BadParamErr);
     2805        }
     2806
     2807        // Otherwise, use the specified interface index value and the operation will
     2808        // be applied to that interface when it comes up.
     2809        InterfaceID = (mDNSInterfaceID)(uintptr_t)interfaceIndex;
     2810        LogInfo("handle_resolve_request: resolve pending for interface index %d", interfaceIndex);
     2811    }
    27492812
    27502813    if (get_string(&request->msgptr, request->msgend, name, 256) < 0 ||
     
    27742837    request->u.resolve.qsrv.ReturnIntermed   = (flags & kDNSServiceFlagsReturnIntermediates) != 0;
    27752838    request->u.resolve.qsrv.SuppressUnusable = mDNSfalse;
     2839    request->u.resolve.qsrv.DenyOnCellInterface = mDNSfalse;
     2840    request->u.resolve.qsrv.DenyOnExpInterface  = mDNSfalse;
    27762841    request->u.resolve.qsrv.SearchListIndex  = 0;
    27772842    request->u.resolve.qsrv.AppendSearchDomains = 0;
     
    28002865    request->u.resolve.qtxt.ReturnIntermed   = (flags & kDNSServiceFlagsReturnIntermediates) != 0;
    28012866    request->u.resolve.qtxt.SuppressUnusable = mDNSfalse;
     2867    request->u.resolve.qtxt.DenyOnCellInterface = mDNSfalse;
     2868    request->u.resolve.qtxt.DenyOnExpInterface  = mDNSfalse;
    28022869    request->u.resolve.qtxt.SearchListIndex  = 0;
    28032870    request->u.resolve.qtxt.AppendSearchDomains = 0;
     
    36273694    mDNSu32 interfaceIndex = get_uint32(&request->msgptr, request->msgend);
    36283695    mDNSInterfaceID InterfaceID = mDNSPlatformInterfaceIDfromInterfaceIndex(&mDNSStorage, interfaceIndex);
    3629     if (interfaceIndex && !InterfaceID) return(mStatus_BadParamErr);
     3696
     3697    // The request is scoped to a specific interface index, but the
     3698    // interface is not currently in our list.
     3699    if (interfaceIndex && !InterfaceID)
     3700    {
     3701        // If it's one of the specially defined inteface index values, just return an error.
     3702        if (PreDefinedInterfaceIndex(interfaceIndex))
     3703        {
     3704            LogMsg("ERROR: handle_queryrecord_request: bad interfaceIndex %d", interfaceIndex);
     3705            return(mStatus_BadParamErr);
     3706        }
     3707
     3708        // Otherwise, use the specified interface index value and the request will
     3709        // be applied to that interface when it comes up.
     3710        InterfaceID = (mDNSInterfaceID)(uintptr_t)interfaceIndex;
     3711        LogInfo("handle_queryrecord_request: query pending for interface index %d", interfaceIndex);
     3712    }
    36303713
    36313714    if (get_string(&request->msgptr, request->msgend, name, 256) < 0) return(mStatus_BadParamErr);
     
    36563739    q->WakeOnResolve    = 0;
    36573740    q->UseBackgroundTrafficClass = (flags & kDNSServiceFlagsBackgroundTrafficClass) != 0;
     3741    q->DenyOnCellInterface = (flags & kDNSServiceFlagsDenyCellular)  != 0;
     3742    q->DenyOnExpInterface  = (flags & kDNSServiceFlagsDenyExpensive) != 0;
    36583743    if ((flags & kDNSServiceFlagsValidate) != 0)
    36593744        q->ValidationRequired = DNSSEC_VALIDATION_SECURE;
     
    42964381    domainname d;
    42974382    mStatus err = 0;
    4298 
     4383    mDNSs32 serviceIndex   = -1;  // default unscoped value for ServiceID is -1
     4384   
    42994385    DNSServiceFlags flags  = get_flags(&request->msgptr, request->msgend);
     4386   
    43004387    mDNSu32 interfaceIndex = get_uint32(&request->msgptr, request->msgend);
    43014388
     4389    if (flags & kDNSServiceFlagsServiceIndex)
     4390    {
     4391        // NOTE: kDNSServiceFlagsServiceIndex flag can only be set for DNSServiceGetAddrInfo()
     4392        LogInfo("DNSServiceGetAddrInfo: kDNSServiceFlagsServiceIndex is SET by the client");
     4393        // if kDNSServiceFlagsServiceIndex is SET,
     4394        // interpret the interfaceID as the serviceId and set the interfaceID to 0.
     4395        serviceIndex   = interfaceIndex;
     4396        interfaceIndex = 0;
     4397    }
     4398   
    43024399    mDNSPlatformMemZero(&request->u.addrinfo, sizeof(request->u.addrinfo));
    4303     request->u.addrinfo.interface_id = mDNSPlatformInterfaceIDfromInterfaceIndex(&mDNSStorage, interfaceIndex);
     4400
     4401    mDNSInterfaceID InterfaceID = mDNSPlatformInterfaceIDfromInterfaceIndex(&mDNSStorage, interfaceIndex);
     4402
     4403    // The request is scoped to a specific interface index, but the
     4404    // interface is not currently in our list.
     4405    if (interfaceIndex && !InterfaceID)
     4406    {
     4407        // If it's one of the specially defined inteface index values, just return an error.
     4408        if (PreDefinedInterfaceIndex(interfaceIndex))
     4409        {
     4410            LogMsg("ERROR: handle_addrinfo_request: bad interfaceIndex %d", interfaceIndex);
     4411            return(mStatus_BadParamErr);
     4412        }
     4413
     4414        // Otherwise, use the specified interface index value and the registration will
     4415        // be applied to that interface when it comes up.
     4416        InterfaceID = (mDNSInterfaceID)(uintptr_t)interfaceIndex;
     4417        LogInfo("handle_addrinfo_request: query pending for interface index %d", interfaceIndex);
     4418    }
     4419    request->u.addrinfo.interface_id = InterfaceID;
    43044420    request->u.addrinfo.flags        = flags;
    43054421    request->u.addrinfo.protocol     = get_uint32(&request->msgptr, request->msgend);
    43064422
    4307     if (interfaceIndex && !request->u.addrinfo.interface_id) return(mStatus_BadParamErr);
    43084423    if (request->u.addrinfo.protocol > (kDNSServiceProtocol_IPv4|kDNSServiceProtocol_IPv6)) return(mStatus_BadParamErr);
    43094424
     
    43264441
    43274442    request->u.addrinfo.q4.InterfaceID      = request->u.addrinfo.q6.InterfaceID      = request->u.addrinfo.interface_id;
     4443    request->u.addrinfo.q4.ServiceID        = request->u.addrinfo.q6.ServiceID        = serviceIndex;
    43284444    request->u.addrinfo.q4.flags            = request->u.addrinfo.q6.flags            = flags;
    43294445    request->u.addrinfo.q4.Target           = request->u.addrinfo.q6.Target           = zeroAddr;
     
    43384454    request->u.addrinfo.q4.WakeOnResolve    = request->u.addrinfo.q6.WakeOnResolve    = 0;
    43394455    request->u.addrinfo.q4.UseBackgroundTrafficClass = request->u.addrinfo.q6.UseBackgroundTrafficClass  = (flags & kDNSServiceFlagsBackgroundTrafficClass) != 0;
     4456    request->u.addrinfo.q4.DenyOnCellInterface = request->u.addrinfo.q6.DenyOnCellInterface = (flags & kDNSServiceFlagsDenyCellular) != 0;
     4457    request->u.addrinfo.q4.DenyOnExpInterface = request->u.addrinfo.q6.DenyOnExpInterface = (flags & kDNSServiceFlagsDenyExpensive) != 0;
    43404458    if ((flags & kDNSServiceFlagsValidate) != 0)
    43414459        request->u.addrinfo.q4.ValidationRequired = request->u.addrinfo.q6.ValidationRequired = DNSSEC_VALIDATION_SECURE;
Note: See TracChangeset for help on using the changeset viewer.