Lines Matching refs:iface
319 int BandwidthController::setInterfaceSharedQuota(const std::string& iface, int64_t maxBytes) { in setInterfaceSharedQuota() argument
330 if (!isIfaceName(iface)) in setInterfaceSharedQuota()
334 return removeInterfaceSharedQuota(iface); in setInterfaceSharedQuota()
337 auto it = mSharedQuotaIfaces.find(iface); in setInterfaceSharedQuota()
343 StringPrintf("-I bw_INPUT %d -i %s -j %s", ruleInsertPos, iface.c_str(), chain), in setInterfaceSharedQuota()
344 StringPrintf("-I bw_OUTPUT %d -o %s -j %s", ruleInsertPos, iface.c_str(), chain), in setInterfaceSharedQuota()
345 StringPrintf("-A bw_FORWARD -i %s -j %s", iface.c_str(), chain), in setInterfaceSharedQuota()
346 StringPrintf("-A bw_FORWARD -o %s -j %s", iface.c_str(), chain), in setInterfaceSharedQuota()
357 removeInterfaceSharedQuota(iface); in setInterfaceSharedQuota()
361 mSharedQuotaIfaces.insert(iface); in setInterfaceSharedQuota()
368 removeInterfaceSharedQuota(iface); in setInterfaceSharedQuota()
377 int BandwidthController::removeInterfaceSharedQuota(const std::string& iface) { in removeInterfaceSharedQuota() argument
381 if (!isIfaceName(iface)) in removeInterfaceSharedQuota()
384 auto it = mSharedQuotaIfaces.find(iface); in removeInterfaceSharedQuota()
387 ALOGE("No such iface %s to delete", iface.c_str()); in removeInterfaceSharedQuota()
393 StringPrintf("-D bw_INPUT -i %s -j %s", iface.c_str(), chain), in removeInterfaceSharedQuota()
394 StringPrintf("-D bw_OUTPUT -o %s -j %s", iface.c_str(), chain), in removeInterfaceSharedQuota()
395 StringPrintf("-D bw_FORWARD -i %s -j %s", iface.c_str(), chain), in removeInterfaceSharedQuota()
396 StringPrintf("-D bw_FORWARD -o %s -j %s", iface.c_str(), chain), in removeInterfaceSharedQuota()
405 ALOGE("Failed to remove shared quota on %s", iface.c_str()); in removeInterfaceSharedQuota()
425 int BandwidthController::setInterfaceQuota(const std::string& iface, int64_t maxBytes) { in setInterfaceQuota() argument
426 const std::string& cost = iface; in setInterfaceQuota()
428 if (!isIfaceName(iface)) return -EINVAL; in setInterfaceQuota()
435 return removeInterfaceQuota(iface); in setInterfaceQuota()
439 auto it = mQuotaIfaces.find(iface); in setInterfaceQuota()
443 ALOGE("Failed update quota for %s", iface.c_str()); in setInterfaceQuota()
444 removeInterfaceQuota(iface); in setInterfaceQuota()
451 const std::string chain = "bw_costly_" + iface; in setInterfaceQuota()
457 StringPrintf("-I bw_INPUT %d -i %s -j %s", ruleInsertPos, iface.c_str(), chain.c_str()), in setInterfaceQuota()
458 StringPrintf("-I bw_OUTPUT %d -o %s -j %s", ruleInsertPos, iface.c_str(), in setInterfaceQuota()
460 StringPrintf("-A bw_FORWARD -i %s -j %s", iface.c_str(), chain.c_str()), in setInterfaceQuota()
461 StringPrintf("-A bw_FORWARD -o %s -j %s", iface.c_str(), chain.c_str()), in setInterfaceQuota()
468 removeInterfaceQuota(iface); in setInterfaceQuota()
472 mQuotaIfaces[iface] = QuotaInfo{maxBytes, 0}; in setInterfaceQuota()
480 int BandwidthController::getInterfaceQuota(const std::string& iface, int64_t* bytes) { in getInterfaceQuota() argument
482 const std::string fname = "/proc/net/xt_quota/" + iface; in getInterfaceQuota()
484 if (!isIfaceName(iface)) return -1; in getInterfaceQuota()
488 ALOGE("Reading quota %s failed (%s)", iface.c_str(), toString(file).c_str()); in getInterfaceQuota()
493 ALOGE("Reading quota %s failed (%s)", iface.c_str(), toString(rv).c_str()); in getInterfaceQuota()
500 int BandwidthController::removeInterfaceQuota(const std::string& iface) { in removeInterfaceQuota() argument
501 if (!isIfaceName(iface)) return -EINVAL; in removeInterfaceQuota()
503 auto it = mQuotaIfaces.find(iface); in removeInterfaceQuota()
506 ALOGE("No such iface %s to delete", iface.c_str()); in removeInterfaceQuota()
510 const std::string chain = "bw_costly_" + iface; in removeInterfaceQuota()
513 StringPrintf("-D bw_INPUT -i %s -j %s", iface.c_str(), chain.c_str()), in removeInterfaceQuota()
514 StringPrintf("-D bw_OUTPUT -o %s -j %s", iface.c_str(), chain.c_str()), in removeInterfaceQuota()
515 StringPrintf("-D bw_FORWARD -i %s -j %s", iface.c_str(), chain.c_str()), in removeInterfaceQuota()
516 StringPrintf("-D bw_FORWARD -o %s -j %s", iface.c_str(), chain.c_str()), in removeInterfaceQuota()
623 int BandwidthController::setInterfaceAlert(const std::string& iface, int64_t bytes) { in setInterfaceAlert() argument
624 if (!isIfaceName(iface)) { in setInterfaceAlert()
625 ALOGE("setInterfaceAlert: Invalid iface \"%s\"", iface.c_str()); in setInterfaceAlert()
633 auto it = mQuotaIfaces.find(iface); in setInterfaceAlert()
640 return setCostlyAlert(iface, bytes, &it->second.alert); in setInterfaceAlert()
643 int BandwidthController::removeInterfaceAlert(const std::string& iface) { in removeInterfaceAlert() argument
644 if (!isIfaceName(iface)) { in removeInterfaceAlert()
645 ALOGE("removeInterfaceAlert: Invalid iface \"%s\"", iface.c_str()); in removeInterfaceAlert()
649 auto it = mQuotaIfaces.find(iface); in removeInterfaceAlert()
652 ALOGE("No prior alert set for interface %s", iface.c_str()); in removeInterfaceAlert()
656 return removeCostlyAlert(iface, &it->second.alert); in removeInterfaceAlert()