ipacm: make changes to store offload state
Make changes to store offload state in a file.
Change-Id: I5cbeacd2849bcdac043941d9bd491eaa62364fbc
diff --git a/ipacm/inc/IPACM_Wan.h b/ipacm/inc/IPACM_Wan.h
index a73ec98..9460938 100644
--- a/ipacm/inc/IPACM_Wan.h
+++ b/ipacm/inc/IPACM_Wan.h
@@ -63,6 +63,7 @@
#define NETWORK_STATS "%s %llu %llu %llu %llu"
#define IPA_NETWORK_STATS_FILE_NAME "/data/misc/ipa/network_stats"
+#define IPA_OFFLOAD_TETHER_STATE_FILE_NAME "/data/vendor/ipa/offload_state"
typedef struct _wan_client_rt_hdl
{
diff --git a/ipacm/src/IPACM_Wan.cpp b/ipacm/src/IPACM_Wan.cpp
index 2ee9f2c..f17eb03 100644
--- a/ipacm/src/IPACM_Wan.cpp
+++ b/ipacm/src/IPACM_Wan.cpp
@@ -2395,6 +2395,20 @@
IPACMERR("Failed to send WAN_IOC_NOTIFY_WAN_STATE as up %d\n ", wan_state.up);
}
close(fd_wwan_ioctl);
+
+ /* Store the Offload state. */
+ FILE *fp = NULL;
+ fp = fopen(IPA_OFFLOAD_TETHER_STATE_FILE_NAME, "w");
+ if (fp == NULL)
+ {
+ IPACMERR("Failed to write offload state to %s, error is %d - %s\n",
+ IPA_OFFLOAD_TETHER_STATE_FILE_NAME, errno, strerror(errno));
+ }
+ else
+ {
+ fprintf(fp, "UPSTREAM=%s,STATE=UP", dev_name);
+ fclose(fp);
+ }
}
ipa_pm_q6_check++;
IPACMDBG_H("update ipa_pm_q6_check to %d\n", ipa_pm_q6_check);
@@ -5073,6 +5087,20 @@
IPACMERR("Failed to send WAN_IOC_NOTIFY_WAN_STATE as up %d\n ", wan_state.up);
}
close(fd_wwan_ioctl);
+
+ /* Store the Offload state. */
+ FILE *fp = NULL;
+ fp = fopen(IPA_OFFLOAD_TETHER_STATE_FILE_NAME, "w");
+ if (fp == NULL)
+ {
+ IPACMERR("Failed to write offload state to %s, error is %d - %s\n",
+ IPA_OFFLOAD_TETHER_STATE_FILE_NAME, errno, strerror(errno));
+ }
+ else
+ {
+ fprintf(fp, "UPSTREAM=%s,STATE=DOWN", dev_name);
+ fclose(fp);
+ }
}
if (ipa_pm_q6_check > 0)
ipa_pm_q6_check--;