LOCAL_C_INCLUDES := bionic/libc/dns/include system/netd/include
LOCAL_CLANG := true
LOCAL_CPPFLAGS := -std=c++11 -Wall -Werror
-
-ifeq ($(BOARD_USES_LIBC_WRAPPER),true)
-LOCAL_CPPFLAGS += -DUSE_WRAPPER
-endif
-
LOCAL_MODULE := libnetd_client
LOCAL_SRC_FILES := FwmarkClient.cpp NetdClient.cpp
#include "FwmarkCommand.h"
#include "resolv_netid.h"
-#ifdef USE_WRAPPER
-#include "codeaurora/PropClientDispatch.h"
-#endif
-
namespace {
std::atomic_uint netIdForProcess(NETID_UNSET);
typedef int (*SocketFunctionType)(int, int, int);
typedef unsigned (*NetIdForResolvFunctionType)(unsigned);
-#ifdef USE_WRAPPER
-typedef void (*SetConnectFunc) (ConnectFunctionType*);
-#endif
-
// These variables are only modified at startup (when libc.so is loaded) and never afterwards, so
// it's okay that they are read later at runtime without a lock.
Accept4FunctionType libcAccept4 = 0;
return -1;
}
}
-
-#ifdef USE_WRAPPER
- if ( FwmarkClient::shouldSetFwmark(addr->sa_family)) {
- if( __propClientDispatch.propConnect ) {
- return __propClientDispatch.propConnect(sockfd, addr, addrlen);
- } else {
- return libcConnect(sockfd, addr, addrlen);
- }
- }
-#endif
return libcConnect(sockfd, addr, addrlen);
}
int netdClientSocket(int domain, int type, int protocol) {
-
- int socketFd;
-#ifndef USE_WRAPPER
- socketFd = libcSocket(domain, type, protocol);
-#else
- if( __propClientDispatch.propSocket ) {
- socketFd = __propClientDispatch.propSocket(domain, type, protocol);
- } else {
- socketFd = libcSocket(domain, type, protocol);
- }
-#endif
+ int socketFd = libcSocket(domain, type, protocol);
if (socketFd == -1) {
return -1;
}
LOCAL_CLANG := true
LOCAL_CPPFLAGS := -std=c++11 -Wall -Werror
-
-ifeq ($(BOARD_USES_LIBC_WRAPPER),true)
-LOCAL_CPPFLAGS += -DUSE_WRAPPER
-endif
-
LOCAL_MODULE := netd
LOCAL_INIT_RC := netd.rc
#include <resolv_netid.h>
#include <net/if.h>
-#ifdef USE_WRAPPER
-#include <QtiConnectivityAdapter.h>
-#endif
#define LOG_TAG "DnsProxyListener"
#define DBG 0
#define VDBG 0
mNetContext.uid);
}
-#ifdef USE_WRAPPER
- int ret = connAdapterGetAddrInfo( mClient->getPid(), mClient->getUid(), mClient->getGid(), mHost, mHints);
-#endif
-
struct addrinfo* result = NULL;
Stopwatch s;
uint32_t rv = android_getaddrinfofornetcontext(mHost, mService, mHints, &mNetContext, &result);
if (rv) {
// getaddrinfo failed
mClient->sendBinaryMsg(ResponseCode::DnsProxyOperationFailed, &rv, sizeof(rv));
-
-#ifdef USE_WRAPPER
- if(!ret && (rv == EAI_NODATA) ) {
- connAdapterSendDnsReport( latencyMs );
- }
-#endif
} else {
bool success = !mClient->sendCode(ResponseCode::DnsProxyQueryResult);
struct addrinfo* ai = result;
ALOGD("DnsProxyListener::GetHostByNameHandler::run\n");
}
-#ifdef USE_WRAPPER
- int ret = connAdapterGetHostByName( mClient->getPid(), mClient->getUid(), mClient->getGid(), mName );
-#endif
-
Stopwatch s;
struct hostent* hp = android_gethostbynamefornet(mName, mAf, mNetId, mMark);
const int latencyMs = lround(s.timeTaken());
success = mClient->sendCode(ResponseCode::DnsProxyQueryResult) == 0;
success &= sendhostent(mClient, hp);
} else {
-#ifdef USE_WRAPPER
- if( !ret ) {
- connAdapterSendDnsReport( latencyMs );
- }
-#endif
success = mClient->sendBinaryMsg(ResponseCode::DnsProxyOperationFailed, NULL, 0) == 0;
}
if (DBG) {
ALOGD("DnsProxyListener::GetHostByAddrHandler::run\n");
}
-
-#ifdef USE_WRAPPER
- int ret = connAdapterGetHostByAddr( mClient->getPid(), mClient->getUid(), mClient->getGid(), mAddress);
-#endif
-
struct hostent* hp;
-#ifdef USE_WRAPPER
- Stopwatch s;
-#endif
// NOTE gethostbyaddr should take a void* but bionic thinks it should be char*
hp = android_gethostbyaddrfornet((char*)mAddress, mAddressLen, mAddressFamily, mNetId, mMark);
-#ifdef USE_WRAPPER
- int latencyMs;
- if(!ret) {
- latencyMs = lround(s.timeTaken());
- }
-#endif
if (DBG) {
ALOGD("GetHostByAddrHandler::run gethostbyaddr errno: %s hp->h_name = %s, name_len = %zu\n",
success = mClient->sendCode(ResponseCode::DnsProxyQueryResult) == 0;
success &= sendhostent(mClient, hp);
} else {
-#ifdef USE_WRAPPER
- if( !ret ) {
- connAdapterSendDnsReport( latencyMs );
- }
-#endif
success = mClient->sendBinaryMsg(ResponseCode::DnsProxyOperationFailed, NULL, 0) == 0;
}
#include "QtiConnectivityAdapter.h"
#include "ResponseCode.h"
-#ifdef USE_WRAPPER
-#include "codeaurora/PropClientDispatch.h"
-#endif
-
void *_libConnectivityHandle = NULL;
void (*_initExtension) (SocketListener*) = NULL;
int (*_runQtiConnectivityCmd) (SocketClient*, int, char**) = NULL;
return static_cast<NetdCommand*>(this);
}
-#ifdef USE_WRAPPER
-int connAdapterGetHostByName(const pid_t pid, const uid_t uid, const gid_t gid, const char* name) {
- if( __propClientDispatch.propGetHostByNameForNet ) {
- return __propClientDispatch.propGetHostByNameForNet(pid, uid, gid, name);
- } else {
- return -1;
- }
-}
-
-int connAdapterGetHostByAddr(const pid_t pid, const uid_t uid, const gid_t gid, const void* addr) {
- if( __propClientDispatch.propGetHostByAddrForNet ) {
- return __propClientDispatch.propGetHostByAddrForNet(pid, uid, gid, addr);
- } else {
- return -1;
- }
-}
-
-int connAdapterGetAddrInfo( const pid_t pid, const uid_t uid, const gid_t gid, const char* hostname, const struct addrinfo* hints) {
- if ( __propClientDispatch.propGetAddrInfoForNet ) {
- return __propClientDispatch.propGetAddrInfoForNet(pid, uid, gid, hostname, hints);
- } else {
- return -1;
- }
-}
-
-void connAdapterSendDnsReport( const int latencyMs ) {
- if( __propClientDispatch.propSendDnsReport ) {
- __propClientDispatch.propSendDnsReport(latencyMs);
- }
-}
-#endif
-
int QtiConnectivityCommand::runCommand
(
SocketClient *cli,
int getV6TetherStats(SocketClient *cli, const char* tetherIface, const char* upstreamIface,
std::string &extraProcessingInfo);
-#ifdef USE_WRAPPER
-int connAdapterGetHostByName(const pid_t pid, const uid_t uid, const gid_t gid, const char* mName);
-int connAdapterGetHostByAddr(const pid_t pid, const uid_t uid, const gid_t gid, const void* addr);
-int connAdapterGetAddrInfo(const pid_t pid, const uid_t uid, const gid_t gid, const char* hostname, const struct addrinfo* hints);
-void connAdapterSendDnsReport(const int latencyMs);
-#endif
-
class QtiConnectivityCommand : NetdCommand {
public:
QtiConnectivityCommand() : NetdCommand("qticonnectivity") {}