ipacm: Add flag -Wall -Werror and fix warnings
Add flag -Wall -Werror in Android.mk and fix all the warnings and
errors.
Change-Id: I86de057f5cc38ec9944f4988ac87724ba00b2e52
Acked-by: Pooja Kumari <kumarip@qti.qualcomm.com>
diff --git a/hal/src/HAL.cpp b/hal/src/HAL.cpp
index d812f9b..0dd79e2 100644
--- a/hal/src/HAL.cpp
+++ b/hal/src/HAL.cpp
@@ -88,7 +88,7 @@
status_t ret = 0;
ret = IOffloadControl::registerAsService();
- if (ret != 0) ALOGE("Failed to register IOffloadControl (%d)", ret);
+ if (ret != 0) ALOGE("Failed to register IOffloadControl (%d) name(%s)", ret, name);
else if (DBG) {
ALOGI("Successfully registered IOffloadControl");
}
diff --git a/ipacm/inc/IPACM_Defs.h b/ipacm/inc/IPACM_Defs.h
index 266e69f..fe252c9 100644
--- a/ipacm/inc/IPACM_Defs.h
+++ b/ipacm/inc/IPACM_Defs.h
@@ -187,8 +187,6 @@
IPA_ETH_BRIDGE_CLIENT_DEL, /* ipacm_event_eth_bridge*/
IPA_ETH_BRIDGE_WLAN_SCC_MCC_SWITCH, /* ipacm_event_eth_bridge*/
IPA_LAN_DELETE_SELF, /* ipacm_event_data_fid */
- IPA_DOWNSTREAM_ADD, /* ipacm_event_ipahal_stream */
- IPA_DOWNSTREAM_DEL, /* ipacm_event_ipahal_stream */
#ifdef FEATURE_L2TP
IPA_ADD_VLAN_IFACE, /* ipa_ioc_vlan_iface_info */
IPA_DEL_VLAN_IFACE, /* ipa_ioc_vlan_iface_info */
diff --git a/ipacm/inc/IPACM_Iface.h b/ipacm/inc/IPACM_Iface.h
index 0469699..2e18f51 100644
--- a/ipacm/inc/IPACM_Iface.h
+++ b/ipacm/inc/IPACM_Iface.h
@@ -97,7 +97,7 @@
bool softwarerouting_act;
/* IPACM number of default route rules for ipv6*/
- int num_dft_rt_v6;
+ uint32_t num_dft_rt_v6;
uint32_t dft_v4fl_rule_hdl[IPV4_DEFAULT_FILTERTING_RULES];
uint32_t dft_v6fl_rule_hdl[IPV6_DEFAULT_FILTERTING_RULES + IPV6_DEFAULT_LAN_FILTERTING_RULES];
diff --git a/ipacm/inc/IPACM_Lan.h b/ipacm/inc/IPACM_Lan.h
index 2146689..0f50ae7 100644
--- a/ipacm/inc/IPACM_Lan.h
+++ b/ipacm/inc/IPACM_Lan.h
@@ -297,7 +297,7 @@
int header_name_count;
- int num_eth_client;
+ uint32_t num_eth_client;
NatApp *Nat_App;
diff --git a/ipacm/inc/IPACM_Wan.h b/ipacm/inc/IPACM_Wan.h
index c60612c..a4d0557 100644
--- a/ipacm/inc/IPACM_Wan.h
+++ b/ipacm/inc/IPACM_Wan.h
@@ -107,9 +107,11 @@
{
#ifdef FEATURE_IPA_ANDROID
#ifdef FEATURE_IPACM_HAL
+ /*To avoid -Wall -Werror error */
+ IPACMDBG_H("ipa_if_num_tether: %d\n",ipa_if_num_tether);
return wan_up;
#else
- int i;
+ uint32_t i;
for (i=0; i < ipa_if_num_tether_v4_total;i++)
{
if (ipa_if_num_tether_v4[i] == ipa_if_num_tether)
@@ -156,7 +158,7 @@
#ifdef FEATURE_IPA_ANDROID
static int delete_tether_iface(ipa_ip_type iptype, int ipa_if_num_tether)
{
- int i, j;
+ uint32_t i, j;
if (iptype == IPA_IP_v4)
{
@@ -245,9 +247,9 @@
}
#ifdef FEATURE_IPA_ANDROID
/* IPACM interface id */
- static int ipa_if_num_tether_v4_total;
+ static uint32_t ipa_if_num_tether_v4_total;
static int ipa_if_num_tether_v4[IPA_MAX_IFACE_ENTRIES];
- static int ipa_if_num_tether_v6_total;
+ static uint32_t ipa_if_num_tether_v6_total;
static int ipa_if_num_tether_v6[IPA_MAX_IFACE_ENTRIES];
#endif
@@ -301,7 +303,7 @@
int wan_client_len;
ipa_wan_client *wan_client;
int header_name_count;
- int num_wan_client;
+ uint32_t num_wan_client;
uint8_t invalid_mac[IPA_MAC_ADDR_SIZE];
bool is_xlat;
diff --git a/ipacm/inc/IPACM_Wlan.h b/ipacm/inc/IPACM_Wlan.h
index eb911ac..5fee0fa 100644
--- a/ipacm/inc/IPACM_Wlan.h
+++ b/ipacm/inc/IPACM_Wlan.h
@@ -101,7 +101,7 @@
ipa_wlan_client *wlan_client;
int header_name_count;
- int num_wifi_client;
+ uint32_t num_wifi_client;
int wlan_ap_index;
diff --git a/ipacm/src/Android.mk b/ipacm/src/Android.mk
index 262f8c4..1468a5b 100644
--- a/ipacm/src/Android.mk
+++ b/ipacm/src/Android.mk
@@ -28,7 +28,7 @@
LOCAL_CFLAGS := -v
LOCAL_CFLAGS += -DFEATURE_IPA_ANDROID
-LOCAL_CFLAGS += -DFEATURE_IPACM_HAL
+LOCAL_CFLAGS += -DFEATURE_IPACM_HAL -Wall -Werror
ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
LOCAL_CFLAGS += -DDEBUG
endif
diff --git a/ipacm/src/IPACM_CmdQueue.cpp b/ipacm/src/IPACM_CmdQueue.cpp
index a17fb08..c612b7f 100644
--- a/ipacm/src/IPACM_CmdQueue.cpp
+++ b/ipacm/src/IPACM_CmdQueue.cpp
@@ -122,6 +122,8 @@
MessageQueue *MsgQueueInternal = NULL;
MessageQueue *MsgQueueExternal = NULL;
Message *item = NULL;
+ param = NULL;
+
IPACMDBG("MessageQueue::Process()\n");
MsgQueueInternal = MessageQueue::getInstanceInternal();
diff --git a/ipacm/src/IPACM_ConntrackClient.cpp b/ipacm/src/IPACM_ConntrackClient.cpp
index ffb0088..d8f7f73 100644
--- a/ipacm/src/IPACM_ConntrackClient.cpp
+++ b/ipacm/src/IPACM_ConntrackClient.cpp
@@ -104,6 +104,7 @@
ipacm_cmd_q_data evt_data;
ipacm_ct_evt_data *ct_data;
uint8_t ip_type = 0;
+ data = NULL;
IPACMDBG("Event callback called with msgtype: %d\n",type);
@@ -175,7 +176,7 @@
if(strlen(IPACM_Iface::ipacmcfg->ipa_virtual_iface_name) >= sizeof(ifr.ifr_name))
{
- IPACMERR("interface name overflows: len %d\n",
+ IPACMERR("interface name overflows: len %zu\n",
strlen(IPACM_Iface::ipacmcfg->ipa_virtual_iface_name));
close(fd);
return -1;
@@ -388,6 +389,7 @@
{
NatApp *nat_inst = NULL;
+ ptr = NULL;
#ifdef IPACM_DEBUG
IPACMDBG("\n");
#endif
@@ -601,7 +603,6 @@
/* Thread to initialize TCP Conntrack Filters*/
void IPACM_ConntrackClient::UNRegisterWithConnTrack(void)
{
- int ret;
IPACM_ConntrackClient *pClient = NULL;
IPACMDBG("\n");
diff --git a/ipacm/src/IPACM_ConntrackListener.cpp b/ipacm/src/IPACM_ConntrackListener.cpp
index de0e7e7..4f83b3d 100644
--- a/ipacm/src/IPACM_ConntrackListener.cpp
+++ b/ipacm/src/IPACM_ConntrackListener.cpp
@@ -142,7 +142,7 @@
int IPACM_ConntrackListener::CheckNatIface(
ipacm_event_data_all *data, bool *NatIface)
{
- int fd = 0, len = 0, cnt, i, j;
+ int fd = 0, len = 0, cnt, i;
struct ifreq ifr;
*NatIface = false;
diff --git a/ipacm/src/IPACM_Conntrack_NATApp.cpp b/ipacm/src/IPACM_Conntrack_NATApp.cpp
index 533fb53..c13c48e 100644
--- a/ipacm/src/IPACM_Conntrack_NATApp.cpp
+++ b/ipacm/src/IPACM_Conntrack_NATApp.cpp
@@ -403,17 +403,16 @@
void NatApp::UpdateCTUdpTs(nat_table_entry *rule, uint32_t new_ts)
{
- int ret;
#ifdef FEATURE_IPACM_HAL
IOffloadManager::ConntrackTimeoutUpdater::natTimeoutUpdate_t entry;
IPACM_OffloadManager* OffloadMng;
#endif
-
iptodot("Private IP:", rule->private_ip);
iptodot("Target IP:", rule->target_ip);
IPACMDBG("Private Port: %d, Target Port: %d\n", rule->private_port, rule->target_port);
#ifndef FEATURE_IPACM_HAL
+ int ret;
if(!ct_hdl)
{
ct_hdl = nfct_open(CONNTRACK, 0);
diff --git a/ipacm/src/IPACM_Filtering.cpp b/ipacm/src/IPACM_Filtering.cpp
index 22eb19c..260871f 100644
--- a/ipacm/src/IPACM_Filtering.cpp
+++ b/ipacm/src/IPACM_Filtering.cpp
@@ -264,6 +264,7 @@
ipa_install_fltr_rule_req_ex_msg_v01 qmi_rule_ex_msg;
#endif
+ memset(&qmi_rule_msg, 0, sizeof(qmi_rule_msg));
int fd_wwan_ioctl = open(WWAN_QMI_IOCTL_DEVICE_NAME, O_RDWR);
if(fd_wwan_ioctl < 0)
{
@@ -292,8 +293,6 @@
}
else
{
- memset(&qmi_rule_msg, 0, sizeof(qmi_rule_msg));
-
if (num_rules > 0)
{
qmi_rule_msg.filter_spec_list_valid = true;
diff --git a/ipacm/src/IPACM_Iface.cpp b/ipacm/src/IPACM_Iface.cpp
index 7ff5e4c..36e2141 100644
--- a/ipacm/src/IPACM_Iface.cpp
+++ b/ipacm/src/IPACM_Iface.cpp
@@ -237,8 +237,6 @@
int IPACM_Iface::handle_software_routing_disable(void)
{
int res = IPACM_SUCCESS;
- ipa_ip_type ip;
- uint32_t flt_hdl;
if (rx_prop == NULL)
{
@@ -964,7 +962,7 @@
if(strlen(if_name) >= sizeof(ifr.ifr_name))
{
- IPACMERR("interface name overflows: len %d\n", strlen(if_name));
+ IPACMERR("interface name overflows: len %zu\n", strlen(if_name));
close(fd);
return IPACM_FAILURE;
}
diff --git a/ipacm/src/IPACM_IfaceManager.cpp b/ipacm/src/IPACM_IfaceManager.cpp
index eab43fd..17f546d 100644
--- a/ipacm/src/IPACM_IfaceManager.cpp
+++ b/ipacm/src/IPACM_IfaceManager.cpp
@@ -72,7 +72,9 @@
ipacm_event_data_fid *evt_data = (ipacm_event_data_fid *)param;
ipacm_event_data_mac *StaData = (ipacm_event_data_mac *)param;
ipacm_event_data_all *data_all = (ipacm_event_data_all *)param;
- ipacm_ifacemgr_data ifmgr_data = {0};
+ ipacm_ifacemgr_data ifmgr_data;
+
+ memset(&ifmgr_data,0,sizeof(ifmgr_data));
switch(event)
{
diff --git a/ipacm/src/IPACM_Lan.cpp b/ipacm/src/IPACM_Lan.cpp
index 1da02c2..4208727 100644
--- a/ipacm/src/IPACM_Lan.cpp
+++ b/ipacm/src/IPACM_Lan.cpp
@@ -67,7 +67,8 @@
odu_route_rule_v4_hdl = NULL;
odu_route_rule_v6_hdl = NULL;
eth_client = NULL;
- int i, m_fd_odu, ret = IPACM_SUCCESS;
+ int m_fd_odu, ret = IPACM_SUCCESS;
+ uint32_t i;
Nat_App = NatApp::GetInstance();
if (Nat_App == NULL)
@@ -225,7 +226,6 @@
int ipa_interface_index;
ipacm_ext_prop* ext_prop;
- ipacm_event_iface_up* data_wan;
ipacm_event_iface_up_tehter* data_wan_tether;
switch (event)
@@ -755,7 +755,7 @@
case IPA_HANDLE_WAN_UP:
IPACMDBG_H("Received IPA_HANDLE_WAN_UP event\n");
- data_wan = (ipacm_event_iface_up*)param;
+ ipacm_event_iface_up* data_wan = (ipacm_event_iface_up*)param;
if (data_wan == NULL)
{
IPACMERR("No event data is found.\n");
@@ -1038,7 +1038,7 @@
if(data->iptype == IPA_IP_v6)
{
if ((data->ipv6_addr[0] != 0) || (data->ipv6_addr[1] != 0) ||
- (data->ipv6_addr[2] != 0) || (data->ipv6_addr[3] || 0))
+ (data->ipv6_addr[2] != 0) || (data->ipv6_addr[3] != 0))
{
IPACMDBG_H("ipv6 address got: 0x%x:%x:%x:%x\n", data->ipv6_addr[0], data->ipv6_addr[1], data->ipv6_addr[2], data->ipv6_addr[3]);
for(num_v6=0;num_v6 < get_client_memptr(eth_client, clnt_indx)->ipv6_set;num_v6++)
@@ -1053,6 +1053,11 @@
}
}
}
+ else
+ {
+ IPACMDBG_H("Invalid ipv6 address\n");
+ return IPACM_FAILURE;
+ }
if (num_v6 == IPV6_NUM_ADDR)
{
IPACMDBG_H("ipv6 addr is not found. \n");
@@ -1077,7 +1082,7 @@
get_client_memptr(eth_client, clnt_indx)->ipv6_set--;
get_client_memptr(eth_client, clnt_indx)->route_rule_set_v6--;
- for(num_v6;num_v6< get_client_memptr(eth_client, clnt_indx)->ipv6_set;num_v6++)
+ for(;num_v6< get_client_memptr(eth_client, clnt_indx)->ipv6_set;num_v6++)
{
get_client_memptr(eth_client, clnt_indx)->v6_addr[num_v6][0] =
get_client_memptr(eth_client, clnt_indx)->v6_addr[num_v6+1][0];
@@ -1134,7 +1139,7 @@
memset(&flt_index, 0, sizeof(flt_index));
flt_index.source_pipe_index = ioctl(fd, IPA_IOC_QUERY_EP_MAPPING, rx_prop->rx[0].src_pipe);
- if (flt_index.source_pipe_index == -1)
+ if ((int)flt_index.source_pipe_index == -1)
{
IPACMERR("Error Query src pipe idx, aborting...\n");
close(fd);
@@ -1149,7 +1154,7 @@
#endif
flt_index.embedded_pipe_index_valid = 1;
flt_index.embedded_pipe_index = ioctl(fd, IPA_IOC_QUERY_EP_MAPPING, IPA_CLIENT_APPS_LAN_WAN_PROD);
- if (flt_index.embedded_pipe_index == -1)
+ if ((int)flt_index.embedded_pipe_index == -1)
{
IPACMERR("Error Query emb pipe idx, aborting...\n");
close(fd);
@@ -1189,7 +1194,7 @@
struct ipa_ioc_add_rt_rule *rt_rule;
struct ipa_rt_rule_add *rt_rule_entry;
const int NUM_RULES = 1;
- int num_ipv6_addr;
+ uint32_t num_ipv6_addr;
int res = IPACM_SUCCESS;
#ifdef FEATURE_IPACM_HAL
IPACM_OffloadManager* OffloadMng;
@@ -1677,7 +1682,8 @@
int IPACM_Lan::handle_wan_up_ex(ipacm_ext_prop *ext_prop, ipa_ip_type iptype, uint8_t xlat_mux_id)
{
- int fd, ret = IPACM_SUCCESS, cnt;
+ int fd, ret = IPACM_SUCCESS;
+ uint32_t cnt;
IPACM_Config* ipacm_config = IPACM_Iface::ipacmcfg;
struct ipa_ioc_write_qmapid mux;
@@ -1841,7 +1847,7 @@
pHeaderDescriptor->hdr[0].name[IPA_RESOURCE_NAME_MAX-1] = '\0';
if (strlcat(pHeaderDescriptor->hdr[0].name, IPA_ETH_HDR_NAME_v4, sizeof(pHeaderDescriptor->hdr[0].name)) > IPA_RESOURCE_NAME_MAX)
{
- IPACMERR(" header name construction failed exceed length (%d)\n", strlen(pHeaderDescriptor->hdr[0].name));
+ IPACMERR(" header name construction failed exceed length (%zu)\n", strlen(pHeaderDescriptor->hdr[0].name));
res = IPACM_FAILURE;
goto fail;
}
@@ -1849,7 +1855,7 @@
snprintf(index,sizeof(index), "%d", header_name_count);
if (strlcat(pHeaderDescriptor->hdr[0].name, index, sizeof(pHeaderDescriptor->hdr[0].name)) > IPA_RESOURCE_NAME_MAX)
{
- IPACMERR(" header name construction failed exceed length (%d)\n", strlen(pHeaderDescriptor->hdr[0].name));
+ IPACMERR(" header name construction failed exceed length (%zu)\n", strlen(pHeaderDescriptor->hdr[0].name));
res = IPACM_FAILURE;
goto fail;
}
@@ -1941,14 +1947,14 @@
pHeaderDescriptor->hdr[0].name[IPA_RESOURCE_NAME_MAX-1] = '\0';
if (strlcat(pHeaderDescriptor->hdr[0].name, IPA_ETH_HDR_NAME_v6, sizeof(pHeaderDescriptor->hdr[0].name)) > IPA_RESOURCE_NAME_MAX)
{
- IPACMERR(" header name construction failed exceed length (%d)\n", strlen(pHeaderDescriptor->hdr[0].name));
+ IPACMERR(" header name construction failed exceed length (%zu)\n", strlen(pHeaderDescriptor->hdr[0].name));
res = IPACM_FAILURE;
goto fail;
}
snprintf(index,sizeof(index), "%d", header_name_count);
if (strlcat(pHeaderDescriptor->hdr[0].name, index, sizeof(pHeaderDescriptor->hdr[0].name)) > IPA_RESOURCE_NAME_MAX)
{
- IPACMERR(" header name construction failed exceed length (%d)\n", strlen(pHeaderDescriptor->hdr[0].name));
+ IPACMERR(" header name construction failed exceed length (%zu)\n", strlen(pHeaderDescriptor->hdr[0].name));
res = IPACM_FAILURE;
goto fail;
}
@@ -2061,7 +2067,7 @@
else
{
if ((data->ipv6_addr[0] != 0) || (data->ipv6_addr[1] != 0) ||
- (data->ipv6_addr[2] != 0) || (data->ipv6_addr[3] || 0)) /* check if all 0 not valid ipv6 address */
+ (data->ipv6_addr[2] != 0) || (data->ipv6_addr[3] != 0)) /* check if all 0 not valid ipv6 address */
{
IPACMDBG_H("ipv6 address: 0x%x:%x:%x:%x\n", data->ipv6_addr[0], data->ipv6_addr[1], data->ipv6_addr[2], data->ipv6_addr[3]);
if( (data->ipv6_addr[0] & ipv6_link_local_prefix_mask) != (ipv6_link_local_prefix & ipv6_link_local_prefix_mask) &&
@@ -2099,6 +2105,11 @@
return IPACM_FAILURE; /* not setup the RT rules*/
}
}
+ else
+ {
+ IPACMDBG_H("Invalid IPV6 address\n");
+ return IPACM_FAILURE;
+ }
}
return IPACM_SUCCESS;
@@ -2763,7 +2774,7 @@
/*handle LAN iface down event*/
int IPACM_Lan::handle_down_evt()
{
- int i;
+ uint32_t i;
int res = IPACM_SUCCESS;
IPACMDBG_H("lan handle_down_evt\n ");
@@ -3111,7 +3122,7 @@
memset(&flt_index, 0, sizeof(flt_index));
flt_index.source_pipe_index = ioctl(fd, IPA_IOC_QUERY_EP_MAPPING, rx_prop->rx[0].src_pipe);
- if (flt_index.source_pipe_index == -1)
+ if ((int)flt_index.source_pipe_index == -1)
{
IPACMERR("Error Query src pipe idx, aborting...\n");
close(fd);
@@ -3127,7 +3138,7 @@
#endif
flt_index.embedded_pipe_index_valid = 1;
flt_index.embedded_pipe_index = ioctl(fd, IPA_IOC_QUERY_EP_MAPPING, IPA_CLIENT_APPS_LAN_WAN_PROD);
- if (flt_index.embedded_pipe_index == -1)
+ if ((int)flt_index.embedded_pipe_index == -1)
{
IPACMERR("Error Query emb pipe idx, aborting...\n");
close(fd);
@@ -3419,7 +3430,7 @@
memset(&flt_index, 0, sizeof(flt_index));
flt_index.source_pipe_index = ioctl(fd, IPA_IOC_QUERY_EP_MAPPING, rx_prop->rx[0].src_pipe);
- if (flt_index.source_pipe_index == -1)
+ if ((int)flt_index.source_pipe_index == -1)
{
IPACMERR("Error Query src pipe idx, aborting...\n");
close(fd);
@@ -3434,7 +3445,7 @@
#endif
flt_index.embedded_pipe_index_valid = 1;
flt_index.embedded_pipe_index = ioctl(fd, IPA_IOC_QUERY_EP_MAPPING, IPA_CLIENT_APPS_LAN_WAN_PROD);
- if (flt_index.embedded_pipe_index == -1)
+ if ((int)flt_index.embedded_pipe_index == -1)
{
IPACMERR("Error Query emb pipe idx, aborting...\n");
close(fd);
@@ -3592,7 +3603,8 @@
/*handle reset usb-client rt-rules */
int IPACM_Lan::handle_lan_client_reset_rt(ipa_ip_type iptype)
{
- int i, res = IPACM_SUCCESS;
+ uint32_t i;
+ int res = IPACM_SUCCESS;
/* clean eth-client routing rules */
IPACMDBG_H("left %d eth clients need to be deleted \n ", num_eth_client);
@@ -4158,7 +4170,8 @@
/*handle reset usb-client rt-rules */
int IPACM_Lan::handle_tethering_stats_event(ipa_get_data_stats_resp_msg_v01 *data)
{
- int cnt, pipe_len, fd;
+ int fd;
+ uint32_t pipe_len, cnt;
uint64_t num_ul_packets, num_ul_bytes;
uint64_t num_dl_packets, num_dl_bytes;
bool ul_pipe_found, dl_pipe_found;
@@ -4189,7 +4202,7 @@
for (cnt=0; cnt<tx_prop->num_tx_props; cnt++)
{
IPACMDBG_H("Check Tx_prop_entry(%d) pipe(%d)\n", cnt, ioctl(fd, IPA_IOC_QUERY_EP_MAPPING, tx_prop->tx[cnt].dst_pipe));
- if(ioctl(fd, IPA_IOC_QUERY_EP_MAPPING, tx_prop->tx[cnt].dst_pipe) == data->dl_dst_pipe_stats_list[pipe_len].pipe_index)
+ if(ioctl(fd, IPA_IOC_QUERY_EP_MAPPING, tx_prop->tx[cnt].dst_pipe) == (int)data->dl_dst_pipe_stats_list[pipe_len].pipe_index)
{
/* update the DL stats */
dl_pipe_found = true;
@@ -4216,7 +4229,8 @@
for (cnt=0; cnt < rx_prop->num_rx_props; cnt++)
{
IPACMDBG_H("Check Rx_prop_entry(%d) pipe(%d)\n", cnt, ioctl(fd, IPA_IOC_QUERY_EP_MAPPING, rx_prop->rx[cnt].src_pipe));
- if(ioctl(fd, IPA_IOC_QUERY_EP_MAPPING, rx_prop->rx[cnt].src_pipe) == data->ul_src_pipe_stats_list[pipe_len].pipe_index)
+ //Typecasting to avoid -Wall -Werror errors
+ if(ioctl(fd, IPA_IOC_QUERY_EP_MAPPING, rx_prop->rx[cnt].src_pipe) == (int)data->ul_src_pipe_stats_list[pipe_len].pipe_index)
{
/* update the UL stats */
ul_pipe_found = true;
@@ -4266,7 +4280,8 @@
/*handle tether client */
int IPACM_Lan::handle_tethering_client(bool reset, ipacm_client_enum ipa_client)
{
- int cnt, fd, ret = IPACM_SUCCESS;
+ int fd, ret = IPACM_SUCCESS;
+ uint32_t cnt;
int fd_wwan_ioctl = open(WWAN_QMI_IOCTL_DEVICE_NAME, O_RDWR);
wan_ioctl_set_tether_client_pipe tether_client;
@@ -4328,8 +4343,14 @@
{
ipacm_cmd_q_data eth_bridge_evt;
ipacm_event_eth_bridge *evt_data_eth_bridge;
+#ifdef FEATURE_L2TP
ipacm_event_data_all *evt_data_all;
-
+#endif
+ if(ipv6_addr)
+ {
+ IPACMDBG_H("IPv6 addr: %08x:%08x:%08x:%08x \n", ipv6_addr[0],
+ ipv6_addr[1], ipv6_addr[2], ipv6_addr[3]);
+ }
memset(ð_bridge_evt, 0, sizeof(ipacm_cmd_q_data));
eth_bridge_evt.event = evt;
@@ -4440,10 +4461,10 @@
int IPACM_Lan::eth_bridge_add_rt_rule(uint8_t *mac, char *rt_tbl_name, uint32_t hdr_proc_ctx_hdl,
ipa_hdr_l2_type peer_l2_hdr_type, ipa_ip_type iptype, uint32_t *rt_rule_hdl, int *rt_rule_count)
{
- int i, len, res = IPACM_SUCCESS;
+ int len, res = IPACM_SUCCESS;
+ uint32_t i, position, num_rt_rule;
struct ipa_ioc_add_rt_rule* rt_rule_table = NULL;
struct ipa_rt_rule_add rt_rule;
- int position, num_rt_rule;
IPACMDBG_H("Received client MAC 0x%02x%02x%02x%02x%02x%02x.\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
@@ -4536,7 +4557,8 @@
{
struct ipa_ioc_mdfy_rt_rule *rt_rule = NULL;
struct ipa_rt_rule_mdfy *rt_rule_entry;
- int len, index, res = IPACM_SUCCESS;
+ int len, res = IPACM_SUCCESS;
+ uint32_t index;
if(tx_prop == NULL)
{
@@ -4781,6 +4803,7 @@
uint32_t *second_pass_hdr_hdl, int *num_rt_hdl, uint32_t *first_pass_rt_rule_hdl, uint32_t *second_pass_rt_rule_hdl)
{
int i, size, position;
+ uint32_t tx_index;
uint32_t vlan_iface_ipv6_addr_network[4], vlan_client_ipv6_addr_network[4];
ipa_ioc_add_hdr *hdr_table;
ipa_hdr_add *hdr;
@@ -4901,9 +4924,9 @@
rt_rule_table->rt_tbl_name[IPA_RESOURCE_NAME_MAX-1] = 0;
position = 0;
- for(i = 0; i < iface_query->num_tx_props; i++)
+ for(tx_index = 0; tx_index < iface_query->num_tx_props; tx_index++)
{
- if(tx_prop->tx[i].ip == iptype)
+ if(tx_prop->tx[tx_index].ip == iptype)
{
if(position >= *num_rt_hdl || position >= MAX_NUM_PROP)
{
@@ -4921,7 +4944,7 @@
rt_rule->rule.hdr_proc_ctx_hdl = *first_pass_hdr_proc_ctx_hdl;
rt_rule->rule.dst = IPA_CLIENT_DUMMY_CONS;
- memcpy(&rt_rule->rule.attrib, &tx_prop->tx[i].attrib, sizeof(rt_rule->rule.attrib));
+ memcpy(&rt_rule->rule.attrib, &tx_prop->tx[tx_index].attrib, sizeof(rt_rule->rule.attrib));
if(peer_l2_hdr_type == IPA_HDR_L2_ETHERNET_II)
rt_rule->rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_ETHER_II;
else
@@ -4973,14 +4996,14 @@
}
hdr->type = IPA_HDR_L2_ETHERNET_II;
hdr->is_partial = 0;
- for(i = 0; i < tx_prop->num_tx_props; i++)
+ for(tx_index = 0; tx_index < tx_prop->num_tx_props; tx_index++)
{
- if(tx_prop->tx[i].ip == IPA_IP_v6)
+ if(tx_prop->tx[tx_index].ip == IPA_IP_v6)
{
memset(©_hdr, 0, sizeof(copy_hdr));
- strlcpy(copy_hdr.name, tx_prop->tx[i].hdr_name,
+ strlcpy(copy_hdr.name, tx_prop->tx[tx_index].hdr_name,
sizeof(copy_hdr.name));
- IPACMDBG_H("Header name: %s in tx:%d\n", copy_hdr.name, i);
+ IPACMDBG_H("Header name: %s in tx:%d\n", copy_hdr.name, tx_index);
if(m_header.CopyHeader(©_hdr) == false)
{
IPACMERR("Failed to get partial header.\n");
@@ -5033,9 +5056,9 @@
rt_rule_table->rt_tbl_name[IPA_RESOURCE_NAME_MAX-1] = 0;
position = 0;
- for(i = 0; i < iface_query->num_tx_props; i++)
+ for(tx_index = 0; tx_index < iface_query->num_tx_props; tx_index++)
{
- if(tx_prop->tx[i].ip == IPA_IP_v6)
+ if(tx_prop->tx[tx_index].ip == IPA_IP_v6)
{
if(position >= *num_rt_hdl || position >= MAX_NUM_PROP)
{
@@ -5051,9 +5074,9 @@
rt_rule->rule.hashable = false; //WLAN->ETH direction rules are set to non-hashable to keep consistent with the other direction
rt_rule->rule.hdr_hdl = *second_pass_hdr_hdl;
rt_rule->rule.hdr_proc_ctx_hdl = 0;
- rt_rule->rule.dst = tx_prop->tx[i].dst_pipe;
+ rt_rule->rule.dst = tx_prop->tx[tx_index].dst_pipe;
- memcpy(&rt_rule->rule.attrib, &tx_prop->tx[i].attrib, sizeof(rt_rule->rule.attrib));
+ memcpy(&rt_rule->rule.attrib, &tx_prop->tx[tx_index].attrib, sizeof(rt_rule->rule.attrib));
rt_rule->rule.attrib.attrib_mask |= IPA_FLT_DST_ADDR;
memcpy(rt_rule->rule.attrib.u.v6.dst_addr, vlan_client_ipv6_addr,
sizeof(rt_rule->rule.attrib.u.v6.dst_addr));
@@ -5137,6 +5160,7 @@
int *num_rt_hdl, uint32_t *rt_rule_hdl)
{
int i, size, position;
+ uint32_t tx_index;
ipa_ioc_add_hdr_proc_ctx *hdr_proc_ctx_table;
ipa_hdr_proc_ctx_add *hdr_proc_ctx;
ipa_ioc_add_rt_rule* rt_rule_table;
@@ -5150,11 +5174,11 @@
}
memset(&hdr, 0, sizeof(hdr));
- for(i = 0; i < tx_prop->num_tx_props; i++)
+ for(tx_index = 0; tx_index < tx_prop->num_tx_props; tx_index++)
{
- if(tx_prop->tx[i].ip == iptype)
+ if(tx_prop->tx[tx_index].ip == iptype)
{
- strlcpy(hdr.name, tx_prop->tx[i].hdr_name,
+ strlcpy(hdr.name, tx_prop->tx[tx_index].hdr_name,
sizeof(hdr.name));
break;
}
@@ -5224,9 +5248,9 @@
rt_rule_table->rt_tbl_name[IPA_RESOURCE_NAME_MAX-1] = 0;
position = 0;
- for(i = 0; i < iface_query->num_tx_props; i++)
+ for(tx_index = 0; tx_index < iface_query->num_tx_props; tx_index++)
{
- if(tx_prop->tx[i].ip == iptype)
+ if(tx_prop->tx[tx_index].ip == iptype)
{
if(position >= *num_rt_hdl || position >= MAX_NUM_PROP)
{
@@ -5243,9 +5267,9 @@
rt_rule->rule.hdr_hdl = 0;
rt_rule->rule.hdr_proc_ctx_hdl = *hdr_proc_ctx_hdl;
- rt_rule->rule.dst = tx_prop->tx[i].dst_pipe;
+ rt_rule->rule.dst = tx_prop->tx[tx_index].dst_pipe;
- memcpy(&rt_rule->rule.attrib, &tx_prop->tx[i].attrib, sizeof(rt_rule->rule.attrib));
+ memcpy(&rt_rule->rule.attrib, &tx_prop->tx[tx_index].attrib, sizeof(rt_rule->rule.attrib));
rt_rule->rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_L2TP;
memset(rt_rule->rule.attrib.dst_mac_addr_mask, 0xFF, sizeof(rt_rule->rule.attrib.dst_mac_addr_mask));
diff --git a/ipacm/src/IPACM_Log.cpp b/ipacm/src/IPACM_Log.cpp
index 20dd26c..d0bd108 100644
--- a/ipacm/src/IPACM_Log.cpp
+++ b/ipacm/src/IPACM_Log.cpp
@@ -50,13 +50,8 @@
#include <errno.h>
#include <IPACM_Defs.h>
-void logmessage(int log_level)
-{
- return;
-}
-
/* start IPACMDIAG socket*/
-int create_socket(unsigned int *sockfd)
+int create_socket(int *sockfd)
{
if ((*sockfd = socket(AF_UNIX, SOCK_DGRAM, 0)) == IPACM_FAILURE)
@@ -78,7 +73,7 @@
ipacm_log_buffer_t ipacm_log_buffer;
int numBytes=0, len;
struct sockaddr_un ipacmlog_socket;
- static unsigned int ipacm_log_sockfd = 0;
+ static int ipacm_log_sockfd = 0;
if(ipacm_log_sockfd == 0)
{
diff --git a/ipacm/src/IPACM_Main.cpp b/ipacm/src/IPACM_Main.cpp
index a05876f..5d0f83b 100644
--- a/ipacm/src/IPACM_Main.cpp
+++ b/ipacm/src/IPACM_Main.cpp
@@ -106,9 +106,17 @@
void ipa_is_ipacm_running(void);
int ipa_get_if_index(char *if_name, int *if_index);
+IPACM_Neighbor *neigh;
+IPACM_IfaceManager *ifacemgr;
+#ifdef FEATURE_IPACM_HAL
+ IPACM_OffloadManager* OffloadMng;
+ HAL *hal;
+#endif
+
/* start netlink socket monitor*/
void* netlink_start(void *param)
{
+ param = NULL;
ipa_nl_sk_fd_set_info_t sk_fdset;
int ret_val = 0;
memset(&sk_fdset, 0, sizeof(ipa_nl_sk_fd_set_info_t));
@@ -137,6 +145,7 @@
ipacm_cmd_q_data evt_data;
uint32_t mask = IN_MODIFY | IN_MOVE;
+ param = NULL;
inotify_fd = inotify_init();
if (inotify_fd < 0)
{
@@ -234,7 +243,6 @@
ipacm_event_data_wlan_ex *data_ex;
ipa_get_data_stats_resp_msg_v01 *data_tethering_stats = NULL;
ipa_get_apn_data_stats_resp_msg_v01 *data_network_stats = NULL;
-
#ifdef FEATURE_L2TP
ipa_ioc_vlan_iface_info *vlan_info = NULL;
ipa_ioc_l2tp_vlan_mapping_info *mapping = NULL;
@@ -242,6 +250,7 @@
ipacm_cmd_q_data new_neigh_evt;
ipacm_event_data_all* new_neigh_data;
+ param = NULL;
fd = open(IPA_DRIVER, O_RDWR);
if (fd < 0)
{
@@ -784,7 +793,6 @@
void IPACM_Sig_Handler(int sig)
{
- int cnt;
ipacm_cmd_q_data evt_data;
printf("Received Signal: %d\n", sig);
@@ -823,19 +831,19 @@
int ret;
pthread_t netlink_thread = 0, monitor_thread = 0, ipa_driver_thread = 0;
pthread_t cmd_queue_thread = 0;
-#ifdef FEATURE_IPACM_HAL
- IPACM_OffloadManager* OffloadMng;
-#endif
/* check if ipacm is already running or not */
ipa_is_ipacm_running();
IPACMDBG_H("In main()\n");
- IPACM_Neighbor *neigh = new IPACM_Neighbor();
- IPACM_IfaceManager *ifacemgr = new IPACM_IfaceManager();
+ (void)argc;
+ (void)argv;
+
+ neigh = new IPACM_Neighbor();
+ ifacemgr = new IPACM_IfaceManager();
#ifdef FEATURE_IPACM_HAL
OffloadMng = IPACM_OffloadManager::GetInstance();
- HAL *hal = HAL::makeIPAHAL(1, OffloadMng);
+ hal = HAL::makeIPAHAL(1, OffloadMng);
IPACMDBG_H(" START IPACM_OffloadManager and link to android framework\n");
#endif
diff --git a/ipacm/src/IPACM_Netlink.cpp b/ipacm/src/IPACM_Netlink.cpp
index b5fadcb..587663b 100644
--- a/ipacm/src/IPACM_Netlink.cpp
+++ b/ipacm/src/IPACM_Netlink.cpp
@@ -607,7 +607,7 @@
)
{
char dev_name[IF_NAME_LEN]={0};
- int ret_val, mask_value, mask_index, mask_value_v6;
+ int ret_val, mask_index, mask_value_v6;
struct nlmsghdr *nlh = (struct nlmsghdr *)buffer;
uint32_t if_ipv4_addr =0, if_ipipv4_addr_mask =0, temp =0, if_ipv4_addr_gw =0;
diff --git a/ipacm/src/IPACM_OffloadManager.cpp b/ipacm/src/IPACM_OffloadManager.cpp
index 4ff46c2..32606b9 100644
--- a/ipacm/src/IPACM_OffloadManager.cpp
+++ b/ipacm/src/IPACM_OffloadManager.cpp
@@ -339,8 +339,6 @@
RET IPACM_OffloadManager::setUpstream(const char *upstream_name, const Prefix& gw_addr_v4 , const Prefix& gw_addr_v6)
{
int index;
- ipacm_cmd_q_data evt;
- ipacm_event_data_addr *evt_data_addr;
RET result = SUCCESS;
/* if interface name is NULL, default route is removed */
@@ -534,7 +532,7 @@
return FAIL_INPUT_CHECK;
}
- IPACMDBG_H("SET_DATA_QUOTA %s %lld", quota.interface_name, mb);
+ IPACMDBG_H("SET_DATA_QUOTA %s %lu", quota.interface_name, mb);
if (ioctl(fd, WAN_IOC_SET_DATA_QUOTA, "a) < 0) {
IPACMERR("IOCTL WAN_IOCTL_SET_DATA_QUOTA call failed: %s", strerror(errno));
@@ -575,7 +573,7 @@
offload_stats.tx = stats.tx_bytes;
offload_stats.rx = stats.rx_bytes;
- IPACMDBG_H("send getStats tx:%lld rx:%lld \n", offload_stats.tx, offload_stats.rx);
+ IPACMDBG_H("send getStats tx:%lu rx:%lu \n", offload_stats.tx, offload_stats.rx);
close(fd);
return SUCCESS;
}
@@ -631,7 +629,7 @@
}
if(strnlen(if_name, sizeof(if_name)) >= sizeof(ifr.ifr_name)) {
- IPACMERR("interface name overflows: len %d\n", strnlen(if_name, sizeof(if_name)));
+ IPACMERR("interface name overflows: len %zu\n", strnlen(if_name, sizeof(if_name)));
close(fd);
return IPACM_FAILURE;
}
diff --git a/ipacm/src/IPACM_Wan.cpp b/ipacm/src/IPACM_Wan.cpp
index e0391cd..79f88cd 100644
--- a/ipacm/src/IPACM_Wan.cpp
+++ b/ipacm/src/IPACM_Wan.cpp
@@ -79,8 +79,8 @@
uint32_t IPACM_Wan::backhaul_ipv6_prefix[2];
#ifdef FEATURE_IPA_ANDROID
-int IPACM_Wan::ipa_if_num_tether_v4_total = 0;
-int IPACM_Wan::ipa_if_num_tether_v6_total = 0;
+uint32_t IPACM_Wan::ipa_if_num_tether_v4_total = 0;
+uint32_t IPACM_Wan::ipa_if_num_tether_v6_total = 0;
int IPACM_Wan::ipa_if_num_tether_v4[IPA_MAX_IFACE_ENTRIES];
int IPACM_Wan::ipa_if_num_tether_v6[IPA_MAX_IFACE_ENTRIES];
@@ -96,6 +96,7 @@
wan_route_rule_v6_hdl = NULL;
wan_route_rule_v6_hdl_a5 = NULL;
wan_client = NULL;
+ mac_addr = NULL;
if(iface_query != NULL)
{
@@ -196,7 +197,7 @@
/* handle new_address event */
int IPACM_Wan::handle_addr_evt(ipacm_event_data_addr *data)
{
- struct ipa_ioc_add_rt_rule *rt_rule;
+ struct ipa_ioc_add_rt_rule *rt_rule = NULL;
struct ipa_rt_rule_add *rt_rule_entry;
struct ipa_ioc_add_flt_rule *flt_rule;
struct ipa_flt_rule_add flt_rule_entry;
@@ -560,7 +561,7 @@
if ((ipa_interface_index == ipa_if_num) && (m_is_sta_mode == Q6_WAN))
{
is_xlat = true;
- IPACMDBG_H("WAN-LTE (%s) link up, iface: %d is_xlat: \n",
+ IPACMDBG_H("WAN-LTE (%s) link up, iface: %d is_xlat: %d\n",
IPACM_Iface::ipacmcfg->iface_table[ipa_interface_index].iface_name,data->if_index, is_xlat);
}
break;
@@ -1093,7 +1094,7 @@
}
else if (data->iptype == IPA_IP_v6)
{
- for (int num_ipv6_addr = 0; num_ipv6_addr < num_dft_rt_v6; num_ipv6_addr++)
+ for (uint32_t num_ipv6_addr = 0; num_ipv6_addr < num_dft_rt_v6; num_ipv6_addr++)
{
if ((ipv6_addr[num_ipv6_addr][0] == data->ipv6_addr[0]) &&
(ipv6_addr[num_ipv6_addr][1] == data->ipv6_addr[1]) &&
@@ -1268,11 +1269,9 @@
/* add default WAN route */
struct ipa_ioc_add_rt_rule *rt_rule = NULL;
struct ipa_rt_rule_add *rt_rule_entry;
- struct ipa_ioc_get_hdr sRetHeader;
- uint32_t cnt, tx_index = 0;
+ uint32_t tx_index = 0;
const int NUM = 1;
ipacm_cmd_q_data evt_data;
- struct ipa_ioc_copy_hdr sCopyHeader; /* checking if partial header*/
struct ipa_ioc_get_hdr hdr;
IPACMDBG_H("ip-type:%d\n", iptype);
@@ -1362,7 +1361,7 @@
IPACMDBG_H("header length: %d, paritial: %d\n", sCopyHeader.hdr_len, sCopyHeader.is_partial);
if(sCopyHeader.is_partial)
{
- IPACMDBG_H("Not setup default WAN routing rules cuz the header is not complete\n");
+ IPACMDBG_H("Not setup default WAN routing rules cuz the header is not complete\n");
if(iptype==IPA_IP_v4)
{
header_partial_default_wan_v4 = true;
@@ -1598,7 +1597,7 @@
IPACM_Wan::xlat_mux_id = ext_prop->ext[0].mux_id;
wanup_data->xlat_mux_id = IPACM_Wan::xlat_mux_id;
IPACMDBG_H("Set xlat configuraiton with below information:\n");
- IPACMDBG_H("xlat_enabled: xlat_mux_id: %d \n",
+ IPACMDBG_H("xlat_enabled: %d xlat_mux_id: %d \n",
is_xlat, xlat_mux_id);
}
else
@@ -3159,10 +3158,6 @@
{
int res = IPACM_SUCCESS;
- char *dev_wlan0="wlan0";
- char *dev_wlan1="wlan1";
- char *dev_ecm0="ecm0";
-
/* ADD corresponding ipa_rm_resource_name of RX-endpoint before adding all IPV4V6 FT-rules */
IPACMDBG_H(" dun add producer dependency from %s with registered rx-prop\n", dev_name);
@@ -3395,7 +3390,8 @@
int IPACM_Wan::query_ext_prop()
{
- int fd, ret = IPACM_SUCCESS, cnt;
+ int fd, ret = IPACM_SUCCESS;
+ uint32_t cnt;
if (iface_query->num_ext_props > 0)
{
@@ -4353,7 +4349,7 @@
int IPACM_Wan::handle_down_evt()
{
int res = IPACM_SUCCESS;
- int i;
+ uint32_t i;
IPACMDBG_H(" wan handle_down_evt \n");
@@ -4581,7 +4577,7 @@
int IPACM_Wan::handle_down_evt_ex()
{
int res = IPACM_SUCCESS;
- int i, tether_total;
+ uint32_t i, tether_total;
int ipa_if_num_tether_tmp[IPA_MAX_IFACE_ENTRIES];
IPACMDBG_H(" wan handle_down_evt \n");
@@ -5284,7 +5280,7 @@
pHeaderDescriptor->hdr[0].name[IPA_RESOURCE_NAME_MAX-1] = '\0';
if (strlcat(pHeaderDescriptor->hdr[0].name, IPA_WAN_PARTIAL_HDR_NAME_v4, sizeof(pHeaderDescriptor->hdr[0].name)) > IPA_RESOURCE_NAME_MAX)
{
- IPACMERR(" header name construction failed exceed length (%d)\n", strlen(pHeaderDescriptor->hdr[0].name));
+ IPACMERR(" header name construction failed exceed length (%zu)\n", strlen(pHeaderDescriptor->hdr[0].name));
res = IPACM_FAILURE;
goto fail;
}
@@ -5292,7 +5288,7 @@
snprintf(index,sizeof(index), "%d", header_name_count);
if (strlcat(pHeaderDescriptor->hdr[0].name, index, sizeof(pHeaderDescriptor->hdr[0].name)) > IPA_RESOURCE_NAME_MAX)
{
- IPACMERR(" header name construction failed exceed length (%d)\n", strlen(pHeaderDescriptor->hdr[0].name));
+ IPACMERR(" header name construction failed exceed length (%zu)\n", strlen(pHeaderDescriptor->hdr[0].name));
res = IPACM_FAILURE;
goto fail;
}
@@ -5381,14 +5377,14 @@
pHeaderDescriptor->hdr[0].name[IPA_RESOURCE_NAME_MAX-1] = '\0';
if (strlcat(pHeaderDescriptor->hdr[0].name, IPA_WAN_PARTIAL_HDR_NAME_v6, sizeof(pHeaderDescriptor->hdr[0].name)) > IPA_RESOURCE_NAME_MAX)
{
- IPACMERR(" header name construction failed exceed length (%d)\n", strlen(pHeaderDescriptor->hdr[0].name));
+ IPACMERR(" header name construction failed exceed length (%zu)\n", strlen(pHeaderDescriptor->hdr[0].name));
res = IPACM_FAILURE;
goto fail;
}
snprintf(index,sizeof(index), "%d", header_name_count);
if (strlcat(pHeaderDescriptor->hdr[0].name, index, sizeof(pHeaderDescriptor->hdr[0].name)) > IPA_RESOURCE_NAME_MAX)
{
- IPACMERR(" header name construction failed exceed length (%d)\n", strlen(pHeaderDescriptor->hdr[0].name));
+ IPACMERR(" header name construction failed exceed length (%zu)\n", strlen(pHeaderDescriptor->hdr[0].name));
res = IPACM_FAILURE;
goto fail;
}
@@ -5504,7 +5500,7 @@
else
{
if ((data->ipv6_addr[0] != 0) || (data->ipv6_addr[1] != 0) ||
- (data->ipv6_addr[2] != 0) || (data->ipv6_addr[3] || 0)) /* check if all 0 not valid ipv6 address */
+ (data->ipv6_addr[2] != 0) || (data->ipv6_addr[3] != 0)) /* check if all 0 not valid ipv6 address */
{
IPACMDBG_H("ipv6 address: 0x%x:%x:%x:%x\n", data->ipv6_addr[0], data->ipv6_addr[1], data->ipv6_addr[2], data->ipv6_addr[3]);
if(get_client_memptr(wan_client, clnt_indx)->ipv6_set < IPV6_NUM_ADDR)
@@ -5535,6 +5531,11 @@
return IPACM_FAILURE; /* not setup the RT rules*/
}
}
+ else
+ {
+ IPACMDBG_H("Invalid IPV6 address\n");
+ return IPACM_FAILURE;
+ }
}
return IPACM_SUCCESS;
@@ -5879,7 +5880,7 @@
int size = sizeof(struct ipa_ioc_mdfy_rt_rule) +
NUM_RULES * sizeof(struct ipa_rt_rule_mdfy);
- IPACMDBG("\n");
+ IPACMDBG("isSCCMode: %d\n",isSCCMode);
if (tx_prop == NULL || is_default_gateway == false)
{
@@ -6056,7 +6057,7 @@
{
FILE *fp = NULL;
- for (int apn_index =0; apn_index < data->apn_data_stats_list_len; apn_index++)
+ for (uint32_t apn_index =0; apn_index < data->apn_data_stats_list_len; apn_index++)
{
if(data->apn_data_stats_list[apn_index].mux_id == ext_prop->ext[0].mux_id)
{
@@ -6175,7 +6176,7 @@
if (strlcat(ipv6_hdr->name, IPA_DUMMY_ETH_HDR_NAME_v6, sizeof(ipv6_hdr->name)) > IPA_RESOURCE_NAME_MAX)
{
- IPACMERR(" header name construction failed exceed length (%d)\n", strlen(ipv6_hdr->name));
+ IPACMERR(" header name construction failed exceed length (%zu)\n", strlen(ipv6_hdr->name));
return IPACM_FAILURE;
}
diff --git a/ipacm/src/IPACM_Wlan.cpp b/ipacm/src/IPACM_Wlan.cpp
index a36f0f9..a594fe5 100644
--- a/ipacm/src/IPACM_Wlan.cpp
+++ b/ipacm/src/IPACM_Wlan.cpp
@@ -147,7 +147,6 @@
int ipa_interface_index;
int wlan_index;
ipacm_ext_prop* ext_prop;
- ipacm_event_iface_up* data_wan;
ipacm_event_iface_up_tehter* data_wan_tether;
switch (event)
@@ -605,7 +604,7 @@
case IPA_HANDLE_WAN_UP:
IPACMDBG_H("Received IPA_HANDLE_WAN_UP event\n");
- data_wan = (ipacm_event_iface_up*)param;
+ ipacm_event_iface_up* data_wan = (ipacm_event_iface_up*)param;
if(data_wan == NULL)
{
IPACMERR("No event data is found.\n");
@@ -1036,14 +1035,14 @@
if (strlcat(pHeaderDescriptor->hdr[0].name, IPA_WLAN_PARTIAL_HDR_NAME_v4, sizeof(pHeaderDescriptor->hdr[0].name)) > IPA_RESOURCE_NAME_MAX)
{
- IPACMERR(" header name construction failed exceed length (%d)\n", strlen(pHeaderDescriptor->hdr[0].name));
+ IPACMERR(" header name construction failed exceed length (%zu)\n", strlen(pHeaderDescriptor->hdr[0].name));
res = IPACM_FAILURE;
goto fail;
}
snprintf(index,sizeof(index), "%d", header_name_count);
if (strlcat(pHeaderDescriptor->hdr[0].name, index, sizeof(pHeaderDescriptor->hdr[0].name)) > IPA_RESOURCE_NAME_MAX)
{
- IPACMERR(" header name construction failed exceed length (%d)\n", strlen(pHeaderDescriptor->hdr[0].name));
+ IPACMERR(" header name construction failed exceed length (%zu)\n", strlen(pHeaderDescriptor->hdr[0].name));
res = IPACM_FAILURE;
goto fail;
}
@@ -1150,7 +1149,7 @@
pHeaderDescriptor->hdr[0].name[IPA_RESOURCE_NAME_MAX-1] = '\0';
if (strlcat(pHeaderDescriptor->hdr[0].name, IPA_WLAN_PARTIAL_HDR_NAME_v6, sizeof(pHeaderDescriptor->hdr[0].name)) > IPA_RESOURCE_NAME_MAX)
{
- IPACMERR(" header name construction failed exceed length (%d)\n", strlen(pHeaderDescriptor->hdr[0].name));
+ IPACMERR(" header name construction failed exceed length (%zu)\n", strlen(pHeaderDescriptor->hdr[0].name));
res = IPACM_FAILURE;
goto fail;
}
@@ -1158,7 +1157,7 @@
snprintf(index,sizeof(index), "%d", header_name_count);
if (strlcat(pHeaderDescriptor->hdr[0].name, index, sizeof(pHeaderDescriptor->hdr[0].name)) > IPA_RESOURCE_NAME_MAX)
{
- IPACMERR(" header name construction failed exceed length (%d)\n", strlen(pHeaderDescriptor->hdr[0].name));
+ IPACMERR(" header name construction failed exceed length (%zu)\n", strlen(pHeaderDescriptor->hdr[0].name));
res = IPACM_FAILURE;
goto fail;
}
@@ -1273,7 +1272,7 @@
else
{
if ((data->ipv6_addr[0] != 0) || (data->ipv6_addr[1] != 0) ||
- (data->ipv6_addr[2] != 0) || (data->ipv6_addr[3] || 0)) /* check if all 0 not valid ipv6 address */
+ (data->ipv6_addr[2] != 0) || (data->ipv6_addr[3] != 0)) /* check if all 0 not valid ipv6 address */
{
IPACMDBG_H("ipv6 address: 0x%x:%x:%x:%x\n", data->ipv6_addr[0], data->ipv6_addr[1], data->ipv6_addr[2], data->ipv6_addr[3]);
if( (data->ipv6_addr[0] & ipv6_link_local_prefix_mask) != (ipv6_link_local_prefix & ipv6_link_local_prefix_mask) &&
@@ -1313,6 +1312,11 @@
return IPACM_FAILURE; /* not setup the RT rules*/
}
}
+ else
+ {
+ IPACMDBG_H("IPV6 address is invalid\n");
+ return IPACM_FAILURE;
+ }
}
return IPACM_SUCCESS;
@@ -1705,7 +1709,9 @@
/*handle wlan iface down event*/
int IPACM_Wlan::handle_down_evt()
{
- int res = IPACM_SUCCESS, i, num_private_subnet_fl_rule;
+ int res = IPACM_SUCCESS, num_private_subnet_fl_rule;
+ uint32_t i;
+ num_private_subnet_fl_rule = 0;
IPACMDBG_H("WLAN ip-type: %d \n", ip_type);
/* no iface address up, directly close iface*/
@@ -1977,7 +1983,8 @@
/*handle reset wifi-client rt-rules */
int IPACM_Wlan::handle_wlan_client_reset_rt(ipa_ip_type iptype)
{
- int i, res = IPACM_SUCCESS;
+ uint32_t i;
+ int res = IPACM_SUCCESS;
/* clean wifi-client routing rules */
IPACMDBG_H("left %d wifi clients to reset ip-type(%d) rules \n ", num_wifi_client, iptype);
@@ -2214,7 +2221,7 @@
void IPACM_Wlan::eth_bridge_handle_wlan_mode_switch()
{
- int i;
+ uint32_t i;
/* ====== post events to mimic WLAN interface goes down/up when AP mode is changing ====== */
diff --git a/ipanat/src/Android.mk b/ipanat/src/Android.mk
index 6622e5e..4afc414 100644
--- a/ipanat/src/Android.mk
+++ b/ipanat/src/Android.mk
@@ -17,7 +17,8 @@
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
-LOCAL_CFLAGS := -DDEBUG
+LOCAL_CFLAGS := -DDEBUG -Wall -Werror
+LOCAL_CFLAGS += -DFEATURE_IPA_ANDROID
LOCAL_MODULE := libipanat
LOCAL_MODULE_TAGS := optional
LOCAL_PRELINK_MODULE := false
diff --git a/ipanat/src/ipa_nat_drvi.c b/ipanat/src/ipa_nat_drvi.c
index d309bb3..9b06028 100644
--- a/ipanat/src/ipa_nat_drvi.c
+++ b/ipanat/src/ipa_nat_drvi.c
@@ -34,6 +34,7 @@
#include <glib.h>
#define strlcpy g_strlcpy
#else
+#ifndef FEATURE_IPA_ANDROID
static size_t strlcpy(char * dst, const char * src, size_t size) {
if (size < 1)
return 0;
@@ -42,6 +43,7 @@
return strlen(dst);
}
#endif
+#endif
struct ipa_nat_cache ipv4_nat_cache;
pthread_mutex_t nat_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -762,9 +764,9 @@
/* Calclate the memory size for both table and index table entries */
mem->size = (IPA_NAT_TABLE_ENTRY_SIZE * total_entries);
- IPADBG("Nat Table size: %d\n", mem->size);
+ IPADBG("Nat Table size: %zu\n", mem->size);
mem->size += (IPA_NAT_INDEX_TABLE_ENTRY_SIZE * total_entries);
- IPADBG("Nat Base and Index Table size: %d\n", mem->size);
+ IPADBG("Nat Base and Index Table size: %zu\n", mem->size);
if (!ipv4_nat_cache.ipa_fd) {
fd = open(IPA_DEV_NAME, O_RDONLY);