Lines Matching refs:iface
414 int BandwidthController::setInterfaceSharedQuota(const std::string& iface, int64_t maxBytes) { in setInterfaceSharedQuota() argument
425 if (!isIfaceName(iface)) in setInterfaceSharedQuota()
429 return removeInterfaceSharedQuota(iface); in setInterfaceSharedQuota()
432 auto it = mSharedQuotaIfaces.find(iface); in setInterfaceSharedQuota()
438 StringPrintf("-I bw_INPUT %d -i %s -j %s", ruleInsertPos, iface.c_str(), chain), in setInterfaceSharedQuota()
439 StringPrintf("-I bw_OUTPUT %d -o %s -j %s", ruleInsertPos, iface.c_str(), chain), in setInterfaceSharedQuota()
440 StringPrintf("-A bw_FORWARD -i %s -j %s", iface.c_str(), chain), in setInterfaceSharedQuota()
441 StringPrintf("-A bw_FORWARD -o %s -j %s", iface.c_str(), chain), in setInterfaceSharedQuota()
452 removeInterfaceSharedQuota(iface); in setInterfaceSharedQuota()
456 mSharedQuotaIfaces.insert(iface); in setInterfaceSharedQuota()
463 removeInterfaceSharedQuota(iface); in setInterfaceSharedQuota()
472 int BandwidthController::removeInterfaceSharedQuota(const std::string& iface) { in removeInterfaceSharedQuota() argument
476 if (!isIfaceName(iface)) in removeInterfaceSharedQuota()
479 auto it = mSharedQuotaIfaces.find(iface); in removeInterfaceSharedQuota()
482 ALOGE("No such iface %s to delete", iface.c_str()); in removeInterfaceSharedQuota()
488 StringPrintf("-D bw_INPUT -i %s -j %s", iface.c_str(), chain), in removeInterfaceSharedQuota()
489 StringPrintf("-D bw_OUTPUT -o %s -j %s", iface.c_str(), chain), in removeInterfaceSharedQuota()
490 StringPrintf("-D bw_FORWARD -i %s -j %s", iface.c_str(), chain), in removeInterfaceSharedQuota()
491 StringPrintf("-D bw_FORWARD -o %s -j %s", iface.c_str(), chain), in removeInterfaceSharedQuota()
500 ALOGE("Failed to remove shared quota on %s", iface.c_str()); in removeInterfaceSharedQuota()
520 int BandwidthController::setInterfaceQuota(const std::string& iface, int64_t maxBytes) { in setInterfaceQuota() argument
521 const std::string& cost = iface; in setInterfaceQuota()
523 if (!isIfaceName(iface)) return -EINVAL; in setInterfaceQuota()
530 return removeInterfaceQuota(iface); in setInterfaceQuota()
534 auto it = mQuotaIfaces.find(iface); in setInterfaceQuota()
538 ALOGE("Failed update quota for %s", iface.c_str()); in setInterfaceQuota()
539 removeInterfaceQuota(iface); in setInterfaceQuota()
546 const std::string chain = "bw_costly_" + iface; in setInterfaceQuota()
552 StringPrintf("-I bw_INPUT %d -i %s -j %s", ruleInsertPos, iface.c_str(), chain.c_str()), in setInterfaceQuota()
553 StringPrintf("-I bw_OUTPUT %d -o %s -j %s", ruleInsertPos, iface.c_str(), in setInterfaceQuota()
555 StringPrintf("-A bw_FORWARD -i %s -j %s", iface.c_str(), chain.c_str()), in setInterfaceQuota()
556 StringPrintf("-A bw_FORWARD -o %s -j %s", iface.c_str(), chain.c_str()), in setInterfaceQuota()
563 removeInterfaceQuota(iface); in setInterfaceQuota()
567 mQuotaIfaces[iface] = QuotaInfo{maxBytes, 0}; in setInterfaceQuota()
575 int BandwidthController::getInterfaceQuota(const std::string& iface, int64_t* bytes) { in getInterfaceQuota() argument
577 const std::string fname = "/proc/net/xt_quota/" + iface; in getInterfaceQuota()
579 if (!isIfaceName(iface)) return -1; in getInterfaceQuota()
583 ALOGE("Reading quota %s failed (%s)", iface.c_str(), toString(file).c_str()); in getInterfaceQuota()
588 ALOGE("Reading quota %s failed (%s)", iface.c_str(), toString(rv).c_str()); in getInterfaceQuota()
595 int BandwidthController::removeInterfaceQuota(const std::string& iface) { in removeInterfaceQuota() argument
596 if (!isIfaceName(iface)) return -EINVAL; in removeInterfaceQuota()
598 auto it = mQuotaIfaces.find(iface); in removeInterfaceQuota()
601 ALOGE("No such iface %s to delete", iface.c_str()); in removeInterfaceQuota()
605 const std::string chain = "bw_costly_" + iface; in removeInterfaceQuota()
608 StringPrintf("-D bw_INPUT -i %s -j %s", iface.c_str(), chain.c_str()), in removeInterfaceQuota()
609 StringPrintf("-D bw_OUTPUT -o %s -j %s", iface.c_str(), chain.c_str()), in removeInterfaceQuota()
610 StringPrintf("-D bw_FORWARD -i %s -j %s", iface.c_str(), chain.c_str()), in removeInterfaceQuota()
611 StringPrintf("-D bw_FORWARD -o %s -j %s", iface.c_str(), chain.c_str()), in removeInterfaceQuota()
718 int BandwidthController::setInterfaceAlert(const std::string& iface, int64_t bytes) { in setInterfaceAlert() argument
719 if (!isIfaceName(iface)) { in setInterfaceAlert()
720 ALOGE("setInterfaceAlert: Invalid iface \"%s\"", iface.c_str()); in setInterfaceAlert()
728 auto it = mQuotaIfaces.find(iface); in setInterfaceAlert()
735 return setCostlyAlert(iface, bytes, &it->second.alert); in setInterfaceAlert()
738 int BandwidthController::removeInterfaceAlert(const std::string& iface) { in removeInterfaceAlert() argument
739 if (!isIfaceName(iface)) { in removeInterfaceAlert()
740 ALOGE("removeInterfaceAlert: Invalid iface \"%s\"", iface.c_str()); in removeInterfaceAlert()
744 auto it = mQuotaIfaces.find(iface); in removeInterfaceAlert()
747 ALOGE("No prior alert set for interface %s", iface.c_str()); in removeInterfaceAlert()
751 return removeCostlyAlert(iface, &it->second.alert); in removeInterfaceAlert()