Lines Matching refs:iface
351 int BandwidthController::setInterfaceSharedQuota(const std::string& iface, int64_t maxBytes) { in setInterfaceSharedQuota() argument
362 if (!isIfaceName(iface)) in setInterfaceSharedQuota()
366 return removeInterfaceSharedQuota(iface); in setInterfaceSharedQuota()
369 auto it = mSharedQuotaIfaces.find(iface); in setInterfaceSharedQuota()
375 StringPrintf("-I bw_INPUT %d -i %s -j %s", ruleInsertPos, iface.c_str(), chain), in setInterfaceSharedQuota()
376 StringPrintf("-I bw_OUTPUT %d -o %s -j %s", ruleInsertPos, iface.c_str(), chain), in setInterfaceSharedQuota()
377 StringPrintf("-A bw_FORWARD -i %s -j %s", iface.c_str(), chain), in setInterfaceSharedQuota()
378 StringPrintf("-A bw_FORWARD -o %s -j %s", iface.c_str(), chain), in setInterfaceSharedQuota()
389 removeInterfaceSharedQuota(iface); in setInterfaceSharedQuota()
393 mSharedQuotaIfaces.insert(iface); in setInterfaceSharedQuota()
400 removeInterfaceSharedQuota(iface); in setInterfaceSharedQuota()
409 int BandwidthController::removeInterfaceSharedQuota(const std::string& iface) { in removeInterfaceSharedQuota() argument
413 if (!isIfaceName(iface)) in removeInterfaceSharedQuota()
416 auto it = mSharedQuotaIfaces.find(iface); in removeInterfaceSharedQuota()
419 ALOGE("No such iface %s to delete", iface.c_str()); in removeInterfaceSharedQuota()
425 StringPrintf("-D bw_INPUT -i %s -j %s", iface.c_str(), chain), in removeInterfaceSharedQuota()
426 StringPrintf("-D bw_OUTPUT -o %s -j %s", iface.c_str(), chain), in removeInterfaceSharedQuota()
427 StringPrintf("-D bw_FORWARD -i %s -j %s", iface.c_str(), chain), in removeInterfaceSharedQuota()
428 StringPrintf("-D bw_FORWARD -o %s -j %s", iface.c_str(), chain), in removeInterfaceSharedQuota()
437 ALOGE("Failed to remove shared quota on %s", iface.c_str()); in removeInterfaceSharedQuota()
457 int BandwidthController::setInterfaceQuota(const std::string& iface, int64_t maxBytes) { in setInterfaceQuota() argument
458 const std::string& cost = iface; in setInterfaceQuota()
460 if (!isIfaceName(iface)) return -EINVAL; in setInterfaceQuota()
467 return removeInterfaceQuota(iface); in setInterfaceQuota()
471 auto it = mQuotaIfaces.find(iface); in setInterfaceQuota()
475 ALOGE("Failed update quota for %s", iface.c_str()); in setInterfaceQuota()
476 removeInterfaceQuota(iface); in setInterfaceQuota()
483 const std::string chain = "bw_costly_" + iface; in setInterfaceQuota()
489 StringPrintf("-I bw_INPUT %d -i %s -j %s", ruleInsertPos, iface.c_str(), chain.c_str()), in setInterfaceQuota()
490 StringPrintf("-I bw_OUTPUT %d -o %s -j %s", ruleInsertPos, iface.c_str(), in setInterfaceQuota()
492 StringPrintf("-A bw_FORWARD -i %s -j %s", iface.c_str(), chain.c_str()), in setInterfaceQuota()
493 StringPrintf("-A bw_FORWARD -o %s -j %s", iface.c_str(), chain.c_str()), in setInterfaceQuota()
500 removeInterfaceQuota(iface); in setInterfaceQuota()
504 mQuotaIfaces[iface] = QuotaInfo{maxBytes, 0}; in setInterfaceQuota()
512 int BandwidthController::getInterfaceQuota(const std::string& iface, int64_t* bytes) { in getInterfaceQuota() argument
514 const std::string fname = "/proc/net/xt_quota/" + iface; in getInterfaceQuota()
516 if (!isIfaceName(iface)) return -1; in getInterfaceQuota()
520 ALOGE("Reading quota %s failed (%s)", iface.c_str(), toString(file).c_str()); in getInterfaceQuota()
525 ALOGE("Reading quota %s failed (%s)", iface.c_str(), toString(rv).c_str()); in getInterfaceQuota()
532 int BandwidthController::removeInterfaceQuota(const std::string& iface) { in removeInterfaceQuota() argument
533 if (!isIfaceName(iface)) return -EINVAL; in removeInterfaceQuota()
535 auto it = mQuotaIfaces.find(iface); in removeInterfaceQuota()
538 ALOGE("No such iface %s to delete", iface.c_str()); in removeInterfaceQuota()
542 const std::string chain = "bw_costly_" + iface; in removeInterfaceQuota()
545 StringPrintf("-D bw_INPUT -i %s -j %s", iface.c_str(), chain.c_str()), in removeInterfaceQuota()
546 StringPrintf("-D bw_OUTPUT -o %s -j %s", iface.c_str(), chain.c_str()), in removeInterfaceQuota()
547 StringPrintf("-D bw_FORWARD -i %s -j %s", iface.c_str(), chain.c_str()), in removeInterfaceQuota()
548 StringPrintf("-D bw_FORWARD -o %s -j %s", iface.c_str(), chain.c_str()), in removeInterfaceQuota()
655 int BandwidthController::setInterfaceAlert(const std::string& iface, int64_t bytes) { in setInterfaceAlert() argument
656 if (!isIfaceName(iface)) { in setInterfaceAlert()
657 ALOGE("setInterfaceAlert: Invalid iface \"%s\"", iface.c_str()); in setInterfaceAlert()
665 auto it = mQuotaIfaces.find(iface); in setInterfaceAlert()
672 return setCostlyAlert(iface, bytes, &it->second.alert); in setInterfaceAlert()
675 int BandwidthController::removeInterfaceAlert(const std::string& iface) { in removeInterfaceAlert() argument
676 if (!isIfaceName(iface)) { in removeInterfaceAlert()
677 ALOGE("removeInterfaceAlert: Invalid iface \"%s\"", iface.c_str()); in removeInterfaceAlert()
681 auto it = mQuotaIfaces.find(iface); in removeInterfaceAlert()
684 ALOGE("No prior alert set for interface %s", iface.c_str()); in removeInterfaceAlert()
688 return removeCostlyAlert(iface, &it->second.alert); in removeInterfaceAlert()