Lines Matching refs:socketFd

99 int checkSocket(int socketFd) {  in checkSocket()  argument
100 if (socketFd < 0) { in checkSocket()
105 if (getsockopt(socketFd, SOL_SOCKET, SO_DOMAIN, &family, &familyLen) == -1) { in checkSocket()
114 bool shouldMarkSocket(int socketFd, const sockaddr* dst) { in shouldMarkSocket() argument
118 return dst && FwmarkClient::shouldSetFwmark(dst->sa_family) && (checkSocket(socketFd) == 0); in shouldMarkSocket()
187 int socketFd = libcSocket(domain, type, protocol); in netdClientSocket() local
188 if (socketFd == -1) { in netdClientSocket()
193 if (int error = setNetworkForSocket(netId, socketFd)) { in netdClientSocket()
194 return closeFdAndSetErrno(socketFd, error); in netdClientSocket()
197 return socketFd; in netdClientSocket()
270 int socketFd = socketFunc(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0); in setNetworkForTarget() local
271 if (socketFd < 0) { in setNetworkForTarget()
274 int error = setNetworkForSocket(netId, socketFd); in setNetworkForTarget()
278 close(socketFd); in setNetworkForTarget()
446 extern "C" int getNetworkForSocket(unsigned* netId, int socketFd) { in getNetworkForSocket() argument
447 if (!netId || socketFd < 0) { in getNetworkForSocket()
452 if (getsockopt(socketFd, SOL_SOCKET, SO_MARK, &fwmark.intValue, &fwmarkLen) == -1) { in getNetworkForSocket()
463 extern "C" int setNetworkForSocket(unsigned netId, int socketFd) { in setNetworkForSocket() argument
464 CHECK_SOCKET_IS_MARKABLE(socketFd); in setNetworkForSocket()
466 return FwmarkClient().send(&command, socketFd, nullptr); in setNetworkForSocket()
477 extern "C" int protectFromVpn(int socketFd) { in protectFromVpn() argument
478 CHECK_SOCKET_IS_MARKABLE(socketFd); in protectFromVpn()
480 return FwmarkClient().send(&command, socketFd, nullptr); in protectFromVpn()
483 extern "C" int setNetworkForUser(uid_t uid, int socketFd) { in setNetworkForUser() argument
484 CHECK_SOCKET_IS_MARKABLE(socketFd); in setNetworkForUser()
486 return FwmarkClient().send(&command, socketFd, nullptr); in setNetworkForUser()
494 extern "C" int tagSocket(int socketFd, uint32_t tag, uid_t uid) { in tagSocket() argument
495 CHECK_SOCKET_IS_MARKABLE(socketFd); in tagSocket()
497 return FwmarkClient().send(&command, socketFd, nullptr); in tagSocket()
500 extern "C" int untagSocket(int socketFd) { in untagSocket() argument
501 CHECK_SOCKET_IS_MARKABLE(socketFd); in untagSocket()
503 return FwmarkClient().send(&command, socketFd, nullptr); in untagSocket()