From 8a3cc56ef8bd82b57e913710d53889e0d9c406b3 Mon Sep 17 00:00:00 2001 From: Apple Date: Fri, 20 Apr 2001 21:49:37 +0000 Subject: [PATCH] configd-24.1.tar.gz --- SystemConfiguration.fproj/CustomInfo.plist | 2 +- SystemConfiguration.fproj/SCNetwork.c | 53 ++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/SystemConfiguration.fproj/CustomInfo.plist b/SystemConfiguration.fproj/CustomInfo.plist index 89cf132..9fe5a3d 100644 --- a/SystemConfiguration.fproj/CustomInfo.plist +++ b/SystemConfiguration.fproj/CustomInfo.plist @@ -1,5 +1,5 @@ { CFBundleName = "SystemConfiguration"; CFBundleIdentifier = "com.apple.SystemConfiguration"; - CFBundleShortVersionString = "1.0.0"; + CFBundleShortVersionString = "1.0.1"; } diff --git a/SystemConfiguration.fproj/SCNetwork.c b/SystemConfiguration.fproj/SCNetwork.c index 9c24f2e..1828984 100644 --- a/SystemConfiguration.fproj/SCNetwork.c +++ b/SystemConfiguration.fproj/SCNetwork.c @@ -1133,6 +1133,7 @@ SCNIsReachableByName(const char *nodename, const char **errorMessage) { struct in_addr *defaultRoute = NULL; + struct hostent *h; int i; CFDictionaryRef interfaces = NULL; CFArrayRef interfaceOrder = NULL; @@ -1225,6 +1226,58 @@ SCNIsReachableByName(const char *nodename, } } + if (res) { + goto done; + } + + /* + * The getaddrinfo() function call didn't return any addresses. While + * this may be the correct answer we have found that some DNS servers + * may, depending on what has been cached, not return all available + * records when issued a T_ANY query. To accomodate these servers + * we double check by using the gethostbyname() function which uses + * a simple T_A query. + */ + +#ifdef DEBUG + if (SCDOptionGet(session, kSCDOptionDebug)) + SCDLog(LOG_INFO, CFSTR("getaddrinfo() returned no addresses, try gethostbyname()")); +#endif /* DEBUG */ + + h = gethostbyname(nodename); + if (h && h->h_length) { + struct in_addr **s = (struct in_addr **)h->h_addr_list; + + while (*s) { + struct sockaddr_in sa; + + bzero(&sa, sizeof(sa)); + sa.sin_len = sizeof(sa); + sa.sin_family = AF_INET; + sa.sin_addr = **s; + + ns_status = checkAddress(session, + (struct sockaddr *)&sa, + sizeof(sa), + services, + interfaces, + interfaceOrder, + defaultRoute, + flags, + errorMessage); + if (ns_status > scn_status) { + /* return the best case result */ + scn_status = ns_status; + if (ns_status == SCN_REACHABLE_YES) { + /* we're in luck */ + break; + } + } + + s++; + } + } + done : _IsReachableFree(services, interfaces, interfaceOrder, defaultRoute); -- 2.45.2