• Home
  • Raw
  • Download

Lines Matching refs:netId

170 int NetworkController::setDefaultNetwork(unsigned netId) {  in setDefaultNetwork()  argument
173 if (netId == mDefaultNetId) { in setDefaultNetwork()
177 if (netId != NETID_UNSET) { in setDefaultNetwork()
178 Network* network = getNetworkLocked(netId); in setDefaultNetwork()
180 ALOGE("no such netId %u", netId); in setDefaultNetwork()
184 ALOGE("cannot set default to non-physical network with netId %u", netId); in setDefaultNetwork()
203 mDefaultNetId = netId; in setDefaultNetwork()
207 uint32_t NetworkController::getNetworkForDnsLocked(unsigned* netId, uid_t uid) const { in getNetworkForDnsLocked() argument
220 if (*netId == NETID_UNSET && getVirtualNetworkForUserLocked(uid) == nullptr) { in getNetworkForDnsLocked()
221 *netId = defaultNetId; in getNetworkForDnsLocked()
222 fwmark.netId = *netId; in getNetworkForDnsLocked()
227 if (checkUserNetworkAccessLocked(uid, *netId) == 0) { in getNetworkForDnsLocked()
236 Network *network = getNetworkLocked(*netId); in getNetworkForDnsLocked()
237 if (network && network->isVirtual() && !resolv_has_nameservers(*netId)) { in getNetworkForDnsLocked()
238 *netId = defaultNetId; in getNetworkForDnsLocked()
247 *netId = virtualNetwork->getNetId(); in getNetworkForDnsLocked()
251 *netId = defaultNetId; in getNetworkForDnsLocked()
254 fwmark.netId = *netId; in getNetworkForDnsLocked()
311 unsigned netId, uid_t uid, struct android_net_context* netcontext) const { in getNetworkContext() argument
315 .app_netid = netId, in getNetworkContext()
317 .dns_netid = netId, in getNetworkContext()
341 fwmark.netId = nc.app_netid; in getNetworkContext()
373 bool NetworkController::isVirtualNetwork(unsigned netId) const { in isVirtualNetwork()
375 return isVirtualNetworkLocked(netId); in isVirtualNetwork()
378 bool NetworkController::isVirtualNetworkLocked(unsigned netId) const { in isVirtualNetworkLocked()
379 Network* network = getNetworkLocked(netId); in isVirtualNetworkLocked()
383 int NetworkController::createPhysicalNetworkLocked(unsigned netId, Permission permission) { in createPhysicalNetworkLocked() argument
384 if (!((MIN_NET_ID <= netId && netId <= MAX_NET_ID) || in createPhysicalNetworkLocked()
385 (MIN_OEM_ID <= netId && netId <= MAX_OEM_ID))) { in createPhysicalNetworkLocked()
386 ALOGE("invalid netId %u", netId); in createPhysicalNetworkLocked()
390 if (isValidNetworkLocked(netId)) { in createPhysicalNetworkLocked()
391 ALOGE("duplicate netId %u", netId); in createPhysicalNetworkLocked()
395 PhysicalNetwork* physicalNetwork = new PhysicalNetwork(netId, mDelegateImpl); in createPhysicalNetworkLocked()
402 mNetworks[netId] = physicalNetwork; in createPhysicalNetworkLocked()
409 int NetworkController::createPhysicalNetwork(unsigned netId, Permission permission) { in createPhysicalNetwork() argument
411 return createPhysicalNetworkLocked(netId, permission); in createPhysicalNetwork()
440 int NetworkController::createVirtualNetwork(unsigned netId, bool secure, NativeVpnType vpnType) { in createVirtualNetwork() argument
443 if (!(MIN_NET_ID <= netId && netId <= MAX_NET_ID)) { in createVirtualNetwork()
444 ALOGE("invalid netId %u", netId); in createVirtualNetwork()
448 if (isValidNetworkLocked(netId)) { in createVirtualNetwork()
449 ALOGE("duplicate netId %u", netId); in createVirtualNetwork()
458 if (int ret = modifyFallthroughLocked(netId, true)) { in createVirtualNetwork()
461 mNetworks[netId] = new VirtualNetwork(netId, secure); in createVirtualNetwork()
465 int NetworkController::destroyNetwork(unsigned netId) { in destroyNetwork() argument
468 if (netId == LOCAL_NET_ID || netId == UNREACHABLE_NET_ID) { in destroyNetwork()
472 if (!isValidNetworkLocked(netId)) { in destroyNetwork()
473 ALOGE("no such netId %u", netId); in destroyNetwork()
479 Network* network = getNetworkLocked(netId); in destroyNetwork()
486 if (mDefaultNetId == netId) { in destroyNetwork()
495 if (int err = modifyFallthroughLocked(netId, false)) { in destroyNetwork()
501 mNetworks.erase(netId); in destroyNetwork()
505 if (iter->second == netId) { in destroyNetwork()
517 int NetworkController::addInterfaceToNetwork(unsigned netId, const char* interface) { in addInterfaceToNetwork() argument
520 if (!isValidNetworkLocked(netId)) { in addInterfaceToNetwork()
521 ALOGE("no such netId %u", netId); in addInterfaceToNetwork()
526 if (existingNetId != NETID_UNSET && existingNetId != netId) { in addInterfaceToNetwork()
530 if (int ret = getNetworkLocked(netId)->addInterface(interface)) { in addInterfaceToNetwork()
540 if (netId != LOCAL_NET_ID) { in addInterfaceToNetwork()
543 mIfindexToLastNetId[ifIndex] = netId; in addInterfaceToNetwork()
552 int NetworkController::removeInterfaceFromNetwork(unsigned netId, const char* interface) { in removeInterfaceFromNetwork() argument
555 if (!isValidNetworkLocked(netId)) { in removeInterfaceFromNetwork()
556 ALOGE("no such netId %u", netId); in removeInterfaceFromNetwork()
560 return getNetworkLocked(netId)->removeInterface(interface); in removeInterfaceFromNetwork()
576 int NetworkController::checkUserNetworkAccess(uid_t uid, unsigned netId) const { in checkUserNetworkAccess()
578 return checkUserNetworkAccessLocked(uid, netId); in checkUserNetworkAccess()
584 for (unsigned netId : netIds) { in setPermissionForNetworks() local
585 Network* network = getNetworkLocked(netId); in setPermissionForNetworks()
587 ALOGE("no such netId %u", netId); in setPermissionForNetworks()
591 ALOGE("cannot set permissions on non-physical network with netId %u", netId); in setPermissionForNetworks()
604 int isWrongNetworkForUidRanges(unsigned netId, Network* network) { in isWrongNetworkForUidRanges() argument
606 ALOGE("no such netId %u", netId); in isWrongNetworkForUidRanges()
611 netId); in isWrongNetworkForUidRanges()
619 int NetworkController::addUsersToNetwork(unsigned netId, const UidRanges& uidRanges, in addUsersToNetwork() argument
622 Network* network = getNetworkLocked(netId); in addUsersToNetwork()
623 if (int ret = isWrongNetworkForUidRanges(netId, network)) { in addUsersToNetwork()
629 int NetworkController::removeUsersFromNetwork(unsigned netId, const UidRanges& uidRanges, in removeUsersFromNetwork() argument
632 Network* network = getNetworkLocked(netId); in removeUsersFromNetwork()
633 if (int ret = isWrongNetworkForUidRanges(netId, network)) { in removeUsersFromNetwork()
639 int NetworkController::addRoute(unsigned netId, const char* interface, const char* destination, in addRoute() argument
641 return modifyRoute(netId, interface, destination, nexthop, ROUTE_ADD, legacy, uid, mtu); in addRoute()
644 int NetworkController::updateRoute(unsigned netId, const char* interface, const char* destination, in updateRoute() argument
646 return modifyRoute(netId, interface, destination, nexthop, ROUTE_UPDATE, legacy, uid, mtu); in updateRoute()
649 int NetworkController::removeRoute(unsigned netId, const char* interface, const char* destination, in removeRoute() argument
651 return modifyRoute(netId, interface, destination, nexthop, ROUTE_REMOVE, legacy, uid, 0); in removeRoute()
776 bool NetworkController::isValidNetworkLocked(unsigned netId) const { in isValidNetworkLocked()
777 return getNetworkLocked(netId); in isValidNetworkLocked()
780 Network* NetworkController::getNetworkLocked(unsigned netId) const { in getNetworkLocked()
781 auto iter = mNetworks.find(netId); in getNetworkLocked()
802 for (const auto& [netId, network] : mNetworks) { in getPhysicalOrUnreachableNetworkForUserLocked()
822 int NetworkController::checkUserNetworkAccessLocked(uid_t uid, unsigned netId) const { in checkUserNetworkAccessLocked()
823 Network* network = getNetworkLocked(netId); in checkUserNetworkAccessLocked()
866 int NetworkController::modifyRoute(unsigned netId, const char* interface, const char* destination, in modifyRoute() argument
871 if (!isValidNetworkLocked(netId)) { in modifyRoute()
872 ALOGE("no such netId %u", netId); in modifyRoute()
880 if (existingNetId != netId) { in modifyRoute()
881 ALOGE("interface %s assigned to netId %u, not %u", interface, existingNetId, netId); in modifyRoute()
886 if (netId == LOCAL_NET_ID) { in modifyRoute()