Lines Matching defs:netId

104             ALOGE("failed to add fallthrough to %s for VPN netId %u", physicalInterface.c_str(),
112 ALOGE("failed to remove fallthrough to %s for VPN netId %u", physicalInterface.c_str(),
154 int NetworkController::setDefaultNetwork(unsigned netId) {
157 if (netId == mDefaultNetId) {
161 if (netId != NETID_UNSET) {
162 Network* network = getNetworkLocked(netId);
164 ALOGE("no such netId %u", netId);
168 ALOGE("cannot set default to non-physical network with netId %u", netId);
179 ALOGE("cannot find previously set default network with netId %u", mDefaultNetId);
187 mDefaultNetId = netId;
191 uint32_t NetworkController::getNetworkForDns(unsigned* netId, uid_t uid) const {
196 if (checkUserNetworkAccessLocked(uid, *netId) == 0) {
206 Network *network = getNetworkLocked(*netId);
209 *netId = mDefaultNetId;
217 *netId = virtualNetwork->getNetId();
221 *netId = mDefaultNetId;
224 fwmark.netId = *netId;
262 unsigned netId, uid_t uid, struct android_net_context* netcontext) const {
264 .app_netid = netId,
266 .dns_netid = netId,
271 // |netId| comes directly (via dnsproxyd) from the value returned by netIdForResolv() in the
290 fwmark.netId = nc.app_netid;
318 bool NetworkController::isVirtualNetwork(unsigned netId) const {
320 Network* network = getNetworkLocked(netId);
324 int NetworkController::createPhysicalNetwork(unsigned netId, Permission permission) {
325 if (!((MIN_NET_ID <= netId && netId <= MAX_NET_ID) ||
326 (MIN_OEM_ID <= netId && netId <= MAX_OEM_ID))) {
327 ALOGE("invalid netId %u", netId);
331 if (isValidNetwork(netId)) {
332 ALOGE("duplicate netId %u", netId);
336 PhysicalNetwork* physicalNetwork = new PhysicalNetwork(netId, mDelegateImpl);
344 mNetworks[netId] = physicalNetwork;
348 int NetworkController::createVirtualNetwork(unsigned netId, bool hasDns, bool secure) {
349 if (!(MIN_NET_ID <= netId && netId <= MAX_NET_ID)) {
350 ALOGE("invalid netId %u", netId);
354 if (isValidNetwork(netId)) {
355 ALOGE("duplicate netId %u", netId);
360 if (int ret = modifyFallthroughLocked(netId, true)) {
363 mNetworks[netId] = new VirtualNetwork(netId, hasDns, secure);
367 int NetworkController::destroyNetwork(unsigned netId) {
368 if (netId == LOCAL_NET_ID) {
372 if (!isValidNetwork(netId)) {
373 ALOGE("no such netId %u", netId);
380 Network* network = getNetworkLocked(netId);
387 if (mDefaultNetId == netId) {
396 if (int err = modifyFallthroughLocked(netId, false)) {
402 mNetworks.erase(netId);
404 _resolv_delete_cache_for_net(netId);
408 int NetworkController::addInterfaceToNetwork(unsigned netId, const char* interface) {
409 if (!isValidNetwork(netId)) {
410 ALOGE("no such netId %u", netId);
415 if (existingNetId != NETID_UNSET && existingNetId != netId) {
416 ALOGE("interface %s already assigned to netId %u", interface, existingNetId);
421 return getNetworkLocked(netId)->addInterface(interface);
424 int NetworkController::removeInterfaceFromNetwork(unsigned netId, const char* interface) {
425 if (!isValidNetwork(netId)) {
426 ALOGE("no such netId %u", netId);
431 return getNetworkLocked(netId)->removeInterface(interface);
447 int NetworkController::checkUserNetworkAccess(uid_t uid, unsigned netId) const {
449 return checkUserNetworkAccessLocked(uid, netId);
455 for (unsigned netId : netIds) {
456 Network* network = getNetworkLocked(netId);
458 ALOGE("no such netId %u", netId);
462 ALOGE("cannot set permissions on non-physical network with netId %u", netId);
473 int NetworkController::addUsersToNetwork(unsigned netId, const UidRanges& uidRanges) {
475 Network* network = getNetworkLocked(netId);
477 ALOGE("no such netId %u", netId);
481 ALOGE("cannot add users to non-virtual network with netId %u", netId);
490 int NetworkController::removeUsersFromNetwork(unsigned netId, const UidRanges& uidRanges) {
492 Network* network = getNetworkLocked(netId);
494 ALOGE("no such netId %u", netId);
498 ALOGE("cannot remove users from non-virtual network with netId %u", netId);
508 int NetworkController::addRoute(unsigned netId, const char* interface, const char* destination,
510 return modifyRoute(netId, interface, destination, nexthop, true, legacy, uid);
513 int NetworkController::removeRoute(unsigned netId, const char* interface, const char* destination,
515 return modifyRoute(netId, interface, destination, nexthop, false, legacy, uid);
567 bool NetworkController::isValidNetwork(unsigned netId) const {
569 return getNetworkLocked(netId);
572 Network* NetworkController::getNetworkLocked(unsigned netId) const {
573 auto iter = mNetworks.find(netId);
597 int NetworkController::checkUserNetworkAccessLocked(uid_t uid, unsigned netId) const {
598 Network* network = getNetworkLocked(netId);
624 int NetworkController::modifyRoute(unsigned netId, const char* interface, const char* destination,
626 if (!isValidNetwork(netId)) {
627 ALOGE("no such netId %u", netId);
632 ALOGE("interface %s not assigned to any netId", interface);
635 if (existingNetId != netId) {
636 ALOGE("interface %s assigned to netId %u, not %u", interface, existingNetId, netId);
641 if (netId == LOCAL_NET_ID) {
663 ALOGE("cannot find previously set default network with netId %u", mDefaultNetId);