Merge 062ad1c13776b8ff37502c74882bb99b22a185d6 on remote branch
Change-Id: Ife260e1947d35238b6d525fbbb18e6b451252ed0
diff --git a/hal/Android.mk b/hal/Android.mk
index 67e9b07..6574682 100644
--- a/hal/Android.mk
+++ b/hal/Android.mk
@@ -1,29 +1,29 @@
-# LOCAL_PATH := $(call my-dir)
-#
-# include $(CLEAR_VARS)
-# LOCAL_ARM_MODE := arm
-# LOCAL_SRC_FILES := src/CtUpdateAmbassador.cpp \
-# src/HAL.cpp \
-# src/IpaEventRelay.cpp \
-# src/LocalLogBuffer.cpp \
-# src/OffloadStatistics.cpp \
-# src/PrefixParser.cpp
-# LOCAL_C_INCLUDES := $(LOCAL_PATH)/inc
-# LOCAL_MODULE := liboffloadhal
-# LOCAL_CPP_FLAGS := -Wall -Werror
-# LOCAL_SHARED_LIBRARIES := libhwbinder \
-# libhidlbase \
-# libhidltransport \
-# liblog \
-# libcutils \
-# libdl \
-# libbase \
-# libutils \
-# libhardware_legacy \
-# libhardware \
-# android.hardware.tetheroffload.config@1.0 \
-# android.hardware.tetheroffload.control@1.0
-# LOCAL_VENDOR_MODULE := true
-# LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
-# LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
-# include $(BUILD_SHARED_LIBRARY)
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_ARM_MODE := arm
+LOCAL_SRC_FILES := src/CtUpdateAmbassador.cpp \
+ src/HAL.cpp \
+ src/IpaEventRelay.cpp \
+ src/LocalLogBuffer.cpp \
+ src/OffloadStatistics.cpp \
+ src/PrefixParser.cpp
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/inc
+LOCAL_MODULE := liboffloadhal
+#LOCAL_CPP_FLAGS := -Wall -Werror
+LOCAL_SHARED_LIBRARIES := libhwbinder \
+ libhidlbase \
+ libhidltransport \
+ liblog \
+ libcutils \
+ libdl \
+ libbase \
+ libutils \
+ libhardware_legacy \
+ libhardware \
+ android.hardware.tetheroffload.config@1.0 \
+ android.hardware.tetheroffload.control@1.0
+LOCAL_VENDOR_MODULE := true
+LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
+LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
+include $(BUILD_SHARED_LIBRARY)
diff --git a/hal/src/HAL.cpp b/hal/src/HAL.cpp
index 18249a5..0dd79e2 100644
--- a/hal/src/HAL.cpp
+++ b/hal/src/HAL.cpp
@@ -41,6 +41,7 @@
/* External Includes */
#include <cutils/log.h>
#include <string>
+#include <sys/socket.h>
#include <sys/types.h>
#include <vector>
@@ -87,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");
}
@@ -399,15 +400,26 @@
const hidl_vec<hidl_string>& prefixes,
setLocalPrefixes_cb hidl_cb
) {
+ BoolResult res;
+ PrefixParser parser;
+ vector<string> prefixesStr = convertHidlStrToStdStr(prefixes);
+
LocalLogBuffer::FunctionLog fl(__func__);
- fl.addArg("prefixes", "unused");
- #pragma unused(prefixes)
+ fl.addArg("prefixes", prefixesStr);
- /* Fake Success */
- BoolResult res = ipaResultToBoolResult(RET::SUCCESS);
+ if (!isInitialized()) {
+ BoolResult res = makeInputCheckFailure("Not initialized");
+ } else if(prefixesStr.size() < 1) {
+ res = ipaResultToBoolResult(RET::FAIL_INPUT_CHECK);
+ } else if (!parser.add(prefixesStr)) {
+ res = makeInputCheckFailure(parser.getLastErrAsStr());
+ } else {
+ res = ipaResultToBoolResult(RET::SUCCESS);
+ }
+
hidl_cb(res.success, res.errMsg);
-
fl.setResult(res.success, res.errMsg);
+ mLogs.addLog(fl);
return Void();
} /* setLocalPrefixes */
@@ -451,11 +463,17 @@
fl.addArg("upstream", upstream);
fl.addArg("limit", limit);
- RET ipaReturn = mIPA->setQuota(upstream.c_str(), limit);
- BoolResult res = ipaResultToBoolResult(ipaReturn);
- hidl_cb(res.success, res.errMsg);
+ if (!isInitialized()) {
+ BoolResult res = makeInputCheckFailure("Not initialized (setDataLimit)");
+ hidl_cb(res.success, res.errMsg);
+ fl.setResult(res.success, res.errMsg);
+ } else {
+ RET ipaReturn = mIPA->setQuota(upstream.c_str(), limit);
+ BoolResult res = ipaResultToBoolResult(ipaReturn);
+ hidl_cb(res.success, res.errMsg);
+ fl.setResult(res.success, res.errMsg);
+ }
- fl.setResult(res.success, res.errMsg);
mLogs.addLog(fl);
return Void();
} /* setDataLimit */
@@ -484,7 +502,12 @@
* qualified here. But then, how do we allow them to be empty/null as well
* while still preserving a sane API on PrefixParser?
*/
- if (!v4AddrParser.addV4(v4Addr) && !v4Addr.empty()) {
+ if (!isInitialized()) {
+ BoolResult res = makeInputCheckFailure("Not initialized (setUpstreamParameters)");
+ hidl_cb(res.success, res.errMsg);
+ fl.setResult(res.success, res.errMsg);
+ }
+ else if (!v4AddrParser.addV4(v4Addr) && !v4Addr.empty()) {
BoolResult res = makeInputCheckFailure(v4AddrParser.getLastErrAsStr());
hidl_cb(res.success, res.errMsg);
fl.setResult(res.success, res.errMsg);
@@ -496,19 +519,6 @@
BoolResult res = makeInputCheckFailure(v6GwParser.getLastErrAsStr());
hidl_cb(res.success, res.errMsg);
fl.setResult(res.success, res.errMsg);
- } else if (v6GwParser.size() > 1) {
- RET ipaReturn = mIPA->stopAllOffload();
- if (ipaReturn != RET::SUCCESS) {
- BoolResult res =
- makeInputCheckFailure("Cannot accept more than 1 IPv6 Gateway. Offload still running and may result in data path errors");
- hidl_cb(res.success, res.errMsg);
- fl.setResult(res.success, res.errMsg);
- } else {
- BoolResult res =
- makeInputCheckFailure("Cannot accept more than 1 IPv6 Gateway. In an effort to avoid any data path errors, offload has been stopped");
- hidl_cb(res.success, res.errMsg);
- fl.setResult(res.success, res.errMsg);
- }
} else {
RET ipaReturn = mIPA->setUpstream(
iface.c_str(),
@@ -535,7 +545,12 @@
PrefixParser prefixParser;
- if (!prefixParser.add(prefix)) {
+ if (!isInitialized()) {
+ BoolResult res = makeInputCheckFailure("Not initialized (setUpstreamParameters)");
+ hidl_cb(res.success, res.errMsg);
+ fl.setResult(res.success, res.errMsg);
+ }
+ else if (!prefixParser.add(prefix)) {
BoolResult res = makeInputCheckFailure(prefixParser.getLastErrAsStr());
hidl_cb(res.success, res.errMsg);
fl.setResult(res.success, res.errMsg);
@@ -564,7 +579,12 @@
PrefixParser prefixParser;
- if (!prefixParser.add(prefix)) {
+ if (!isInitialized()) {
+ BoolResult res = makeInputCheckFailure("Not initialized (setUpstreamParameters)");
+ hidl_cb(res.success, res.errMsg);
+ fl.setResult(res.success, res.errMsg);
+ }
+ else if (!prefixParser.add(prefix)) {
BoolResult res = makeInputCheckFailure(prefixParser.getLastErrAsStr());
hidl_cb(res.success, res.errMsg);
fl.setResult(res.success, res.errMsg);
diff --git a/hal/src/PrefixParser.cpp b/hal/src/PrefixParser.cpp
index 60aae08..d38bec0 100644
--- a/hal/src/PrefixParser.cpp
+++ b/hal/src/PrefixParser.cpp
@@ -118,6 +118,9 @@
/* ------------------------------ PRIVATE ----------------------------------- */
bool PrefixParser::add(vector<string> in, IP_FAM famHint) {
+ if (in.size() == 0)
+ return false;
+
for (size_t i = 0; i < in.size(); i++) {
if (!add(in[i], famHint))
return false;
@@ -126,6 +129,11 @@
} /* add */
bool PrefixParser::add(string in, IP_FAM famHint) {
+ if (in.length() == 0) {
+ mLastErr = "Failed to parse string, length = 0...";
+ return false;
+ }
+
if (famHint == IP_FAM::INVALID)
famHint = guessIPFamily(in);
@@ -138,8 +146,10 @@
}
int mask = parseSubnetMask(subnet, famHint);
- if (!isMaskValid(mask, famHint))
+ if (!isMaskValid(mask, famHint)) {
+ mLastErr = "Invalid mask";
return false;
+ }
Prefix pre = makeBlankPrefix(famHint);
diff --git a/ipacm/inc/IPACM_Defs.h b/ipacm/inc/IPACM_Defs.h
index 39c7298..fe252c9 100644
--- a/ipacm/inc/IPACM_Defs.h
+++ b/ipacm/inc/IPACM_Defs.h
@@ -187,14 +187,14 @@
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 */
IPA_ADD_L2TP_VLAN_MAPPING, /* ipa_ioc_l2tp_vlan_mapping_info */
IPA_DEL_L2TP_VLAN_MAPPING, /* ipa_ioc_l2tp_vlan_mapping_info */
IPA_HANDLE_VLAN_CLIENT_INFO, /* ipacm_event_data_all */
IPA_HANDLE_VLAN_IFACE_INFO, /* ipacm_event_data_all */
+#endif
IPACM_EVENT_MAX
} ipa_cm_event_id;
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 cb63e34..0f50ae7 100644
--- a/ipacm/inc/IPACM_Lan.h
+++ b/ipacm/inc/IPACM_Lan.h
@@ -169,6 +169,7 @@
/* delete header processing context */
int eth_bridge_del_hdr_proc_ctx(uint32_t hdr_proc_ctx_hdl);
+#ifdef FEATURE_L2TP
/* add l2tp rt rule for l2tp client */
int add_l2tp_rt_rule(ipa_ip_type iptype, uint8_t *dst_mac, ipa_hdr_l2_type peer_l2_hdr_type,
uint32_t l2tp_session_id, uint32_t vlan_id, uint8_t *vlan_client_mac, uint32_t *vlan_iface_ipv6_addr,
@@ -198,6 +199,7 @@
/* delete l2tp flt rule on non l2tp interface */
int del_l2tp_flt_rule(ipa_ip_type iptype, uint32_t first_pass_flt_rule_hdl, uint32_t second_pass_flt_rule_hdl);
+#endif
protected:
@@ -209,15 +211,16 @@
void eth_bridge_post_event(ipa_cm_event_id evt, ipa_ip_type iptype, uint8_t *mac,
uint32_t *ipv6_addr, char *iface_name);
+#ifdef FEATURE_L2TP
/* check if the event is associated with vlan interface */
bool is_vlan_event(char *event_iface_name);
-
/* check if the event is associated with l2tp interface */
bool is_l2tp_event(char *event_iface_name);
/* check if the IPv6 address is unique local address */
bool is_unique_local_ipv6_addr(uint32_t *ipv6_addr);
+#endif
virtual int add_dummy_private_subnet_flt_rule(ipa_ip_type iptype);
int handle_private_subnet_android(ipa_ip_type iptype);
@@ -294,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_LanToLan.h b/ipacm/inc/IPACM_LanToLan.h
index b055cdd..e517e97 100644
--- a/ipacm/inc/IPACM_LanToLan.h
+++ b/ipacm/inc/IPACM_LanToLan.h
@@ -160,7 +160,7 @@
void increment_ref_cnt_peer_l2_hdr_type(ipa_hdr_l2_type peer_l2_type);
void decrement_ref_cnt_peer_l2_hdr_type(ipa_hdr_l2_type peer_l2_type);
-
+#ifdef FEATURE_L2TP
void switch_to_l2tp_iface();
bool set_l2tp_iface(char *vlan_iface_name);
@@ -170,7 +170,7 @@
void handle_l2tp_enable();
void handle_l2tp_disable();
-
+#endif
private:
IPACM_Lan *m_p_iface;
@@ -223,7 +223,9 @@
static IPACM_LanToLan* p_instance;
static IPACM_LanToLan* get_instance();
+#ifdef FEATURE_L2TP
bool has_l2tp_iface();
+#endif
private:
@@ -251,6 +253,7 @@
void handle_wlan_scc_mcc_switch(ipacm_event_eth_bridge *data);
+#ifdef FEATURE_L2TP
void handle_add_vlan_iface(ipa_ioc_vlan_iface_info *data);
void handle_del_vlan_iface(ipa_ioc_vlan_iface_info *data);
@@ -262,6 +265,7 @@
void handle_vlan_client_info(ipacm_event_data_all *data);
void handle_vlan_iface_info(ipacm_event_data_all *data);
+#endif
void handle_new_iface_up(IPACM_LanToLan_Iface *new_iface, IPACM_LanToLan_Iface *exist_iface);
diff --git a/ipacm/inc/IPACM_OffloadManager.h b/ipacm/inc/IPACM_OffloadManager.h
index 9d94253..72070dd 100644
--- a/ipacm/inc/IPACM_OffloadManager.h
+++ b/ipacm/inc/IPACM_OffloadManager.h
@@ -29,7 +29,7 @@
#ifndef _IPACM_OFFLOAD_MANAGER_H_
#define _IPACM_OFFLOAD_MANAGER_H_
-
+#include <list>
#include <stdint.h>
#include <IOffloadManager.h>
#include "IPACM_Defs.h"
@@ -96,6 +96,8 @@
private:
+ std::list<const char *> valid_ifaces;
+
bool upstream_v4_up;
bool upstream_v6_up;
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..01715f8 100644
--- a/ipacm/src/Android.mk
+++ b/ipacm/src/Android.mk
@@ -1,7 +1,8 @@
BOARD_PLATFORM_LIST := test
BOARD_IPAv3_LIST := msm8998
BOARD_IPAv3_LIST += sdm845
-ifeq ($(call is-board-platform-in-list,$(BOARD_PLATFORM_LIST)),true)
+BOARD_IPAv3_LIST += sdm670
+ifneq ($(call is-board-platform-in-list,$(BOARD_PLATFORM_LIST)),true)
ifneq (,$(filter $(QCOM_BOARD_PLATFORMS),$(TARGET_BOARD_PLATFORM)))
ifneq (, $(filter aarch64 arm arm64, $(TARGET_ARCH)))
@@ -28,7 +29,7 @@
LOCAL_CFLAGS := -v
LOCAL_CFLAGS += -DFEATURE_IPA_ANDROID
-LOCAL_CFLAGS += -DFEATURE_IPACM_HAL
+LOCAL_CFLAGS += -DFEATURE_IPACM_HAL -Wall -Werror -Wno-error=macro-redefined
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_Config.cpp b/ipacm/src/IPACM_Config.cpp
index 64534ee..d3fa58d 100644
--- a/ipacm/src/IPACM_Config.cpp
+++ b/ipacm/src/IPACM_Config.cpp
@@ -107,12 +107,14 @@
__stringify(IPA_ETH_BRIDGE_CLIENT_DEL), /* ipacm_event_eth_bridge*/
__stringify(IPA_ETH_BRIDGE_WLAN_SCC_MCC_SWITCH), /* ipacm_event_eth_bridge*/
__stringify(IPA_LAN_DELETE_SELF), /* ipacm_event_data_fid */
+#ifdef FEATURE_L2TP
__stringify(IPA_ADD_VLAN_IFACE), /* ipa_ioc_vlan_iface_info */
__stringify(IPA_DEL_VLAN_IFACE), /* ipa_ioc_vlan_iface_info */
__stringify(IPA_ADD_L2TP_VLAN_MAPPING), /* ipa_ioc_l2tp_vlan_mapping_info */
__stringify(IPA_DEL_L2TP_VLAN_MAPPING), /* ipa_ioc_l2tp_vlan_mapping_info */
__stringify(IPA_VLAN_CLIENT_INFO), /* ipacm_event_data_all */
__stringify(IPA_VLAN_IFACE_INFO), /* ipacm_event_data_all */
+#endif
__stringify(IPACM_EVENT_MAX),
};
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..411fe90 100644
--- a/ipacm/src/IPACM_Filtering.cpp
+++ b/ipacm/src/IPACM_Filtering.cpp
@@ -142,6 +142,9 @@
return false;
}
IPACMDBG("Added Filtering rule %p\n", ruleTable);
+#else
+ if (ruleTable)
+ IPACMERR("Not support adding Filtering rule %p\n", ruleTable);
#endif
return true;
}
@@ -264,6 +267,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 +296,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 b39c678..7acb668 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)
@@ -330,6 +330,21 @@
}
}
#endif
+
+#ifdef FEATURE_ETH_BRIDGE_LE
+ if(rx_prop != NULL)
+ {
+ free(rx_prop);
+ }
+ if(tx_prop != NULL)
+ {
+ free(tx_prop);
+ }
+ if(iface_query != NULL)
+ {
+ free(iface_query);
+ }
+#endif
delete this;
}
break;
@@ -740,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");
@@ -856,8 +871,12 @@
}
}
- if (ipa_interface_index == ipa_if_num || is_vlan_event(data->iface_name)
- || (is_l2tp_event(data->iface_name) && ipa_if_cate == ODU_IF))
+ if (ipa_interface_index == ipa_if_num
+#ifdef FEATURE_L2TP
+ || is_vlan_event(data->iface_name)
+ || (is_l2tp_event(data->iface_name) && ipa_if_cate == ODU_IF)
+#endif
+ )
{
IPACMDBG_H("ETH iface got client \n");
if(ipa_interface_index == ipa_if_num)
@@ -916,7 +935,10 @@
}
if (ipa_interface_index == ipa_if_num
- || (is_l2tp_event(data->iface_name) && ipa_if_cate == ODU_IF))
+#ifdef FEATURE_L2TP
+ || (is_l2tp_event(data->iface_name) && ipa_if_cate == ODU_IF)
+#endif
+ )
{
if(ipa_interface_index == ipa_if_num)
{
@@ -1016,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++)
@@ -1031,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");
@@ -1055,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];
@@ -1112,6 +1139,12 @@
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 ((int)flt_index.source_pipe_index == -1)
+ {
+ IPACMERR("Error Query src pipe idx, aborting...\n");
+ close(fd);
+ return IPACM_FAILURE;
+ }
flt_index.install_status = IPA_QMI_RESULT_SUCCESS_V01;
#ifndef FEATURE_IPA_V3
flt_index.filter_index_list_len = 0;
@@ -1121,6 +1154,12 @@
#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 ((int)flt_index.embedded_pipe_index == -1)
+ {
+ IPACMERR("Error Query emb pipe idx, aborting...\n");
+ close(fd);
+ return IPACM_FAILURE;
+ }
flt_index.retain_header_valid = 1;
flt_index.retain_header = 0;
flt_index.embedded_call_mux_id_valid = 1;
@@ -1155,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;
@@ -1643,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;
@@ -1807,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;
}
@@ -1815,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;
}
@@ -1907,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;
}
@@ -2027,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) &&
@@ -2065,6 +2105,11 @@
return IPACM_FAILURE; /* not setup the RT rules*/
}
}
+ else
+ {
+ IPACMDBG_H("Invalid IPV6 address\n");
+ return IPACM_FAILURE;
+ }
}
return IPACM_SUCCESS;
@@ -2144,7 +2189,7 @@
continue;
}
- rt_rule_entry = &rt_rule->rules[0];
+ rt_rule_entry = &rt_rule->rules[0];
rt_rule_entry->at_rear = 0;
if (iptype == IPA_IP_v4)
@@ -2170,20 +2215,19 @@
#ifdef FEATURE_IPA_V3
rt_rule_entry->rule.hashable = false;
#endif
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- IPACMERR("Routing rule addition failed!\n");
- free(rt_rule);
- return IPACM_FAILURE;
- }
+ if (false == m_routing.AddRoutingRule(rt_rule))
+ {
+ IPACMERR("Routing rule addition failed!\n");
+ free(rt_rule);
+ return IPACM_FAILURE;
+ }
/* copy ipv4 RT hdl */
get_client_memptr(eth_client, eth_index)->eth_rt_hdl[tx_index].eth_rt_rule_hdl_v4 =
rt_rule->rules[0].rt_rule_hdl;
IPACMDBG_H("tx:%d, rt rule hdl=%x ip-type: %d\n", tx_index,
get_client_memptr(eth_client, eth_index)->eth_rt_hdl[tx_index].eth_rt_rule_hdl_v4, iptype);
-
- } else {
+ } else {
for(v6_num = get_client_memptr(eth_client, eth_index)->route_rule_set_v6;v6_num < get_client_memptr(eth_client, eth_index)->ipv6_set;v6_num++)
{
@@ -2212,12 +2256,12 @@
#ifdef FEATURE_IPA_V3
rt_rule_entry->rule.hashable = true;
#endif
- if (false == m_routing.AddRoutingRule(rt_rule))
- {
- IPACMERR("Routing rule addition failed!\n");
- free(rt_rule);
- return IPACM_FAILURE;
- }
+ if (false == m_routing.AddRoutingRule(rt_rule))
+ {
+ IPACMERR("Routing rule addition failed!\n");
+ free(rt_rule);
+ return IPACM_FAILURE;
+ }
get_client_memptr(eth_client, eth_index)->eth_rt_hdl[tx_index].eth_rt_rule_hdl_v6[v6_num] = rt_rule->rules[0].rt_rule_hdl;
IPACMDBG_H("tx:%d, rt rule hdl=%x ip-type: %d\n", tx_index,
@@ -2257,7 +2301,7 @@
}
}
- } /* end of for loop */
+ } /* end of for loop */
free(rt_rule);
@@ -2624,7 +2668,7 @@
{
IPACMDBG_H("Clean Nat Rules for ipv4:0x%x\n", get_client_memptr(eth_client, clt_indx)->v4_addr);
CtList->HandleNeighIpAddrDelEvt(get_client_memptr(eth_client, clt_indx)->v4_addr);
- }
+ }
if (delete_eth_rtrules(clt_indx, IPA_IP_v4))
{
@@ -2730,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 ");
@@ -3013,14 +3057,16 @@
IPACMDBG_H("depend Got pipe %d rm index : %d \n", rx_prop->rx[0].src_pipe, IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[rx_prop->rx[0].src_pipe]);
IPACM_Iface::ipacmcfg->DelRmDepend(IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[rx_prop->rx[0].src_pipe]);
IPACMDBG_H("Finished delete dependency \n ");
+#ifndef FEATURE_ETH_BRIDGE_LE
free(rx_prop);
+#endif
}
if (eth_client != NULL)
{
free(eth_client);
}
-
+#ifndef FEATURE_ETH_BRIDGE_LE
if (tx_prop != NULL)
{
free(tx_prop);
@@ -3029,7 +3075,7 @@
{
free(iface_query);
}
-
+#endif
is_active = false;
post_del_self_evt();
@@ -3076,6 +3122,13 @@
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 ((int)flt_index.source_pipe_index == -1)
+ {
+ IPACMERR("Error Query src pipe idx, aborting...\n");
+ close(fd);
+ return IPACM_FAILURE;
+ }
+
flt_index.install_status = IPA_QMI_RESULT_SUCCESS_V01;
#ifndef FEATURE_IPA_V3
flt_index.filter_index_list_len = prop->num_ext_props;
@@ -3085,6 +3138,13 @@
#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 ((int)flt_index.embedded_pipe_index == -1)
+ {
+ IPACMERR("Error Query emb pipe idx, aborting...\n");
+ close(fd);
+ return IPACM_FAILURE;
+ }
+
flt_index.retain_header_valid = 1;
flt_index.retain_header = 0;
flt_index.embedded_call_mux_id_valid = 1;
@@ -3370,6 +3430,12 @@
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 ((int)flt_index.source_pipe_index == -1)
+ {
+ IPACMERR("Error Query src pipe idx, aborting...\n");
+ close(fd);
+ return IPACM_FAILURE;
+ }
flt_index.install_status = IPA_QMI_RESULT_SUCCESS_V01;
#ifndef FEATURE_IPA_V3
flt_index.filter_index_list_len = 0;
@@ -3379,6 +3445,13 @@
#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 ((int)flt_index.embedded_pipe_index == -1)
+ {
+ IPACMERR("Error Query emb pipe idx, aborting...\n");
+ close(fd);
+ return IPACM_FAILURE;
+ }
+
flt_index.retain_header_valid = 1;
flt_index.retain_header = 0;
flt_index.embedded_call_mux_id_valid = 1;
@@ -3530,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);
@@ -4096,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;
@@ -4127,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;
@@ -4154,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;
@@ -4204,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;
@@ -4266,11 +4343,18 @@
{
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;
+#ifdef FEATURE_L2TP
if(evt == IPA_HANDLE_VLAN_CLIENT_INFO || evt == IPA_HANDLE_VLAN_IFACE_INFO)
{
evt_data_all = (ipacm_event_data_all*)malloc(sizeof(*evt_data_all));
@@ -4301,6 +4385,7 @@
eth_bridge_evt.evt_data = (void*)evt_data_all;
}
else
+#endif
{
evt_data_eth_bridge = (ipacm_event_eth_bridge*)malloc(sizeof(*evt_data_eth_bridge));
if(evt_data_eth_bridge == NULL)
@@ -4326,7 +4411,6 @@
}
eth_bridge_evt.evt_data = (void*)evt_data_eth_bridge;
}
-
IPACMDBG_H("Posting event %s\n",
IPACM_Iface::ipacmcfg->getEventName(evt));
IPACM_EvtDispatcher::PostEvt(ð_bridge_evt);
@@ -4377,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]);
@@ -4473,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)
{
@@ -4572,11 +4657,12 @@
int IPACM_Lan::eth_bridge_add_flt_rule(uint8_t *mac, uint32_t rt_tbl_hdl, ipa_ip_type iptype, uint32_t *flt_rule_hdl)
{
- int len, res = IPACM_SUCCESS;
+ int res = IPACM_SUCCESS;
+#ifdef FEATURE_IPA_V3
+ int len;
struct ipa_flt_rule_add flt_rule_entry;
struct ipa_ioc_add_flt_rule_after *pFilteringTable = NULL;
-#ifdef FEATURE_IPA_V3
if (rx_prop == NULL || tx_prop == NULL)
{
IPACMDBG_H("No rx or tx properties registered for iface %s\n", dev_name);
@@ -4635,6 +4721,9 @@
end:
free(pFilteringTable);
+#else
+ 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]);
+ IPACMDBG_H("Not support rt_tbl_hdl %d flt_rule_hdl %p ip-type %d\n", rt_tbl_hdl, flt_rule_hdl, iptype);
#endif
return res;
}
@@ -4670,6 +4759,7 @@
return IPACM_SUCCESS;
}
+#ifdef FEATURE_L2TP
/* check if the event is associated with vlan interface */
bool IPACM_Lan::is_vlan_event(char *event_iface_name)
{
@@ -4717,6 +4807,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;
@@ -4837,9 +4928,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)
{
@@ -4857,7 +4948,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
@@ -4909,14 +5000,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");
@@ -4969,9 +5060,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)
{
@@ -4987,9 +5078,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));
@@ -5073,6 +5164,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;
@@ -5086,11 +5178,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;
}
@@ -5160,9 +5252,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)
{
@@ -5179,9 +5271,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));
@@ -5489,6 +5581,7 @@
}
return false;
}
+#endif
/* add tcp syn flt rule */
int IPACM_Lan::add_tcp_syn_flt_rule(ipa_ip_type iptype)
diff --git a/ipacm/src/IPACM_LanToLan.cpp b/ipacm/src/IPACM_LanToLan.cpp
index 799dfee..2902268 100644
--- a/ipacm/src/IPACM_LanToLan.cpp
+++ b/ipacm/src/IPACM_LanToLan.cpp
@@ -94,15 +94,15 @@
IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_CLIENT_ADD, this);
IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_CLIENT_DEL, this);
IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_WLAN_SCC_MCC_SWITCH, this);
+#ifdef FEATURE_L2TP
IPACM_EvtDispatcher::registr(IPA_ADD_VLAN_IFACE, this);
IPACM_EvtDispatcher::registr(IPA_DEL_VLAN_IFACE, this);
IPACM_EvtDispatcher::registr(IPA_ADD_L2TP_VLAN_MAPPING, this);
IPACM_EvtDispatcher::registr(IPA_DEL_L2TP_VLAN_MAPPING, this);
IPACM_EvtDispatcher::registr(IPA_HANDLE_VLAN_CLIENT_INFO, this);
IPACM_EvtDispatcher::registr(IPA_HANDLE_VLAN_IFACE_INFO, this);
-
+#endif
m_has_l2tp_iface = false;
-
return;
}
@@ -122,6 +122,7 @@
return p_instance;
}
+#ifdef FEATURE_L2TP
bool IPACM_LanToLan::has_l2tp_iface()
{
list<IPACM_LanToLan_Iface>::iterator it;
@@ -137,12 +138,16 @@
}
return has_l2tp_iface;
}
+#endif
void IPACM_LanToLan::event_callback(ipa_cm_event_id event, void* param)
{
ipacm_event_eth_bridge *eth_bridge_data;
ipa_ioc_vlan_iface_info *vlan_iface_data;
+
+#ifdef FEATURE_L2TP
ipa_ioc_l2tp_vlan_mapping_info *l2tp_vlan_mapping_data;
+#endif
ipacm_event_data_all *vlan_data;
IPACMDBG_H("Get %s event.\n", IPACM_Iface::ipacmcfg->getEventName(event));
@@ -184,6 +189,7 @@
break;
}
+#ifdef FEATURE_L2TP
case IPA_ADD_VLAN_IFACE:
{
vlan_iface_data = (ipa_ioc_vlan_iface_info*)param;
@@ -197,14 +203,12 @@
handle_del_vlan_iface(vlan_iface_data);
break;
}
-
case IPA_ADD_L2TP_VLAN_MAPPING:
{
l2tp_vlan_mapping_data = (ipa_ioc_l2tp_vlan_mapping_info*)param;
handle_add_l2tp_vlan_mapping(l2tp_vlan_mapping_data);
break;
}
-
case IPA_DEL_L2TP_VLAN_MAPPING:
{
l2tp_vlan_mapping_data = (ipa_ioc_l2tp_vlan_mapping_info*)param;
@@ -223,6 +227,7 @@
handle_vlan_iface_info(vlan_data);
break;
}
+#endif
default:
break;
}
@@ -377,7 +382,6 @@
break;
}
}
-
if(m_has_l2tp_iface == true && has_l2tp_iface == false)
{
IPACMDBG_H("There is no l2tp iface now, delete rt rules for l2tp iface.\n");
@@ -525,6 +529,7 @@
return;
}
+#ifdef FEATURE_L2TP
void IPACM_LanToLan::handle_add_vlan_iface(ipa_ioc_vlan_iface_info *data)
{
list<vlan_iface_info>::iterator it_vlan;
@@ -588,12 +593,12 @@
}
return;
}
-
void IPACM_LanToLan::handle_add_l2tp_vlan_mapping(ipa_ioc_l2tp_vlan_mapping_info *data)
{
list<l2tp_vlan_mapping_info>::iterator it_mapping;
list<vlan_iface_info>::iterator it_vlan;
list<IPACM_LanToLan_Iface>::iterator it_iface;
+ IPACM_LanToLan_Iface *l2tp_iface;
l2tp_vlan_mapping_info new_mapping;
bool has_l2tp_iface = false;
@@ -637,6 +642,8 @@
if(it_iface->set_l2tp_iface(data->vlan_iface_name) == true)
{
has_l2tp_iface = true;
+ l2tp_iface = &(*it_iface);
+ break;
}
}
@@ -651,6 +658,7 @@
it_iface->handle_l2tp_enable();
}
}
+ l2tp_iface->switch_to_l2tp_iface();
}
return;
}
@@ -682,7 +690,6 @@
}
return;
}
-
void IPACM_LanToLan::handle_vlan_client_info(ipacm_event_data_all *data)
{
list<l2tp_vlan_mapping_info>::iterator it_mapping;
@@ -759,6 +766,7 @@
}
return;
}
+#endif
void IPACM_LanToLan::handle_cached_client_add_event(IPACM_Lan *p_iface)
{
@@ -813,6 +821,7 @@
IPACMDBG_H("Is there l2tp interface? %d\n", m_has_l2tp_iface);
+#ifdef FEATURE_L2TP
IPACMDBG_H("There are %d vlan interfaces.\n", m_vlan_iface.size());
for(it_vlan = m_vlan_iface.begin(); it_vlan != m_vlan_iface.end(); it_vlan++)
{
@@ -841,7 +850,7 @@
IPACMDBG_H("L2tp client mac: 0x%02x%02x%02x%02x%02x%02x\n", it_mapping->l2tp_client_mac[0], it_mapping->l2tp_client_mac[1],
it_mapping->l2tp_client_mac[2], it_mapping->l2tp_client_mac[3], it_mapping->l2tp_client_mac[4], it_mapping->l2tp_client_mac[5]);
}
-
+#endif
IPACMDBG_H("There are %d interfaces in total.\n", m_iface.size());
for(it = m_iface.begin(); it != m_iface.end(); it++)
{
@@ -952,6 +961,7 @@
return;
}
+#ifdef FEATURE_L2TP
void IPACM_LanToLan_Iface::add_l2tp_client_rt_rule(peer_iface_info *peer, client_info *client)
{
ipa_hdr_l2_type peer_l2_hdr_type;
@@ -985,6 +995,7 @@
}
return;
}
+#endif
void IPACM_LanToLan_Iface::add_all_inter_interface_client_flt_rule(ipa_ip_type iptype)
{
@@ -1068,18 +1079,22 @@
l2tp_second_pass_flt_rule_hdl = it_flt->l2tp_second_pass_flt_rule_hdl;
}
+#ifdef FEATURE_L2TP
if(m_is_l2tp_iface)
{
m_p_iface->add_l2tp_flt_rule(client->mac_addr, &l2tp_first_pass_flt_rule_hdl);
}
else
+#endif
{
+#ifdef FEATURE_L2TP
if(client->is_l2tp_client)
{
m_p_iface->add_l2tp_flt_rule(iptype, client->mac_addr, client->mapping_info->vlan_client_ipv6_addr,
&l2tp_first_pass_flt_rule_hdl, &l2tp_second_pass_flt_rule_hdl);
}
else
+#endif
{
rt_tbl.ip = iptype;
memcpy(rt_tbl.name, peer->rt_tbl_name_for_flt[iptype], sizeof(rt_tbl.name));
@@ -1151,6 +1166,7 @@
}
else
{
+#ifdef FEATURE_L2TP
if(client->is_l2tp_client)
{
m_p_iface->del_l2tp_flt_rule(IPA_IP_v4, it_flt->l2tp_first_pass_flt_rule_hdl[IPA_IP_v4],
@@ -1160,6 +1176,7 @@
it_flt->l2tp_first_pass_flt_rule_hdl[IPA_IP_v4], it_flt->l2tp_second_pass_flt_rule_hdl);
}
else
+#endif
{
m_p_iface->eth_bridge_del_flt_rule(it_flt->flt_rule_hdl[IPA_IP_v4], IPA_IP_v4);
IPACMDBG_H("Deleted IPv4 flt rule %d.\n", it_flt->flt_rule_hdl[IPA_IP_v4]);
@@ -1168,13 +1185,16 @@
}
if(m_is_ip_addr_assigned[IPA_IP_v6])
{
+#ifdef FEATURE_L2TP
if(m_is_l2tp_iface)
{
m_p_iface->del_l2tp_flt_rule(it_flt->l2tp_first_pass_flt_rule_hdl[IPA_IP_v6]);
IPACMDBG_H("Deleted IPv6 flt rule %d.\n", it_flt->l2tp_first_pass_flt_rule_hdl[IPA_IP_v6]);
}
else
+#endif
{
+#ifdef FEATURE_L2TP
if(client->is_l2tp_client)
{
m_p_iface->del_l2tp_flt_rule(IPA_IP_v6, it_flt->l2tp_first_pass_flt_rule_hdl[IPA_IP_v6],
@@ -1183,6 +1203,7 @@
it_flt->l2tp_first_pass_flt_rule_hdl[IPA_IP_v6], it_flt->l2tp_second_pass_flt_rule_hdl);
}
else
+#endif
{
m_p_iface->eth_bridge_del_flt_rule(it_flt->flt_rule_hdl[IPA_IP_v6], IPA_IP_v6);
IPACMDBG_H("Deleted IPv6 flt rule %d.\n", it_flt->flt_rule_hdl[IPA_IP_v6]);
@@ -1224,15 +1245,17 @@
IPACMDBG_H("IPv6 rt rule %d is deleted.\n", client->inter_iface_rt_rule_hdl[peer_l2_hdr_type].rule_hdl[IPA_IP_v6][i]);
}
client->inter_iface_rt_rule_hdl[peer_l2_hdr_type].num_hdl[IPA_IP_v6] = 0;
-
+#ifdef FEATURE_L2TP
if(IPACM_LanToLan::get_instance()->has_l2tp_iface() == true)
{
m_p_iface->del_l2tp_rt_rule(IPA_IP_v6, client->l2tp_rt_rule_hdl[peer_l2_hdr_type].num_rt_hdl[IPA_IP_v6],
client->l2tp_rt_rule_hdl[peer_l2_hdr_type].first_pass_rt_rule_hdl[IPA_IP_v6]);
}
+#endif
}
else
{
+#ifdef FEATURE_L2TP
m_p_iface->del_l2tp_rt_rule(IPA_IP_v4, client->l2tp_rt_rule_hdl[peer_l2_hdr_type].first_pass_hdr_hdl,
client->l2tp_rt_rule_hdl[peer_l2_hdr_type].first_pass_hdr_proc_ctx_hdl[IPA_IP_v4], client->l2tp_rt_rule_hdl[peer_l2_hdr_type].second_pass_hdr_hdl,
client->l2tp_rt_rule_hdl[peer_l2_hdr_type].num_rt_hdl[IPA_IP_v4], client->l2tp_rt_rule_hdl[peer_l2_hdr_type].first_pass_rt_rule_hdl[IPA_IP_v4],
@@ -1241,6 +1264,7 @@
m_p_iface->del_l2tp_rt_rule(IPA_IP_v6, 0, client->l2tp_rt_rule_hdl[peer_l2_hdr_type].first_pass_hdr_proc_ctx_hdl[IPA_IP_v6],
0, client->l2tp_rt_rule_hdl[peer_l2_hdr_type].num_rt_hdl[IPA_IP_v6], client->l2tp_rt_rule_hdl[peer_l2_hdr_type].first_pass_rt_rule_hdl[IPA_IP_v6],
NULL);
+#endif
}
}
else
@@ -1344,6 +1368,7 @@
}
else
{
+#ifdef FEATURE_L2TP
if(it->p_client->is_l2tp_client)
{
m_p_iface->del_l2tp_flt_rule(IPA_IP_v4, it->l2tp_first_pass_flt_rule_hdl[IPA_IP_v4],
@@ -1353,6 +1378,7 @@
it->l2tp_first_pass_flt_rule_hdl[IPA_IP_v4], it->l2tp_second_pass_flt_rule_hdl);
}
else
+#endif
{
m_p_iface->eth_bridge_del_flt_rule(it->flt_rule_hdl[IPA_IP_v4], IPA_IP_v4);
IPACMDBG_H("Deleted IPv4 flt rule %d.\n", it->flt_rule_hdl[IPA_IP_v4]);
@@ -1361,13 +1387,16 @@
}
if(m_is_ip_addr_assigned[IPA_IP_v6])
{
+#ifdef FEATURE_L2TP
if(m_is_l2tp_iface)
{
m_p_iface->del_l2tp_flt_rule(it->l2tp_first_pass_flt_rule_hdl[IPA_IP_v6]);
IPACMDBG_H("Deleted IPv6 flt rule %d.\n", it->l2tp_first_pass_flt_rule_hdl[IPA_IP_v6]);
}
else
+#endif
{
+#ifdef FEATURE_L2TP
if(it->p_client->is_l2tp_client)
{
m_p_iface->del_l2tp_flt_rule(IPA_IP_v6, it->l2tp_first_pass_flt_rule_hdl[IPA_IP_v6],
@@ -1376,6 +1405,7 @@
it->l2tp_first_pass_flt_rule_hdl[IPA_IP_v6], it->l2tp_second_pass_flt_rule_hdl);
}
else
+#endif
{
m_p_iface->eth_bridge_del_flt_rule(it->flt_rule_hdl[IPA_IP_v6], IPA_IP_v6);
IPACMDBG_H("Deleted IPv6 flt rule %d.\n", it->flt_rule_hdl[IPA_IP_v6]);
@@ -1399,11 +1429,13 @@
{
del_client_rt_rule(peer, &(*it));
}
+#ifdef FEATURE_L2TP
if(IPACM_LanToLan::get_instance()->has_l2tp_iface() == true)
{
m_p_iface->eth_bridge_del_hdr_proc_ctx(hdr_proc_ctx_for_l2tp);
hdr_proc_ctx_for_l2tp = 0;
}
+#endif
}
return;
@@ -1646,12 +1678,14 @@
{
IPACMDBG_H("Delete client routing rule for peer interface.\n");
del_client_rt_rule(&(*it_peer_info), &(*it_client));
+#ifdef FEATURE_L2TP
if(it_client->is_l2tp_client == false && IPACM_LanToLan::get_instance()->has_l2tp_iface() == true
&& m_client_info.size() == 1)
{
m_p_iface->eth_bridge_del_hdr_proc_ctx(hdr_proc_ctx_for_l2tp);
hdr_proc_ctx_for_l2tp = 0;
}
+#endif
flag[it_peer_info->peer->get_iface_pointer()->tx_prop->tx[0].hdr_l2_type] = true;
}
}
@@ -1768,6 +1802,7 @@
IPACMDBG_H("%d\n", it_client->inter_iface_rt_rule_hdl[j].rule_hdl[IPA_IP_v6][k]);
}
+#ifdef FEATURE_L2TP
if(it_client->is_l2tp_client)
{
IPACMDBG_H("Printing l2tp hdr info for l2tp client.\n");
@@ -1815,6 +1850,7 @@
}
}
}
+#endif
}
}
}
@@ -1930,6 +1966,7 @@
return;
}
+#ifdef FEATURE_L2TP
bool IPACM_LanToLan_Iface::set_l2tp_iface(char *vlan_iface_name)
{
IPACMDBG_H("Self iface %s, vlan iface %s\n", m_p_iface->dev_name,
@@ -1941,7 +1978,6 @@
{
IPACMDBG_H("This interface is l2tp interface.\n");
m_is_l2tp_iface = true;
- switch_to_l2tp_iface();
}
}
return m_is_l2tp_iface;
@@ -1976,7 +2012,6 @@
}
return;
}
-
void IPACM_LanToLan_Iface::handle_l2tp_enable()
{
int i;
@@ -2046,3 +2081,4 @@
}
return;
}
+#endif
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 562ff82..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,12 +243,14 @@
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;
-
+#endif
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)
{
@@ -782,7 +793,6 @@
void IPACM_Sig_Handler(int sig)
{
- int cnt;
ipacm_cmd_q_data evt_data;
printf("Received Signal: %d\n", sig);
@@ -821,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 762b56d..32606b9 100644
--- a/ipacm/src/IPACM_OffloadManager.cpp
+++ b/ipacm/src/IPACM_OffloadManager.cpp
@@ -263,6 +263,13 @@
return SUCCESS;
}
+ /* Iface is valid, add to list if not present */
+ if (std::find(valid_ifaces.begin(), valid_ifaces.end(), downstream_name) == valid_ifaces.end())
+ {
+ /* Iface is new, add it to the list */
+ valid_ifaces.push_back(downstream_name);
+ }
+
evt_data = (ipacm_event_ipahal_stream*)malloc(sizeof(ipacm_event_ipahal_stream));
if(evt_data == NULL)
{
@@ -291,10 +298,21 @@
ipacm_event_ipahal_stream *evt_data;
IPACMDBG_H("removeDownstream name(%s), ip-family(%d) \n", downstream_name, prefix.fam);
+ if(strnlen(downstream_name, sizeof(downstream_name)) == 0)
+ {
+ IPACMERR("iface length is 0.\n");
+ return FAIL_HARDWARE;
+ }
+ if (std::find(valid_ifaces.begin(), valid_ifaces.end(), downstream_name) == valid_ifaces.end())
+ {
+ IPACMERR("iface is not present in list.\n");
+ return FAIL_HARDWARE;
+ }
+
if(ipa_get_if_index(downstream_name, &index))
{
- IPACMERR("fail to get iface index.\n");
- return FAIL_HARDWARE;
+ IPACMERR("netdev(%s) already removed, ignored\n", downstream_name);
+ return SUCCESS;
}
evt_data = (ipacm_event_ipahal_stream*)malloc(sizeof(ipacm_event_ipahal_stream));
@@ -321,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 */
@@ -516,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));
@@ -557,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;
}
@@ -613,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 ff8fcee..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)
@@ -202,6 +201,20 @@
IPACMDBG_H("Received IPA_LAN_DELETE_SELF event.\n");
IPACMDBG_H("ipa_WLAN (%s):ipa_index (%d) instance close \n", IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].iface_name, ipa_if_num);
+#ifdef FEATURE_ETH_BRIDGE_LE
+ if(rx_prop != NULL)
+ {
+ free(rx_prop);
+ }
+ if(tx_prop != NULL)
+ {
+ free(tx_prop);
+ }
+ if(iface_query != NULL)
+ {
+ free(iface_query);
+ }
+#endif
delete this;
}
break;
@@ -591,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");
@@ -1022,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;
}
@@ -1136,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;
}
@@ -1144,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;
}
@@ -1259,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) &&
@@ -1299,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;
@@ -1691,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*/
@@ -1926,7 +1946,9 @@
IPACMDBG_H("dev %s add producer dependency\n", dev_name);
IPACMDBG_H("depend Got pipe %d rm index : %d \n", rx_prop->rx[0].src_pipe, IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[rx_prop->rx[0].src_pipe]);
IPACM_Iface::ipacmcfg->DelRmDepend(IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[rx_prop->rx[0].src_pipe]);
+#ifndef FEATURE_ETH_BRIDGE_LE
free(rx_prop);
+#endif
}
for (i = 0; i < num_wifi_client; i++)
@@ -1940,6 +1962,7 @@
{
free(wlan_client);
}
+#ifndef FEATURE_ETH_BRIDGE_LE
if (tx_prop != NULL)
{
free(tx_prop);
@@ -1949,6 +1972,7 @@
{
free(iface_query);
}
+#endif
is_active = false;
post_del_self_evt();
@@ -1959,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);
@@ -2196,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..157e40c 100644
--- a/ipanat/src/Android.mk
+++ b/ipanat/src/Android.mk
@@ -1,5 +1,6 @@
-BOARD_PLATFORM_LIST := test
-ifeq ($(call is-board-platform-in-list,$(BOARD_PLATFORM_LIST)),true)
+BOARD_PLATFORM_LIST := msm8916
+BOARD_PLATFORM_LIST += msm8909
+ifneq ($(call is-board-platform-in-list,$(BOARD_PLATFORM_LIST)),true)
ifneq (,$(filter $(QCOM_BOARD_PLATFORMS),$(TARGET_BOARD_PLATFORM)))
ifneq (, $(filter aarch64 arm arm64, $(TARGET_ARCH)))
@@ -17,7 +18,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);