summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammed Javid <mjavid@codeaurora.org>2017-12-04 15:30:19 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2017-12-19 11:59:27 -0800
commited1e6ed96e200f6758db703d4705f3544006cf56 (patch)
treea3b253325736fbeaf1640073862f3f7b61a8352d
parent1f8f2830893125389001faa28849f7b6bd8cf141 (diff)
downloadipacfg-mgr-ed1e6ed96e200f6758db703d4705f3544006cf56.tar.gz
ipacm: Change error value for set quota
Currently IPA send common error FAIL_TRY_AGAIN to framework in case of IOCTL fails. Change error value for set quota based on error received from modem. Change-Id: I7e31cb27892bed733d71173e9cc479a06b3f462f
-rw-r--r--ipacm/src/IPACM_OffloadManager.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/ipacm/src/IPACM_OffloadManager.cpp b/ipacm/src/IPACM_OffloadManager.cpp
index 9be019f..777edb6 100644
--- a/ipacm/src/IPACM_OffloadManager.cpp
+++ b/ipacm/src/IPACM_OffloadManager.cpp
@@ -536,7 +536,7 @@ RET IPACM_OffloadManager::stopAllOffload()
RET IPACM_OffloadManager::setQuota(const char * upstream_name /* upstream */, uint64_t mb/* limit */)
{
wan_ioctl_set_data_quota quota;
- int fd = -1;
+ int fd = -1,rc = 0;
if ((fd = open(DEVICE_NAME, O_RDWR)) < 0)
{
@@ -556,12 +556,20 @@ RET IPACM_OffloadManager::setQuota(const char * upstream_name /* upstream */, ui
IPACMDBG_H("SET_DATA_QUOTA %s %lu", quota.interface_name, mb);
- if (ioctl(fd, WAN_IOC_SET_DATA_QUOTA, &quota) < 0) {
- IPACMERR("IOCTL WAN_IOCTL_SET_DATA_QUOTA call failed: %s", strerror(errno));
+ rc = ioctl(fd, WAN_IOC_SET_DATA_QUOTA, &quota);
+
+ if(rc != 0)
+ {
close(fd);
- return FAIL_TRY_AGAIN;
+ IPACMERR("IOCTL WAN_IOCTL_SET_DATA_QUOTA call failed: %s rc: %d\n", strerror(errno),rc);
+ if (errno == ENODEV) {
+ IPACMDBG_H("Invalid argument.\n");
+ return FAIL_UNSUPPORTED;
+ }
+ else {
+ return FAIL_TRY_AGAIN;
+ }
}
-
close(fd);
return SUCCESS;
}