Merge "IPACM: fix the CPE client header issue"
diff --git a/ipacm/inc/IPACM_Config.h b/ipacm/inc/IPACM_Config.h
index 5a79849..fa705e2 100644
--- a/ipacm/inc/IPACM_Config.h
+++ b/ipacm/inc/IPACM_Config.h
@@ -132,8 +132,8 @@
struct ipa_ioc_get_rt_tbl rt_tbl_wan_dl;
struct ipa_ioc_get_rt_tbl rt_tbl_lan2lan_v4, rt_tbl_lan2lan_v6;
struct ipa_ioc_get_rt_tbl rt_tbl_odu_v4, rt_tbl_odu_v6;
- struct ipa_ioc_get_rt_tbl rt_tbl_eth_bridge_usb_wlan_v4, rt_tbl_eth_bridge_wlan_wlan_v4;
- struct ipa_ioc_get_rt_tbl rt_tbl_eth_bridge_usb_wlan_v6, rt_tbl_eth_bridge_wlan_wlan_v6;
+ struct ipa_ioc_get_rt_tbl rt_tbl_eth_bridge_lan_wlan_v4, rt_tbl_eth_bridge_wlan_wlan_v4;
+ struct ipa_ioc_get_rt_tbl rt_tbl_eth_bridge_lan_wlan_v6, rt_tbl_eth_bridge_wlan_wlan_v6;
bool isMCC_Mode;
diff --git a/ipacm/inc/IPACM_Defs.h b/ipacm/inc/IPACM_Defs.h
index 37f3ff4..f90ada4 100644
--- a/ipacm/inc/IPACM_Defs.h
+++ b/ipacm/inc/IPACM_Defs.h
@@ -85,9 +85,9 @@
#define V4_ODU_ROUTE_TABLE_NAME "ODURTBLv4"
#define V6_ODU_ROUTE_TABLE_NAME "ODURTBLv6"
-#define ETH_BRIDGE_USB_WLAN_ROUTE_TABLE_NAME_V4 "ETH_BRIDGE_USB_WLAN_RTBLv4"
+#define ETH_BRIDGE_USB_WLAN_ROUTE_TABLE_NAME_V4 "ETH_BRIDGE_LAN_WLAN_RTBLv4"
#define ETH_BRIDGE_WLAN_WLAN_ROUTE_TABLE_NAME_V4 "ETH_BRIDGE_WLAN_WLAN_RTBLv4"
-#define ETH_BRIDGE_USB_WLAN_ROUTE_TABLE_NAME_V6 "ETH_BRIDGE_USB_WLAN_RTBLv6"
+#define ETH_BRIDGE_USB_WLAN_ROUTE_TABLE_NAME_V6 "ETH_BRIDGE_LAN_WLAN_RTBLv6"
#define ETH_BRIDGE_WLAN_WLAN_ROUTE_TABLE_NAME_V6 "ETH_BRIDGE_WLAN_WLAN_RTBLv6"
#define WWAN_QMI_IOCTL_DEVICE_NAME "/dev/wwan_ioctl"
@@ -100,8 +100,8 @@
#define IPA_LAN_TO_LAN_USB_HDR_NAME_V6 "Lan2Lan_USB_v6"
#define IPA_LAN_TO_LAN_WLAN_HDR_NAME_V4 "Lan2Lan_Wlan_v4"
#define IPA_LAN_TO_LAN_WLAN_HDR_NAME_V6 "Lan2Lan_Wlan_v6"
-#define IPA_LAN_TO_LAN_MAX_WLAN_CLIENT 32
-#define IPA_LAN_TO_LAN_MAX_USB_CLIENT 15
+#define IPA_LAN_TO_LAN_MAX_WLAN_CLIENT 16
+#define IPA_LAN_TO_LAN_MAX_LAN_CLIENT 16
#define TCP_FIN_SHIFT 16
#define TCP_SYN_SHIFT 17
#define TCP_RST_SHIFT 18
@@ -154,16 +154,16 @@
IPA_HANDLE_WLAN_UP, /* 24 ipacm_event_iface_up */
IPA_HANDLE_LAN_UP, /* 25 ipacm_event_iface_up */
IPA_WLAN_CLIENT_ADD_EVENT_EX, /* 26 ipacm_event_data_wlan_ex */
- IPA_HANDLE_WAN_UP_V6, /* 27 NULL */
- IPA_HANDLE_WAN_DOWN_V6, /* 28 NULL */
- IPA_LAN_CLIENT_ACTIVE, /* 29 ipacm_event_lan_client*/
- IPA_LAN_CLIENT_INACTIVE, /* 30 ipacm_event_lan_client*/
- IPA_LAN_CLIENT_DISCONNECT, /* 31 ipacm_event_lan_client*/
- IPA_LAN_CLIENT_POWER_SAVE, /* 32 ipacm_event_lan_client*/
- IPA_LAN_CLIENT_POWER_RECOVER, /* 33 ipacm_event_lan_client*/
- IPA_LAN_TO_LAN_NEW_CONNECTION, /* 34 ipacm_event_connection */
- IPA_LAN_TO_LAN_DEL_CONNECTION, /* 35 ipacm_event_connection */
- IPA_LAN_DELETE_SELF, /* 36 ipacm_event_data_fid */
+ IPA_HANDLE_WAN_UP_V6, /* 27 NULL */
+ IPA_HANDLE_WAN_DOWN_V6, /* 28 NULL */
+ IPA_LAN_CLIENT_ACTIVE, /* 29 ipacm_event_lan_client*/
+ IPA_LAN_CLIENT_INACTIVE, /* 30 ipacm_event_lan_client*/
+ IPA_LAN_CLIENT_DISCONNECT, /* 31 ipacm_event_lan_client*/
+ IPA_LAN_CLIENT_POWER_SAVE, /* 32 ipacm_event_lan_client*/
+ IPA_LAN_CLIENT_POWER_RECOVER, /* 33 ipacm_event_lan_client*/
+ IPA_LAN_TO_LAN_NEW_CONNECTION, /* 34 ipacm_event_connection */
+ IPA_LAN_TO_LAN_DEL_CONNECTION, /* 35 ipacm_event_connection */
+ IPA_LAN_DELETE_SELF, /* 36 ipacm_event_data_fid */
IPA_WLAN_LINK_DOWN_EVENT, /* 37 ipacm_event_data_mac */
IPA_USB_LINK_UP_EVENT, /* 38 ipacm_event_data_fid */
IPA_PROCESS_CT_MESSAGE_V6, /* 39 ipacm_ct_evt_data */
@@ -171,15 +171,16 @@
IPA_WAN_UPSTREAM_ROUTE_ADD_EVENT, /* 41 ipacm_event_data_fid */
IPA_WAN_UPSTREAM_ROUTE_DEL_EVENT, /* 42 ipacm_event_data_fid */
IPA_WAN_EMBMS_LINK_UP_EVENT, /* 43 ipacm_event_data_mac */
- IPA_ETH_BRIDGE_USB_CLIENT_ADD_EVENT, /* 44 ipacm_event_data_mac */
+ IPA_ETH_BRIDGE_LAN_CLIENT_ADD_EVENT, /* 44 ipacm_event_data_mac */
IPA_ETH_BRIDGE_WLAN_CLIENT_ADD_EVENT, /* 45 ipacm_event_data_mac */
- IPA_ETH_BRIDGE_USB_CLIENT_DEL_EVENT, /* 46 ipacm_event_data_mac */
+ IPA_ETH_BRIDGE_LAN_CLIENT_DEL_EVENT, /* 46 ipacm_event_data_mac */
IPA_ETH_BRIDGE_WLAN_CLIENT_DEL_EVENT, /* 47 ipacm_event_data_mac */
- IPA_ETH_BRIDGE_HDR_PROC_CTX_SET_EVENT, /* 48 ipacm_event_data_fid */
- IPA_ETH_BRIDGE_HDR_PROC_CTX_UNSET_EVENT, /* 49 ipacm_event_data_fid */
+ IPA_ETH_BRIDGE_HDR_PROC_CTX_SET_EVENT, /* 48 ipacm_event_data_if_cat */
+ IPA_ETH_BRIDGE_HDR_PROC_CTX_UNSET_EVENT, /* 49 ipacm_event_data_if_cat */
IPA_WLAN_SWITCH_TO_SCC, /* 50 No Data */
IPA_WLAN_SWITCH_TO_MCC, /* 51 No Data */
- IPA_CRADLE_WAN_MODE_SWITCH, /* 52 ipacm_event_cradle_wan_mode */
+ IPA_CRADLE_WAN_MODE_SWITCH, /* 52 ipacm_event_cradle_wan_mode */
+ IPA_WAN_XLAT_CONNECT_EVENT, /* 53 ipacm_event_data_fid */
IPACM_EVENT_MAX
} ipa_cm_event_id;
@@ -267,6 +268,11 @@
int if_index;
} ipacm_event_data_fid;
+typedef struct
+{
+ ipacm_iface_type if_cat;
+} ipacm_event_data_if_cat;
+
typedef struct _ipacm_event_data_iptype
{
int if_index;
@@ -305,6 +311,7 @@
uint32_t addr_mask;
uint32_t ipv6_prefix[2];
bool is_sta;
+ uint8_t xlat_mux_id;
}ipacm_event_iface_up;
typedef enum
diff --git a/ipacm/inc/IPACM_Lan.h b/ipacm/inc/IPACM_Lan.h
index e520d58..53bf2f3 100644
--- a/ipacm/inc/IPACM_Lan.h
+++ b/ipacm/inc/IPACM_Lan.h
@@ -146,13 +146,12 @@
uint32_t private_fl_rule_hdl[IPA_MAX_PRIVATE_SUBNET_ENTRIES];
/* LAN-iface's callback function */
- void event_callback(ipa_cm_event_id event,
- void *data);
+ void event_callback(ipa_cm_event_id event, void *data);
virtual int handle_wan_up(ipa_ip_type ip_type);
/* configure filter rule for wan_up event*/
- virtual int handle_wan_up_ex(ipacm_ext_prop* ext_prop, ipa_ip_type iptype);
+ virtual int handle_wan_up_ex(ipacm_ext_prop* ext_prop, ipa_ip_type iptype, uint8_t xlat_mux_id);
/* delete filter rule for wan_down event*/
virtual int handle_wan_down(bool is_sta_mode);
@@ -171,7 +170,7 @@
static bool odu_up;
/* install UL filter rule from Q6 */
- virtual int handle_uplink_filter_rule(ipacm_ext_prop* prop, ipa_ip_type iptype);
+ virtual int handle_uplink_filter_rule(ipacm_ext_prop* prop, ipa_ip_type iptype, uint8_t xlat_mux_id);
int add_lan2lan_flt_rule(ipa_ip_type iptype, uint32_t src_v4_addr, uint32_t dst_v4_addr, uint32_t* src_v6_addr, uint32_t* dst_v6_addr, uint32_t* rule_hdl);
@@ -190,20 +189,24 @@
int install_ipv4_icmp_flt_rule();
- static ipa_hdr_l2_type usb_hdr_type;
+ static ipa_hdr_l2_type lan_hdr_type;
static ipa_hdr_l2_type wlan_hdr_type;
static uint32_t usb_hdr_template_hdl;
static uint32_t wlan_hdr_template_hdl;
+ static uint32_t cpe_hdr_template_hdl;
- static hdr_proc_ctx_info usb_to_wlan_hdr_proc_ctx, wlan_to_usb_hdr_proc_ctx;
+ static hdr_proc_ctx_info lan_to_wlan_hdr_proc_ctx, wlan_to_usb_hdr_proc_ctx, wlan_to_cpe_hdr_proc_ctx;
static hdr_proc_ctx_info wlan_to_wlan_hdr_proc_ctx;
static eth_bridge_subnet_client_info eth_bridge_wlan_client[IPA_LAN_TO_LAN_MAX_WLAN_CLIENT];
- static eth_bridge_subnet_client_info eth_bridge_usb_client[IPA_LAN_TO_LAN_MAX_USB_CLIENT];
+ static eth_bridge_subnet_client_info eth_bridge_lan_client[IPA_LAN_TO_LAN_MAX_LAN_CLIENT];
static int num_wlan_client;
- static int num_usb_client;
+ static int num_lan_client;
+
+ static bool is_usb_up;
+ static bool is_cpe_up;
protected:
@@ -213,10 +216,10 @@
eth_bridge_client_flt_info eth_bridge_wlan_client_flt_info[IPA_LAN_TO_LAN_MAX_WLAN_CLIENT];
int wlan_client_flt_info_count;
- eth_bridge_client_rt_info* eth_bridge_usb_client_rt_info_v4;
- eth_bridge_client_rt_info* eth_bridge_usb_client_rt_info_v6;
- int usb_client_rt_info_count_v4;
- int usb_client_rt_info_count_v6;
+ eth_bridge_client_rt_info* eth_bridge_lan_client_rt_info_v4;
+ eth_bridge_client_rt_info* eth_bridge_lan_client_rt_info_v6;
+ int lan_client_rt_info_count_v4;
+ int lan_client_rt_info_count_v6;
int client_rt_info_size_v4;
int client_rt_info_size_v6;
@@ -227,7 +230,7 @@
virtual int eth_bridge_add_wlan_guest_ap_flt_rule(ipa_ip_type iptype);
- virtual int eth_bridge_handle_dummy_usb_client_flt_rule(ipa_ip_type iptype);
+ virtual int eth_bridge_handle_dummy_lan_client_flt_rule(ipa_ip_type iptype);
int eth_bridge_add_wlan_client_flt_rule(uint8_t* mac, ipa_ip_type iptype);
@@ -243,17 +246,17 @@
virtual int eth_bridge_install_cache_wlan_client_flt_rule(ipa_ip_type iptype);
- virtual int eth_bridge_install_cache_usb_client_flt_rule(ipa_ip_type iptype);
+ virtual int eth_bridge_install_cache_lan_client_flt_rule(ipa_ip_type iptype);
- int eth_bridge_add_usb_client_rt_rule(uint8_t* mac, ipa_ip_type iptype);
+ int eth_bridge_add_lan_client_rt_rule(uint8_t* mac, ipa_ip_type iptype);
- int eth_bridge_del_usb_client_rt_rule(uint8_t* mac);
+ int eth_bridge_del_lan_client_rt_rule(uint8_t* mac);
eth_bridge_client_rt_info* eth_bridge_get_client_rt_info_ptr(uint8_t index, ipa_ip_type iptype);
- void eth_bridge_add_usb_client(uint8_t* mac);
+ void eth_bridge_add_lan_client(uint8_t* mac);
- void eth_bridge_del_usb_client(uint8_t* mac);
+ void eth_bridge_del_lan_client(uint8_t* mac);
int eth_bridge_get_hdr_template_hdl(uint32_t* hdr_hdl);
@@ -327,7 +330,7 @@
NatApp *Nat_App;
- int ipv6_set;
+ int ipv6_set;
uint32_t ODU_hdr_hdl_v4, ODU_hdr_hdl_v6;
diff --git a/ipacm/inc/IPACM_Wan.h b/ipacm/inc/IPACM_Wan.h
index 5160ac3..9009136 100644
--- a/ipacm/inc/IPACM_Wan.h
+++ b/ipacm/inc/IPACM_Wan.h
@@ -86,6 +86,7 @@
static bool wan_up;
static bool wan_up_v6;
+ static uint8_t xlat_mux_id;
IPACM_Wan(int, ipacm_wan_iface_type, uint8_t *);
virtual ~IPACM_Wan();
@@ -100,6 +101,10 @@
return wan_up_v6;
}
+ static bool getXlat_Mux_Id()
+ {
+ return xlat_mux_id;
+ }
void event_callback(ipa_cm_event_id event,
void *data);
@@ -168,6 +173,8 @@
int header_name_count;
int num_wan_client;
uint8_t invalid_mac[IPA_MAC_ADDR_SIZE];
+ bool is_xlat;
+
inline ipa_wan_client* get_client_memptr(ipa_wan_client *param, int cnt)
{
diff --git a/ipacm/inc/IPACM_Wlan.h b/ipacm/inc/IPACM_Wlan.h
index fb5555a..cbbb4c2 100644
--- a/ipacm/inc/IPACM_Wlan.h
+++ b/ipacm/inc/IPACM_Wlan.h
@@ -77,7 +77,7 @@
typedef enum
{
SRC_WLAN,
- SRC_USB
+ SRC_LAN
} eth_bridge_src_iface;
@@ -99,8 +99,8 @@
private:
- eth_bridge_client_flt_info eth_bridge_usb_client_flt_info[IPA_LAN_TO_LAN_MAX_USB_CLIENT];
- int num_usb_client;
+ eth_bridge_client_flt_info eth_bridge_lan_client_flt_info[IPA_LAN_TO_LAN_MAX_LAN_CLIENT];
+ int lan_client_flt_info_count;
uint32_t wlan_guest_ap_flt_rule_hdl_v4[IPA_MAX_PRIVATE_SUBNET_ENTRIES];
@@ -109,15 +109,15 @@
static lan2lan_flt_rule_hdl self_client_flt_rule_hdl_v4[IPA_LAN_TO_LAN_MAX_WLAN_CLIENT];
static lan2lan_flt_rule_hdl self_client_flt_rule_hdl_v6[IPA_LAN_TO_LAN_MAX_WLAN_CLIENT];
- static lan2lan_flt_rule_hdl usb_client_flt_rule_hdl_v4[IPA_LAN_TO_LAN_MAX_USB_CLIENT];
- static lan2lan_flt_rule_hdl usb_client_flt_rule_hdl_v6[IPA_LAN_TO_LAN_MAX_USB_CLIENT];
+ static lan2lan_flt_rule_hdl lan_client_flt_rule_hdl_v4[IPA_LAN_TO_LAN_MAX_LAN_CLIENT];
+ static lan2lan_flt_rule_hdl lan_client_flt_rule_hdl_v6[IPA_LAN_TO_LAN_MAX_LAN_CLIENT];
bool is_guest_ap;
- eth_bridge_client_rt_info* eth_bridge_wlan_client_rt_from_usb_info_v4;
- int wlan_client_rt_from_usb_info_count_v4;
- eth_bridge_client_rt_info* eth_bridge_wlan_client_rt_from_usb_info_v6;
- int wlan_client_rt_from_usb_info_count_v6;
+ eth_bridge_client_rt_info* eth_bridge_wlan_client_rt_from_lan_info_v4;
+ int wlan_client_rt_from_lan_info_count_v4;
+ eth_bridge_client_rt_info* eth_bridge_wlan_client_rt_from_lan_info_v6;
+ int wlan_client_rt_from_lan_info_count_v6;
eth_bridge_client_rt_info* eth_bridge_wlan_client_rt_from_wlan_info_v4;
int wlan_client_rt_from_wlan_info_count_v4;
@@ -130,11 +130,11 @@
virtual int eth_bridge_handle_dummy_wlan_client_flt_rule(ipa_ip_type iptype);
- virtual int eth_bridge_handle_dummy_usb_client_flt_rule(ipa_ip_type iptype);
+ virtual int eth_bridge_handle_dummy_lan_client_flt_rule(ipa_ip_type iptype);
- int eth_bridge_add_usb_client_flt_rule(uint8_t* mac, ipa_ip_type iptype);
+ int eth_bridge_add_lan_client_flt_rule(uint8_t* mac, ipa_ip_type iptype);
- int eth_bridge_del_usb_client_flt_rule(uint8_t* mac);
+ int eth_bridge_del_lan_client_flt_rule(uint8_t* mac);
int eth_bridge_add_self_client_flt_rule(uint8_t* mac, ipa_ip_type iptype);
@@ -142,7 +142,7 @@
virtual int eth_bridge_install_cache_wlan_client_flt_rule(ipa_ip_type iptype);
- virtual int eth_bridge_install_cache_usb_client_flt_rule(ipa_ip_type iptype);
+ virtual int eth_bridge_install_cache_lan_client_flt_rule(ipa_ip_type iptype);
int eth_bridge_add_wlan_client_rt_rule(uint8_t* mac, eth_bridge_src_iface src, ipa_ip_type iptype);
@@ -313,7 +313,7 @@
virtual int handle_private_subnet(ipa_ip_type iptype);
/* install UL filter rule from Q6 */
- virtual int handle_uplink_filter_rule(ipacm_ext_prop* prop, ipa_ip_type iptype);
+ virtual int handle_uplink_filter_rule(ipacm_ext_prop* prop, ipa_ip_type iptype, uint8_t xlat_mux_id);
/* install TCP control filter rules */
virtual void install_tcp_ctl_flt_rule(ipa_ip_type iptype);
diff --git a/ipacm/src/IPACM_Config.cpp b/ipacm/src/IPACM_Config.cpp
index 7ed3ade..0bd47ce 100644
--- a/ipacm/src/IPACM_Config.cpp
+++ b/ipacm/src/IPACM_Config.cpp
@@ -78,9 +78,9 @@
memset(&ext_prop_v4, 0, sizeof(ext_prop_v4));
memset(&ext_prop_v6, 0, sizeof(ext_prop_v6));
- memset(&rt_tbl_eth_bridge_usb_wlan_v4, 0, sizeof(rt_tbl_eth_bridge_usb_wlan_v4));
+ memset(&rt_tbl_eth_bridge_lan_wlan_v4, 0, sizeof(rt_tbl_eth_bridge_lan_wlan_v4));
memset(&rt_tbl_eth_bridge_wlan_wlan_v4, 0, sizeof(rt_tbl_eth_bridge_wlan_wlan_v4));
- memset(&rt_tbl_eth_bridge_usb_wlan_v6, 0, sizeof(rt_tbl_eth_bridge_usb_wlan_v6));
+ memset(&rt_tbl_eth_bridge_lan_wlan_v6, 0, sizeof(rt_tbl_eth_bridge_lan_wlan_v6));
memset(&rt_tbl_eth_bridge_wlan_wlan_v6, 0, sizeof(rt_tbl_eth_bridge_wlan_wlan_v6));
qmap_id = ~0;
@@ -267,14 +267,14 @@
rt_tbl_lan2lan_v6.ip = IPA_IP_v6;
strncpy(rt_tbl_lan2lan_v6.name, V6_LAN_TO_LAN_ROUTE_TABLE_NAME, sizeof(rt_tbl_lan2lan_v6.name));
- rt_tbl_eth_bridge_usb_wlan_v4.ip = IPA_IP_v4;
- strncpy(rt_tbl_eth_bridge_usb_wlan_v4.name, ETH_BRIDGE_USB_WLAN_ROUTE_TABLE_NAME_V4, sizeof(rt_tbl_eth_bridge_usb_wlan_v4.name));
+ rt_tbl_eth_bridge_lan_wlan_v4.ip = IPA_IP_v4;
+ strncpy(rt_tbl_eth_bridge_lan_wlan_v4.name, ETH_BRIDGE_USB_WLAN_ROUTE_TABLE_NAME_V4, sizeof(rt_tbl_eth_bridge_lan_wlan_v4.name));
rt_tbl_eth_bridge_wlan_wlan_v4.ip = IPA_IP_v4;
strncpy(rt_tbl_eth_bridge_wlan_wlan_v4.name, ETH_BRIDGE_WLAN_WLAN_ROUTE_TABLE_NAME_V4, sizeof(rt_tbl_eth_bridge_wlan_wlan_v4.name));
- rt_tbl_eth_bridge_usb_wlan_v6.ip = IPA_IP_v6;
- strncpy(rt_tbl_eth_bridge_usb_wlan_v6.name, ETH_BRIDGE_USB_WLAN_ROUTE_TABLE_NAME_V6, sizeof(rt_tbl_eth_bridge_usb_wlan_v6.name));
+ rt_tbl_eth_bridge_lan_wlan_v6.ip = IPA_IP_v6;
+ strncpy(rt_tbl_eth_bridge_lan_wlan_v6.name, ETH_BRIDGE_USB_WLAN_ROUTE_TABLE_NAME_V6, sizeof(rt_tbl_eth_bridge_lan_wlan_v6.name));
rt_tbl_eth_bridge_wlan_wlan_v6.ip = IPA_IP_v6;
strncpy(rt_tbl_eth_bridge_wlan_wlan_v6.name, ETH_BRIDGE_WLAN_WLAN_ROUTE_TABLE_NAME_V6, sizeof(rt_tbl_eth_bridge_wlan_wlan_v6.name));
diff --git a/ipacm/src/IPACM_IfaceManager.cpp b/ipacm/src/IPACM_IfaceManager.cpp
index 4e6c438..b2e7ea7 100644
--- a/ipacm/src/IPACM_IfaceManager.cpp
+++ b/ipacm/src/IPACM_IfaceManager.cpp
@@ -271,6 +271,12 @@
IPACM_EvtDispatcher::registr(IPA_HANDLE_WAN_UP_V6, odu);
IPACM_EvtDispatcher::registr(IPA_HANDLE_WAN_DOWN, odu);
IPACM_EvtDispatcher::registr(IPA_HANDLE_WAN_DOWN_V6, odu);
+#ifdef FEATURE_ETH_BRIDGE_LE
+ IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_WLAN_CLIENT_ADD_EVENT, odu);
+ IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_WLAN_CLIENT_DEL_EVENT, odu);
+ IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_HDR_PROC_CTX_SET_EVENT, odu);
+ IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_HDR_PROC_CTX_UNSET_EVENT, odu);
+#endif
IPACM_EvtDispatcher::registr(IPA_CRADLE_WAN_MODE_SWITCH, odu);
IPACM_EvtDispatcher::registr(IPA_LINK_DOWN_EVENT, odu);
IPACM_EvtDispatcher::registr(IPA_LAN_DELETE_SELF, odu);
@@ -317,8 +323,8 @@
IPACM_EvtDispatcher::registr(IPA_HANDLE_WAN_DOWN_V6, wl);
IPACM_EvtDispatcher::registr(IPA_PRIVATE_SUBNET_CHANGE_EVENT, wl); // register for IPA_PRIVATE_SUBNET_CHANGE_EVENT event
#ifdef FEATURE_ETH_BRIDGE_LE
- IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_USB_CLIENT_ADD_EVENT, wl);
- IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_USB_CLIENT_DEL_EVENT, wl);
+ IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_LAN_CLIENT_ADD_EVENT, wl);
+ IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_LAN_CLIENT_DEL_EVENT, wl);
IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_HDR_PROC_CTX_SET_EVENT, wl);
IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_HDR_PROC_CTX_UNSET_EVENT, wl);
#endif
@@ -362,6 +368,7 @@
IPACM_EvtDispatcher::registr(IPA_SW_ROUTING_ENABLE, w);
IPACM_EvtDispatcher::registr(IPA_SW_ROUTING_DISABLE, w);
IPACM_EvtDispatcher::registr(IPA_CFG_CHANGE_EVENT, w); // register for IPA_CFG_CHANGE event
+ IPACM_EvtDispatcher::registr(IPA_WAN_XLAT_CONNECT_EVENT, w);
if(is_sta_mode == WLAN_WAN)
{
IPACM_EvtDispatcher::registr(IPA_WLAN_LINK_DOWN_EVENT, w); // for STA mode
diff --git a/ipacm/src/IPACM_Lan.cpp b/ipacm/src/IPACM_Lan.cpp
index 947d66e..e8551ba 100644
--- a/ipacm/src/IPACM_Lan.cpp
+++ b/ipacm/src/IPACM_Lan.cpp
@@ -55,21 +55,25 @@
bool IPACM_Lan::odu_up = false;
-ipa_hdr_l2_type IPACM_Lan::usb_hdr_type = IPA_HDR_L2_NONE;
+ipa_hdr_l2_type IPACM_Lan::lan_hdr_type = IPA_HDR_L2_NONE;
ipa_hdr_l2_type IPACM_Lan::wlan_hdr_type = IPA_HDR_L2_NONE;
uint32_t IPACM_Lan::usb_hdr_template_hdl = 0;
uint32_t IPACM_Lan::wlan_hdr_template_hdl = 0;
+uint32_t IPACM_Lan::cpe_hdr_template_hdl = 0;
-hdr_proc_ctx_info IPACM_Lan::usb_to_wlan_hdr_proc_ctx;
+hdr_proc_ctx_info IPACM_Lan::lan_to_wlan_hdr_proc_ctx;
hdr_proc_ctx_info IPACM_Lan::wlan_to_usb_hdr_proc_ctx;
+hdr_proc_ctx_info IPACM_Lan::wlan_to_cpe_hdr_proc_ctx;
hdr_proc_ctx_info IPACM_Lan::wlan_to_wlan_hdr_proc_ctx;
eth_bridge_subnet_client_info IPACM_Lan::eth_bridge_wlan_client[IPA_LAN_TO_LAN_MAX_WLAN_CLIENT];
-eth_bridge_subnet_client_info IPACM_Lan::eth_bridge_usb_client[IPA_LAN_TO_LAN_MAX_USB_CLIENT];
+eth_bridge_subnet_client_info IPACM_Lan::eth_bridge_lan_client[IPA_LAN_TO_LAN_MAX_LAN_CLIENT];
int IPACM_Lan::num_wlan_client = 0;
-int IPACM_Lan::num_usb_client = 0;
+int IPACM_Lan::num_lan_client = 0;
+bool IPACM_Lan::is_usb_up = false;
+bool IPACM_Lan::is_cpe_up = false;
IPACM_Lan::IPACM_Lan(int iface_index) : IPACM_Iface(iface_index)
{
@@ -82,6 +86,7 @@
odu_route_rule_v6_hdl = NULL;
eth_client = NULL;
int m_fd_odu, ret = IPACM_SUCCESS;
+ uint32_t* hdr_template_ptr;
Nat_App = NatApp::GetInstance();
if (Nat_App == NULL)
@@ -93,36 +98,47 @@
/* support eth multiple clients */
if(iface_query != NULL)
{
-
- if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat != WLAN_IF)
- {
- eth_client_len = (sizeof(ipa_eth_client)) + (iface_query->num_tx_props * sizeof(eth_client_rt_hdl));
- eth_client = (ipa_eth_client *)calloc(IPA_MAX_NUM_ETH_CLIENTS, eth_client_len);
- if (eth_client == NULL)
+ if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat != WLAN_IF)
{
- IPACMERR("unable to allocate memory\n");
- return;
+ eth_client_len = (sizeof(ipa_eth_client)) + (iface_query->num_tx_props * sizeof(eth_client_rt_hdl));
+ eth_client = (ipa_eth_client *)calloc(IPA_MAX_NUM_ETH_CLIENTS, eth_client_len);
+ if (eth_client == NULL)
+ {
+ IPACMERR("unable to allocate memory\n");
+ return;
+ }
}
- }
- IPACMDBG_H(" IPACM->IPACM_Lan(%d) constructor: Tx:%d Rx:%d\n", ipa_if_num,
+ IPACMDBG_H(" IPACM->IPACM_Lan(%d) constructor: Tx:%d Rx:%d\n", ipa_if_num,
iface_query->num_tx_props, iface_query->num_rx_props);
#ifdef FEATURE_ETH_BRIDGE_LE
- if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == LAN_IF && tx_prop != NULL)
+ if((IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == LAN_IF
+ || IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ODU_IF) && tx_prop != NULL)
{
- if(IPACM_Lan::usb_hdr_type != IPA_HDR_L2_NONE && tx_prop->tx[0].hdr_l2_type != IPACM_Lan::usb_hdr_type)
+ if(IPACM_Lan::lan_hdr_type != IPA_HDR_L2_NONE && tx_prop->tx[0].hdr_l2_type != IPACM_Lan::lan_hdr_type)
{
- IPACMERR("The USB header format is not consistent! Now header format is %d.\n", tx_prop->tx[0].hdr_l2_type);
+ IPACMERR("The LAN header format is not consistent! Now header format is %d.\n", tx_prop->tx[0].hdr_l2_type);
}
else
{
- if(eth_bridge_get_hdr_template_hdl(&IPACM_Lan::usb_hdr_template_hdl) == IPACM_FAILURE)
+ if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == LAN_IF)
{
- IPACMERR("Failed to setup usb hdr template.\n");
+ hdr_template_ptr = &IPACM_Lan::usb_hdr_template_hdl;
+ IPACM_Lan::is_usb_up = true;
+ }
+ else //else it is ODU_IF (cpe)
+ {
+ hdr_template_ptr = &IPACM_Lan::cpe_hdr_template_hdl;
+ IPACM_Lan::is_cpe_up = true;
+ }
+
+ if(eth_bridge_get_hdr_template_hdl(hdr_template_ptr) == IPACM_FAILURE)
+ {
+ IPACMERR("Failed to setup lan hdr template.\n");
}
else
{
- IPACM_Lan::usb_hdr_type = tx_prop->tx[0].hdr_l2_type;
+ IPACM_Lan::lan_hdr_type = tx_prop->tx[0].hdr_l2_type;
add_hdr_proc_ctx();
}
}
@@ -241,19 +257,19 @@
memset(eth_bridge_wlan_client_flt_info, 0, IPA_LAN_TO_LAN_MAX_WLAN_CLIENT * sizeof(eth_bridge_client_flt_info));
wlan_client_flt_info_count = 0;
- eth_bridge_usb_client_rt_info_v4 = NULL;
- eth_bridge_usb_client_rt_info_v6 = NULL;
+ eth_bridge_lan_client_rt_info_v4 = NULL;
+ eth_bridge_lan_client_rt_info_v6 = NULL;
#ifdef FEATURE_ETH_BRIDGE_LE
if(tx_prop != NULL)
{
client_rt_info_size_v4 = sizeof(eth_bridge_client_rt_info) + each_client_rt_rule_count_v4 * sizeof(uint32_t);
- eth_bridge_usb_client_rt_info_v4 = (eth_bridge_client_rt_info*)calloc(IPA_LAN_TO_LAN_MAX_USB_CLIENT, client_rt_info_size_v4);
+ eth_bridge_lan_client_rt_info_v4 = (eth_bridge_client_rt_info*)calloc(IPA_LAN_TO_LAN_MAX_LAN_CLIENT, client_rt_info_size_v4);
client_rt_info_size_v6 = sizeof(eth_bridge_client_rt_info) + each_client_rt_rule_count_v6 * sizeof(uint32_t);
- eth_bridge_usb_client_rt_info_v6 = (eth_bridge_client_rt_info*)calloc(IPA_LAN_TO_LAN_MAX_USB_CLIENT, client_rt_info_size_v6);
+ eth_bridge_lan_client_rt_info_v6 = (eth_bridge_client_rt_info*)calloc(IPA_LAN_TO_LAN_MAX_LAN_CLIENT, client_rt_info_size_v6);
}
#endif
- usb_client_rt_info_count_v4 = 0;
- usb_client_rt_info_count_v6 = 0;
+ lan_client_rt_info_count_v4 = 0;
+ lan_client_rt_info_count_v6 = 0;
return;
}
@@ -444,7 +460,8 @@
if(IPACM_Wan::backhaul_is_sta_mode == false)
{
ext_prop = IPACM_Iface::ipacmcfg->GetExtProp(IPA_IP_v4);
- handle_wan_up_ex(ext_prop, IPA_IP_v4);
+ handle_wan_up_ex(ext_prop, IPA_IP_v4,
+ IPACM_Wan::getXlat_Mux_Id());
}
else
{
@@ -461,7 +478,7 @@
if(IPACM_Wan::backhaul_is_sta_mode == false)
{
ext_prop = IPACM_Iface::ipacmcfg->GetExtProp(IPA_IP_v6);
- handle_wan_up_ex(ext_prop, IPA_IP_v6);
+ handle_wan_up_ex(ext_prop, IPA_IP_v6, 0);
}
else
{
@@ -529,8 +546,8 @@
if(data_wan->is_sta == false)
{
ext_prop = IPACM_Iface::ipacmcfg->GetExtProp(IPA_IP_v4);
- handle_wan_up_ex(ext_prop, IPA_IP_v4);
- }
+ handle_wan_up_ex(ext_prop, IPA_IP_v4, data_wan->xlat_mux_id);
+ }
else
{
handle_wan_up(IPA_IP_v4);
@@ -554,7 +571,7 @@
if(data_wan->is_sta == false)
{
ext_prop = IPACM_Iface::ipacmcfg->GetExtProp(IPA_IP_v6);
- handle_wan_up_ex(ext_prop, IPA_IP_v6);
+ handle_wan_up_ex(ext_prop, IPA_IP_v6, 0);
}
else
{
@@ -649,13 +666,20 @@
CtList->HandleNeighIpAddrAddEvt(data);
}
#ifdef FEATURE_ETH_BRIDGE_LE
- if(IPACM_Lan::wlan_to_usb_hdr_proc_ctx.valid == true)
+ if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == LAN_IF
+ && IPACM_Lan::wlan_to_usb_hdr_proc_ctx.valid == true)
{
- eth_bridge_add_usb_client_rt_rule(data->mac_addr, IPA_IP_v4);
- eth_bridge_add_usb_client_rt_rule(data->mac_addr, IPA_IP_v6);
+ eth_bridge_add_lan_client_rt_rule(data->mac_addr, IPA_IP_v4);
+ eth_bridge_add_lan_client_rt_rule(data->mac_addr, IPA_IP_v6);
}
- eth_bridge_post_lan_client_event(data->mac_addr, IPA_ETH_BRIDGE_USB_CLIENT_ADD_EVENT);
- eth_bridge_add_usb_client(data->mac_addr);
+ if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ODU_IF
+ && IPACM_Lan::wlan_to_cpe_hdr_proc_ctx.valid == true)
+ {
+ eth_bridge_add_lan_client_rt_rule(data->mac_addr, IPA_IP_v4);
+ eth_bridge_add_lan_client_rt_rule(data->mac_addr, IPA_IP_v6);
+ }
+ eth_bridge_post_lan_client_event(data->mac_addr, IPA_ETH_BRIDGE_LAN_CLIENT_ADD_EVENT);
+ eth_bridge_add_lan_client(data->mac_addr);
#endif
return;
}
@@ -734,22 +758,25 @@
{
IPACMDBG_H("Received IPA_ETH_BRIDGE_HDR_PROC_CTX_SET_EVENT event.\n");
int i;
- ipacm_event_data_fid* fid = (ipacm_event_data_fid*)param;
- if(fid == NULL)
+ ipacm_event_data_if_cat* cat = (ipacm_event_data_if_cat*)param;
+ if(cat == NULL)
{
IPACMERR("Event data is empty.\n");
return;
}
- if(fid->if_index == ipa_if_num)
+ if(cat->if_cat != WLAN_IF)
{
- IPACMDBG_H("The event was sent by the same interface, ignore.\n");
+ IPACMDBG_H("The event was not sent by WLAN interface, ignore.\n");
return;
}
- for(i=0; i<IPACM_Lan::num_usb_client; i++)
+ for(i=0; i<IPACM_Lan::num_lan_client; i++)
{
- eth_bridge_add_usb_client_rt_rule(IPACM_Lan::eth_bridge_usb_client[i].mac, IPA_IP_v4);
- eth_bridge_add_usb_client_rt_rule(IPACM_Lan::eth_bridge_usb_client[i].mac, IPA_IP_v6);
+ if(IPACM_Lan::eth_bridge_lan_client[i].ipa_if_num == ipa_if_num)
+ {
+ eth_bridge_add_lan_client_rt_rule(IPACM_Lan::eth_bridge_lan_client[i].mac, IPA_IP_v4);
+ eth_bridge_add_lan_client_rt_rule(IPACM_Lan::eth_bridge_lan_client[i].mac, IPA_IP_v6);
+ }
}
}
break;
@@ -758,21 +785,24 @@
{
IPACMDBG_H("Received IPA_ETH_BRIDGE_HDR_PROC_CTX_UNSET_EVENT event.\n");
int i;
- ipacm_event_data_fid* fid = (ipacm_event_data_fid*)param;
- if(fid == NULL)
+ ipacm_event_data_if_cat* cat = (ipacm_event_data_if_cat*)param;
+ if(cat == NULL)
{
IPACMERR("Event data is empty.\n");
return;
}
- if(fid->if_index == ipa_if_num)
+ if(cat->if_cat != WLAN_IF)
{
- IPACMDBG_H("The event was sent by the same interface, ignore.\n");
+ IPACMDBG_H("The event was not sent by WLAN interface, ignore.\n");
return;
}
- for(i=0; i<IPACM_Lan::num_usb_client; i++)
+ for(i=0; i<IPACM_Lan::num_lan_client; i++)
{
- eth_bridge_del_usb_client_rt_rule(IPACM_Lan::eth_bridge_usb_client[i].mac);
+ if(IPACM_Lan::eth_bridge_lan_client[i].ipa_if_num == ipa_if_num)
+ {
+ eth_bridge_del_lan_client_rt_rule(IPACM_Lan::eth_bridge_lan_client[i].mac);
+ }
}
}
break;
@@ -937,9 +967,9 @@
init_fl_rule(data->iptype);
eth_bridge_add_wlan_guest_ap_flt_rule(data->iptype);
eth_bridge_handle_dummy_wlan_client_flt_rule(data->iptype);
- eth_bridge_handle_dummy_usb_client_flt_rule(data->iptype);
+ eth_bridge_handle_dummy_lan_client_flt_rule(data->iptype);
eth_bridge_install_cache_wlan_client_flt_rule(data->iptype);
- eth_bridge_install_cache_usb_client_flt_rule(data->iptype);
+ eth_bridge_install_cache_lan_client_flt_rule(data->iptype);
#else
#ifdef CT_OPT
install_tcp_ctl_flt_rule(IPA_IP_v4);
@@ -1035,9 +1065,9 @@
#ifdef FEATURE_ETH_BRIDGE_LE
eth_bridge_add_wlan_guest_ap_flt_rule(data->iptype);
eth_bridge_handle_dummy_wlan_client_flt_rule(data->iptype);
- eth_bridge_handle_dummy_usb_client_flt_rule(data->iptype);
+ eth_bridge_handle_dummy_lan_client_flt_rule(data->iptype);
eth_bridge_install_cache_wlan_client_flt_rule(data->iptype);
- eth_bridge_install_cache_usb_client_flt_rule(data->iptype);
+ eth_bridge_install_cache_lan_client_flt_rule(data->iptype);
init_fl_rule(data->iptype);
#else
#ifdef CT_OPT
@@ -1308,7 +1338,7 @@
return IPACM_SUCCESS;
}
-int IPACM_Lan::handle_wan_up_ex(ipacm_ext_prop* ext_prop, ipa_ip_type iptype)
+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;
IPACM_Config* ipacm_config = IPACM_Iface::ipacmcfg;
@@ -1343,8 +1373,8 @@
if ((num_dft_rt_v6 ==1 && iptype ==IPA_IP_v6) ||
(iptype ==IPA_IP_v4))
{
- IPACMDBG_H("num_dft_rt_v6 %d iptype %d\n", num_dft_rt_v6, iptype);
- ret = handle_uplink_filter_rule(ext_prop, iptype);
+ IPACMDBG_H("num_dft_rt_v6 %d iptype %d xlat_mux_id: %d \n", num_dft_rt_v6, iptype, xlat_mux_id);
+ ret = handle_uplink_filter_rule(ext_prop, iptype, xlat_mux_id);
}
return ret;
}
@@ -1754,9 +1784,11 @@
/* Add corresponding ipa_rm_resource_name of TX-endpoint up before IPV6 RT-rule set */
IPACMDBG_H("dev %s add producer dependency\n", dev_name);
- IPACMDBG_H("depend Got pipe %d rm index : %d \n", tx_prop->tx[0].dst_pipe, IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[tx_prop->tx[0].dst_pipe]);
- IPACM_Iface::ipacmcfg->AddRmDepend(IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[tx_prop->tx[0].dst_pipe],false);
-
+ if (tx_prop != NULL)
+ {
+ IPACMDBG_H("depend Got pipe %d rm index : %d \n", tx_prop->tx[0].dst_pipe, IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[tx_prop->tx[0].dst_pipe]);
+ IPACM_Iface::ipacmcfg->AddRmDepend(IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[tx_prop->tx[0].dst_pipe],false);
+ }
rt_rule = (struct ipa_ioc_add_rt_rule *)
calloc(1, sizeof(struct ipa_ioc_add_rt_rule) +
NUM * sizeof(struct ipa_rt_rule_add));
@@ -2337,8 +2369,11 @@
{
/* Delete corresponding ipa_rm_resource_name of TX-endpoint after delete all IPV4V6 RT-rule*/
IPACMDBG_H("dev %s add producer dependency\n", dev_name);
- IPACMDBG_H("depend Got pipe %d rm index : %d \n", tx_prop->tx[0].dst_pipe, IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[tx_prop->tx[0].dst_pipe]);
- IPACM_Iface::ipacmcfg->DelRmDepend(IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[tx_prop->tx[0].dst_pipe]);
+ if (tx_prop != NULL)
+ {
+ IPACMDBG_H("depend Got pipe %d rm index : %d \n", tx_prop->tx[0].dst_pipe, IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[tx_prop->tx[0].dst_pipe]);
+ IPACM_Iface::ipacmcfg->DelRmDepend(IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[tx_prop->tx[0].dst_pipe]);
+ }
}
return IPACM_SUCCESS;
@@ -2394,8 +2429,24 @@
IPACMDBG_H("lan handle_down_evt\n ");
#ifdef FEATURE_ETH_BRIDGE_LE
- IPACM_Lan::usb_hdr_type = IPA_HDR_L2_NONE;
- IPACM_Lan::usb_hdr_template_hdl = 0;
+ if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == LAN_IF)
+ {
+ IPACM_Lan::usb_hdr_template_hdl = 0;
+ IPACM_Lan::is_usb_up = false;
+ if(IPACM_Lan::is_cpe_up == false) //if all LAN ifaces are down
+ {
+ IPACM_Lan::lan_hdr_type = IPA_HDR_L2_NONE;
+ }
+ }
+ if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ODU_IF)
+ {
+ IPACM_Lan::cpe_hdr_template_hdl = 0;
+ IPACM_Lan::is_cpe_up = false;
+ if(IPACM_Lan::is_usb_up == false) //if all LAN ifaces are down
+ {
+ IPACM_Lan::lan_hdr_type = IPA_HDR_L2_NONE;
+ }
+ }
del_hdr_proc_ctx();
#endif
@@ -2583,9 +2634,9 @@
for (i = 0; i < num_eth_client; i++)
{
#ifdef FEATURE_ETH_BRIDGE_LE
- eth_bridge_del_usb_client_rt_rule(get_client_memptr(eth_client, i)->mac);
- eth_bridge_post_lan_client_event(get_client_memptr(eth_client, i)->mac, IPA_ETH_BRIDGE_USB_CLIENT_DEL_EVENT);
- eth_bridge_del_usb_client(get_client_memptr(eth_client, i)->mac);
+ eth_bridge_del_lan_client_rt_rule(get_client_memptr(eth_client, i)->mac);
+ eth_bridge_post_lan_client_event(get_client_memptr(eth_client, i)->mac, IPA_ETH_BRIDGE_LAN_CLIENT_DEL_EVENT);
+ eth_bridge_del_lan_client(get_client_memptr(eth_client, i)->mac);
#endif
/* First reset nat rules and then route rules */
@@ -2637,10 +2688,12 @@
IPACMDBG_H("Free ecm clients cache\n");
/* Delete corresponding ipa_rm_resource_name of TX-endpoint after delete all IPV4V6 RT-rule */
- IPACMDBG_H("dev %s add producer dependency\n", dev_name);
- IPACMDBG_H("depend Got pipe %d rm index : %d \n", tx_prop->tx[0].dst_pipe, IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[tx_prop->tx[0].dst_pipe]);
- IPACM_Iface::ipacmcfg->DelRmDepend(IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[tx_prop->tx[0].dst_pipe]);
-
+ IPACMDBG_H("dev %s delete producer dependency\n", dev_name);
+ if (tx_prop != NULL)
+ {
+ IPACMDBG_H("depend Got pipe %d rm index : %d \n", tx_prop->tx[0].dst_pipe, IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[tx_prop->tx[0].dst_pipe]);
+ IPACM_Iface::ipacmcfg->DelRmDepend(IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[tx_prop->tx[0].dst_pipe]);
+ }
/* check software routing fl rule hdl */
if (softwarerouting_act == true && rx_prop != NULL)
{
@@ -2696,13 +2749,13 @@
free(iface_query);
}
#ifdef FEATURE_ETH_BRIDGE_LE
- if(eth_bridge_usb_client_rt_info_v4 != NULL)
+ if(eth_bridge_lan_client_rt_info_v4 != NULL)
{
- free(eth_bridge_usb_client_rt_info_v4);
+ free(eth_bridge_lan_client_rt_info_v4);
}
- if(eth_bridge_usb_client_rt_info_v6 != NULL)
+ if(eth_bridge_lan_client_rt_info_v6 != NULL)
{
- free(eth_bridge_usb_client_rt_info_v6);
+ free(eth_bridge_lan_client_rt_info_v6);
}
#endif
is_active = false;
@@ -2712,7 +2765,7 @@
}
/* install UL filter rule from Q6 */
-int IPACM_Lan::handle_uplink_filter_rule(ipacm_ext_prop* prop, ipa_ip_type iptype)
+int IPACM_Lan::handle_uplink_filter_rule(ipacm_ext_prop *prop, ipa_ip_type iptype, uint8_t xlat_mux_id)
{
ipa_flt_rule_add flt_rule_entry;
int len = 0, cnt, ret = IPACM_SUCCESS;
@@ -2720,6 +2773,7 @@
ipa_fltr_installed_notif_req_msg_v01 flt_index;
int fd;
int i, index;
+ uint32_t value = 0;
IPACMDBG_H("Set extended property rules in LAN\n");
@@ -2817,6 +2871,19 @@
&prop->prop[cnt].eq_attrib,
sizeof(prop->prop[cnt].eq_attrib));
flt_rule_entry.rule.rt_tbl_idx = prop->prop[cnt].rt_tbl_idx;
+
+ /* Handle XLAT configuration */
+ if ((iptype == IPA_IP_v4) && prop->prop[cnt].is_xlat_rule && (xlat_mux_id != 0))
+ {
+ /* fill the value of meta-data */
+ value = xlat_mux_id;
+ flt_rule_entry.rule.eq_attrib.metadata_meq32_present = 1;
+ flt_rule_entry.rule.eq_attrib.metadata_meq32.offset = 0;
+ flt_rule_entry.rule.eq_attrib.metadata_meq32.value = (value & 0xFF) << 16;
+ flt_rule_entry.rule.eq_attrib.metadata_meq32.mask = 0x00FF0000;
+ IPACMDBG_H("xlat meta-data is modified fur rult: %d has index %d with xlat_mux_id: %d\n",
+ cnt, index, xlat_mux_id);
+ }
memcpy(&pFilteringTable->rules[cnt], &flt_rule_entry, sizeof(flt_rule_entry));
IPACMDBG_H("Modem UL filtering rule %d has index %d\n", cnt, index);
@@ -4714,7 +4781,7 @@
return IPACM_SUCCESS;
}
-int IPACM_Lan::eth_bridge_handle_dummy_usb_client_flt_rule(ipa_ip_type iptype)
+int IPACM_Lan::eth_bridge_handle_dummy_lan_client_flt_rule(ipa_ip_type iptype)
{
IPACMDBG_H("No need to add USB client specific flt rule on USB pipe.\n");
return IPACM_SUCCESS;
@@ -4765,7 +4832,7 @@
IPACMERR("MAC address is empty.\n");
return IPACM_FAILURE;
}
- if(IPACM_Lan::usb_to_wlan_hdr_proc_ctx.valid == false)
+ if(IPACM_Lan::lan_to_wlan_hdr_proc_ctx.valid == false)
{
IPACMDBG_H("USB to WLAN hdr proc ctx has not been set, don't add client specific flt rule.\n");
return IPACM_FAILURE;
@@ -4820,33 +4887,33 @@
/* point to USB-WLAN routing table */
if(iptype == IPA_IP_v4)
{
- if (false == m_routing.GetRoutingTable(&IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_usb_wlan_v4))
+ if (false == m_routing.GetRoutingTable(&IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_wlan_v4))
{
IPACMERR("Failed to get routing table handle.\n");
res = IPACM_FAILURE;
goto fail;
}
- flt_rule.rule.rt_tbl_hdl = IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_usb_wlan_v4.hdl;
- IPACMDBG_H("USB->WLAN filter rule use table: %s\n",IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_usb_wlan_v4.name);
+ flt_rule.rule.rt_tbl_hdl = IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_wlan_v4.hdl;
+ IPACMDBG_H("USB->WLAN filter rule use table: %s\n",IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_wlan_v4.name);
}
else
{
- if (false == m_routing.GetRoutingTable(&IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_usb_wlan_v6))
+ if (false == m_routing.GetRoutingTable(&IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_wlan_v6))
{
IPACMERR("Failed to get routing table handle.\n");
res = IPACM_FAILURE;
goto fail;
}
- flt_rule.rule.rt_tbl_hdl = IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_usb_wlan_v6.hdl;
- IPACMDBG_H("USB->WLAN filter rule use table: %s\n",IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_usb_wlan_v6.name);
+ flt_rule.rule.rt_tbl_hdl = IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_wlan_v6.hdl;
+ IPACMDBG_H("USB->WLAN filter rule use table: %s\n",IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_wlan_v6.name);
}
memcpy(&flt_rule.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule.rule.attrib));
- if(IPACM_Lan::usb_hdr_type == IPA_HDR_L2_ETHERNET_II)
+ if(IPACM_Lan::lan_hdr_type == IPA_HDR_L2_ETHERNET_II)
{
flt_rule.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_ETHER_II;
}
- else if(IPACM_Lan::usb_hdr_type == IPA_HDR_L2_802_3)
+ else if(IPACM_Lan::lan_hdr_type == IPA_HDR_L2_802_3)
{
flt_rule.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_802_3;
}
@@ -5051,14 +5118,14 @@
}
}
- if(IPACM_Lan::usb_hdr_type != IPA_HDR_L2_NONE)
+ if(IPACM_Lan::lan_hdr_type != IPA_HDR_L2_NONE)
{
- if(IPACM_Lan::usb_to_wlan_hdr_proc_ctx.valid == false)
+ if(IPACM_Lan::lan_to_wlan_hdr_proc_ctx.valid == false)
{
memset(pHeaderProcTable, 0, len);
pHeaderProcTable->commit = 1;
pHeaderProcTable->num_proc_ctxs = 1;
- pHeaderProcTable->proc_ctx[0].type = get_hdr_proc_type(IPACM_Lan::usb_hdr_type, IPACM_Lan::wlan_hdr_type);
+ pHeaderProcTable->proc_ctx[0].type = get_hdr_proc_type(IPACM_Lan::lan_hdr_type, IPACM_Lan::wlan_hdr_type);
pHeaderProcTable->proc_ctx[0].hdr_hdl = IPACM_Lan::wlan_hdr_template_hdl;
if (m_header.AddHeaderProcCtx(pHeaderProcTable) == false)
{
@@ -5068,41 +5135,39 @@
}
else
{
- IPACM_Lan::usb_to_wlan_hdr_proc_ctx.proc_ctx_hdl = pHeaderProcTable->proc_ctx[0].proc_ctx_hdl;
- IPACM_Lan::usb_to_wlan_hdr_proc_ctx.valid = true;
+ IPACM_Lan::lan_to_wlan_hdr_proc_ctx.proc_ctx_hdl = pHeaderProcTable->proc_ctx[0].proc_ctx_hdl;
+ IPACM_Lan::lan_to_wlan_hdr_proc_ctx.valid = true;
}
ipacm_cmd_q_data evt_data;
memset(&evt_data, 0, sizeof(ipacm_cmd_q_data));
- ipacm_event_data_fid* fid;
- fid = (ipacm_event_data_fid*)malloc(sizeof(ipacm_event_data_fid));
- if(fid == NULL)
+ ipacm_event_data_if_cat* cat;
+ cat = (ipacm_event_data_if_cat*)malloc(sizeof(ipacm_event_data_if_cat));
+ if(cat == NULL)
{
IPACMERR("Unable to allocate memory.\n");
return IPACM_FAILURE;
}
- memset(fid, 0, sizeof(ipacm_event_data_fid));
- fid->if_index = ipa_if_num;
+ memset(cat, 0, sizeof(ipacm_event_data_if_cat));
+ cat->if_cat = IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat;
- evt_data.evt_data = fid;
+ evt_data.evt_data = cat;
evt_data.event = IPA_ETH_BRIDGE_HDR_PROC_CTX_SET_EVENT;
IPACMDBG_H("Posting event IPA_ETH_BRIDGE_HDR_PROC_CTX_SET_EVENT\n");
IPACM_EvtDispatcher::PostEvt(&evt_data);
}
- if(IPACM_Lan::wlan_to_usb_hdr_proc_ctx.valid == false)
+ if(IPACM_Lan::is_usb_up == true && IPACM_Lan::wlan_to_usb_hdr_proc_ctx.valid == false)
{
memset(pHeaderProcTable, 0, len);
pHeaderProcTable->commit = 1;
pHeaderProcTable->num_proc_ctxs = 1;
- pHeaderProcTable->proc_ctx[0].type = get_hdr_proc_type(IPACM_Lan::wlan_hdr_type, IPACM_Lan::usb_hdr_type);
+ pHeaderProcTable->proc_ctx[0].type = get_hdr_proc_type(IPACM_Lan::wlan_hdr_type, IPACM_Lan::lan_hdr_type);
pHeaderProcTable->proc_ctx[0].hdr_hdl = IPACM_Lan::usb_hdr_template_hdl;
if (m_header.AddHeaderProcCtx(pHeaderProcTable) == false)
{
IPACMERR("Adding WLAN to USB hdr proc ctx failed with status: %d\n", pHeaderProcTable->proc_ctx[0].status);
- m_header.DeleteHeaderProcCtx(IPACM_Lan::usb_to_wlan_hdr_proc_ctx.proc_ctx_hdl);
- IPACM_Lan::usb_to_wlan_hdr_proc_ctx.valid = false;
res = IPACM_FAILURE;
goto fail;
}
@@ -5112,6 +5177,26 @@
IPACM_Lan::wlan_to_usb_hdr_proc_ctx.valid = true;
}
}
+
+ if(IPACM_Lan::is_cpe_up == true && IPACM_Lan::wlan_to_cpe_hdr_proc_ctx.valid == false)
+ {
+ memset(pHeaderProcTable, 0, len);
+ pHeaderProcTable->commit = 1;
+ pHeaderProcTable->num_proc_ctxs = 1;
+ pHeaderProcTable->proc_ctx[0].type = get_hdr_proc_type(IPACM_Lan::wlan_hdr_type, IPACM_Lan::lan_hdr_type);
+ pHeaderProcTable->proc_ctx[0].hdr_hdl = IPACM_Lan::cpe_hdr_template_hdl;
+ if (m_header.AddHeaderProcCtx(pHeaderProcTable) == false)
+ {
+ IPACMERR("Adding WLAN to CPE hdr proc ctx failed with status: %d\n", pHeaderProcTable->proc_ctx[0].status);
+ res = IPACM_FAILURE;
+ goto fail;
+ }
+ else
+ {
+ IPACM_Lan::wlan_to_cpe_hdr_proc_ctx.proc_ctx_hdl = pHeaderProcTable->proc_ctx[0].proc_ctx_hdl;
+ IPACM_Lan::wlan_to_cpe_hdr_proc_ctx.valid = true;
+ }
+ }
}
}
else
@@ -5165,13 +5250,13 @@
return IPACM_SUCCESS;
}
-int IPACM_Lan::eth_bridge_install_cache_usb_client_flt_rule(ipa_ip_type iptype)
+int IPACM_Lan::eth_bridge_install_cache_lan_client_flt_rule(ipa_ip_type iptype)
{
IPACMDBG_H("No need to install usb client specific flt rules on usb pipe.\n");
return IPACM_SUCCESS;
}
-int IPACM_Lan::eth_bridge_add_usb_client_rt_rule(uint8_t* mac, ipa_ip_type iptype)
+int IPACM_Lan::eth_bridge_add_lan_client_rt_rule(uint8_t* mac, ipa_ip_type iptype)
{
if(tx_prop == NULL)
{
@@ -5183,17 +5268,24 @@
IPACMERR("Client MAC address is empty.\n");
return IPACM_FAILURE;
}
- if( (iptype == IPA_IP_v4 && usb_client_rt_info_count_v4 == IPA_LAN_TO_LAN_MAX_USB_CLIENT)
- || (iptype == IPA_IP_v6 && usb_client_rt_info_count_v6 == IPA_LAN_TO_LAN_MAX_USB_CLIENT))
+ if( (iptype == IPA_IP_v4 && lan_client_rt_info_count_v4 == IPA_LAN_TO_LAN_MAX_LAN_CLIENT)
+ || (iptype == IPA_IP_v6 && lan_client_rt_info_count_v6 == IPA_LAN_TO_LAN_MAX_LAN_CLIENT))
{
IPACMDBG_H("USB client number has reached maximum.\n");
return IPACM_FAILURE;
}
- if(IPACM_Lan::wlan_to_usb_hdr_proc_ctx.valid == false)
+ if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == LAN_IF
+ && IPACM_Lan::wlan_to_usb_hdr_proc_ctx.valid == false)
{
IPACMDBG_H("WLAN to USB hdr proc ctx has not been set, don't add USB routing rule.\n");
return IPACM_FAILURE;
}
+ if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ODU_IF
+ && IPACM_Lan::wlan_to_cpe_hdr_proc_ctx.valid == false)
+ {
+ IPACMDBG_H("WLAN to CPE hdr proc ctx has not been set, don't add CPE routing rule.\n");
+ return IPACM_FAILURE;
+ }
IPACMDBG_H("Receive USB client MAC 0x%02x%02x%02x%02x%02x%02x.\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
@@ -5204,7 +5296,7 @@
if(iptype == IPA_IP_v4)
{
- for(i=0; i<usb_client_rt_info_count_v4; i++)
+ for(i=0; i<lan_client_rt_info_count_v4; i++)
{
if(memcmp(eth_bridge_get_client_rt_info_ptr(i, iptype)->mac, mac, sizeof(eth_bridge_get_client_rt_info_ptr(i, iptype)->mac)) == 0)
{
@@ -5212,12 +5304,12 @@
return IPACM_SUCCESS;
}
}
- memcpy(eth_bridge_get_client_rt_info_ptr(usb_client_rt_info_count_v4, iptype)->mac, mac,
- sizeof(eth_bridge_get_client_rt_info_ptr(usb_client_rt_info_count_v4, iptype)->mac));
+ memcpy(eth_bridge_get_client_rt_info_ptr(lan_client_rt_info_count_v4, iptype)->mac, mac,
+ sizeof(eth_bridge_get_client_rt_info_ptr(lan_client_rt_info_count_v4, iptype)->mac));
}
else
{
- for(i=0; i<usb_client_rt_info_count_v6; i++)
+ for(i=0; i<lan_client_rt_info_count_v6; i++)
{
if(memcmp(eth_bridge_get_client_rt_info_ptr(i, iptype)->mac, mac, sizeof(eth_bridge_get_client_rt_info_ptr(i, iptype)->mac)) == 0)
{
@@ -5225,8 +5317,8 @@
return IPACM_SUCCESS;
}
}
- memcpy(eth_bridge_get_client_rt_info_ptr(usb_client_rt_info_count_v6, iptype)->mac, mac,
- sizeof(eth_bridge_get_client_rt_info_ptr(usb_client_rt_info_count_v6, iptype)->mac));
+ memcpy(eth_bridge_get_client_rt_info_ptr(lan_client_rt_info_count_v6, iptype)->mac, mac,
+ sizeof(eth_bridge_get_client_rt_info_ptr(lan_client_rt_info_count_v6, iptype)->mac));
}
if(iptype == IPA_IP_v4)
@@ -5253,11 +5345,11 @@
if(iptype == IPA_IP_v4)
{
- strncpy(rt_rule_table->rt_tbl_name, IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_usb_wlan_v4.name, sizeof(rt_rule_table->rt_tbl_name));
+ strncpy(rt_rule_table->rt_tbl_name, IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_wlan_v4.name, sizeof(rt_rule_table->rt_tbl_name));
}
else
{
- strncpy(rt_rule_table->rt_tbl_name, IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_usb_wlan_v6.name, sizeof(rt_rule_table->rt_tbl_name));
+ strncpy(rt_rule_table->rt_tbl_name, IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_wlan_v6.name, sizeof(rt_rule_table->rt_tbl_name));
}
memset(&rt_rule, 0, sizeof(ipa_rt_rule_add));
@@ -5266,7 +5358,21 @@
rt_rule.rt_rule_hdl = -1;
rt_rule.rule.hdr_hdl = 0;
- rt_rule.rule.hdr_proc_ctx_hdl = IPACM_Lan::wlan_to_usb_hdr_proc_ctx.proc_ctx_hdl;
+ if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == LAN_IF)
+ {
+ rt_rule.rule.hdr_proc_ctx_hdl = IPACM_Lan::wlan_to_usb_hdr_proc_ctx.proc_ctx_hdl;
+ }
+ else if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ODU_IF)
+ {
+ rt_rule.rule.hdr_proc_ctx_hdl = IPACM_Lan::wlan_to_cpe_hdr_proc_ctx.proc_ctx_hdl;
+ }
+ else
+ {
+ IPACMERR("Iface category is not expected.\n");
+ res = IPACM_FAILURE;
+ goto fail;
+ }
+
position = 0;
for(i=0; i<iface_query->num_tx_props; i++)
{
@@ -5315,24 +5421,24 @@
{
if(iptype == IPA_IP_v4)
{
- eth_bridge_get_client_rt_info_ptr(usb_client_rt_info_count_v4, iptype)->rt_rule_hdl[i] = rt_rule_table->rules[i].rt_rule_hdl;
+ eth_bridge_get_client_rt_info_ptr(lan_client_rt_info_count_v4, iptype)->rt_rule_hdl[i] = rt_rule_table->rules[i].rt_rule_hdl;
}
else
{
- eth_bridge_get_client_rt_info_ptr(usb_client_rt_info_count_v6, iptype)->rt_rule_hdl[i] = rt_rule_table->rules[i].rt_rule_hdl;
+ eth_bridge_get_client_rt_info_ptr(lan_client_rt_info_count_v6, iptype)->rt_rule_hdl[i] = rt_rule_table->rules[i].rt_rule_hdl;
}
}
}
if(iptype == IPA_IP_v4)
{
- usb_client_rt_info_count_v4++;
- IPACMDBG_H("Now the number of IPv4 rt rule info is %d.\n", usb_client_rt_info_count_v4);
+ lan_client_rt_info_count_v4++;
+ IPACMDBG_H("Now the number of IPv4 rt rule info is %d.\n", lan_client_rt_info_count_v4);
}
else
{
- usb_client_rt_info_count_v6++;
- IPACMDBG_H("Now the number of IPv6 rt rule info is %d.\n", usb_client_rt_info_count_v6);
+ lan_client_rt_info_count_v6++;
+ IPACMDBG_H("Now the number of IPv6 rt rule info is %d.\n", lan_client_rt_info_count_v6);
}
fail:
@@ -5343,7 +5449,7 @@
return res;
}
-int IPACM_Lan::eth_bridge_del_usb_client_rt_rule(uint8_t* mac)
+int IPACM_Lan::eth_bridge_del_lan_client_rt_rule(uint8_t* mac)
{
if(tx_prop == NULL)
{
@@ -5360,7 +5466,7 @@
int i, position;
/* delete rule from IPv4 rt table first */
- for(i=0; i<usb_client_rt_info_count_v4; i++)
+ for(i=0; i<lan_client_rt_info_count_v4; i++)
{
if(memcmp(eth_bridge_get_client_rt_info_ptr(i, IPA_IP_v4)->mac, mac, sizeof(eth_bridge_get_client_rt_info_ptr(i, IPA_IP_v4)->mac)) == 0)
{
@@ -5369,7 +5475,7 @@
break;
}
}
- if(i == usb_client_rt_info_count_v4)
+ if(i == lan_client_rt_info_count_v4)
{
IPACMERR("The client is not found.\n");
return IPACM_FAILURE;
@@ -5384,16 +5490,16 @@
}
}
- for(i=position+1; i<usb_client_rt_info_count_v4; i++)
+ for(i=position+1; i<lan_client_rt_info_count_v4; i++)
{
memcpy(eth_bridge_get_client_rt_info_ptr(i-1, IPA_IP_v4), eth_bridge_get_client_rt_info_ptr(i, IPA_IP_v4), client_rt_info_size_v4);
}
- memset(eth_bridge_get_client_rt_info_ptr(usb_client_rt_info_count_v4-1, IPA_IP_v4), 0, client_rt_info_size_v4);
- usb_client_rt_info_count_v4--;
- IPACMDBG_H("Now the number of IPv4 rt rule info is %d.\n", usb_client_rt_info_count_v4);
+ memset(eth_bridge_get_client_rt_info_ptr(lan_client_rt_info_count_v4-1, IPA_IP_v4), 0, client_rt_info_size_v4);
+ lan_client_rt_info_count_v4--;
+ IPACMDBG_H("Now the number of IPv4 rt rule info is %d.\n", lan_client_rt_info_count_v4);
/*delete rule from IPv6 rt table */
- for(i=0; i<usb_client_rt_info_count_v6; i++)
+ for(i=0; i<lan_client_rt_info_count_v6; i++)
{
if(memcmp(eth_bridge_get_client_rt_info_ptr(i, IPA_IP_v6)->mac, mac, sizeof(eth_bridge_get_client_rt_info_ptr(i, IPA_IP_v6)->mac)) == 0)
{
@@ -5402,7 +5508,7 @@
break;
}
}
- if(i == usb_client_rt_info_count_v6)
+ if(i == lan_client_rt_info_count_v6)
{
IPACMERR("The client is not found.\n");
return IPACM_FAILURE;
@@ -5417,13 +5523,13 @@
}
}
- for(i=position+1; i<usb_client_rt_info_count_v6; i++)
+ for(i=position+1; i<lan_client_rt_info_count_v6; i++)
{
memcpy(eth_bridge_get_client_rt_info_ptr(i-1, IPA_IP_v6), eth_bridge_get_client_rt_info_ptr(i, IPA_IP_v6), client_rt_info_size_v6);
}
- memset(eth_bridge_get_client_rt_info_ptr(usb_client_rt_info_count_v6-1, IPA_IP_v6), 0, client_rt_info_size_v6);
- usb_client_rt_info_count_v6--;
- IPACMDBG_H("Now the number of IPv6 rt rule info is %d.\n", usb_client_rt_info_count_v6);
+ memset(eth_bridge_get_client_rt_info_ptr(lan_client_rt_info_count_v6-1, IPA_IP_v6), 0, client_rt_info_size_v6);
+ lan_client_rt_info_count_v6--;
+ IPACMDBG_H("Now the number of IPv6 rt rule info is %d.\n", lan_client_rt_info_count_v6);
return IPACM_SUCCESS;
}
@@ -5433,18 +5539,18 @@
void* result;
if(iptype == IPA_IP_v4)
{
- result = (void*)((void*)eth_bridge_usb_client_rt_info_v4 + index * client_rt_info_size_v4);
+ result = (void*)((void*)eth_bridge_lan_client_rt_info_v4 + index * client_rt_info_size_v4);
}
else
{
- result = (void*)((void*)eth_bridge_usb_client_rt_info_v6 + index * client_rt_info_size_v6);
+ result = (void*)((void*)eth_bridge_lan_client_rt_info_v6 + index * client_rt_info_size_v6);
}
return (eth_bridge_client_rt_info*)result;
}
-void IPACM_Lan::eth_bridge_add_usb_client(uint8_t* mac)
+void IPACM_Lan::eth_bridge_add_lan_client(uint8_t* mac)
{
- if(IPACM_Lan::num_usb_client == IPA_LAN_TO_LAN_MAX_USB_CLIENT)
+ if(IPACM_Lan::num_lan_client == IPA_LAN_TO_LAN_MAX_LAN_CLIENT)
{
IPACMDBG_H("USB client table is already full.\n");
return;
@@ -5456,12 +5562,24 @@
return;
}
- memcpy(IPACM_Lan::eth_bridge_usb_client[IPACM_Lan::num_usb_client].mac, mac, sizeof(IPACM_Lan::eth_bridge_usb_client[IPACM_Lan::num_usb_client].mac));
- IPACM_Lan::num_usb_client++;
+ int i;
+ for(i=0; i<IPACM_Lan::num_lan_client; i++)
+ {
+ if(memcmp(IPACM_Lan::eth_bridge_lan_client[i].mac, mac, sizeof(IPACM_Lan::eth_bridge_lan_client[i].mac)) == 0)
+ {
+ IPACMDBG_H("The lan client mac has been added before at position %d.\n", i);
+ return;
+ }
+ }
+
+ memcpy(IPACM_Lan::eth_bridge_lan_client[IPACM_Lan::num_lan_client].mac, mac, sizeof(IPACM_Lan::eth_bridge_lan_client[IPACM_Lan::num_lan_client].mac));
+ IPACM_Lan::eth_bridge_lan_client[IPACM_Lan::num_lan_client].ipa_if_num = ipa_if_num;
+ IPACM_Lan::num_lan_client++;
+ IPACMDBG_H("Now total num of lan clients is %d\n", IPACM_Lan::num_lan_client);
return;
}
-void IPACM_Lan::eth_bridge_del_usb_client(uint8_t* mac)
+void IPACM_Lan::eth_bridge_del_lan_client(uint8_t* mac)
{
if(mac == NULL)
{
@@ -5470,27 +5588,28 @@
}
int i, j;
- for(i=0; i<IPACM_Lan::num_usb_client; i++)
+ for(i=0; i<IPACM_Lan::num_lan_client; i++)
{
- if(memcmp(IPACM_Lan::eth_bridge_usb_client[i].mac, mac, sizeof(IPACM_Lan::eth_bridge_usb_client[i].mac)) == 0)
+ if(memcmp(IPACM_Lan::eth_bridge_lan_client[i].mac, mac, sizeof(IPACM_Lan::eth_bridge_lan_client[i].mac)) == 0)
{
IPACMDBG_H("Found USB client at position %d.\n", i);
break;
}
}
- if(i == IPACM_Lan::num_usb_client)
+ if(i == IPACM_Lan::num_lan_client)
{
IPACMDBG_H("Not finding the USB client.\n");
return;
}
- for(j=i+1; j<IPACM_Lan::num_usb_client; j++)
+ for(j=i+1; j<IPACM_Lan::num_lan_client; j++)
{
- memcpy(IPACM_Lan::eth_bridge_usb_client[j-1].mac, IPACM_Lan::eth_bridge_usb_client[j].mac, sizeof(IPACM_Lan::eth_bridge_usb_client[j].mac));
- IPACM_Lan::eth_bridge_usb_client[j-1].ipa_if_num = IPACM_Lan::eth_bridge_usb_client[j].ipa_if_num;
+ memcpy(IPACM_Lan::eth_bridge_lan_client[j-1].mac, IPACM_Lan::eth_bridge_lan_client[j].mac, sizeof(IPACM_Lan::eth_bridge_lan_client[j].mac));
+ IPACM_Lan::eth_bridge_lan_client[j-1].ipa_if_num = IPACM_Lan::eth_bridge_lan_client[j].ipa_if_num;
}
- IPACM_Lan::num_usb_client--;
+ IPACM_Lan::num_lan_client--;
+ IPACMDBG_H("Now total num of lan clients is %d\n", IPACM_Lan::num_lan_client);
return;
}
@@ -5518,42 +5637,62 @@
int IPACM_Lan::del_hdr_proc_ctx()
{
- if(IPACM_Lan::usb_to_wlan_hdr_proc_ctx.valid == true)
+ if(IPACM_Lan::lan_to_wlan_hdr_proc_ctx.valid == true)
{
- if(m_header.DeleteHeaderProcCtx(IPACM_Lan::usb_to_wlan_hdr_proc_ctx.proc_ctx_hdl) == false)
+ if((IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == WLAN_IF)
+ || (IPACM_Lan::is_usb_up == false && IPACM_Lan::is_cpe_up == false))
{
- IPACMERR("Failed to delete usb to wlan hdr proc ctx.\n");
- return IPACM_FAILURE;
+ if(m_header.DeleteHeaderProcCtx(IPACM_Lan::lan_to_wlan_hdr_proc_ctx.proc_ctx_hdl) == false)
+ {
+ IPACMERR("Failed to delete usb to wlan hdr proc ctx.\n");
+ return IPACM_FAILURE;
+ }
+ IPACM_Lan::lan_to_wlan_hdr_proc_ctx.valid = false;
+
+ ipacm_cmd_q_data evt_data;
+ memset(&evt_data, 0, sizeof(ipacm_cmd_q_data));
+
+ ipacm_event_data_if_cat* cat;
+ cat = (ipacm_event_data_if_cat*)malloc(sizeof(ipacm_event_data_if_cat));
+ if(cat == NULL)
+ {
+ IPACMERR("Unable to allocate memory.\n");
+ return IPACM_FAILURE;
+ }
+ memset(cat, 0, sizeof(ipacm_event_data_if_cat));
+ cat->if_cat = IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat;
+
+ evt_data.evt_data = cat;
+ evt_data.event = IPA_ETH_BRIDGE_HDR_PROC_CTX_UNSET_EVENT;
+ IPACMDBG_H("Posting event IPA_ETH_BRIDGE_HDR_PROC_CTX_UNSET_EVENT\n");
+ IPACM_EvtDispatcher::PostEvt(&evt_data);
}
- IPACM_Lan::usb_to_wlan_hdr_proc_ctx.valid = false;
-
- ipacm_cmd_q_data evt_data;
- memset(&evt_data, 0, sizeof(ipacm_cmd_q_data));
-
- ipacm_event_data_fid* fid;
- fid = (ipacm_event_data_fid*)malloc(sizeof(ipacm_event_data_fid));
- if(fid == NULL)
- {
- IPACMERR("Unable to allocate memory.\n");
- return IPACM_FAILURE;
- }
- memset(fid, 0, sizeof(ipacm_event_data_fid));
- fid->if_index = ipa_if_num;
-
- evt_data.evt_data = fid;
- evt_data.event = IPA_ETH_BRIDGE_HDR_PROC_CTX_UNSET_EVENT;
- IPACMDBG_H("Posting event IPA_ETH_BRIDGE_HDR_PROC_CTX_UNSET_EVENT\n");
- IPACM_EvtDispatcher::PostEvt(&evt_data);
}
if(IPACM_Lan::wlan_to_usb_hdr_proc_ctx.valid == true)
{
- if(m_header.DeleteHeaderProcCtx(IPACM_Lan::wlan_to_usb_hdr_proc_ctx.proc_ctx_hdl) == false)
+ if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == WLAN_IF || IPACM_Lan::is_usb_up == false)
{
- IPACMERR("Failed to delete wlan to usb hdr proc ctx.\n");
- return IPACM_FAILURE;
+ if(m_header.DeleteHeaderProcCtx(IPACM_Lan::wlan_to_usb_hdr_proc_ctx.proc_ctx_hdl) == false)
+ {
+ IPACMERR("Failed to delete wlan to usb hdr proc ctx.\n");
+ return IPACM_FAILURE;
+ }
+ IPACM_Lan::wlan_to_usb_hdr_proc_ctx.valid = false;
}
- IPACM_Lan::wlan_to_usb_hdr_proc_ctx.valid = false;
+ }
+
+ if(IPACM_Lan::wlan_to_cpe_hdr_proc_ctx.valid == true)
+ {
+ if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == WLAN_IF || IPACM_Lan::is_cpe_up == false)
+ {
+ if(m_header.DeleteHeaderProcCtx(IPACM_Lan::wlan_to_cpe_hdr_proc_ctx.proc_ctx_hdl) == false)
+ {
+ IPACMERR("Failed to delete wlan to cpe hdr proc ctx.\n");
+ return IPACM_FAILURE;
+ }
+ IPACM_Lan::wlan_to_cpe_hdr_proc_ctx.valid = false;
+ }
}
if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == WLAN_IF)
diff --git a/ipacm/src/IPACM_LanToLan.cpp b/ipacm/src/IPACM_LanToLan.cpp
index c3c589b..0abfc42 100644
--- a/ipacm/src/IPACM_LanToLan.cpp
+++ b/ipacm/src/IPACM_LanToLan.cpp
@@ -54,8 +54,8 @@
{
num_offload_pair_v4_ = 0;
num_offload_pair_v6_ = 0;
- client_info_v4_.reserve(IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_USB_CLIENT);
- client_info_v6_.reserve(3*(IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_USB_CLIENT));
+ client_info_v4_.reserve(IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_LAN_CLIENT);
+ client_info_v6_.reserve(3*(IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_LAN_CLIENT));
p_instance = this;
IPACM_EvtDispatcher::registr(IPA_LAN_CLIENT_ACTIVE, this);
diff --git a/ipacm/src/IPACM_Main.cpp b/ipacm/src/IPACM_Main.cpp
index 3cc58e1..1e3cce7 100644
--- a/ipacm/src/IPACM_Main.cpp
+++ b/ipacm/src/IPACM_Main.cpp
@@ -112,13 +112,14 @@
__stringify(IPA_LAN_CLIENT_POWER_RECOVER), /* 33 ipacm_event_lan_client*/
__stringify(IPA_LAN_TO_LAN_NEW_CONNECTION), /* 34 ipacm_event_connection */
__stringify(IPA_LAN_TO_LAN_DEL_CONNECTION), /* 35 ipacm_event_connection */
- __stringify(IPA_LAN_DELETE_SELF), /* 36 ipacm_event_data_fid */
- __stringify(IPA_WLAN_LINK_DOWN_EVENT), /* 37 ipacm_event_data_mac */
- __stringify(IPA_USB_LINK_UP_EVENT), /* 38 ipacm_event_data_fid */
- __stringify(IPA_PROCESS_CT_MESSAGE_V6), /* 39 ipacm_ct_evt_data */
+ __stringify(IPA_LAN_DELETE_SELF), /* 36 ipacm_event_data_fid */
+ __stringify(IPA_WLAN_LINK_DOWN_EVENT), /* 37 ipacm_event_data_mac */
+ __stringify(IPA_USB_LINK_UP_EVENT), /* 38 ipacm_event_data_fid */
+ __stringify(IPA_PROCESS_CT_MESSAGE_V6), /* 39 ipacm_ct_evt_data */
__stringify(IPA_PRIVATE_SUBNET_CHANGE_EVENT), /* 40 ipacm_event_data_fid */
__stringify(IPA_WAN_UPSTREAM_ROUTE_ADD_EVENT), /* 41 ipacm_event_data_fid */
__stringify(IPA_WAN_UPSTREAM_ROUTE_DEL_EVENT), /* 42 ipacm_event_data_fid */
+ __stringify(IPA_WAN_XLAT_CONNECT_EVENT), /* 43 ipacm_event_data_fid */
};
#define IPA_DRIVER "/dev/ipa"
@@ -252,8 +253,8 @@
}
-/* start IPACM WLAN-driver notifier */
-void* ipa_driver_wlan_notifier(void *param)
+/* start IPACM wan-driver notifier */
+void* ipa_driver_msg_notifier(void *param)
{
int length, fd, cnt;
char buffer[IPA_DRIVER_WLAN_BUF_LEN];
@@ -266,7 +267,7 @@
ipacm_cmd_q_data evt_data;
ipacm_event_data_mac *data = NULL;
- ipacm_event_data_fid *data_fid = NULL;
+ ipacm_event_data_fid *data_fid = NULL;
ipacm_event_data_iptype *data_iptype = NULL;
ipacm_event_data_wlan_ex *data_ex;
@@ -537,7 +538,7 @@
case ECM_CONNECT:
memcpy(&event_ecm, buffer + sizeof(struct ipa_msg_meta), sizeof(struct ipa_ecm_msg));
IPACMDBG_H("Received ECM_CONNECT name: %s\n",event_ecm.name);
- data_fid = (ipacm_event_data_fid *)malloc(sizeof(ipacm_event_data_fid));
+ data_fid = (ipacm_event_data_fid *)malloc(sizeof(ipacm_event_data_fid));
if(data_fid == NULL)
{
IPACMERR("unable to allocate memory for event_ecm data_fid\n");
@@ -565,7 +566,7 @@
case WAN_UPSTREAM_ROUTE_ADD:
memcpy(&event_wan, buffer + sizeof(struct ipa_msg_meta), sizeof(struct ipa_wan_msg));
IPACMDBG_H("Received WAN_UPSTREAM_ROUTE_ADD name: %s, tethered name: %s\n", event_wan.upstream_ifname, event_wan.tethered_ifname);
- data_iptype = (ipacm_event_data_iptype *)malloc(sizeof(ipacm_event_data_iptype));
+ data_iptype = (ipacm_event_data_iptype *)malloc(sizeof(ipacm_event_data_iptype));
if(data_iptype == NULL)
{
IPACMERR("unable to allocate memory for event_ecm data_iptype\n");
@@ -580,7 +581,7 @@
case WAN_UPSTREAM_ROUTE_DEL:
memcpy(&event_wan, buffer + sizeof(struct ipa_msg_meta), sizeof(struct ipa_wan_msg));
IPACMDBG_H("Received WAN_UPSTREAM_ROUTE_DEL name: %s, tethered name: %s\n", event_wan.upstream_ifname, event_wan.tethered_ifname);
- data_iptype = (ipacm_event_data_iptype *)malloc(sizeof(ipacm_event_data_iptype));
+ data_iptype = (ipacm_event_data_iptype *)malloc(sizeof(ipacm_event_data_iptype));
if(data_iptype == NULL)
{
IPACMERR("unable to allocate memory for event_ecm data_iptype\n");
@@ -611,6 +612,8 @@
case WLAN_SWITCH_TO_SCC:
IPACMDBG_H("Received WLAN_SWITCH_TO_SCC\n");
+ case WLAN_WDI_ENABLE:
+ IPACMDBG_H("Received WLAN_WDI_ENABLE\n");
if (IPACM_Iface::ipacmcfg->isMCC_Mode == true)
{
IPACM_Iface::ipacmcfg->isMCC_Mode = false;
@@ -620,6 +623,8 @@
continue;
case WLAN_SWITCH_TO_MCC:
IPACMDBG_H("Received WLAN_SWITCH_TO_MCC\n");
+ case WLAN_WDI_DISABLE:
+ IPACMDBG_H("Received WLAN_WDI_DISABLE\n");
if (IPACM_Iface::ipacmcfg->isMCC_Mode == false)
{
IPACM_Iface::ipacmcfg->isMCC_Mode == true;
@@ -627,12 +632,46 @@
break;
}
continue;
+
+ case WAN_XLAT_CONNECT:
+ memcpy(&event_wan, buffer + sizeof(struct ipa_msg_meta),
+ sizeof(struct ipa_wan_msg));
+ IPACMDBG_H("Received WAN_XLAT_CONNECT name: %s\n",
+ event_wan.upstream_ifname);
+
+ /* post IPA_LINK_UP_EVENT event
+ * may be WAN interface is not up
+ */
+ data_fid = (ipacm_event_data_fid *)calloc(1, sizeof(ipacm_event_data_fid));
+ if(data_fid == NULL)
+ {
+ IPACMERR("unable to allocate memory for xlat event\n");
+ return NULL;
+ }
+ ipa_get_if_index(event_wan.upstream_ifname, &(data_fid->if_index));
+ evt_data.event = IPA_LINK_UP_EVENT;
+ evt_data.evt_data = data_fid;
+ IPACMDBG_H("Posting IPA_LINK_UP_EVENT event:%d\n", evt_data.event);
+ IPACM_EvtDispatcher::PostEvt(&evt_data);
+
+ /* post IPA_WAN_XLAT_CONNECT_EVENT event */
+ memset(&evt_data, 0, sizeof(evt_data));
+ data_fid = (ipacm_event_data_fid *)calloc(1, sizeof(ipacm_event_data_fid));
+ if(data_fid == NULL)
+ {
+ IPACMERR("unable to allocate memory for xlat event\n");
+ return NULL;
+ }
+ ipa_get_if_index(event_wan.upstream_ifname, &(data_fid->if_index));
+ evt_data.event = IPA_WAN_XLAT_CONNECT_EVENT;
+ evt_data.evt_data = data_fid;
+ IPACMDBG_H("Posting IPA_WAN_XLAT_CONNECT_EVENT event:%d\n", evt_data.event);
+ break;
default:
IPACMDBG_H("Unhandled message type: %d\n", event_hdr.msg_type);
continue;
}
-
/* finish command queue */
IPACMDBG_H("Posting event:%d\n", evt_data.event);
IPACM_EvtDispatcher::PostEvt(&evt_data);
@@ -758,7 +797,7 @@
if (IPACM_SUCCESS == ipa_driver_thread)
{
- ret = pthread_create(&ipa_driver_thread, NULL, ipa_driver_wlan_notifier, NULL);
+ ret = pthread_create(&ipa_driver_thread, NULL, ipa_driver_msg_notifier, NULL);
if (IPACM_SUCCESS != ret)
{
IPACMERR("unable to create ipa_driver_wlan thread\n");
diff --git a/ipacm/src/IPACM_Wan.cpp b/ipacm/src/IPACM_Wan.cpp
index 785d8e2..552d6d2 100644
--- a/ipacm/src/IPACM_Wan.cpp
+++ b/ipacm/src/IPACM_Wan.cpp
@@ -52,6 +52,7 @@
bool IPACM_Wan::wan_up = false;
bool IPACM_Wan::wan_up_v6 = false;
+uint8_t IPACM_Wan::xlat_mux_id = 0;
int IPACM_Wan::num_v4_flt_rule = 0;
int IPACM_Wan::num_v6_flt_rule = 0;
@@ -71,8 +72,8 @@
uint32_t IPACM_Wan::backhaul_ipv6_prefix[2];
IPACM_Wan::IPACM_Wan(int iface_index,
- ipacm_wan_iface_type is_sta_mode,
- uint8_t *mac_addr) : IPACM_Iface(iface_index)
+ ipacm_wan_iface_type is_sta_mode,
+ uint8_t *mac_addr) : IPACM_Iface(iface_index)
{
num_firewall_v4 = 0;
num_firewall_v6 = 0;
@@ -108,6 +109,9 @@
num_wan_client = 0;
header_name_count = 0;
memset(invalid_mac, 0, sizeof(invalid_mac));
+
+ is_xlat = false;
+
if(iface_query != NULL)
{
wan_client_len = (sizeof(ipa_wan_client)) + (iface_query->num_tx_props * sizeof(wan_client_rt_hdl));
@@ -502,6 +506,19 @@
}
break;
+ case IPA_WAN_XLAT_CONNECT_EVENT:
+ {
+ IPACMDBG_H("Recieved IPA_WAN_XLAT_CONNECT_EVENT\n");
+ ipacm_event_data_fid *data = (ipacm_event_data_fid *)param;
+ ipa_interface_index = IPACM_Iface::iface_ipa_index_query(data->if_index);
+ 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",
+ IPACM_Iface::ipacmcfg->iface_table[ipa_interface_index].iface_name,data->if_index, is_xlat);
+ }
+ break;
+ }
case IPA_CFG_CHANGE_EVENT:
{
if ( (IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ipa_if_cate) &&
@@ -785,15 +802,21 @@
/* Check & construct STA header */
handle_sta_header_add_evt();
handle_route_add_evt(data->iptype);
+ /* Add IPv6 routing table if XLAT is enabled */
+ if(is_xlat && (m_is_sta_mode == Q6_WAN) && (active_v6 == false))
+ {
+ IPACMDBG_H("XLAT enabled: adding IPv6 routing table dev (%s)\n", dev_name);
+ handle_route_add_evt(IPA_IP_v6);
+ }
}
else if ((data->iptype == IPA_IP_v6) &&
- (!data->ipv6_addr[0]) && (!data->ipv6_addr[1]) && (!data->ipv6_addr[2]) && (!data->ipv6_addr[3]) && (active_v6 == false)
- && (ip_type == IPA_IP_v6 || ip_type == IPA_IP_MAX))
+ (!data->ipv6_addr[0]) && (!data->ipv6_addr[1]) && (!data->ipv6_addr[2]) && (!data->ipv6_addr[3]) &&
+ (active_v6 == false) && (ip_type == IPA_IP_v6 || ip_type == IPA_IP_MAX))
{
IPACMDBG_H("\n get default v6 route (dst:00.00.00.00)\n");
IPACMDBG_H(" IPV6 value: %08x:%08x:%08x:%08x \n",
- data->ipv6_addr[0], data->ipv6_addr[1], data->ipv6_addr[2], data->ipv6_addr[3]);
- handle_route_add_evt(data->iptype);
+ data->ipv6_addr[0], data->ipv6_addr[1], data->ipv6_addr[2], data->ipv6_addr[3]);
+ handle_route_add_evt(data->iptype);
}
}
else /* double check if current default iface is not itself */
@@ -1375,8 +1398,24 @@
}
IPACMDBG_H("Posting IPA_HANDLE_WAN_UP with below information:\n");
IPACMDBG_H("if_name:%s, ipv4_address:0x%x, is sta mode:%d\n",
- wanup_data->ifname, wanup_data->ipv4_addr, wanup_data->is_sta);
+ wanup_data->ifname, wanup_data->ipv4_addr, wanup_data->is_sta);
memset(&evt_data, 0, sizeof(evt_data));
+
+ /* send xlat configuration for installing uplink rules */
+ if(is_xlat && (m_is_sta_mode == Q6_WAN))
+ {
+ 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",
+ is_xlat, xlat_mux_id);
+ }
+ else
+ {
+ IPACM_Wan::xlat_mux_id = 0;
+ wanup_data->xlat_mux_id = 0;
+ IPACMDBG_H("No xlat configuratio:\n");
+ }
evt_data.event = IPA_HANDLE_WAN_UP;
evt_data.evt_data = (void *)wanup_data;
IPACM_EvtDispatcher::PostEvt(&evt_data);
@@ -3003,12 +3042,14 @@
return ret;
}
- IPACMDBG_H("Wan interface has %d tx props, %d rx props and %d ext props\n", iface_query->num_tx_props, iface_query->num_rx_props, iface_query->num_ext_props);
+ IPACMDBG_H("Wan interface has %d tx props, %d rx props and %d ext props\n",
+ iface_query->num_tx_props, iface_query->num_rx_props, iface_query->num_ext_props);
for (cnt = 0; cnt < ext_prop->num_ext_props; cnt++)
{
- IPACMDBG_H("Ex(%d): ip-type: %d, mux_id: %d, flt_action: %d\n, rt_tbl_idx: %d, flt_hdr: %d \n",
- cnt, ext_prop->ext[cnt].ip, ext_prop->ext[cnt].mux_id, ext_prop->ext[cnt].action, ext_prop->ext[cnt].rt_tbl_idx, ext_prop->ext[cnt].filter_hdl);
+ IPACMDBG_H("Ex(%d): ip-type: %d, mux_id: %d, flt_action: %d\n, rt_tbl_idx: %d, flt_hdr: %d is_xlat_rule: %d\n",
+ cnt, ext_prop->ext[cnt].ip, ext_prop->ext[cnt].mux_id, ext_prop->ext[cnt].action,
+ ext_prop->ext[cnt].rt_tbl_idx, ext_prop->ext[cnt].filter_hdl, ext_prop->ext[cnt].is_xlat_rule);
}
if(IPACM_Wan::is_ext_prop_set == false)
@@ -3763,8 +3804,11 @@
/* Delete corresponding ipa_rm_resource_name of TX-endpoint after delete IPV4/V6 RT-rule */
IPACMDBG_H("dev %s add producer dependency\n", dev_name);
- IPACMDBG_H("depend Got pipe %d rm index : %d \n", tx_prop->tx[0].dst_pipe, IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[tx_prop->tx[0].dst_pipe]);
- IPACM_Iface::ipacmcfg->DelRmDepend(IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[tx_prop->tx[0].dst_pipe]);
+ if (tx_prop != NULL)
+ {
+ IPACMDBG_H("depend Got pipe %d rm index : %d \n", tx_prop->tx[0].dst_pipe, IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[tx_prop->tx[0].dst_pipe]);
+ IPACM_Iface::ipacmcfg->DelRmDepend(IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[tx_prop->tx[0].dst_pipe]);
+ }
/* no iface address up, directly close iface*/
if (ip_type == IPACM_IP_NULL)
@@ -3970,8 +4014,11 @@
embms_is_on = false;
/* Delete corresponding ipa_rm_resource_name of TX-endpoint after delete IPV4/V6 RT-rule */
IPACMDBG_H("dev %s add producer dependency\n", dev_name);
- IPACMDBG_H("depend Got pipe %d rm index : %d \n", tx_prop->tx[0].dst_pipe, IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[tx_prop->tx[0].dst_pipe]);
- IPACM_Iface::ipacmcfg->DelRmDepend(IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[tx_prop->tx[0].dst_pipe]);
+ if (tx_prop != NULL)
+ {
+ IPACMDBG_H("depend Got pipe %d rm index : %d \n", tx_prop->tx[0].dst_pipe, IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[tx_prop->tx[0].dst_pipe]);
+ IPACM_Iface::ipacmcfg->DelRmDepend(IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[tx_prop->tx[0].dst_pipe]);
+ }
if (rx_prop != NULL)
{
diff --git a/ipacm/src/IPACM_Wlan.cpp b/ipacm/src/IPACM_Wlan.cpp
index f75b806..6a5705f 100644
--- a/ipacm/src/IPACM_Wlan.cpp
+++ b/ipacm/src/IPACM_Wlan.cpp
@@ -61,8 +61,8 @@
lan2lan_flt_rule_hdl IPACM_Wlan::self_client_flt_rule_hdl_v4[IPA_LAN_TO_LAN_MAX_WLAN_CLIENT];
lan2lan_flt_rule_hdl IPACM_Wlan::self_client_flt_rule_hdl_v6[IPA_LAN_TO_LAN_MAX_WLAN_CLIENT];
-lan2lan_flt_rule_hdl IPACM_Wlan::usb_client_flt_rule_hdl_v4[IPA_LAN_TO_LAN_MAX_USB_CLIENT];
-lan2lan_flt_rule_hdl IPACM_Wlan::usb_client_flt_rule_hdl_v6[IPA_LAN_TO_LAN_MAX_USB_CLIENT];
+lan2lan_flt_rule_hdl IPACM_Wlan::lan_client_flt_rule_hdl_v4[IPA_LAN_TO_LAN_MAX_LAN_CLIENT];
+lan2lan_flt_rule_hdl IPACM_Wlan::lan_client_flt_rule_hdl_v6[IPA_LAN_TO_LAN_MAX_LAN_CLIENT];
IPACM_Wlan::IPACM_Wlan(int iface_index) : IPACM_Lan(iface_index)
{
@@ -112,8 +112,8 @@
#ifdef FEATURE_ETH_BRIDGE_LE
exp_index_v4 = IPV4_DEFAULT_FILTERTING_RULES + 2 * IPACM_Iface::ipacmcfg->ipa_num_private_subnet
- + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_USB_CLIENT + NUM_IPV4_ICMP_FLT_RULE;
- exp_index_v6 = IPV6_DEFAULT_FILTERTING_RULES + 1 + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_USB_CLIENT + NUM_IPV6_PREFIX_FLT_RULE
+ + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_LAN_CLIENT + NUM_IPV4_ICMP_FLT_RULE;
+ exp_index_v6 = IPV6_DEFAULT_FILTERTING_RULES + 1 + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_LAN_CLIENT + NUM_IPV6_PREFIX_FLT_RULE
+ NUM_IPV6_ICMP_FLT_RULE;
#else
#ifndef CT_OPT
@@ -135,28 +135,27 @@
memset(wlan_guest_ap_flt_rule_hdl_v4, 0, IPA_MAX_PRIVATE_SUBNET_ENTRIES * sizeof(uint32_t));
wlan_guest_ap_flt_rule_hdl_v6 = 0;
is_guest_ap = false;
- num_usb_client = 0;
- memset(eth_bridge_usb_client_flt_info, 0, IPA_LAN_TO_LAN_MAX_USB_CLIENT * sizeof(eth_bridge_client_flt_info));
- num_usb_client = 0;
- eth_bridge_wlan_client_rt_from_usb_info_v4 = NULL;
- eth_bridge_wlan_client_rt_from_usb_info_v6 = NULL;
+ memset(eth_bridge_lan_client_flt_info, 0, IPA_LAN_TO_LAN_MAX_LAN_CLIENT * sizeof(eth_bridge_client_flt_info));
+ lan_client_flt_info_count = 0;
+ eth_bridge_wlan_client_rt_from_lan_info_v4 = NULL;
+ eth_bridge_wlan_client_rt_from_lan_info_v6 = NULL;
eth_bridge_wlan_client_rt_from_wlan_info_v4 = NULL;
eth_bridge_wlan_client_rt_from_wlan_info_v6 = NULL;
if(tx_prop != NULL)
{
#ifdef FEATURE_ETH_BRIDGE_LE
client_rt_info_size_v4 = sizeof(eth_bridge_client_rt_info) + each_client_rt_rule_count_v4 * sizeof(uint32_t);
- eth_bridge_wlan_client_rt_from_usb_info_v4 = (eth_bridge_client_rt_info*)calloc(IPA_LAN_TO_LAN_MAX_WLAN_CLIENT, client_rt_info_size_v4);
+ eth_bridge_wlan_client_rt_from_lan_info_v4 = (eth_bridge_client_rt_info*)calloc(IPA_LAN_TO_LAN_MAX_WLAN_CLIENT, client_rt_info_size_v4);
eth_bridge_wlan_client_rt_from_wlan_info_v4 = (eth_bridge_client_rt_info*)calloc(IPA_LAN_TO_LAN_MAX_WLAN_CLIENT, client_rt_info_size_v4);
client_rt_info_size_v6 = sizeof(eth_bridge_client_rt_info) + each_client_rt_rule_count_v6 * sizeof(uint32_t);
- eth_bridge_wlan_client_rt_from_usb_info_v6 = (eth_bridge_client_rt_info*)calloc(IPA_LAN_TO_LAN_MAX_WLAN_CLIENT, client_rt_info_size_v6);
+ eth_bridge_wlan_client_rt_from_lan_info_v6 = (eth_bridge_client_rt_info*)calloc(IPA_LAN_TO_LAN_MAX_WLAN_CLIENT, client_rt_info_size_v6);
eth_bridge_wlan_client_rt_from_wlan_info_v6 = (eth_bridge_client_rt_info*)calloc(IPA_LAN_TO_LAN_MAX_WLAN_CLIENT, client_rt_info_size_v6);
#endif
}
- wlan_client_rt_from_usb_info_count_v4 = 0;
- wlan_client_rt_from_usb_info_count_v6 = 0;
+ wlan_client_rt_from_lan_info_count_v4 = 0;
+ wlan_client_rt_from_lan_info_count_v6 = 0;
wlan_client_rt_from_wlan_info_count_v4 = 0;
wlan_client_rt_from_wlan_info_count_v6 = 0;
#ifdef FEATURE_ETH_BRIDGE_LE
@@ -346,7 +345,8 @@
if(IPACM_Wan::backhaul_is_sta_mode == false)
{
ext_prop = IPACM_Iface::ipacmcfg->GetExtProp(IPA_IP_v4);
- IPACM_Lan::handle_wan_up_ex(ext_prop, IPA_IP_v4);
+ IPACM_Lan::handle_wan_up_ex(ext_prop, IPA_IP_v4,
+ IPACM_Wan::getXlat_Mux_Id());
}
else
{
@@ -366,7 +366,7 @@
if(IPACM_Wan::backhaul_is_sta_mode == false)
{
ext_prop = IPACM_Iface::ipacmcfg->GetExtProp(IPA_IP_v6);
- IPACM_Lan::handle_wan_up_ex(ext_prop, IPA_IP_v6);
+ IPACM_Lan::handle_wan_up_ex(ext_prop, IPA_IP_v6, 0);
}
else
{
@@ -389,7 +389,6 @@
break;
case IPA_HANDLE_WAN_UP:
- {
IPACMDBG_H("Received IPA_HANDLE_WAN_UP event\n");
data_wan = (ipacm_event_iface_up*)param;
@@ -401,17 +400,16 @@
IPACMDBG_H("Backhaul is sta mode?%d\n", data_wan->is_sta);
if(ip_type == IPA_IP_v4 || ip_type == IPA_IP_MAX)
{
- if(data_wan->is_sta == false)
- {
+ if(data_wan->is_sta == false)
+ {
ext_prop = IPACM_Iface::ipacmcfg->GetExtProp(IPA_IP_v4);
- IPACM_Lan::handle_wan_up_ex(ext_prop, IPA_IP_v4);
+ IPACM_Lan::handle_wan_up_ex(ext_prop, IPA_IP_v4, data_wan->xlat_mux_id);
}
- else
- {
- IPACM_Lan::handle_wan_up(IPA_IP_v4);
+ else
+ {
+ IPACM_Lan::handle_wan_up(IPA_IP_v4);
+ }
}
- }
- }
break;
case IPA_HANDLE_WAN_UP_V6:
@@ -436,7 +434,7 @@
if(data_wan->is_sta == false)
{
ext_prop = IPACM_Iface::ipacmcfg->GetExtProp(IPA_IP_v6);
- IPACM_Lan::handle_wan_up_ex(ext_prop, IPA_IP_v6);
+ IPACM_Lan::handle_wan_up_ex(ext_prop, IPA_IP_v6, 0);
}
else
{
@@ -513,10 +511,10 @@
eth_bridge_add_wlan_client_rt_rule(data->attribs[i].u.mac_addr, SRC_WLAN, IPA_IP_v4);
eth_bridge_add_wlan_client_rt_rule(data->attribs[i].u.mac_addr, SRC_WLAN, IPA_IP_v6);
}
- if(IPACM_Lan::usb_to_wlan_hdr_proc_ctx.valid == true)
+ if(IPACM_Lan::lan_to_wlan_hdr_proc_ctx.valid == true)
{
- eth_bridge_add_wlan_client_rt_rule(data->attribs[i].u.mac_addr, SRC_USB, IPA_IP_v4);
- eth_bridge_add_wlan_client_rt_rule(data->attribs[i].u.mac_addr, SRC_USB, IPA_IP_v6);
+ eth_bridge_add_wlan_client_rt_rule(data->attribs[i].u.mac_addr, SRC_LAN, IPA_IP_v4);
+ eth_bridge_add_wlan_client_rt_rule(data->attribs[i].u.mac_addr, SRC_LAN, IPA_IP_v6);
}
if(ip_type == IPA_IP_v4 || ip_type == IPA_IP_MAX)
{
@@ -547,9 +545,9 @@
IPACMDBG_H("Received IPA_WLAN_CLIENT_DEL_EVENT\n");
#ifdef FEATURE_ETH_BRIDGE_LE
eth_bridge_del_wlan_client_rt_rule(data->mac_addr, SRC_WLAN);
- if(IPACM_Lan::usb_to_wlan_hdr_proc_ctx.valid == true)
+ if(IPACM_Lan::lan_to_wlan_hdr_proc_ctx.valid == true)
{
- eth_bridge_del_wlan_client_rt_rule(data->mac_addr, SRC_USB);
+ eth_bridge_del_wlan_client_rt_rule(data->mac_addr, SRC_LAN);
}
eth_bridge_del_self_client_flt_rule(data->mac_addr);
eth_bridge_post_lan_client_event(data->mac_addr, IPA_ETH_BRIDGE_WLAN_CLIENT_DEL_EVENT);
@@ -657,19 +655,19 @@
IPACM_Iface::handle_software_routing_disable();
break;
- case IPA_ETH_BRIDGE_USB_CLIENT_ADD_EVENT:
+ case IPA_ETH_BRIDGE_LAN_CLIENT_ADD_EVENT:
{
- IPACMDBG_H("Received IPA_ETH_BRIDGE_USB_CLIENT_ADD_EVENT event.\n");
+ IPACMDBG_H("Received IPA_ETH_BRIDGE_LAN_CLIENT_ADD_EVENT event.\n");
ipacm_event_data_mac* mac = (ipacm_event_data_mac*)param;
if(mac != NULL)
{
if(ip_type == IPA_IP_v4 || ip_type == IPA_IP_MAX)
{
- eth_bridge_add_usb_client_flt_rule(mac->mac_addr, IPA_IP_v4);
+ eth_bridge_add_lan_client_flt_rule(mac->mac_addr, IPA_IP_v4);
}
if(ip_type == IPA_IP_v6 || ip_type == IPA_IP_MAX)
{
- eth_bridge_add_usb_client_flt_rule(mac->mac_addr, IPA_IP_v6);
+ eth_bridge_add_lan_client_flt_rule(mac->mac_addr, IPA_IP_v6);
}
}
else
@@ -679,17 +677,17 @@
}
break;
- case IPA_ETH_BRIDGE_USB_CLIENT_DEL_EVENT:
+ case IPA_ETH_BRIDGE_LAN_CLIENT_DEL_EVENT:
{
- IPACMDBG_H("Received IPA_ETH_BRIDGE_USB_CLIENT_DEL_EVENT event.\n");
+ IPACMDBG_H("Received IPA_ETH_BRIDGE_LAN_CLIENT_DEL_EVENT event.\n");
ipacm_event_data_mac* mac = (ipacm_event_data_mac*)param;
if(mac != NULL)
{
if(wlan_ap_index == 0)
{
- if(eth_bridge_del_usb_client_flt_rule(mac->mac_addr) == IPACM_FAILURE)
+ if(eth_bridge_del_lan_client_flt_rule(mac->mac_addr) == IPACM_FAILURE)
{
- IPACMDBG_H("Failed to delete usb client MAC based flt rule.\n");
+ IPACMDBG_H("Failed to delete lan client MAC based flt rule.\n");
}
}
}
@@ -704,23 +702,23 @@
{
IPACMDBG_H("Received IPA_ETH_BRIDGE_HDR_PROC_CTX_SET_EVENT event.\n");
int i;
- ipacm_event_data_fid* fid = (ipacm_event_data_fid*)param;
- if(fid == NULL)
+ ipacm_event_data_if_cat* cat = (ipacm_event_data_if_cat*)param;
+ if(cat == NULL)
{
IPACMERR("Event data is empty.\n");
return;
}
- if(fid->if_index == ipa_if_num)
+ if(cat->if_cat != LAN_IF && cat->if_cat != ODU_IF)
{
- IPACMDBG_H("The event was sent by the same interface, ignore.\n");
+ IPACMDBG_H("The event was not sent by LAN interface, ignore.\n");
return;
}
for(i=0; i<IPACM_Lan::num_wlan_client; i++)
{
if(IPACM_Lan::eth_bridge_wlan_client[i].ipa_if_num == ipa_if_num)
{
- eth_bridge_add_wlan_client_rt_rule(IPACM_Lan::eth_bridge_wlan_client[i].mac, SRC_USB, IPA_IP_v4);
- eth_bridge_add_wlan_client_rt_rule(IPACM_Lan::eth_bridge_wlan_client[i].mac, SRC_USB, IPA_IP_v6);
+ eth_bridge_add_wlan_client_rt_rule(IPACM_Lan::eth_bridge_wlan_client[i].mac, SRC_LAN, IPA_IP_v4);
+ eth_bridge_add_wlan_client_rt_rule(IPACM_Lan::eth_bridge_wlan_client[i].mac, SRC_LAN, IPA_IP_v6);
}
}
}
@@ -730,15 +728,15 @@
{
IPACMDBG_H("Received IPA_ETH_BRIDGE_HDR_PROC_CTX_UNSET_EVENT event.\n");
int i;
- ipacm_event_data_fid* fid = (ipacm_event_data_fid*)param;
- if(fid == NULL)
+ ipacm_event_data_if_cat* cat = (ipacm_event_data_if_cat*)param;
+ if(cat == NULL)
{
IPACMERR("Event data is empty.\n");
return;
}
- if(fid->if_index == ipa_if_num)
+ if(cat->if_cat != LAN_IF && cat->if_cat != ODU_IF)
{
- IPACMDBG_H("The event was sent by the same interface, ignore.\n");
+ IPACMDBG_H("The event was not sent by LAN interface, ignore.\n");
return;
}
@@ -746,7 +744,7 @@
{
if(IPACM_Lan::eth_bridge_wlan_client[i].ipa_if_num == ipa_if_num)
{
- eth_bridge_del_wlan_client_rt_rule(IPACM_Lan::eth_bridge_wlan_client[i].mac, SRC_USB);
+ eth_bridge_del_wlan_client_rt_rule(IPACM_Lan::eth_bridge_wlan_client[i].mac, SRC_LAN);
}
}
}
@@ -983,7 +981,7 @@
return IPACM_FAILURE;
}
#ifdef FEATURE_ETH_BRIDGE_LE
- offset = 1 + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_USB_CLIENT;
+ offset = 1 + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_LAN_CLIENT;
#else
#ifndef CT_OPT
offset = wlan_ap_index * (IPV6_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR) + MAX_OFFLOAD_PAIR;
@@ -1172,7 +1170,7 @@
return IPACM_FAILURE;
}
#ifdef FEATURE_ETH_BRIDGE_LE
- offset = IPV4_DEFAULT_FILTERTING_RULES + IPACM_Iface::ipacmcfg->ipa_num_private_subnet + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_USB_CLIENT;
+ offset = IPV4_DEFAULT_FILTERTING_RULES + IPACM_Iface::ipacmcfg->ipa_num_private_subnet + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_LAN_CLIENT;
#else
#ifndef CT_OPT
offset = wlan_ap_index * (IPV4_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR + IPACM_Iface::ipacmcfg->ipa_num_private_subnet)
@@ -1252,16 +1250,16 @@
}
/* install UL filter rule from Q6 */
-int IPACM_Wlan::handle_uplink_filter_rule(ipacm_ext_prop* prop, ipa_ip_type iptype)
+int IPACM_Wlan::handle_uplink_filter_rule(ipacm_ext_prop *prop, ipa_ip_type iptype, uint8_t xlat_mux_id)
{
ipa_flt_rule_add flt_rule_entry;
int len = 0, cnt, ret = IPACM_SUCCESS, index;
ipa_ioc_add_flt_rule *pFilteringTable;
ipa_fltr_installed_notif_req_msg_v01 flt_index;
- int fd;
- int i;
+ int fd, i;
+ uint32_t value = 0;
- IPACMDBG_H("Set extended property rules in LAN\n");
+ IPACMDBG_H("Set extended property rules in WLAN\n");
if (rx_prop == NULL)
{
@@ -1364,6 +1362,20 @@
&prop->prop[cnt].eq_attrib,
sizeof(prop->prop[cnt].eq_attrib));
flt_rule_entry.rule.rt_tbl_idx = prop->prop[cnt].rt_tbl_idx;
+
+ /* Handle XLAT configuration */
+ if ((iptype == IPA_IP_v4) && prop->prop[cnt].is_xlat_rule && (xlat_mux_id != 0))
+ {
+ /* fill the value of meta-data */
+ value = xlat_mux_id;
+ flt_rule_entry.rule.eq_attrib.metadata_meq32_present = 1;
+ flt_rule_entry.rule.eq_attrib.metadata_meq32.offset = 0;
+ flt_rule_entry.rule.eq_attrib.metadata_meq32.value = (value & 0xFF) << 16;
+ flt_rule_entry.rule.eq_attrib.metadata_meq32.mask = 0x00FF0000;
+ IPACMDBG_H("xlat meta-data is modified for rule: %d has index: %d with xlat_mux_id: %d\n",
+ cnt, index, xlat_mux_id);
+ }
+
memcpy(&pFilteringTable->rules[cnt], &flt_rule_entry, sizeof(flt_rule_entry));
IPACMDBG_H("Modem UL filtering rule %d has index %d\n", cnt, index);
@@ -2443,7 +2455,7 @@
eth_bridge_del_self_client_flt_rule(get_client_memptr(wlan_client, i)->mac);
eth_bridge_post_lan_client_event(get_client_memptr(wlan_client, i)->mac, IPA_ETH_BRIDGE_WLAN_CLIENT_DEL_EVENT);
eth_bridge_del_wlan_client_rt_rule(get_client_memptr(wlan_client, i)->mac, SRC_WLAN);
- eth_bridge_del_wlan_client_rt_rule(get_client_memptr(wlan_client, i)->mac, SRC_USB);
+ eth_bridge_del_wlan_client_rt_rule(get_client_memptr(wlan_client, i)->mac, SRC_LAN);
#endif
/* First reset nat rules and then route rules */
if(get_client_memptr(wlan_client, i)->ipv4_set == true)
@@ -2539,21 +2551,21 @@
free(iface_query);
}
#ifdef FEATURE_ETH_BRIDGE_LE
- if(eth_bridge_usb_client_rt_info_v4 != NULL)
+ if(eth_bridge_lan_client_rt_info_v4 != NULL)
{
- free(eth_bridge_usb_client_rt_info_v4);
+ free(eth_bridge_lan_client_rt_info_v4);
}
- if(eth_bridge_usb_client_rt_info_v6 != NULL)
+ if(eth_bridge_lan_client_rt_info_v6 != NULL)
{
- free(eth_bridge_usb_client_rt_info_v6);
+ free(eth_bridge_lan_client_rt_info_v6);
}
- if(eth_bridge_wlan_client_rt_from_usb_info_v4 != NULL)
+ if(eth_bridge_wlan_client_rt_from_lan_info_v4 != NULL)
{
- free(eth_bridge_wlan_client_rt_from_usb_info_v4);
+ free(eth_bridge_wlan_client_rt_from_lan_info_v4);
}
- if(eth_bridge_wlan_client_rt_from_usb_info_v6 != NULL)
+ if(eth_bridge_wlan_client_rt_from_lan_info_v6 != NULL)
{
- free(eth_bridge_wlan_client_rt_from_usb_info_v6);
+ free(eth_bridge_wlan_client_rt_from_lan_info_v6);
}
if(eth_bridge_wlan_client_rt_from_wlan_info_v4 != NULL)
{
@@ -2978,8 +2990,8 @@
return;
}
#ifdef FEATURE_ETH_BRIDGE_LE
- num_v4_dummy_rule = IPV4_DEFAULT_FILTERTING_RULES + IPACM_Iface::ipacmcfg->ipa_num_private_subnet + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_USB_CLIENT + IPACM_Iface::ipacmcfg->ipa_num_private_subnet;
- num_v6_dummy_rule = IPV6_DEFAULT_FILTERTING_RULES + 1 + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_USB_CLIENT;
+ num_v4_dummy_rule = IPV4_DEFAULT_FILTERTING_RULES + IPACM_Iface::ipacmcfg->ipa_num_private_subnet + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_LAN_CLIENT + IPACM_Iface::ipacmcfg->ipa_num_private_subnet;
+ num_v6_dummy_rule = IPV6_DEFAULT_FILTERTING_RULES + 1 + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_LAN_CLIENT;
#else
#ifndef CT_OPT
num_v4_dummy_rule = 2*(IPV4_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR + IPACM_Iface::ipacmcfg->ipa_num_private_subnet);
@@ -3181,8 +3193,8 @@
#endif
#ifdef FEATURE_ETH_BRIDGE_LE
- num_v4_dummy_rule = IPV4_DEFAULT_FILTERTING_RULES + IPACM_Iface::ipacmcfg->ipa_num_private_subnet + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_USB_CLIENT + IPACM_Iface::ipacmcfg->ipa_num_private_subnet;
- num_v6_dummy_rule = IPV6_DEFAULT_FILTERTING_RULES + 1 + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_USB_CLIENT;
+ num_v4_dummy_rule = IPV4_DEFAULT_FILTERTING_RULES + IPACM_Iface::ipacmcfg->ipa_num_private_subnet + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_LAN_CLIENT + IPACM_Iface::ipacmcfg->ipa_num_private_subnet;
+ num_v6_dummy_rule = IPV6_DEFAULT_FILTERTING_RULES + 1 + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_LAN_CLIENT;
#endif
if(m_filtering.DeleteFilteringHdls(IPACM_Wlan::dummy_flt_rule_hdl_v4, IPA_IP_v4, num_v4_dummy_rule) == false)
@@ -3205,8 +3217,8 @@
#ifdef FEATURE_ETH_BRIDGE_LE
memset(self_client_flt_rule_hdl_v4, 0, IPA_LAN_TO_LAN_MAX_WLAN_CLIENT * sizeof(lan2lan_flt_rule_hdl));
memset(self_client_flt_rule_hdl_v6, 0, IPA_LAN_TO_LAN_MAX_WLAN_CLIENT * sizeof(lan2lan_flt_rule_hdl));
- memset(usb_client_flt_rule_hdl_v4, 0, IPA_LAN_TO_LAN_MAX_USB_CLIENT * sizeof(lan2lan_flt_rule_hdl));
- memset(usb_client_flt_rule_hdl_v6, 0, IPA_LAN_TO_LAN_MAX_USB_CLIENT * sizeof(lan2lan_flt_rule_hdl));
+ memset(lan_client_flt_rule_hdl_v4, 0, IPA_LAN_TO_LAN_MAX_LAN_CLIENT * sizeof(lan2lan_flt_rule_hdl));
+ memset(lan_client_flt_rule_hdl_v6, 0, IPA_LAN_TO_LAN_MAX_LAN_CLIENT * sizeof(lan2lan_flt_rule_hdl));
#endif
}
return;
@@ -3580,7 +3592,7 @@
return IPACM_SUCCESS;
}
-int IPACM_Wlan::eth_bridge_handle_dummy_usb_client_flt_rule(ipa_ip_type iptype)
+int IPACM_Wlan::eth_bridge_handle_dummy_lan_client_flt_rule(ipa_ip_type iptype)
{
int i, offset;
if(wlan_ap_index == 0)
@@ -3588,27 +3600,27 @@
if(iptype == IPA_IP_v4)
{
offset = IPV4_DEFAULT_FILTERTING_RULES + IPACM_Iface::ipacmcfg->ipa_num_private_subnet + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT;
- for(i=0; i<IPA_LAN_TO_LAN_MAX_USB_CLIENT; i++)
+ for(i=0; i<IPA_LAN_TO_LAN_MAX_LAN_CLIENT; i++)
{
- usb_client_flt_rule_hdl_v4[i].rule_hdl = IPACM_Wlan::dummy_flt_rule_hdl_v4[offset+i];
- usb_client_flt_rule_hdl_v4[i].valid = true;
+ lan_client_flt_rule_hdl_v4[i].rule_hdl = IPACM_Wlan::dummy_flt_rule_hdl_v4[offset+i];
+ lan_client_flt_rule_hdl_v4[i].valid = true;
}
}
else
{
offset = 1 + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT;
- for(i=0; i<IPA_LAN_TO_LAN_MAX_USB_CLIENT; i++)
+ for(i=0; i<IPA_LAN_TO_LAN_MAX_LAN_CLIENT; i++)
{
- usb_client_flt_rule_hdl_v6[i].rule_hdl = IPACM_Wlan::dummy_flt_rule_hdl_v6[offset+i];
- usb_client_flt_rule_hdl_v6[i].valid = true;
+ lan_client_flt_rule_hdl_v6[i].rule_hdl = IPACM_Wlan::dummy_flt_rule_hdl_v6[offset+i];
+ lan_client_flt_rule_hdl_v6[i].valid = true;
}
}
- IPACMDBG_H("Get %d flt rule hdls for usb clients ip type: %d.\n", IPA_LAN_TO_LAN_MAX_USB_CLIENT, iptype);
+ IPACMDBG_H("Get %d flt rule hdls for lan clients ip type: %d.\n", IPA_LAN_TO_LAN_MAX_LAN_CLIENT, iptype);
}
return IPACM_SUCCESS;
}
-int IPACM_Wlan::eth_bridge_add_usb_client_flt_rule(uint8_t* mac, ipa_ip_type iptype)
+int IPACM_Wlan::eth_bridge_add_lan_client_flt_rule(uint8_t* mac, ipa_ip_type iptype)
{
int i, len, res = IPACM_SUCCESS, client_position;
struct ipa_flt_rule_mdfy flt_rule;
@@ -3630,20 +3642,15 @@
IPACMDBG_H("This is WLAN interface index %d, ignore.\n", wlan_ap_index);
return IPACM_SUCCESS;
}
- if(IPACM_Lan::wlan_to_usb_hdr_proc_ctx.valid == false)
- {
- IPACMDBG_H("WLAN to USB hdr proc ctx has not been set, don't add USB client specific flt rule.\n");
- return IPACM_FAILURE;
- }
- for(i=0; i<num_usb_client; i++)
+ for(i=0; i<lan_client_flt_info_count; i++)
{
- if(memcmp(eth_bridge_usb_client_flt_info[i].mac, mac, sizeof(eth_bridge_usb_client_flt_info[i].mac)) == 0)
+ if(memcmp(eth_bridge_lan_client_flt_info[i].mac, mac, sizeof(eth_bridge_lan_client_flt_info[i].mac)) == 0)
{
client_is_found = true;
client_position = i;
- if( (iptype == IPA_IP_v4 && eth_bridge_usb_client_flt_info[i].flt_rule_set_v4 == true)
- || (iptype == IPA_IP_v6 && eth_bridge_usb_client_flt_info[i].flt_rule_set_v6 == true))
+ if( (iptype == IPA_IP_v4 && eth_bridge_lan_client_flt_info[i].flt_rule_set_v4 == true)
+ || (iptype == IPA_IP_v6 && eth_bridge_lan_client_flt_info[i].flt_rule_set_v6 == true))
{
IPACMDBG_H("Flt rule for iptype %d has been set.\n", iptype);
return IPACM_SUCCESS;
@@ -3652,9 +3659,9 @@
}
}
- if(client_is_found == false && num_usb_client == IPA_LAN_TO_LAN_MAX_USB_CLIENT)
+ if(client_is_found == false && lan_client_flt_info_count == IPA_LAN_TO_LAN_MAX_LAN_CLIENT)
{
- IPACMDBG_H("The usb client flt table is already full.\n");
+ IPACMDBG_H("The lan client flt table is already full.\n");
return IPACM_FAILURE;
}
@@ -3667,14 +3674,14 @@
}
memset(pFilteringTable, 0, len);
- IPACMDBG_H("Receive USB client MAC 0x%02x%02x%02x%02x%02x%02x.\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+ IPACMDBG_H("Receive LAN client MAC 0x%02x%02x%02x%02x%02x%02x.\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
/* add mac based rule on flt table */
pFilteringTable->commit = 1;
pFilteringTable->ip = iptype;
pFilteringTable->num_rules = 1;
- /* point to USB-WLAN routing table */
+ /* point to LAN-WLAN routing table */
memset(&flt_rule, 0, sizeof(struct ipa_flt_rule_mdfy));
flt_rule.status = -1;
@@ -3685,25 +3692,25 @@
if(iptype == IPA_IP_v4)
{
- if (false == m_routing.GetRoutingTable(&IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_usb_wlan_v4))
+ if (false == m_routing.GetRoutingTable(&IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_wlan_v4))
{
IPACMERR("Failed to get routing table handle.\n");
res = IPACM_FAILURE;
goto fail;
}
- flt_rule.rule.rt_tbl_hdl = IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_usb_wlan_v4.hdl;
- IPACMDBG_H("WLAN->USB IPv4 filter rule use table: %s\n",IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_usb_wlan_v4.name);
+ flt_rule.rule.rt_tbl_hdl = IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_wlan_v4.hdl;
+ IPACMDBG_H("WLAN->LAN IPv4 filter rule use table: %s\n",IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_wlan_v4.name);
}
else
{
- if (false == m_routing.GetRoutingTable(&IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_usb_wlan_v6))
+ if (false == m_routing.GetRoutingTable(&IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_wlan_v6))
{
IPACMERR("Failed to get routing table handle.\n");
res = IPACM_FAILURE;
goto fail;
}
- flt_rule.rule.rt_tbl_hdl = IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_usb_wlan_v6.hdl;
- IPACMDBG_H("WLAN->USB IPv6 filter rule use table: %s\n",IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_usb_wlan_v6.name);
+ flt_rule.rule.rt_tbl_hdl = IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_wlan_v6.hdl;
+ IPACMDBG_H("WLAN->LAN IPv6 filter rule use table: %s\n",IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_wlan_v6.name);
}
memcpy(&flt_rule.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule.rule.attrib));
@@ -3727,16 +3734,16 @@
if(iptype == IPA_IP_v4)
{
- for(i=0; i<IPA_LAN_TO_LAN_MAX_USB_CLIENT; i++)
+ for(i=0; i<IPA_LAN_TO_LAN_MAX_LAN_CLIENT; i++)
{
- if(usb_client_flt_rule_hdl_v4[i].valid == true)
+ if(lan_client_flt_rule_hdl_v4[i].valid == true)
{
- flt_rule.rule_hdl = usb_client_flt_rule_hdl_v4[i].rule_hdl;
- usb_client_flt_rule_hdl_v4[i].valid = false;
+ flt_rule.rule_hdl = lan_client_flt_rule_hdl_v4[i].rule_hdl;
+ lan_client_flt_rule_hdl_v4[i].valid = false;
break;
}
}
- if(i == IPA_LAN_TO_LAN_MAX_USB_CLIENT)
+ if(i == IPA_LAN_TO_LAN_MAX_LAN_CLIENT)
{
IPACMDBG_H("Cannot find a valid flt rule hdl.\n");
res = IPACM_FAILURE;
@@ -3745,16 +3752,16 @@
}
else
{
- for(i=0; i<IPA_LAN_TO_LAN_MAX_USB_CLIENT; i++)
+ for(i=0; i<IPA_LAN_TO_LAN_MAX_LAN_CLIENT; i++)
{
- if(usb_client_flt_rule_hdl_v6[i].valid == true)
+ if(lan_client_flt_rule_hdl_v6[i].valid == true)
{
- flt_rule.rule_hdl = usb_client_flt_rule_hdl_v6[i].rule_hdl;
- usb_client_flt_rule_hdl_v6[i].valid = false;
+ flt_rule.rule_hdl = lan_client_flt_rule_hdl_v6[i].rule_hdl;
+ lan_client_flt_rule_hdl_v6[i].valid = false;
break;
}
}
- if(i == IPA_LAN_TO_LAN_MAX_USB_CLIENT)
+ if(i == IPA_LAN_TO_LAN_MAX_LAN_CLIENT)
{
IPACMDBG_H("Cannot find a valid flt rule hdl.\n");
res = IPACM_FAILURE;
@@ -3772,20 +3779,20 @@
if(client_is_found == false)
{
- client_position = num_usb_client;
- num_usb_client++;
+ client_position = lan_client_flt_info_count;
+ lan_client_flt_info_count++;
}
- memcpy(eth_bridge_usb_client_flt_info[client_position].mac, mac, sizeof(eth_bridge_usb_client_flt_info[client_position].mac));
+ memcpy(eth_bridge_lan_client_flt_info[client_position].mac, mac, sizeof(eth_bridge_lan_client_flt_info[client_position].mac));
if(iptype == IPA_IP_v4)
{
- eth_bridge_usb_client_flt_info[client_position].flt_rule_set_v4 = true;
- eth_bridge_usb_client_flt_info[client_position].flt_rule_hdl_v4 = usb_client_flt_rule_hdl_v4[i].rule_hdl;
+ eth_bridge_lan_client_flt_info[client_position].flt_rule_set_v4 = true;
+ eth_bridge_lan_client_flt_info[client_position].flt_rule_hdl_v4 = lan_client_flt_rule_hdl_v4[i].rule_hdl;
}
else
{
- eth_bridge_usb_client_flt_info[client_position].flt_rule_set_v6 = true;
- eth_bridge_usb_client_flt_info[client_position].flt_rule_hdl_v6 = usb_client_flt_rule_hdl_v6[i].rule_hdl;
+ eth_bridge_lan_client_flt_info[client_position].flt_rule_set_v6 = true;
+ eth_bridge_lan_client_flt_info[client_position].flt_rule_hdl_v6 = lan_client_flt_rule_hdl_v6[i].rule_hdl;
}
fail:
@@ -3796,7 +3803,7 @@
return res;
}
-int IPACM_Wlan::eth_bridge_del_usb_client_flt_rule(uint8_t* mac)
+int IPACM_Wlan::eth_bridge_del_lan_client_flt_rule(uint8_t* mac)
{
if(mac == NULL)
{
@@ -3804,36 +3811,36 @@
return IPACM_FAILURE;
}
- IPACMDBG_H("Receive USB client MAC 0x%02x%02x%02x%02x%02x%02x.\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+ IPACMDBG_H("Receive LAN client MAC 0x%02x%02x%02x%02x%02x%02x.\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
int i, j, res = IPACM_SUCCESS;
- for(i=0; i<num_usb_client; i++)
+ for(i=0; i<lan_client_flt_info_count; i++)
{
- if(memcmp(eth_bridge_usb_client_flt_info[i].mac, mac, sizeof(eth_bridge_usb_client_flt_info[i].mac)) == 0)
+ if(memcmp(eth_bridge_lan_client_flt_info[i].mac, mac, sizeof(eth_bridge_lan_client_flt_info[i].mac)) == 0)
{
break;
}
}
- if(i == num_usb_client)
+ if(i == lan_client_flt_info_count)
{
- IPACMERR("Do not find the usb client.\n");
+ IPACMERR("Do not find the lan client.\n");
return IPACM_FAILURE;
}
- if(eth_bridge_usb_client_flt_info[i].flt_rule_set_v4 == true)
+ if(eth_bridge_lan_client_flt_info[i].flt_rule_set_v4 == true)
{
- if(reset_to_dummy_flt_rule(IPA_IP_v4, eth_bridge_usb_client_flt_info[i].flt_rule_hdl_v4) == IPACM_SUCCESS)
+ if(reset_to_dummy_flt_rule(IPA_IP_v4, eth_bridge_lan_client_flt_info[i].flt_rule_hdl_v4) == IPACM_SUCCESS)
{
- for(j=0; j<IPA_LAN_TO_LAN_MAX_USB_CLIENT; j++)
+ for(j=0; j<IPA_LAN_TO_LAN_MAX_LAN_CLIENT; j++)
{
- if(usb_client_flt_rule_hdl_v4[j].rule_hdl == eth_bridge_usb_client_flt_info[i].flt_rule_hdl_v4)
+ if(lan_client_flt_rule_hdl_v4[j].rule_hdl == eth_bridge_lan_client_flt_info[i].flt_rule_hdl_v4)
{
- usb_client_flt_rule_hdl_v4[j].valid = true;
+ lan_client_flt_rule_hdl_v4[j].valid = true;
break;
}
}
- if(j == IPA_LAN_TO_LAN_MAX_USB_CLIENT)
+ if(j == IPA_LAN_TO_LAN_MAX_LAN_CLIENT)
{
IPACMERR("Not finding the rule handle in handle pool.\n");
return IPACM_FAILURE;
@@ -3841,23 +3848,23 @@
}
else
{
- IPACMERR("Failed to delete the usb client specific flt rule.\n");
+ IPACMERR("Failed to delete the lan client specific flt rule.\n");
return IPACM_FAILURE;
}
}
- if(eth_bridge_usb_client_flt_info[i].flt_rule_set_v6 == true)
+ if(eth_bridge_lan_client_flt_info[i].flt_rule_set_v6 == true)
{
- if(reset_to_dummy_flt_rule(IPA_IP_v6, eth_bridge_usb_client_flt_info[i].flt_rule_hdl_v6) == IPACM_SUCCESS)
+ if(reset_to_dummy_flt_rule(IPA_IP_v6, eth_bridge_lan_client_flt_info[i].flt_rule_hdl_v6) == IPACM_SUCCESS)
{
- for(j=0; j<IPA_LAN_TO_LAN_MAX_USB_CLIENT; j++)
+ for(j=0; j<IPA_LAN_TO_LAN_MAX_LAN_CLIENT; j++)
{
- if(usb_client_flt_rule_hdl_v6[j].rule_hdl == eth_bridge_usb_client_flt_info[i].flt_rule_hdl_v6)
+ if(lan_client_flt_rule_hdl_v6[j].rule_hdl == eth_bridge_lan_client_flt_info[i].flt_rule_hdl_v6)
{
- usb_client_flt_rule_hdl_v6[j].valid = true;
+ lan_client_flt_rule_hdl_v6[j].valid = true;
break;
}
}
- if(j == IPA_LAN_TO_LAN_MAX_USB_CLIENT)
+ if(j == IPA_LAN_TO_LAN_MAX_LAN_CLIENT)
{
IPACMERR("Not finding the rule handle in handle pool.\n");
return IPACM_FAILURE;
@@ -3865,17 +3872,17 @@
}
else
{
- IPACMERR("Failed to delete the usb client specific flt rule.\n");
+ IPACMERR("Failed to delete the lan client specific flt rule.\n");
return IPACM_FAILURE;
}
}
- for(j=i+1; j<num_usb_client; j++)
+ for(j=i+1; j<lan_client_flt_info_count; j++)
{
- memcpy(&(eth_bridge_usb_client_flt_info[j-1]), &(eth_bridge_usb_client_flt_info[j]), sizeof(eth_bridge_client_flt_info));
+ memcpy(&(eth_bridge_lan_client_flt_info[j-1]), &(eth_bridge_lan_client_flt_info[j]), sizeof(eth_bridge_client_flt_info));
}
- memset(&(eth_bridge_usb_client_flt_info[num_usb_client-1]), 0, sizeof(eth_bridge_client_flt_info));
- num_usb_client--;
+ memset(&(eth_bridge_lan_client_flt_info[lan_client_flt_info_count-1]), 0, sizeof(eth_bridge_client_flt_info));
+ lan_client_flt_info_count--;
return res;
}
@@ -3941,7 +3948,7 @@
pFilteringTable->ip = iptype;
pFilteringTable->num_rules = 1;
- /* point to USB-WLAN routing table */
+ /* point to LAN-WLAN routing table */
memset(&flt_rule, 0, sizeof(struct ipa_flt_rule_mdfy));
flt_rule.status = -1;
@@ -4147,14 +4154,14 @@
return res;
}
-int IPACM_Wlan::eth_bridge_install_cache_usb_client_flt_rule(ipa_ip_type iptype)
+int IPACM_Wlan::eth_bridge_install_cache_lan_client_flt_rule(ipa_ip_type iptype)
{
int i;
- IPACMDBG_H("There are %d usb clients cached.\n", IPACM_Lan::num_usb_client);
- for(i=0; i<IPACM_Lan::num_usb_client; i++)
+ IPACMDBG_H("There are %d lan clients cached.\n", IPACM_Lan::num_lan_client);
+ for(i=0; i<IPACM_Lan::num_lan_client; i++)
{
- eth_bridge_add_usb_client_flt_rule(IPACM_Lan::eth_bridge_usb_client[i].mac, iptype);
+ eth_bridge_add_lan_client_flt_rule(IPACM_Lan::eth_bridge_lan_client[i].mac, iptype);
}
return IPACM_SUCCESS;
}
@@ -4186,7 +4193,7 @@
if(iptype == IPA_IP_v4)
{
if( (src == SRC_WLAN && wlan_client_rt_from_wlan_info_count_v4 == IPA_LAN_TO_LAN_MAX_WLAN_CLIENT)
- || (src == SRC_USB && wlan_client_rt_from_usb_info_count_v4 == IPA_LAN_TO_LAN_MAX_WLAN_CLIENT))
+ || (src == SRC_LAN && wlan_client_rt_from_lan_info_count_v4 == IPA_LAN_TO_LAN_MAX_WLAN_CLIENT))
{
IPACMDBG_H("WLAN client number has reached maximum.\n");
return IPACM_FAILURE;
@@ -4195,14 +4202,14 @@
else
{
if( (src == SRC_WLAN && wlan_client_rt_from_wlan_info_count_v6 == IPA_LAN_TO_LAN_MAX_WLAN_CLIENT)
- || (src == SRC_USB && wlan_client_rt_from_usb_info_count_v6 == IPA_LAN_TO_LAN_MAX_WLAN_CLIENT))
+ || (src == SRC_LAN && wlan_client_rt_from_lan_info_count_v6 == IPA_LAN_TO_LAN_MAX_WLAN_CLIENT))
{
IPACMDBG_H("WLAN client number has reached maximum.\n");
return IPACM_FAILURE;
}
}
if( (src == SRC_WLAN && IPACM_Lan::wlan_to_wlan_hdr_proc_ctx.valid == false)
- || (src == SRC_USB && IPACM_Lan::usb_to_wlan_hdr_proc_ctx.valid == false) )
+ || (src == SRC_LAN && IPACM_Lan::lan_to_wlan_hdr_proc_ctx.valid == false) )
{
IPACMDBG_H("Hdr proc ctx has not been set for source %d, don't add WLAN client routing rule.\n", src);
return IPACM_FAILURE;
@@ -4248,29 +4255,29 @@
{
if(iptype == IPA_IP_v4)
{
- for(i=0; i<wlan_client_rt_from_usb_info_count_v4; i++)
+ for(i=0; i<wlan_client_rt_from_lan_info_count_v4; i++)
{
- if(memcmp(eth_bridge_get_client_rt_info_ptr(i, SRC_USB, iptype)->mac, mac, sizeof(eth_bridge_get_client_rt_info_ptr(i, SRC_USB, iptype)->mac)) == 0)
+ if(memcmp(eth_bridge_get_client_rt_info_ptr(i, SRC_LAN, iptype)->mac, mac, sizeof(eth_bridge_get_client_rt_info_ptr(i, SRC_LAN, iptype)->mac)) == 0)
{
IPACMDBG_H("The client's routing rule was added before.\n");
return IPACM_SUCCESS;
}
}
- memcpy(eth_bridge_get_client_rt_info_ptr(wlan_client_rt_from_usb_info_count_v4, src, iptype)->mac, mac,
- sizeof(eth_bridge_get_client_rt_info_ptr(wlan_client_rt_from_usb_info_count_v4, src, iptype)->mac));
+ memcpy(eth_bridge_get_client_rt_info_ptr(wlan_client_rt_from_lan_info_count_v4, src, iptype)->mac, mac,
+ sizeof(eth_bridge_get_client_rt_info_ptr(wlan_client_rt_from_lan_info_count_v4, src, iptype)->mac));
}
else
{
- for(i=0; i<wlan_client_rt_from_usb_info_count_v6; i++)
+ for(i=0; i<wlan_client_rt_from_lan_info_count_v6; i++)
{
- if(memcmp(eth_bridge_get_client_rt_info_ptr(i, SRC_USB, iptype)->mac, mac, sizeof(eth_bridge_get_client_rt_info_ptr(i, SRC_USB, iptype)->mac)) == 0)
+ if(memcmp(eth_bridge_get_client_rt_info_ptr(i, SRC_LAN, iptype)->mac, mac, sizeof(eth_bridge_get_client_rt_info_ptr(i, SRC_LAN, iptype)->mac)) == 0)
{
IPACMDBG_H("The client's routing rule was added before.\n");
return IPACM_SUCCESS;
}
}
- memcpy(eth_bridge_get_client_rt_info_ptr(wlan_client_rt_from_usb_info_count_v6, src, iptype)->mac, mac,
- sizeof(eth_bridge_get_client_rt_info_ptr(wlan_client_rt_from_usb_info_count_v6, src, iptype)->mac));
+ memcpy(eth_bridge_get_client_rt_info_ptr(wlan_client_rt_from_lan_info_count_v6, src, iptype)->mac, mac,
+ sizeof(eth_bridge_get_client_rt_info_ptr(wlan_client_rt_from_lan_info_count_v6, src, iptype)->mac));
}
}
@@ -4310,11 +4317,11 @@
{
if(iptype == IPA_IP_v4)
{
- strncpy(rt_rule_table->rt_tbl_name, IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_usb_wlan_v4.name, sizeof(rt_rule_table->rt_tbl_name));
+ strncpy(rt_rule_table->rt_tbl_name, IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_wlan_v4.name, sizeof(rt_rule_table->rt_tbl_name));
}
else
{
- strncpy(rt_rule_table->rt_tbl_name, IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_usb_wlan_v6.name, sizeof(rt_rule_table->rt_tbl_name));
+ strncpy(rt_rule_table->rt_tbl_name, IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_wlan_v6.name, sizeof(rt_rule_table->rt_tbl_name));
}
}
@@ -4330,7 +4337,7 @@
}
else
{
- rt_rule.rule.hdr_proc_ctx_hdl = IPACM_Lan::usb_to_wlan_hdr_proc_ctx.proc_ctx_hdl;
+ rt_rule.rule.hdr_proc_ctx_hdl = IPACM_Lan::lan_to_wlan_hdr_proc_ctx.proc_ctx_hdl;
}
position = 0;
for(i=0; i<iface_query->num_tx_props; i++)
@@ -4367,9 +4374,9 @@
rt_rule.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_802_3;
}
}
- else //packet is from USB
+ else //packet is from LAN
{
- if(IPACM_Lan::usb_hdr_type == IPA_HDR_L2_ETHERNET_II)
+ if(IPACM_Lan::lan_hdr_type == IPA_HDR_L2_ETHERNET_II)
{
rt_rule.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_ETHER_II;
}
@@ -4424,22 +4431,22 @@
{
if(iptype == IPA_IP_v4)
{
- eth_bridge_get_client_rt_info_ptr(wlan_client_rt_from_usb_info_count_v4, src, iptype)->rt_rule_hdl[i] = rt_rule_table->rules[i].rt_rule_hdl;
+ eth_bridge_get_client_rt_info_ptr(wlan_client_rt_from_lan_info_count_v4, src, iptype)->rt_rule_hdl[i] = rt_rule_table->rules[i].rt_rule_hdl;
}
else
{
- eth_bridge_get_client_rt_info_ptr(wlan_client_rt_from_usb_info_count_v6, src, iptype)->rt_rule_hdl[i] = rt_rule_table->rules[i].rt_rule_hdl;
+ eth_bridge_get_client_rt_info_ptr(wlan_client_rt_from_lan_info_count_v6, src, iptype)->rt_rule_hdl[i] = rt_rule_table->rules[i].rt_rule_hdl;
}
}
if(iptype == IPA_IP_v4)
{
- wlan_client_rt_from_usb_info_count_v4++;
- IPACMDBG_H("Now the number of IPv4 rt rule on usb-wlan rt table is %d.\n", wlan_client_rt_from_usb_info_count_v4);
+ wlan_client_rt_from_lan_info_count_v4++;
+ IPACMDBG_H("Now the number of IPv4 rt rule on lan-wlan rt table is %d.\n", wlan_client_rt_from_lan_info_count_v4);
}
else
{
- wlan_client_rt_from_usb_info_count_v6++;
- IPACMDBG_H("Now the number of IPv6 rt rule on usb-wlan rt table is %d.\n", wlan_client_rt_from_usb_info_count_v6);
+ wlan_client_rt_from_lan_info_count_v6++;
+ IPACMDBG_H("Now the number of IPv6 rt rule on lan-wlan rt table is %d.\n", wlan_client_rt_from_lan_info_count_v6);
}
}
}
@@ -4489,7 +4496,7 @@
}
else
{
- for(i=0; i<wlan_client_rt_from_usb_info_count_v4; i++)
+ for(i=0; i<wlan_client_rt_from_lan_info_count_v4; i++)
{
if(memcmp(eth_bridge_get_client_rt_info_ptr(i, src, IPA_IP_v4)->mac, mac, sizeof(eth_bridge_get_client_rt_info_ptr(i, src, IPA_IP_v4)->mac)) == 0)
{
@@ -4498,7 +4505,7 @@
break;
}
}
- if(i == wlan_client_rt_from_usb_info_count_v4)
+ if(i == wlan_client_rt_from_lan_info_count_v4)
{
IPACMERR("The client is not found.\n");
return IPACM_FAILURE;
@@ -4526,13 +4533,13 @@
}
else
{
- for(i=position+1; i<wlan_client_rt_from_usb_info_count_v4; i++)
+ for(i=position+1; i<wlan_client_rt_from_lan_info_count_v4; i++)
{
memcpy(eth_bridge_get_client_rt_info_ptr(i-1, src, IPA_IP_v4), eth_bridge_get_client_rt_info_ptr(i, src, IPA_IP_v4), client_rt_info_size_v4);
}
- memset(eth_bridge_get_client_rt_info_ptr(wlan_client_rt_from_usb_info_count_v4-1, src, IPA_IP_v4), 0, client_rt_info_size_v4);
- wlan_client_rt_from_usb_info_count_v4--;
- IPACMDBG_H("Now the number of IPv4 rt rule from usb info is %d.\n", wlan_client_rt_from_usb_info_count_v4);
+ memset(eth_bridge_get_client_rt_info_ptr(wlan_client_rt_from_lan_info_count_v4-1, src, IPA_IP_v4), 0, client_rt_info_size_v4);
+ wlan_client_rt_from_lan_info_count_v4--;
+ IPACMDBG_H("Now the number of IPv4 rt rule from lan info is %d.\n", wlan_client_rt_from_lan_info_count_v4);
}
/*delete rt rules from IPv6 rt table */
@@ -4555,7 +4562,7 @@
}
else
{
- for(i=0; i<wlan_client_rt_from_usb_info_count_v6; i++)
+ for(i=0; i<wlan_client_rt_from_lan_info_count_v6; i++)
{
if(memcmp(eth_bridge_get_client_rt_info_ptr(i, src, IPA_IP_v6)->mac, mac, sizeof(eth_bridge_get_client_rt_info_ptr(i, src, IPA_IP_v6)->mac)) == 0)
{
@@ -4564,7 +4571,7 @@
break;
}
}
- if(i == wlan_client_rt_from_usb_info_count_v6)
+ if(i == wlan_client_rt_from_lan_info_count_v6)
{
IPACMERR("The client is not found.\n");
return IPACM_FAILURE;
@@ -4592,13 +4599,13 @@
}
else
{
- for(i=position+1; i<wlan_client_rt_from_usb_info_count_v6; i++)
+ for(i=position+1; i<wlan_client_rt_from_lan_info_count_v6; i++)
{
memcpy(eth_bridge_get_client_rt_info_ptr(i-1, src, IPA_IP_v6), eth_bridge_get_client_rt_info_ptr(i, src, IPA_IP_v6), client_rt_info_size_v6);
}
- memset(eth_bridge_get_client_rt_info_ptr(wlan_client_rt_from_usb_info_count_v6-1, src, IPA_IP_v6), 0, client_rt_info_size_v6);
- wlan_client_rt_from_usb_info_count_v6--;
- IPACMDBG_H("Now the number of IPv6 rt rule from usb info is %d.\n", wlan_client_rt_from_usb_info_count_v6);
+ memset(eth_bridge_get_client_rt_info_ptr(wlan_client_rt_from_lan_info_count_v6-1, src, IPA_IP_v6), 0, client_rt_info_size_v6);
+ wlan_client_rt_from_lan_info_count_v6--;
+ IPACMDBG_H("Now the number of IPv6 rt rule from lan info is %d.\n", wlan_client_rt_from_lan_info_count_v6);
}
return IPACM_SUCCESS;
@@ -4622,11 +4629,11 @@
{
if(iptype == IPA_IP_v4)
{
- result = (void*)((void*)eth_bridge_wlan_client_rt_from_usb_info_v4 + index * client_rt_info_size_v4);
+ result = (void*)((void*)eth_bridge_wlan_client_rt_from_lan_info_v4 + index * client_rt_info_size_v4);
}
else
{
- result = (void*)((void*)eth_bridge_wlan_client_rt_from_usb_info_v6 + index * client_rt_info_size_v6);
+ result = (void*)((void*)eth_bridge_wlan_client_rt_from_lan_info_v6 + index * client_rt_info_size_v6);
}
}
return (eth_bridge_client_rt_info*)result;
@@ -4646,9 +4653,20 @@
return;
}
+ int i;
+ for(i=0; i<IPACM_Lan::num_wlan_client; i++)
+ {
+ if(memcmp(IPACM_Lan::eth_bridge_wlan_client[i].mac, mac, sizeof(IPACM_Lan::eth_bridge_wlan_client[i].mac)) == 0)
+ {
+ IPACMDBG_H("The wlan client mac has been added before at position %d.\n", i);
+ return;
+ }
+ }
+
memcpy(IPACM_Lan::eth_bridge_wlan_client[IPACM_Lan::num_wlan_client].mac, mac, sizeof(IPACM_Lan::eth_bridge_wlan_client[IPACM_Lan::num_wlan_client].mac));
IPACM_Lan::eth_bridge_wlan_client[IPACM_Lan::num_wlan_client].ipa_if_num = if_num;
IPACM_Lan::num_wlan_client++;
+ IPACMDBG_H("Now the total num of wlan clients is %d", IPACM_Lan::num_wlan_client);
return;
}
@@ -4682,6 +4700,7 @@
IPACM_Lan::eth_bridge_wlan_client[j-1].ipa_if_num = IPACM_Lan::eth_bridge_wlan_client[j].ipa_if_num;
}
IPACM_Lan::num_wlan_client--;
+ IPACMDBG_H("Now the total num of wlan clients is %d", IPACM_Lan::num_wlan_client);
return;
}
@@ -4907,11 +4926,11 @@
return;
}
}
- if (IPACM_Lan::usb_to_wlan_hdr_proc_ctx.valid == true)
+ if (IPACM_Lan::lan_to_wlan_hdr_proc_ctx.valid == true)
{
- if (eth_bridge_modify_wlan_rt_rule(IPACM_Lan::eth_bridge_wlan_client[i].mac, SRC_USB, iptype) == IPACM_FAILURE)
+ if (eth_bridge_modify_wlan_rt_rule(IPACM_Lan::eth_bridge_wlan_client[i].mac, SRC_LAN, iptype) == IPACM_FAILURE)
{
- IPACMDBG_H("SCC/MCC switch is failed for iptype: %d src_iface: %d \n", iptype, SRC_USB);
+ IPACMDBG_H("SCC/MCC switch is failed for iptype: %d src_iface: %d \n", iptype, SRC_LAN);
return;
}
}
@@ -4994,7 +5013,7 @@
{
if (iptype == IPA_IP_v4)
{
- for (index = 0; index < wlan_client_rt_from_usb_info_count_v4; index++)
+ for (index = 0; index < wlan_client_rt_from_lan_info_count_v4; index++)
{
if (memcmp(eth_bridge_get_client_rt_info_ptr(index, src_iface, IPA_IP_v4)->mac, mac,
sizeof(eth_bridge_get_client_rt_info_ptr(index, src_iface, IPA_IP_v4)->mac)) == 0)
@@ -5004,7 +5023,7 @@
break;
}
}
- if (index == wlan_client_rt_from_usb_info_count_v4)
+ if (index == wlan_client_rt_from_lan_info_count_v4)
{
IPACMERR("The client is not found.\n");
return IPACM_FAILURE;
@@ -5012,7 +5031,7 @@
}
else
{
- for (index = 0; index < wlan_client_rt_from_usb_info_count_v6; index++)
+ for (index = 0; index < wlan_client_rt_from_lan_info_count_v6; index++)
{
if (memcmp(eth_bridge_get_client_rt_info_ptr(index, src_iface, IPA_IP_v6)->mac, mac,
sizeof(eth_bridge_get_client_rt_info_ptr(index, src_iface, IPA_IP_v6)->mac)) == 0)
@@ -5022,7 +5041,7 @@
break;
}
}
- if (index == wlan_client_rt_from_usb_info_count_v6)
+ if (index == wlan_client_rt_from_lan_info_count_v6)
{
IPACMERR("The client is not found.\n");
return IPACM_FAILURE;
@@ -5079,7 +5098,7 @@
else
{
rt_rule_entry->rule.hdr_proc_ctx_hdl =
- IPACM_Lan::usb_to_wlan_hdr_proc_ctx.proc_ctx_hdl;
+ IPACM_Lan::lan_to_wlan_hdr_proc_ctx.proc_ctx_hdl;
}
memcpy(&rt_rule_entry->rule.attrib,
@@ -5097,9 +5116,9 @@
rt_rule_entry->rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_802_3;
}
}
- else //packet is from USB
+ else //packet is from LAN
{
- if (IPACM_Lan::usb_hdr_type == IPA_HDR_L2_ETHERNET_II)
+ if (IPACM_Lan::lan_hdr_type == IPA_HDR_L2_ETHERNET_II)
{
rt_rule_entry->rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_ETHER_II;
}