diff --git a/ipacm/inc/IPACM_Defs.h b/ipacm/inc/IPACM_Defs.h
index dbc8453..7e6af22 100644
--- a/ipacm/inc/IPACM_Defs.h
+++ b/ipacm/inc/IPACM_Defs.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
+Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
@@ -115,6 +115,7 @@
 #define IPA_LAN_TO_LAN_MAX_USB_CLIENT 1
 #define IPA_LAN_TO_LAN_MAX_CPE_CLIENT 15
 #define IPA_LAN_TO_LAN_MAX_LAN_CLIENT (IPA_LAN_TO_LAN_MAX_USB_CLIENT + IPA_LAN_TO_LAN_MAX_CPE_CLIENT)
+#define IPA_LAN_TO_LAN_MAX_CLIENT (IPA_LAN_TO_LAN_MAX_LAN_CLIENT + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT)
 #define TCP_FIN_SHIFT 16
 #define TCP_SYN_SHIFT 17
 #define TCP_RST_SHIFT 18
@@ -185,23 +186,21 @@
 	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_LAN_CLIENT_ADD_EVENT,      /* 44 ipacm_event_data_mac */
-	IPA_ETH_BRIDGE_WLAN_CLIENT_ADD_EVENT,     /* 45 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_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_WAN_XLAT_CONNECT_EVENT,               /* 53 ipacm_event_data_fid */
-	IPA_TETHERING_STATS_UPDATE_EVENT,         /* 54 ipacm_event_data_fid */
-	IPA_NETWORK_STATS_UPDATE_EVENT,           /* 55 ipacm_event_data_fid */
-	IPA_HANDLE_WAN_UP_TETHER,                 /* 56 ipacm_event_iface_up_tehter */
-	IPA_HANDLE_WAN_DOWN_TETHER,               /* 57 ipacm_event_iface_up_tehter */
-	IPA_HANDLE_WAN_UP_V6_TETHER,		  /* 58 ipacm_event_iface_up_tehter */
-	IPA_HANDLE_WAN_DOWN_V6_TETHER,		  /* 59 ipacm_event_iface_up_tehter */
-	IPA_BRIDGE_LINK_UP_EVENT,                 /* 60 ipacm_event_data_all */
+	IPA_ETH_BRIDGE_CLIENT_ADD_EVENT,          /* 44 ipacm_event_data_mac */
+	IPA_ETH_BRIDGE_CLIENT_DEL_EVENT,          /* 45 ipacm_event_data_mac */
+	IPA_ETH_BRIDGE_HDR_PROC_CTX_SET_EVENT,    /* 46 ipacm_event_data_if_cat */
+	IPA_ETH_BRIDGE_HDR_PROC_CTX_UNSET_EVENT,  /* 47 ipacm_event_data_if_cat */
+	IPA_WLAN_SWITCH_TO_SCC,                   /* 48 No Data */
+	IPA_WLAN_SWITCH_TO_MCC,                   /* 49 No Data */
+	IPA_CRADLE_WAN_MODE_SWITCH,               /* 50 ipacm_event_cradle_wan_mode */
+	IPA_WAN_XLAT_CONNECT_EVENT,               /* 51 ipacm_event_data_fid */
+	IPA_TETHERING_STATS_UPDATE_EVENT,         /* 52 ipacm_event_data_fid */
+	IPA_NETWORK_STATS_UPDATE_EVENT,           /* 53 ipacm_event_data_fid */
+	IPA_HANDLE_WAN_UP_TETHER,                 /* 54 ipacm_event_iface_up_tehter */
+	IPA_HANDLE_WAN_DOWN_TETHER,               /* 55 ipacm_event_iface_up_tehter */
+	IPA_HANDLE_WAN_UP_V6_TETHER,		      /* 56 ipacm_event_iface_up_tehter */
+	IPA_HANDLE_WAN_DOWN_V6_TETHER,		      /* 57 ipacm_event_iface_up_tehter */
+	IPA_BRIDGE_LINK_UP_EVENT,                 /* 58 ipacm_event_data_all */
 	IPACM_EVENT_MAX
 } ipa_cm_event_id;
 
@@ -324,6 +323,7 @@
 typedef struct _ipacm_event_data_mac
 {
 	int if_index;
+	int ipa_if_cate;
 	uint8_t mac_addr[IPA_MAC_ADDR_SIZE];
 } ipacm_event_data_mac;
 
diff --git a/ipacm/inc/IPACM_Filtering.h b/ipacm/inc/IPACM_Filtering.h
index 7554ba9..9bb8247 100644
--- a/ipacm/inc/IPACM_Filtering.h
+++ b/ipacm/inc/IPACM_Filtering.h
@@ -1,5 +1,5 @@
-/* 
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
+/*
+Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
@@ -53,6 +53,7 @@
 	IPACM_Filtering();
 	~IPACM_Filtering();
 	bool AddFilteringRule(struct ipa_ioc_add_flt_rule const *ruleTable);
+	bool AddFilteringRuleAfter(struct ipa_ioc_add_flt_rule_after const *ruleTable);
 	bool DeleteFilteringRule(struct ipa_ioc_del_flt_rule *ruleTable);
 	bool Commit(enum ipa_ip_type ip);
 	bool Reset(enum ipa_ip_type ip);
diff --git a/ipacm/inc/IPACM_Iface.h b/ipacm/inc/IPACM_Iface.h
index 9f38325..89bb26f 100644
--- a/ipacm/inc/IPACM_Iface.h
+++ b/ipacm/inc/IPACM_Iface.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
+Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
@@ -81,7 +81,7 @@
 	int ipa_if_num;
 
 	/* IPACM interface category */
-	int ipa_if_cate;
+	ipacm_iface_type ipa_if_cate;
 
 	/* IPACM interface name */
 	char dev_name[IF_NAME_LEN];
diff --git a/ipacm/inc/IPACM_Lan.h b/ipacm/inc/IPACM_Lan.h
index a210255..7a93b12 100644
--- a/ipacm/inc/IPACM_Lan.h
+++ b/ipacm/inc/IPACM_Lan.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
+Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
@@ -121,7 +121,7 @@
 	bool valid;
 };
 
-struct eth_bridge_client_flt_info
+struct eth_bridge_subnet_client_flt_info
 {
 	uint8_t mac[IPA_MAC_ADDR_SIZE];
 	uint32_t flt_rule_hdl_v4;
@@ -146,6 +146,7 @@
 {
 	uint8_t mac[IPA_MAC_ADDR_SIZE];
 	int ipa_if_num;
+	int ipa_if_cate;
 };
 
 /* lan iface */
@@ -219,27 +220,18 @@
 	static hdr_proc_ctx_info wlan_to_wlan_hdr_proc_ctx;
 	static hdr_proc_ctx_info cpe_to_usb_hdr_proc_ctx, usb_to_cpe_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_lan_client[IPA_LAN_TO_LAN_MAX_LAN_CLIENT];
+	static eth_bridge_subnet_client_info eth_bridge_client[IPA_LAN_TO_LAN_MAX_CLIENT];
 
-	static int num_wlan_client;
-	static int num_lan_client;
+	static int eth_bridge_num_client;
 
 	static bool is_usb_up;
 	static bool is_cpe_up;
 
 protected:
 
-	lan2lan_flt_rule_hdl wlan_client_flt_rule_hdl_v4[IPA_LAN_TO_LAN_MAX_WLAN_CLIENT];
-	lan2lan_flt_rule_hdl wlan_client_flt_rule_hdl_v6[IPA_LAN_TO_LAN_MAX_WLAN_CLIENT];
-	lan2lan_flt_rule_hdl lan_client_flt_rule_hdl_v4[IPA_LAN_TO_LAN_MAX_LAN_CLIENT];
-	lan2lan_flt_rule_hdl lan_client_flt_rule_hdl_v6[IPA_LAN_TO_LAN_MAX_LAN_CLIENT];
+	eth_bridge_subnet_client_flt_info eth_bridge_client_flt_info[IPA_LAN_TO_LAN_MAX_CLIENT];
 
-	eth_bridge_client_flt_info eth_bridge_wlan_client_flt_info[IPA_LAN_TO_LAN_MAX_WLAN_CLIENT];
-	eth_bridge_client_flt_info eth_bridge_lan_client_flt_info[IPA_LAN_TO_LAN_MAX_LAN_CLIENT];
-
-	int wlan_client_flt_info_count;
-	int lan_client_flt_info_count;
+	int client_flt_info_count;
 
 	int client_rt_info_size_v4;
 	int client_rt_info_size_v6;
@@ -256,17 +248,9 @@
 	int each_client_rt_rule_count_v4;
 	int each_client_rt_rule_count_v6;
 
-	virtual int eth_bridge_handle_dummy_wlan_client_flt_rule(ipa_ip_type iptype);
+	int eth_bridge_add_client_flt_rule(uint8_t* mac, ipa_ip_type iptype, int dest_if_cate);
 
-	virtual int eth_bridge_handle_dummy_lan_client_flt_rule(ipa_ip_type iptype);
-
-	int eth_bridge_add_lan_client_flt_rule(uint8_t* mac, ipa_ip_type iptype);
-
-	int eth_bridge_del_lan_client_flt_rule(uint8_t* mac);
-
-	int eth_bridge_add_wlan_client_flt_rule(uint8_t* mac, ipa_ip_type iptype);
-
-	int eth_bridge_del_wlan_client_flt_rule(uint8_t* mac);
+	int eth_bridge_del_client_flt_rule(uint8_t* mac);
 
 	int eth_bridge_post_lan_client_event(uint8_t* mac_addr, ipa_cm_event_id evt);
 
@@ -276,9 +260,7 @@
 
 	ipa_hdr_proc_type get_hdr_proc_type(ipa_hdr_l2_type t1, ipa_hdr_l2_type t2);
 
-	virtual int eth_bridge_install_cache_wlan_client_flt_rule(ipa_ip_type iptype);
-
-	virtual int eth_bridge_install_cache_lan_client_flt_rule(ipa_ip_type iptype);
+	virtual int eth_bridge_install_cache_client_flt_rule(ipa_ip_type iptype);
 
 	int eth_bridge_add_lan_client_rt_rule(uint8_t* mac, eth_bridge_src_iface src, ipa_ip_type iptype);
 
@@ -286,12 +268,20 @@
 
 	eth_bridge_client_rt_info* eth_bridge_get_client_rt_info_ptr(uint8_t index, eth_bridge_src_iface src, ipa_ip_type iptype);
 
-	void eth_bridge_add_lan_client(uint8_t* mac);
+	void eth_bridge_add_client(uint8_t* mac);
 
-	void eth_bridge_del_lan_client(uint8_t* mac);
+	void eth_bridge_del_client(uint8_t* mac);
+
+	int eth_bridge_remove_all_client_flt_rule(ipa_ip_type iptype);
 
 	int eth_bridge_get_hdr_template_hdl(uint32_t* hdr_hdl);
 
+	bool eth_bridge_is_lan_client(int ipa_if_cate);
+
+	enum ipa_hdr_l2_type eth_bridge_get_l2_hdr_type();
+
+	void eth_bridge_get_rt_tbl_name(ipa_ip_type iptype, struct ipa_ioc_get_rt_tbl *rt_tbl, int dest_if_cate);
+
 
 
 	virtual int add_dummy_lan2lan_flt_rule(ipa_ip_type iptype);
@@ -352,9 +342,8 @@
 
 	uint32_t if_ipv4_subnet;
 
-	/* expected modem UL rules starting index */
-	int exp_index_v4;
-	int exp_index_v6;
+	uint32_t eth_bridge_flt_rule_offset_v4;
+	uint32_t eth_bridge_flt_rule_offset_v6;
 
 private:
 
diff --git a/ipacm/inc/IPACM_Wlan.h b/ipacm/inc/IPACM_Wlan.h
index 6a2d53a..c1fce13 100644
--- a/ipacm/inc/IPACM_Wlan.h
+++ b/ipacm/inc/IPACM_Wlan.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
+Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
@@ -92,15 +92,6 @@
 
 private:
 
-	eth_bridge_client_flt_info eth_bridge_lan_client_flt_info[IPA_LAN_TO_LAN_MAX_LAN_CLIENT];
-	int lan_client_flt_info_count;
-
-	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 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_lan_info_v4;
@@ -113,23 +104,7 @@
 	eth_bridge_client_rt_info* eth_bridge_wlan_client_rt_from_wlan_info_v6;
 	int wlan_client_rt_from_wlan_info_count_v6;
 
-	int eth_bridge_install_wlan_guest_ap_ipv6_flt_rule();
-
-	virtual int eth_bridge_handle_dummy_wlan_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_lan_client_flt_rule(uint8_t* mac, ipa_ip_type iptype);
-
-	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);
-
-	int eth_bridge_del_self_client_flt_rule(uint8_t* mac);
-
-	virtual int eth_bridge_install_cache_wlan_client_flt_rule(ipa_ip_type iptype);
-
-	virtual int eth_bridge_install_cache_lan_client_flt_rule(ipa_ip_type iptype);
+	virtual int eth_bridge_install_cache_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);
 
@@ -137,9 +112,12 @@
 
 	eth_bridge_client_rt_info* eth_bridge_get_client_rt_info_ptr(uint8_t index, eth_bridge_src_iface src, ipa_ip_type iptype);
 
-	void eth_bridge_add_wlan_client(uint8_t* mac, int if_num);
+	void eth_bridge_handle_wlan_SCC_MCC_switch(ipa_ip_type iptype);
 
-	void eth_bridge_del_wlan_client(uint8_t* mac);
+	int eth_bridge_modify_wlan_rt_rule(uint8_t* mac, eth_bridge_src_iface src_iface, ipa_ip_type iptyp);
+
+	/*handle wlan access mode switch */
+	void eth_bridge_handle_wlan_mode_switch();
 
 
 	int wlan_client_len;
@@ -280,28 +258,8 @@
 	/*handle wlan iface down event*/
 	int handle_down_evt();
 
-	/* add dummy filtering rules for WLAN AP-AP mode support */
-	void add_dummy_flt_rule();
-
-	/* install dummy filtering rules for WLAN AP-AP mode support */
-	int install_dummy_flt_rule(ipa_ip_type iptype, int num_rule);
-
-	/* delete dummy flt rule for WLAN AP-AP mode support*/
-	void del_dummy_flt_rule();
-
-	/*Configure the initial filter rules */
-	virtual int init_fl_rule(ipa_ip_type iptype);
-
 	virtual int add_dummy_lan2lan_flt_rule(ipa_ip_type iptype);
 
-	virtual int add_dummy_private_subnet_flt_rule(ipa_ip_type iptype);
-
-	/*configure private subnet filter rules*/
-	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, uint8_t xlat_mux_id);
-
 	/* install TCP control filter rules */
 	virtual void install_tcp_ctl_flt_rule(ipa_ip_type iptype);
 
@@ -310,19 +268,6 @@
 
 	void handle_SCC_MCC_switch(ipa_ip_type);
 
-	void eth_bridge_handle_wlan_SCC_MCC_switch(ipa_ip_type iptype);
-
-	int eth_bridge_modify_wlan_client_flt_rule(uint8_t* mac, eth_bridge_dst_iface dst_iface, ipa_ip_type iptype);
-
-	int eth_bridge_modify_wlan_rt_rule(uint8_t* mac, eth_bridge_src_iface src_iface, ipa_ip_type iptyp);
-
-	/*handle wlan access mode switch */
-	void eth_bridge_handle_wlan_mode_switch();
-
-	virtual int install_ipv6_prefix_flt_rule(uint32_t* prefix);
-
-	virtual void delete_ipv6_prefix_flt_rule();
-
 };
 
 
diff --git a/ipacm/src/IPACM_Filtering.cpp b/ipacm/src/IPACM_Filtering.cpp
index bd8dadb..7faecad 100644
--- a/ipacm/src/IPACM_Filtering.cpp
+++ b/ipacm/src/IPACM_Filtering.cpp
@@ -1,5 +1,5 @@
-/* 
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
+/*
+Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
@@ -80,9 +80,8 @@
 	IPACMDBG("commit value: %d\n", ruleTable->commit);
 	for (int cnt=0; cnt<ruleTable->num_rules; cnt++)
 	{
-		IPACMDBG("Filter rule:%d attrib mask: 0x%x\n",
-						 cnt, 
-						 ruleTable->rules[cnt].rule.attrib.attrib_mask);
+		IPACMDBG("Filter rule:%d attrib mask: 0x%x\n", cnt,
+				ruleTable->rules[cnt].rule.attrib.attrib_mask);
 	}
 
 	retval = ioctl(fd, IPA_IOC_ADD_FLT_RULE, ruleTable);
@@ -115,6 +114,38 @@
 	return true;
 }
 
+bool IPACM_Filtering::AddFilteringRuleAfter(struct ipa_ioc_add_flt_rule_after const *ruleTable)
+{
+#ifdef FEATURE_IPA_V3
+	int retval = 0;
+
+	IPACMDBG("Printing filter add attributes\n");
+	IPACMDBG("ip type: %d\n", ruleTable->ip);
+	IPACMDBG("Number of rules: %d\n", ruleTable->num_rules);
+	IPACMDBG("End point: %d\n", ruleTable->ep);
+	IPACMDBG("commit value: %d\n", ruleTable->commit);
+
+	retval = ioctl(fd, IPA_IOC_ADD_FLT_RULE_AFTER, ruleTable);
+
+	for (int cnt = 0; cnt<ruleTable->num_rules; cnt++)
+	{
+		if(ruleTable->rules[cnt].status != 0)
+		{
+			IPACMERR("Adding Filter rule:%d failed with status:%d\n",
+							 cnt, ruleTable->rules[cnt].status);
+		}
+	}
+
+	if (retval != 0)
+	{
+		IPACMERR("Failed adding Filtering rule %p\n", ruleTable);
+		return false;
+	}
+	IPACMDBG("Added Filtering rule %p\n", ruleTable);
+#endif
+	return true;
+}
+
 bool IPACM_Filtering::DeleteFilteringRule(struct ipa_ioc_del_flt_rule *ruleTable)
 {
 	int retval = 0;
@@ -215,8 +246,7 @@
 			     res = false;
 			     goto fail;
 		        }
-		   
-		   }	   
+		   }
 	    }
 	}
 
@@ -285,7 +315,7 @@
 		qmi_rule_msg.source_pipe_index_valid = 0;
 
 		IPACMDBG_H("Get %d WAN DL filtering rules in total.\n", num_rules);
-		
+
 		if(rule_table_v4 != NULL)
 		{
 			for(cnt = rule_table_v4->num_rules - 1; cnt >= 0; cnt--)
diff --git a/ipacm/src/IPACM_IfaceManager.cpp b/ipacm/src/IPACM_IfaceManager.cpp
index 59884ab..259532d 100644
--- a/ipacm/src/IPACM_IfaceManager.cpp
+++ b/ipacm/src/IPACM_IfaceManager.cpp
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
+Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
@@ -246,10 +246,8 @@
 				IPACM_EvtDispatcher::registr(IPA_CFG_CHANGE_EVENT, lan); 				// register for IPA_CFG_CHANGE event
 				IPACM_EvtDispatcher::registr(IPA_PRIVATE_SUBNET_CHANGE_EVENT, lan); 	// register for IPA_PRIVATE_SUBNET_CHANGE_EVENT event
 #ifdef FEATURE_ETH_BRIDGE_LE
-				IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_LAN_CLIENT_ADD_EVENT, lan);
-				IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_LAN_CLIENT_DEL_EVENT, lan);
-				IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_WLAN_CLIENT_ADD_EVENT, lan);
-				IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_WLAN_CLIENT_DEL_EVENT, lan);
+				IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_CLIENT_ADD_EVENT, lan);
+				IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_CLIENT_DEL_EVENT, lan);
 				IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_HDR_PROC_CTX_SET_EVENT, lan);
 				IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_HDR_PROC_CTX_UNSET_EVENT, lan);
 #endif
@@ -304,10 +302,8 @@
 					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_LAN_CLIENT_ADD_EVENT, odu);
-					IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_LAN_CLIENT_DEL_EVENT, odu);
-					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_CLIENT_ADD_EVENT, odu);
+					IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_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
@@ -364,8 +360,8 @@
 #endif
 				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_LAN_CLIENT_ADD_EVENT, wl);
-				IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_LAN_CLIENT_DEL_EVENT, wl);
+				IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_CLIENT_ADD_EVENT, wl);
+				IPACM_EvtDispatcher::registr(IPA_ETH_BRIDGE_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);
 				IPACM_EvtDispatcher::registr(IPA_CFG_CHANGE_EVENT, wl);
diff --git a/ipacm/src/IPACM_Lan.cpp b/ipacm/src/IPACM_Lan.cpp
index 798cd51..ce96196 100644
--- a/ipacm/src/IPACM_Lan.cpp
+++ b/ipacm/src/IPACM_Lan.cpp
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
+Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
@@ -69,11 +69,9 @@
 hdr_proc_ctx_info IPACM_Lan::usb_to_cpe_hdr_proc_ctx;
 hdr_proc_ctx_info IPACM_Lan::cpe_to_usb_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_lan_client[IPA_LAN_TO_LAN_MAX_LAN_CLIENT];
+eth_bridge_subnet_client_info IPACM_Lan::eth_bridge_client[IPA_LAN_TO_LAN_MAX_CLIENT];
 
-int IPACM_Lan::num_wlan_client = 0;
-int IPACM_Lan::num_lan_client = 0;
+int IPACM_Lan::eth_bridge_num_client = 0;
 bool IPACM_Lan::is_usb_up = false;
 bool IPACM_Lan::is_cpe_up = false;
 
@@ -100,7 +98,7 @@
 	/* support eth multiple clients */
 	if(iface_query != NULL)
 	{
-		if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat != WLAN_IF)
+		if(ipa_if_cate != 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);
@@ -114,8 +112,7 @@
 		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
-			|| IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ODU_IF) && tx_prop != NULL)
+		if((ipa_if_cate == LAN_IF || ipa_if_cate == ODU_IF) && tx_prop != NULL)
 		{
 			if (IPACM_Lan::lan_hdr_type != IPA_HDR_L2_NONE && tx_prop->tx[0].hdr_l2_type != IPACM_Lan::lan_hdr_type)
 			{
@@ -123,7 +120,7 @@
 			}
 			else
 			{
-				if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == LAN_IF)
+				if(ipa_if_cate == LAN_IF)
 				{
 					hdr_template_ptr = &IPACM_Lan::usb_hdr_template_hdl;
 					IPACM_Lan::is_usb_up = true;
@@ -148,7 +145,7 @@
 		}
 #endif
 		/* ODU routing table initilization */
-		if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ODU_IF)
+		if(ipa_if_cate == ODU_IF)
 		{
 			odu_route_rule_v4_hdl = (uint32_t *)calloc(iface_query->num_tx_props, sizeof(uint32_t));
 			odu_route_rule_v6_hdl = (uint32_t *)calloc(iface_query->num_tx_props, sizeof(uint32_t));
@@ -175,11 +172,6 @@
 	memset(lan2lan_hdr_hdl_v4, 0, MAX_OFFLOAD_PAIR*sizeof(lan2lan_hdr_hdl));
 	memset(lan2lan_hdr_hdl_v6, 0, MAX_OFFLOAD_PAIR*sizeof(lan2lan_hdr_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));
-	memset(wlan_client_flt_rule_hdl_v4, 0, IPA_LAN_TO_LAN_MAX_WLAN_CLIENT * sizeof(lan2lan_flt_rule_hdl));
-	memset(wlan_client_flt_rule_hdl_v6, 0, IPA_LAN_TO_LAN_MAX_WLAN_CLIENT * sizeof(lan2lan_flt_rule_hdl));
-
 	is_active = true;
 	memset(ipv4_icmp_flt_rule_hdl, 0, NUM_IPV4_ICMP_FLT_RULE * sizeof(uint32_t));
 	memset(tcp_ctl_flt_rule_hdl_v4, 0, NUM_TCP_CTL_FLT_RULE*sizeof(uint32_t));
@@ -192,32 +184,8 @@
 	modem_ul_v4_set = false;
 	modem_ul_v6_set = false;
 
-#ifdef FEATURE_ETH_BRIDGE_LE
-	if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == LAN_IF)
-	{
-		exp_index_v4 = IPV4_DEFAULT_FILTERTING_RULES + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_CPE_CLIENT + NUM_IPV4_ICMP_FLT_RULE + IPACM_Iface::ipacmcfg->ipa_num_private_subnet;
-		exp_index_v6 = IPV6_DEFAULT_FILTERTING_RULES + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_CPE_CLIENT + NUM_IPV6_ICMP_FLT_RULE + NUM_IPV6_PREFIX_FLT_RULE;
-	}
-	if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ODU_IF)
-	{
-		exp_index_v4 = IPV4_DEFAULT_FILTERTING_RULES + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_USB_CLIENT + NUM_IPV4_ICMP_FLT_RULE + IPACM_Iface::ipacmcfg->ipa_num_private_subnet;
-		exp_index_v6 = IPV6_DEFAULT_FILTERTING_RULES + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_USB_CLIENT + NUM_IPV6_ICMP_FLT_RULE + NUM_IPV6_PREFIX_FLT_RULE;
-	}
-#else
-#ifdef CT_OPT
-	exp_index_v4 = IPV4_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR + NUM_TCP_CTL_FLT_RULE + NUM_IPV4_ICMP_FLT_RULE +IPACM_Iface::ipacmcfg->ipa_num_private_subnet;
-	exp_index_v6 = IPV6_DEFAULT_FILTERTING_RULES + NUM_TCP_CTL_FLT_RULE + MAX_OFFLOAD_PAIR + NUM_IPV6_ICMP_FLT_RULE + NUM_IPV6_PREFIX_FLT_RULE;
-#else
-	exp_index_v4 = IPV4_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR + NUM_IPV4_ICMP_FLT_RULE + IPACM_Iface::ipacmcfg->ipa_num_private_subnet;
-	exp_index_v6 = IPV6_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR + NUM_IPV6_ICMP_FLT_RULE + NUM_IPV6_PREFIX_FLT_RULE;
-#endif
-#ifdef FEATURE_IPA_ANDROID
-	exp_index_v4 = exp_index_v4 - IPACM_Iface::ipacmcfg->ipa_num_private_subnet + IPA_MAX_PRIVATE_SUBNET_ENTRIES;
-#endif
-#endif
-
 	/* ODU routing table initilization */
-	if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ODU_IF)
+	if(ipa_if_cate == ODU_IF)
 	{
 
 		/* only do one time ioctl to odu-driver to infrom in router or bridge mode*/
@@ -271,11 +239,7 @@
 	}
 	IPACMDBG_H("Need to add %d IPv4 and %d IPv6 routing rules for eth bridge for each client.\n", each_client_rt_rule_count_v4, each_client_rt_rule_count_v6);
 
-	memset(eth_bridge_lan_client_flt_info, 0, IPA_LAN_TO_LAN_MAX_LAN_CLIENT * sizeof(eth_bridge_client_flt_info));
-	memset(eth_bridge_wlan_client_flt_info, 0, IPA_LAN_TO_LAN_MAX_WLAN_CLIENT * sizeof(eth_bridge_client_flt_info));
-
-	lan_client_flt_info_count = 0;
-	wlan_client_flt_info_count = 0;
+	memset(eth_bridge_client_flt_info, 0, IPA_LAN_TO_LAN_MAX_CLIENT * sizeof(eth_bridge_subnet_client_flt_info));
 
 	eth_bridge_lan_client_rt_from_lan_info_v4 = NULL;
 	eth_bridge_lan_client_rt_from_lan_info_v6 = NULL;
@@ -300,7 +264,7 @@
 
 #ifdef FEATURE_IPA_ANDROID
 	/* set the IPA-client pipe enum */
-	if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == LAN_IF)
+	if(ipa_if_cate == LAN_IF)
 	{
 		handle_tethering_client(false, IPACM_CLIENT_USB);
 	}
@@ -457,8 +421,8 @@
 				IPACMDBG_H("Received IPA_ADDR_ADD_EVENT\n");
 
 				/* only call ioctl for ODU iface with bridge mode */
-				if((IPACM_Iface::ipacmcfg->ipacm_odu_enable == true) && (IPACM_Iface::ipacmcfg->ipacm_odu_router_mode == false)
-						&& (IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ODU_IF))
+				if(IPACM_Iface::ipacmcfg->ipacm_odu_enable == true && IPACM_Iface::ipacmcfg->ipacm_odu_router_mode == false
+						&& ipa_if_cate == ODU_IF)
 				{
 					if((data->iptype == IPA_IP_v6) && (num_dft_rt_v6 == 0))
 					{
@@ -483,16 +447,6 @@
 						{
 							return;
 						}
-						/* ADD ipv4 icmp rule */
-						if (data->iptype == IPA_IP_v4)
-						{
-							install_ipv4_icmp_flt_rule();
-						}
-						/* ADD ipv6 icmp rule */
-						if ((num_dft_rt_v6 == 1) && (data->iptype == IPA_IP_v6))
-						{
-							install_ipv6_icmp_flt_rule();
-						}
 
 #ifdef FEATURE_IPA_ANDROID
 						add_dummy_private_subnet_flt_rule(data->iptype);
@@ -773,9 +727,9 @@
 			ipacm_event_data_all *data = (ipacm_event_data_all *)param;
 			ipa_interface_index = iface_ipa_index_query(data->if_index);
 			IPACMDBG_H("Recieved IPA_NEIGH_CLIENT_IP_ADDR_ADD_EVENT event \n");
-			IPACMDBG_H("check iface %s category: %d\n",IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].iface_name, IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat);
+			IPACMDBG_H("check iface %s category: %d\n", dev_name, ipa_if_cate);
 
-			if ((ipa_interface_index == ipa_if_num) && (IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ODU_IF))
+			if (ipa_interface_index == ipa_if_num && ipa_if_cate == ODU_IF)
 			{
 				IPACMDBG_H("ODU iface got v4-ip \n");
 				/* first construc ODU full header */
@@ -820,7 +774,7 @@
 					CtList->HandleNeighIpAddrAddEvt(data);
 				}
 #ifdef FEATURE_ETH_BRIDGE_LE
-				if (IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == LAN_IF)
+				if (ipa_if_cate == LAN_IF)
 				{
 					if (IPACM_Lan::cpe_to_usb_hdr_proc_ctx.valid == true)
 					{
@@ -833,7 +787,7 @@
 						eth_bridge_add_lan_client_rt_rule(data->mac_addr, SRC_WLAN, IPA_IP_v6);
 					}
 				}
-				if (IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ODU_IF)
+				if (ipa_if_cate == ODU_IF)
 				{
 					if (IPACM_Lan::usb_to_cpe_hdr_proc_ctx.valid == true)
 					{
@@ -846,8 +800,8 @@
 						eth_bridge_add_lan_client_rt_rule(data->mac_addr, SRC_WLAN, 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);
+				eth_bridge_post_lan_client_event(data->mac_addr, IPA_ETH_BRIDGE_CLIENT_ADD_EVENT);
+				eth_bridge_add_client(data->mac_addr);
 #endif
 				return;
 			}
@@ -860,10 +814,9 @@
 			ipa_interface_index = iface_ipa_index_query(data->if_index);
 
 			IPACMDBG_H("Received IPA_NEIGH_CLIENT_IP_ADDR_DEL_EVENT event. \n");
-			IPACMDBG_H("check iface %s category: %d\n",IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].iface_name, IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat);
+			IPACMDBG_H("check iface %s category: %d\n", dev_name, ipa_if_cate);
 			/* if ODU in bridge mode, directly return */
-			if ((ipa_interface_index == ipa_if_num) && (IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ODU_IF)
-					&& (IPACM_Iface::ipacmcfg->ipacm_odu_router_mode == false))
+			if (ipa_if_cate == ODU_IF && IPACM_Iface::ipacmcfg->ipacm_odu_router_mode == false)
 			{
 				IPACMDBG_H("ODU is in bridge mode, no action \n");
 				return;
@@ -877,7 +830,7 @@
 					return;
 				}
 #ifdef FEATURE_ETH_BRIDGE_LE
-				if (IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == LAN_IF)
+				if (ipa_if_cate == LAN_IF)
 				{
 					if (IPACM_Lan::cpe_to_usb_hdr_proc_ctx.valid == true)
 					{
@@ -888,7 +841,7 @@
 						eth_bridge_del_lan_client_rt_rule(data->mac_addr, SRC_WLAN);
 					}
 				}
-				if (IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ODU_IF)
+				if (ipa_if_cate == ODU_IF)
 				{
 					if (IPACM_Lan::usb_to_cpe_hdr_proc_ctx.valid == true)
 					{
@@ -899,8 +852,8 @@
 						eth_bridge_del_lan_client_rt_rule(data->mac_addr, SRC_WLAN);
 					}
 				}
-				eth_bridge_post_lan_client_event(data->mac_addr, IPA_ETH_BRIDGE_LAN_CLIENT_DEL_EVENT);
-				eth_bridge_del_lan_client(data->mac_addr);
+				eth_bridge_post_lan_client_event(data->mac_addr, IPA_ETH_BRIDGE_CLIENT_DEL_EVENT);
+				eth_bridge_del_client(data->mac_addr);
 #endif
 				IPACMDBG_H("LAN iface delete client \n");
 				handle_eth_client_down_evt(data->mac_addr);
@@ -922,9 +875,9 @@
 		handle_software_routing_disable();
 		break;
 
-	case IPA_ETH_BRIDGE_LAN_CLIENT_ADD_EVENT:
+	case IPA_ETH_BRIDGE_CLIENT_ADD_EVENT:
 			{
-				IPACMDBG_H("Received IPA_ETH_BRIDGE_LAN_CLIENT_ADD_EVENT event.\n");
+				IPACMDBG_H("Received IPA_ETH_BRIDGE_CLIENT_ADD_EVENT event.\n");
 				ipacm_event_data_mac* mac = (ipacm_event_data_mac*)param;
 				if(mac != NULL)
 				{
@@ -935,11 +888,11 @@
 					}
 					if(ip_type == IPA_IP_v4 || ip_type == IPA_IP_MAX)
 					{
-						eth_bridge_add_lan_client_flt_rule(mac->mac_addr, IPA_IP_v4);
+						eth_bridge_add_client_flt_rule(mac->mac_addr, IPA_IP_v4, mac->ipa_if_cate);
 					}
 					if(ip_type == IPA_IP_v6 || ip_type == IPA_IP_MAX)
 					{
-						eth_bridge_add_lan_client_flt_rule(mac->mac_addr, IPA_IP_v6);
+						eth_bridge_add_client_flt_rule(mac->mac_addr, IPA_IP_v6, mac->ipa_if_cate);
 					}
 				}
 				else
@@ -949,9 +902,9 @@
 			}
 			break;
 
-	case IPA_ETH_BRIDGE_LAN_CLIENT_DEL_EVENT:
+	case IPA_ETH_BRIDGE_CLIENT_DEL_EVENT:
 			{
-				IPACMDBG_H("Received IPA_ETH_BRIDGE_LAN_CLIENT_DEL_EVENT event.\n");
+				IPACMDBG_H("Received IPA_ETH_BRIDGE_CLIENT_DEL_EVENT event.\n");
 				ipacm_event_data_mac* mac = (ipacm_event_data_mac*)param;
 				if(mac != NULL)
 				{
@@ -960,9 +913,9 @@
 						IPACMDBG_H("The event was sent by same interface, if_index: %d ignore. \n", mac->if_index);
 						return;
 					}
-					if(eth_bridge_del_lan_client_flt_rule(mac->mac_addr) == IPACM_FAILURE)
+					if(eth_bridge_del_client_flt_rule(mac->mac_addr) == IPACM_FAILURE)
 					{
-						IPACMDBG_H("Failed to delete lan client MAC based flt rule.\n");
+						IPACMDBG_H("Failed to delete client MAC based flt rule.\n");
 					}
 				}
 				else
@@ -972,46 +925,6 @@
 			}
 			break;
 
-	case IPA_ETH_BRIDGE_WLAN_CLIENT_ADD_EVENT:
-		{
-			IPACMDBG_H("Received IPA_ETH_BRIDGE_WLAN_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_wlan_client_flt_rule(mac->mac_addr, IPA_IP_v4);
-				}
-				if(ip_type == IPA_IP_v6 || ip_type == IPA_IP_MAX)
-				{
-					eth_bridge_add_wlan_client_flt_rule(mac->mac_addr, IPA_IP_v6);
-				}
-			}
-			else
-			{
-				IPACMERR("Event MAC is empty.\n");
-			}
-		}
-		break;
-
-	case IPA_ETH_BRIDGE_WLAN_CLIENT_DEL_EVENT:
-		{
-			IPACMDBG_H("Received IPA_ETH_BRIDGE_WLAN_CLIENT_DEL_EVENT event.\n");
-			ipacm_event_data_mac* mac = (ipacm_event_data_mac*)param;
-			if(mac != NULL)
-			{
-				if(eth_bridge_del_wlan_client_flt_rule(mac->mac_addr) == IPACM_FAILURE)
-				{
-					IPACMDBG_H("Failed to delete wlan client MAC based flt rule.\n");
-				}
-			}
-			else
-			{
-				IPACMERR("Event MAC is empty.\n");
-			}
-		}
-		break;
-
 	case IPA_ETH_BRIDGE_HDR_PROC_CTX_SET_EVENT:
 	{
 		IPACMDBG_H("Received IPA_ETH_BRIDGE_HDR_PROC_CTX_SET_EVENT event.\n");
@@ -1022,25 +935,25 @@
 			IPACMERR("Event data is empty.\n");
 			return;
 		}
-		if (cat->if_cat == IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat)
+		if (cat->if_cat == ipa_if_cate)
 		{
 			IPACMDBG_H("The event was sent by same interface, if_cat: %d ignore. \n", cat->if_cat);
 			return;
 		}
 
-		for(i=0; i<IPACM_Lan::num_lan_client; i++)
+		for(i=0; i<IPACM_Lan::eth_bridge_num_client; i++)
 		{
-			if(IPACM_Lan::eth_bridge_lan_client[i].ipa_if_num == ipa_if_num)
+			if(IPACM_Lan::eth_bridge_client[i].ipa_if_num == ipa_if_num)
 			{
 				if (cat->if_cat == WLAN_IF)
 				{
-					eth_bridge_add_lan_client_rt_rule(IPACM_Lan::eth_bridge_lan_client[i].mac, SRC_WLAN, IPA_IP_v4);
-					eth_bridge_add_lan_client_rt_rule(IPACM_Lan::eth_bridge_lan_client[i].mac, SRC_WLAN, IPA_IP_v6);
+					eth_bridge_add_lan_client_rt_rule(IPACM_Lan::eth_bridge_client[i].mac, SRC_WLAN, IPA_IP_v4);
+					eth_bridge_add_lan_client_rt_rule(IPACM_Lan::eth_bridge_client[i].mac, SRC_WLAN, IPA_IP_v6);
 				}
 				else
 				{
-					eth_bridge_add_lan_client_rt_rule(IPACM_Lan::eth_bridge_lan_client[i].mac, SRC_LAN, IPA_IP_v4);
-					eth_bridge_add_lan_client_rt_rule(IPACM_Lan::eth_bridge_lan_client[i].mac, SRC_LAN, IPA_IP_v6);
+					eth_bridge_add_lan_client_rt_rule(IPACM_Lan::eth_bridge_client[i].mac, SRC_LAN, IPA_IP_v4);
+					eth_bridge_add_lan_client_rt_rule(IPACM_Lan::eth_bridge_client[i].mac, SRC_LAN, IPA_IP_v6);
 				}
 			}
 		}
@@ -1057,23 +970,23 @@
 			IPACMERR("Event data is empty.\n");
 			return;
 		}
-		if (cat->if_cat == IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat)
+		if (cat->if_cat == ipa_if_cate)
 		{
 			IPACMDBG_H("The event was sent by same interface, if_cat: %d ignore.\n", cat->if_cat);
 			return;
 		}
 
-		for(i=0; i<IPACM_Lan::num_lan_client; i++)
+		for(i=0; i<IPACM_Lan::eth_bridge_num_client; i++)
 		{
-			if(IPACM_Lan::eth_bridge_lan_client[i].ipa_if_num == ipa_if_num)
+			if(IPACM_Lan::eth_bridge_client[i].ipa_if_num == ipa_if_num)
 			{
 				if (cat->if_cat == WLAN_IF)
 				{
-					eth_bridge_del_lan_client_rt_rule(IPACM_Lan::eth_bridge_lan_client[i].mac, SRC_WLAN);
+					eth_bridge_del_lan_client_rt_rule(IPACM_Lan::eth_bridge_client[i].mac, SRC_WLAN);
 				}
 				else
 				{
-					eth_bridge_del_lan_client_rt_rule(IPACM_Lan::eth_bridge_lan_client[i].mac, SRC_LAN);
+					eth_bridge_del_lan_client_rt_rule(IPACM_Lan::eth_bridge_client[i].mac, SRC_LAN);
 				}
 			}
 		}
@@ -1292,16 +1205,16 @@
 
 /* Add private subnet*/
 #ifdef FEATURE_IPA_ANDROID
-if (data->iptype == IPA_IP_v4)
-{
-	IPACMDBG_H("current IPACM private subnet_addr number(%d)\n", IPACM_Iface::ipacmcfg->ipa_num_private_subnet);
-	if_ipv4_subnet = (data->ipv4_addr >> 8) << 8;
-	IPACMDBG_H(" Add IPACM private subnet_addr as: 0x%x \n", if_ipv4_subnet);
-	if(IPACM_Iface::ipacmcfg->AddPrivateSubnet(if_ipv4_subnet, ipa_if_num) == false)
+	if (data->iptype == IPA_IP_v4)
 	{
-		IPACMERR(" can't Add IPACM private subnet_addr as: 0x%x \n", if_ipv4_subnet);
+		IPACMDBG_H("current IPACM private subnet_addr number(%d)\n", IPACM_Iface::ipacmcfg->ipa_num_private_subnet);
+		if_ipv4_subnet = (data->ipv4_addr >> 8) << 8;
+		IPACMDBG_H(" Add IPACM private subnet_addr as: 0x%x \n", if_ipv4_subnet);
+		if(IPACM_Iface::ipacmcfg->AddPrivateSubnet(if_ipv4_subnet, ipa_if_num) == false)
+		{
+			IPACMERR(" can't Add IPACM private subnet_addr as: 0x%x \n", if_ipv4_subnet);
+		}
 	}
-}
 #endif /* defined(FEATURE_IPA_ANDROID)*/
 
 	if (data->iptype == IPA_IP_v4)
@@ -1344,18 +1257,13 @@
 		dft_rt_rule_hdl[0] = rt_rule_entry->rt_rule_hdl;
 		IPACMDBG_H("ipv4 iface rt-rule hdl1=0x%x\n", dft_rt_rule_hdl[0]);
 		/* initial multicast/broadcast/fragment filter rule */
+
+		init_fl_rule(data->iptype);
+		install_ipv4_icmp_flt_rule();
 #ifdef FEATURE_ETH_BRIDGE_LE
-		init_fl_rule(data->iptype);
-		eth_bridge_handle_dummy_wlan_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_lan_client_flt_rule(data->iptype);
-#else
-#ifdef CT_OPT
-		install_tcp_ctl_flt_rule(IPA_IP_v4);
-#endif
-		init_fl_rule(data->iptype);
-		add_dummy_lan2lan_flt_rule(data->iptype);
+		/* populate the flt rule offset for eth bridge */
+		eth_bridge_flt_rule_offset_v4 = ipv4_icmp_flt_rule_hdl[0];
+		eth_bridge_install_cache_client_flt_rule(data->iptype);
 #endif
 	}
 	else
@@ -1443,20 +1351,12 @@
 
 		if (num_dft_rt_v6 == 0)
 		{
-			/* initial multicast/broadcast/fragment filter rule */
+			install_ipv6_icmp_flt_rule();
 #ifdef FEATURE_ETH_BRIDGE_LE
-			eth_bridge_handle_dummy_wlan_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_lan_client_flt_rule(data->iptype);
-			init_fl_rule(data->iptype);
-#else
-#ifdef CT_OPT
-			install_tcp_ctl_flt_rule(IPA_IP_v6);
+			eth_bridge_flt_rule_offset_v6 = ipv6_icmp_flt_rule_hdl[0];
+			eth_bridge_install_cache_client_flt_rule(data->iptype);
 #endif
-			add_dummy_lan2lan_flt_rule(data->iptype);
 			init_fl_rule(data->iptype);
-#endif
 		}
 		num_dft_rt_v6++;
 		IPACMDBG_H("number of default route rules %d\n", num_dft_rt_v6);
@@ -2809,10 +2709,9 @@
 {
 	int i;
 	int res = IPACM_SUCCESS;
-	uint32_t temp_eth_bridge_flt_rule[IPA_LAN_TO_LAN_MAX_WLAN_CLIENT];
 
 	IPACMDBG_H("lan handle_down_evt\n ");
-	if (IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ODU_IF)
+	if (ipa_if_cate == ODU_IF)
 	{
 		/* delete ODU default RT rules */
 		if (IPACM_Iface::ipacmcfg->ipacm_odu_embms_enable == true)
@@ -2854,7 +2753,7 @@
 	}
 
 #ifdef FEATURE_ETH_BRIDGE_LE
-	if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == LAN_IF)
+	if(ipa_if_cate == LAN_IF)
 	{
 		IPACM_Lan::usb_hdr_template_hdl = 0;
 		IPACM_Lan::is_usb_up = false;
@@ -2863,7 +2762,7 @@
 			IPACM_Lan::lan_hdr_type = IPA_HDR_L2_NONE;
 		}
 	}
-	if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ODU_IF)
+	if(ipa_if_cate == ODU_IF)
 	{
 		IPACM_Lan::cpe_hdr_template_hdl = 0;
 		IPACM_Lan::is_cpe_up = false;
@@ -2906,70 +2805,9 @@
 			goto fail;
 		}
 		IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, IPV4_DEFAULT_FILTERTING_RULES);
+
 #ifdef FEATURE_ETH_BRIDGE_LE
-		for(i=0; i<IPA_LAN_TO_LAN_MAX_WLAN_CLIENT; i++)
-		{
-			temp_eth_bridge_flt_rule[i] = wlan_client_flt_rule_hdl_v4[i].rule_hdl;
-		}
-		if (m_filtering.DeleteFilteringHdls(temp_eth_bridge_flt_rule, IPA_IP_v4, IPA_LAN_TO_LAN_MAX_WLAN_CLIENT) == false)
-		{
-			IPACMERR("Error Deleting Filtering Rule, aborting...\n");
-			res = IPACM_FAILURE;
-			goto fail;
-		}
-		IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, IPA_LAN_TO_LAN_MAX_WLAN_CLIENT);
-
-		if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == LAN_IF)
-		{
-			for(i=0; i<IPA_LAN_TO_LAN_MAX_CPE_CLIENT; i++)
-			{
-				temp_eth_bridge_flt_rule[i] = lan_client_flt_rule_hdl_v4[i].rule_hdl;
-			}
-			if (m_filtering.DeleteFilteringHdls(temp_eth_bridge_flt_rule, IPA_IP_v4, IPA_LAN_TO_LAN_MAX_CPE_CLIENT) == false)
-			{
-				IPACMERR("Error Deleting Filtering Rule, aborting...\n");
-				res = IPACM_FAILURE;
-				goto fail;
-			}
-			IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, IPA_LAN_TO_LAN_MAX_CPE_CLIENT);
-		}
-
-		if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ODU_IF)
-		{
-			for(i=0; i<IPA_LAN_TO_LAN_MAX_USB_CLIENT; i++)
-			{
-				temp_eth_bridge_flt_rule[i] = lan_client_flt_rule_hdl_v4[i].rule_hdl;
-			}
-			if (m_filtering.DeleteFilteringHdls(temp_eth_bridge_flt_rule, IPA_IP_v4, IPA_LAN_TO_LAN_MAX_USB_CLIENT) == false)
-			{
-				IPACMERR("Error Deleting Filtering Rule, aborting...\n");
-				res = IPACM_FAILURE;
-				goto fail;
-			}
-			IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, IPA_LAN_TO_LAN_MAX_USB_CLIENT);
-		}
-#endif
-#ifndef FEATURE_ETH_BRIDGE_LE
-#ifdef CT_OPT
-		if (m_filtering.DeleteFilteringHdls(tcp_ctl_flt_rule_hdl_v4, IPA_IP_v4, NUM_TCP_CTL_FLT_RULE) == false)
-		{
-			IPACMERR("Error deleting default filtering Rule, aborting...\n");
-			res = IPACM_FAILURE;
-			goto fail;
-		}
-		IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, NUM_TCP_CTL_FLT_RULE);
-#endif
-		for(i=0; i<MAX_OFFLOAD_PAIR; i++)
-		{
-			if(m_filtering.DeleteFilteringHdls(&(lan2lan_flt_rule_hdl_v4[i].rule_hdl), IPA_IP_v4, 1) == false)
-			{
-				IPACMERR("Error deleting lan2lan IPv4 flt rules.\n");
-				res = IPACM_FAILURE;
-				goto fail;
-			}
-			IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, 1);
-		}
-		IPACMDBG_H("Deleted lan2lan IPv4 flt rules.\n");
+		eth_bridge_remove_all_client_flt_rule(IPA_IP_v4);
 #endif
 
 		/* free private-subnet ipv4 filter rules */
@@ -2991,12 +2829,13 @@
 #else
 		if (m_filtering.DeleteFilteringHdls(private_fl_rule_hdl, IPA_IP_v4, IPACM_Iface::ipacmcfg->ipa_num_private_subnet) == false)
 		{
-			IPACMERR("Error Deleting RuleTable(1) to Filtering, aborting...\n");
+			IPACMERR("Error deleting private subnet IPv4 flt rules.\n");
 			res = IPACM_FAILURE;
 			goto fail;
 		}
 		IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, IPACM_Iface::ipacmcfg->ipa_num_private_subnet);
 #endif
+		IPACMDBG_H("Deleted private subnet v4 filter rules successfully.\n");
 	}
 	IPACMDBG_H("Finished delete default iface ipv4 filtering rules \n ");
 
@@ -3018,69 +2857,7 @@
 		}
 		IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, IPV6_DEFAULT_FILTERTING_RULES);
 #ifdef FEATURE_ETH_BRIDGE_LE
-		for(i=0; i<IPA_LAN_TO_LAN_MAX_WLAN_CLIENT; i++)
-		{
-			temp_eth_bridge_flt_rule[i] = wlan_client_flt_rule_hdl_v6[i].rule_hdl;
-		}
-		if (m_filtering.DeleteFilteringHdls(temp_eth_bridge_flt_rule, IPA_IP_v6, IPA_LAN_TO_LAN_MAX_WLAN_CLIENT) == false)
-		{
-			IPACMERR("Error Deleting Filtering Rule, aborting...\n");
-			res = IPACM_FAILURE;
-			goto fail;
-		}
-		IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, IPA_LAN_TO_LAN_MAX_WLAN_CLIENT);
-
-		if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == LAN_IF)
-		{
-			for(i=0; i<IPA_LAN_TO_LAN_MAX_CPE_CLIENT; i++)
-			{
-				temp_eth_bridge_flt_rule[i] = lan_client_flt_rule_hdl_v6[i].rule_hdl;
-			}
-			if (m_filtering.DeleteFilteringHdls(temp_eth_bridge_flt_rule, IPA_IP_v6, IPA_LAN_TO_LAN_MAX_CPE_CLIENT) == false)
-			{
-				IPACMERR("Error Deleting Filtering Rule, aborting...\n");
-				res = IPACM_FAILURE;
-				goto fail;
-			}
-			IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, IPA_LAN_TO_LAN_MAX_CPE_CLIENT);
-		}
-
-		if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ODU_IF)
-		{
-			for(i=0; i<IPA_LAN_TO_LAN_MAX_USB_CLIENT; i++)
-			{
-				temp_eth_bridge_flt_rule[i] = lan_client_flt_rule_hdl_v6[i].rule_hdl;
-			}
-			if (m_filtering.DeleteFilteringHdls(temp_eth_bridge_flt_rule, IPA_IP_v6, IPA_LAN_TO_LAN_MAX_USB_CLIENT) == false)
-			{
-				IPACMERR("Error Deleting Filtering Rule, aborting...\n");
-				res = IPACM_FAILURE;
-				goto fail;
-			}
-			IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, IPA_LAN_TO_LAN_MAX_USB_CLIENT);
-		}
-#endif
-#ifndef FEATURE_ETH_BRIDGE_LE
-#ifdef CT_OPT
-		if (m_filtering.DeleteFilteringHdls(tcp_ctl_flt_rule_hdl_v6, IPA_IP_v6, NUM_TCP_CTL_FLT_RULE) == false)
-		{
-			IPACMERR("Error deleting default filtering Rule, aborting...\n");
-			res = IPACM_FAILURE;
-			goto fail;
-		}
-		IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, NUM_TCP_CTL_FLT_RULE);
-#endif
-		for(i=0; i<MAX_OFFLOAD_PAIR; i++)
-		{
-			if(m_filtering.DeleteFilteringHdls(&(lan2lan_flt_rule_hdl_v6[i].rule_hdl), IPA_IP_v6, 1) == false)
-			{
-				IPACMERR("Error deleting lan2lan IPv4 flt rules.\n");
-				res = IPACM_FAILURE;
-				goto fail;
-			}
-			IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, 1);
-		}
-		IPACMDBG_H("Deleted lan2lan IPv6 flt rules.\n");
+		eth_bridge_remove_all_client_flt_rule(IPA_IP_v6);
 #endif
 	}
 	IPACMDBG_H("Finished delete default iface ipv6 filtering rules \n ");
@@ -3121,8 +2898,8 @@
 #ifdef FEATURE_ETH_BRIDGE_LE
 			eth_bridge_del_lan_client_rt_rule(get_client_memptr(eth_client, i)->mac, SRC_LAN);
 			eth_bridge_del_lan_client_rt_rule(get_client_memptr(eth_client, i)->mac, SRC_WLAN);
-			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);
+			eth_bridge_post_lan_client_event(get_client_memptr(eth_client, i)->mac, IPA_ETH_BRIDGE_CLIENT_DEL_EVENT);
+			eth_bridge_del_client(get_client_memptr(eth_client, i)->mac);
 #endif
 
 			/* First reset nat rules and then route rules */
@@ -3203,7 +2980,7 @@
 	}
 
 	/* reset the IPA-client pipe enum */
-	if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat != WAN_IF)
+	if(ipa_if_cate != WAN_IF)
 	{
 		handle_tethering_client(true, IPACM_CLIENT_USB);
 	}
@@ -3275,7 +3052,7 @@
 	int i, index;
 	uint32_t value = 0;
 
-	IPACMDBG_H("Set extended property rules in LAN\n");
+	IPACMDBG_H("Set modem UL flt rules\n");
 
 	if (rx_prop == NULL)
 	{
@@ -3354,8 +3131,7 @@
 	flt_rule_entry.rule.eq_attrib_type = 1;
 	if(iptype == IPA_IP_v4)
 	{
-		if (IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ODU_IF &&
-			IPACM_Wan::isWan_Bridge_Mode())
+		if (ipa_if_cate == ODU_IF && IPACM_Wan::isWan_Bridge_Mode())
 		{
 			IPACMDBG_H("WAN, ODU are in bridge mode \n");
 			flt_rule_entry.rule.action = IPA_PASS_TO_ROUTING;
@@ -3376,19 +3152,6 @@
 
 	index = IPACM_Iface::ipacmcfg->getFltRuleCount(rx_prop->rx[0].src_pipe, iptype);
 
-#ifndef FEATURE_IPA_ANDROID
-	if(iptype == IPA_IP_v4 && index != exp_index_v4)
-	{
-		IPACMDBG_DMESG("### WARNING ### num flt rules for IPv4 on client %d is not expected: %d expected value: %d",
-			rx_prop->rx[0].src_pipe, index, exp_index_v4);
-	}
-	if(iptype == IPA_IP_v6 && index != exp_index_v6)
-	{
-		IPACMDBG_DMESG("### WARNING ### num flt rules for IPv6 on client %d is not expected: %d expected value: %d",
-			rx_prop->rx[0].src_pipe, index, exp_index_v6);
-	}
-#endif
-
 	for(cnt=0; cnt<prop->num_ext_props; cnt++)
 	{
 		memcpy(&flt_rule_entry.rule.eq_attrib,
@@ -3411,6 +3174,14 @@
 #ifdef FEATURE_IPA_V3
 		flt_rule_entry.rule.hashable = prop->prop[cnt].is_rule_hashable;
 		flt_rule_entry.rule.rule_id = prop->prop[cnt].rule_id;
+		if(rx_prop->rx[0].attrib.attrib_mask & IPA_FLT_META_DATA)	//turn on meta-data equation
+		{
+			flt_rule_entry.rule.eq_attrib.rule_eq_bitmap |= (1<<9);
+			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 |= rx_prop->rx[0].attrib.meta_data;
+			flt_rule_entry.rule.eq_attrib.metadata_meq32.mask |= rx_prop->rx[0].attrib.meta_data_mask;
+		}
 #endif
 		memcpy(&pFilteringTable->rules[cnt], &flt_rule_entry, sizeof(flt_rule_entry));
 
@@ -4721,8 +4492,7 @@
 #endif
 		memcpy(&flt_rule_entry.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule_entry.rule.attrib));
 
-		flt_rule_entry.rule.attrib.attrib_mask &= ~((uint32_t)IPA_FLT_META_DATA);
-		flt_rule_entry.rule.attrib.attrib_mask = IPA_FLT_PROTOCOL;
+		flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_PROTOCOL;
 		flt_rule_entry.rule.attrib.u.v4.protocol = (uint8_t)IPACM_FIREWALL_IPPROTO_ICMP;
 		memcpy(&(flt_rule->rules[0]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add));
 
@@ -4743,6 +4513,64 @@
 	return IPACM_SUCCESS;
 }
 
+int IPACM_Lan::install_ipv6_icmp_flt_rule()
+{
+
+	int len;
+	struct ipa_ioc_add_flt_rule* flt_rule;
+	struct ipa_flt_rule_add flt_rule_entry;
+
+	if(rx_prop != NULL)
+	{
+		len = sizeof(struct ipa_ioc_add_flt_rule) + sizeof(struct ipa_flt_rule_add);
+
+		flt_rule = (struct ipa_ioc_add_flt_rule *)calloc(1, len);
+		if (!flt_rule)
+		{
+			IPACMERR("Error Locate ipa_flt_rule_add memory...\n");
+			return IPACM_FAILURE;
+		}
+
+		flt_rule->commit = 1;
+		flt_rule->ep = rx_prop->rx[0].src_pipe;
+		flt_rule->global = false;
+		flt_rule->ip = IPA_IP_v6;
+		flt_rule->num_rules = 1;
+
+		memset(&flt_rule_entry, 0, sizeof(struct ipa_flt_rule_add));
+
+		flt_rule_entry.rule.retain_hdr = 1;
+		flt_rule_entry.rule.to_uc = 0;
+		flt_rule_entry.rule.eq_attrib_type = 0;
+		flt_rule_entry.at_rear = true;
+		flt_rule_entry.flt_rule_hdl = -1;
+		flt_rule_entry.status = -1;
+		flt_rule_entry.rule.action = IPA_PASS_TO_EXCEPTION;
+#ifdef FEATURE_IPA_V3
+		flt_rule_entry.rule.hashable = false;
+#endif
+		memcpy(&flt_rule_entry.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule_entry.rule.attrib));
+		flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_NEXT_HDR;
+		flt_rule_entry.rule.attrib.u.v6.next_hdr = (uint8_t)IPACM_FIREWALL_IPPROTO_ICMP6;
+		memcpy(&(flt_rule->rules[0]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add));
+
+		if (m_filtering.AddFilteringRule(flt_rule) == false)
+		{
+			IPACMERR("Error Adding Filtering rule, aborting...\n");
+			free(flt_rule);
+			return IPACM_FAILURE;
+		}
+		else
+		{
+			IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, 1);
+			ipv6_icmp_flt_rule_hdl[0] = flt_rule->rules[0].flt_rule_hdl;
+			IPACMDBG_H("IPv6 icmp filter rule HDL:0x%x\n", ipv6_icmp_flt_rule_hdl[0]);
+			free(flt_rule);
+		}
+	}
+	return IPACM_SUCCESS;
+}
+
 void IPACM_Lan::install_tcp_ctl_flt_rule(ipa_ip_type iptype)
 {
 	if (rx_prop == NULL)
@@ -5064,7 +4892,6 @@
 		flt_rule_entry.rule.hashable = false;
 #endif
 		memcpy(&flt_rule_entry.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule_entry.rule.attrib));
-		flt_rule_entry.rule.attrib.attrib_mask = flt_rule_entry.rule.attrib.attrib_mask & ~((uint32_t)IPA_FLT_META_DATA);
 		flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_DST_ADDR;
 		flt_rule_entry.rule.attrib.u.v6.dst_addr[0] = prefix[0];
 		flt_rule_entry.rule.attrib.u.v6.dst_addr[1] = prefix[1];
@@ -5104,65 +4931,6 @@
 	return;
 }
 
-int IPACM_Lan::install_ipv6_icmp_flt_rule()
-{
-
-	int len;
-	struct ipa_ioc_add_flt_rule* flt_rule;
-	struct ipa_flt_rule_add flt_rule_entry;
-
-	if(rx_prop != NULL)
-	{
-		len = sizeof(struct ipa_ioc_add_flt_rule) + sizeof(struct ipa_flt_rule_add);
-
-		flt_rule = (struct ipa_ioc_add_flt_rule *)calloc(1, len);
-		if (!flt_rule)
-		{
-			IPACMERR("Error Locate ipa_flt_rule_add memory...\n");
-			return IPACM_FAILURE;
-		}
-
-		flt_rule->commit = 1;
-		flt_rule->ep = rx_prop->rx[0].src_pipe;
-		flt_rule->global = false;
-		flt_rule->ip = IPA_IP_v6;
-		flt_rule->num_rules = 1;
-
-		memset(&flt_rule_entry, 0, sizeof(struct ipa_flt_rule_add));
-
-		flt_rule_entry.rule.retain_hdr = 1;
-		flt_rule_entry.rule.to_uc = 0;
-		flt_rule_entry.rule.eq_attrib_type = 0;
-		flt_rule_entry.at_rear = true;
-		flt_rule_entry.flt_rule_hdl = -1;
-		flt_rule_entry.status = -1;
-		flt_rule_entry.rule.action = IPA_PASS_TO_EXCEPTION;
-#ifdef FEATURE_IPA_V3
-		flt_rule_entry.rule.hashable = false;
-#endif
-		memcpy(&flt_rule_entry.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule_entry.rule.attrib));
-		flt_rule_entry.rule.attrib.attrib_mask = flt_rule_entry.rule.attrib.attrib_mask & ~((uint32_t)IPA_FLT_META_DATA);
-		flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_NEXT_HDR;
-		flt_rule_entry.rule.attrib.u.v6.next_hdr = (uint8_t)IPACM_FIREWALL_IPPROTO_ICMP6;
-		memcpy(&(flt_rule->rules[0]), &flt_rule_entry, sizeof(struct ipa_flt_rule_add));
-
-		if (m_filtering.AddFilteringRule(flt_rule) == false)
-		{
-			IPACMERR("Error Adding Filtering rule, aborting...\n");
-			free(flt_rule);
-			return IPACM_FAILURE;
-		}
-		else
-		{
-			IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, 1);
-			ipv6_icmp_flt_rule_hdl[0] = flt_rule->rules[0].flt_rule_hdl;
-			IPACMDBG_H("IPv6 icmp filter rule HDL:0x%x\n", ipv6_icmp_flt_rule_hdl[0]);
-			free(flt_rule);
-		}
-	}
-	return IPACM_SUCCESS;
-}
-
 int IPACM_Lan::handle_addr_evt_odu_bridge(ipacm_event_data_addr* data)
 {
 	int fd, res = IPACM_SUCCESS;
@@ -5196,303 +4964,6 @@
 	return res;
 }
 
-int IPACM_Lan::eth_bridge_handle_dummy_wlan_client_flt_rule(ipa_ip_type iptype)
-{
-	if(rx_prop == NULL)
-	{
-		IPACMDBG_H("There is no rx_prop for iface %s, not able to add dummy wlan client specific filtering rule.\n", dev_name);
-		return 0;
-	}
-
-	int i, len, res = IPACM_SUCCESS;
-	struct ipa_flt_rule_add flt_rule;
-	ipa_ioc_add_flt_rule* pFilteringTable;
-
-	len = sizeof(struct ipa_ioc_add_flt_rule) +	IPA_LAN_TO_LAN_MAX_WLAN_CLIENT * sizeof(struct ipa_flt_rule_add);
-
-	pFilteringTable = (struct ipa_ioc_add_flt_rule *)malloc(len);
-	if (pFilteringTable == NULL)
-	{
-		IPACMERR("Error allocate flt table memory...\n");
-		return IPACM_FAILURE;
-	}
-	memset(pFilteringTable, 0, len);
-
-	pFilteringTable->commit = 1;
-	pFilteringTable->ep = rx_prop->rx[0].src_pipe;
-	pFilteringTable->global = false;
-	pFilteringTable->ip = iptype;
-	pFilteringTable->num_rules = IPA_LAN_TO_LAN_MAX_WLAN_CLIENT;
-
-	memset(&flt_rule, 0, sizeof(struct ipa_flt_rule_add));
-
-	flt_rule.rule.retain_hdr = 0;
-	flt_rule.at_rear = true;
-	flt_rule.flt_rule_hdl = -1;
-	flt_rule.status = -1;
-	flt_rule.rule.action = IPA_PASS_TO_EXCEPTION;
-#ifdef FEATURE_IPA_V3
-	flt_rule.rule.hashable = true;
-#endif
-	memcpy(&flt_rule.rule.attrib, &rx_prop->rx[0].attrib,
-			sizeof(flt_rule.rule.attrib));
-
-	if(iptype == IPA_IP_v4)
-	{
-		flt_rule.rule.attrib.attrib_mask = IPA_FLT_SRC_ADDR | IPA_FLT_DST_ADDR;
-		flt_rule.rule.attrib.u.v4.src_addr_mask = ~0;
-		flt_rule.rule.attrib.u.v4.src_addr = ~0;
-		flt_rule.rule.attrib.u.v4.dst_addr_mask = ~0;
-		flt_rule.rule.attrib.u.v4.dst_addr = ~0;
-
-		for(i=0; i<IPA_LAN_TO_LAN_MAX_WLAN_CLIENT; i++)
-		{
-			memcpy(&(pFilteringTable->rules[i]), &flt_rule, sizeof(struct ipa_flt_rule_add));
-		}
-
-		if (false == m_filtering.AddFilteringRule(pFilteringTable))
-		{
-			IPACMERR("Error adding dummy lan2lan v4 flt rule\n");
-			res = IPACM_FAILURE;
-			goto fail;
-		}
-		else
-		{
-			IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, iptype, IPA_LAN_TO_LAN_MAX_WLAN_CLIENT);
-			/* copy filter rule hdls */
-			for (int i = 0; i < IPA_LAN_TO_LAN_MAX_WLAN_CLIENT; i++)
-			{
-				if (pFilteringTable->rules[i].status == 0)
-				{
-					wlan_client_flt_rule_hdl_v4[i].rule_hdl = pFilteringTable->rules[i].flt_rule_hdl;
-					wlan_client_flt_rule_hdl_v4[i].valid = true;
-					IPACMDBG_H("Wlan client v4 flt rule %d hdl:0x%x\n", i, wlan_client_flt_rule_hdl_v4[i].rule_hdl);
-				}
-				else
-				{
-					IPACMERR("Failed adding wlan client v4 flt rule %d\n", i);
-					res = IPACM_FAILURE;
-					goto fail;
-				}
-			}
-		}
-	}
-	else if(iptype == IPA_IP_v6)
-	{
-		flt_rule.rule.attrib.attrib_mask = IPA_FLT_SRC_ADDR | IPA_FLT_DST_ADDR;
-		flt_rule.rule.attrib.u.v6.src_addr_mask[0] = ~0;
-		flt_rule.rule.attrib.u.v6.src_addr_mask[1] = ~0;
-		flt_rule.rule.attrib.u.v6.src_addr_mask[2] = ~0;
-		flt_rule.rule.attrib.u.v6.src_addr_mask[3] = ~0;
-		flt_rule.rule.attrib.u.v6.src_addr[0] = ~0;
-		flt_rule.rule.attrib.u.v6.src_addr[1] = ~0;
-		flt_rule.rule.attrib.u.v6.src_addr[2] = ~0;
-		flt_rule.rule.attrib.u.v6.src_addr[3] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[0] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[1] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[2] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[3] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr[0] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr[1] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr[2] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr[3] = ~0;
-
-		for(i=0; i<IPA_LAN_TO_LAN_MAX_WLAN_CLIENT; i++)
-		{
-			memcpy(&(pFilteringTable->rules[i]), &flt_rule, sizeof(struct ipa_flt_rule_add));
-		}
-
-		if (false == m_filtering.AddFilteringRule(pFilteringTable))
-		{
-			IPACMERR("Error adding dummy lan2lan v6 flt rule\n");
-			res = IPACM_FAILURE;
-			goto fail;
-		}
-		else
-		{
-			IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, iptype, IPA_LAN_TO_LAN_MAX_WLAN_CLIENT);
-			/* copy filter rule hdls */
-			for (int i = 0; i < IPA_LAN_TO_LAN_MAX_WLAN_CLIENT; i++)
-			{
-				if (pFilteringTable->rules[i].status == 0)
-				{
-					wlan_client_flt_rule_hdl_v6[i].rule_hdl = pFilteringTable->rules[i].flt_rule_hdl;
-					wlan_client_flt_rule_hdl_v6[i].valid = true;
-					IPACMDBG_H("Wlan client v6 flt rule %d hdl:0x%x\n", i, wlan_client_flt_rule_hdl_v6[i].rule_hdl);
-				}
-				else
-				{
-					IPACMERR("Failed adding wlan client v6 flt rule %d\n", i);
-					res = IPACM_FAILURE;
-					goto fail;
-				}
-			}
-		}
-	}
-	else
-	{
-		IPACMERR("IP type is not expected.\n");
-		goto fail;
-	}
-
-fail:
-	free(pFilteringTable);
-	return res;
-}
-
-int IPACM_Lan::eth_bridge_handle_dummy_lan_client_flt_rule(ipa_ip_type iptype)
-{
-	if(rx_prop == NULL)
-	{
-		IPACMDBG_H("There is no rx_prop for iface %s, not able to add dummy lan client specific filtering rule.\n", dev_name);
-		return 0;
-	}
-
-	int i, len, res = IPACM_SUCCESS, num_dummy_rules;
-	struct ipa_flt_rule_add flt_rule;
-	ipa_ioc_add_flt_rule* pFilteringTable;
-
-	if (IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == LAN_IF)
-	{
-		num_dummy_rules = IPA_LAN_TO_LAN_MAX_CPE_CLIENT;
-	}
-	if (IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ODU_IF)
-	{
-		num_dummy_rules = IPA_LAN_TO_LAN_MAX_USB_CLIENT;
-	}
-
-	len = sizeof(struct ipa_ioc_add_flt_rule) + num_dummy_rules * sizeof(struct ipa_flt_rule_add);
-
-	pFilteringTable = (struct ipa_ioc_add_flt_rule *)malloc(len);
-	if (pFilteringTable == NULL)
-	{
-		IPACMERR("Error allocate flt table memory...\n");
-		return IPACM_FAILURE;
-	}
-	memset(pFilteringTable, 0, len);
-
-	pFilteringTable->commit = 1;
-	pFilteringTable->ep = rx_prop->rx[0].src_pipe;
-	pFilteringTable->global = false;
-	pFilteringTable->ip = iptype;
-	pFilteringTable->num_rules = num_dummy_rules;
-
-	memset(&flt_rule, 0, sizeof(struct ipa_flt_rule_add));
-
-	flt_rule.rule.retain_hdr = 0;
-	flt_rule.at_rear = true;
-	flt_rule.flt_rule_hdl = -1;
-	flt_rule.status = -1;
-	flt_rule.rule.action = IPA_PASS_TO_EXCEPTION;
-#ifdef FEATURE_IPA_V3
-	flt_rule.rule.hashable = true;
-#endif
-	memcpy(&flt_rule.rule.attrib, &rx_prop->rx[0].attrib,
-			sizeof(flt_rule.rule.attrib));
-
-	if(iptype == IPA_IP_v4)
-	{
-		flt_rule.rule.attrib.attrib_mask = IPA_FLT_SRC_ADDR | IPA_FLT_DST_ADDR;
-		flt_rule.rule.attrib.u.v4.src_addr_mask = ~0;
-		flt_rule.rule.attrib.u.v4.src_addr = ~0;
-		flt_rule.rule.attrib.u.v4.dst_addr_mask = ~0;
-		flt_rule.rule.attrib.u.v4.dst_addr = ~0;
-
-		for(i=0; i < num_dummy_rules; i++)
-		{
-			memcpy(&(pFilteringTable->rules[i]), &flt_rule, sizeof(struct ipa_flt_rule_add));
-		}
-
-		if (false == m_filtering.AddFilteringRule(pFilteringTable))
-		{
-			IPACMERR("Error adding dummy lan2lan v4 flt rule\n");
-			res = IPACM_FAILURE;
-			goto fail;
-		}
-		else
-		{
-			IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, iptype, num_dummy_rules);
-			/* copy filter rule hdls */
-			for (int i = 0; i < num_dummy_rules; i++)
-			{
-				if (pFilteringTable->rules[i].status == 0)
-				{
-					lan_client_flt_rule_hdl_v4[i].rule_hdl = pFilteringTable->rules[i].flt_rule_hdl;
-					lan_client_flt_rule_hdl_v4[i].valid = true;
-					IPACMDBG_H("Lan client v4 flt rule %d hdl:0x%x\n", i, lan_client_flt_rule_hdl_v4[i].rule_hdl);
-				}
-				else
-				{
-					IPACMERR("Failed adding lan client v4 flt rule %d\n", i);
-					res = IPACM_FAILURE;
-					goto fail;
-				}
-			}
-		}
-	}
-	else if(iptype == IPA_IP_v6)
-	{
-		flt_rule.rule.attrib.attrib_mask = IPA_FLT_SRC_ADDR | IPA_FLT_DST_ADDR;
-		flt_rule.rule.attrib.u.v6.src_addr_mask[0] = ~0;
-		flt_rule.rule.attrib.u.v6.src_addr_mask[1] = ~0;
-		flt_rule.rule.attrib.u.v6.src_addr_mask[2] = ~0;
-		flt_rule.rule.attrib.u.v6.src_addr_mask[3] = ~0;
-		flt_rule.rule.attrib.u.v6.src_addr[0] = ~0;
-		flt_rule.rule.attrib.u.v6.src_addr[1] = ~0;
-		flt_rule.rule.attrib.u.v6.src_addr[2] = ~0;
-		flt_rule.rule.attrib.u.v6.src_addr[3] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[0] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[1] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[2] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[3] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr[0] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr[1] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr[2] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr[3] = ~0;
-
-		for(i=0; i<num_dummy_rules; i++)
-		{
-			memcpy(&(pFilteringTable->rules[i]), &flt_rule, sizeof(struct ipa_flt_rule_add));
-		}
-
-		if (false == m_filtering.AddFilteringRule(pFilteringTable))
-		{
-			IPACMERR("Error adding dummy lan2lan v6 flt rule\n");
-			res = IPACM_FAILURE;
-			goto fail;
-		}
-		else
-		{
-			IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, iptype, num_dummy_rules);
-			/* copy filter rule hdls */
-			for (int i = 0; i < num_dummy_rules; i++)
-			{
-				if (pFilteringTable->rules[i].status == 0)
-				{
-					lan_client_flt_rule_hdl_v6[i].rule_hdl = pFilteringTable->rules[i].flt_rule_hdl;
-					lan_client_flt_rule_hdl_v6[i].valid = true;
-					IPACMDBG_H("Lan client v6 flt rule %d hdl:0x%x\n", i, lan_client_flt_rule_hdl_v6[i].rule_hdl);
-				}
-				else
-				{
-					IPACMERR("Failed adding lan client v6 flt rule %d\n", i);
-					res = IPACM_FAILURE;
-					goto fail;
-				}
-			}
-		}
-	}
-	else
-	{
-		IPACMERR("IP type is not expected.\n");
-		goto fail;
-	}
-
-fail:
-	free(pFilteringTable);
-	return res;
-}
-
 int IPACM_Lan::eth_bridge_post_lan_client_event(uint8_t* mac_addr, ipa_cm_event_id evt)
 {
 	if(mac_addr == NULL)
@@ -5514,21 +4985,26 @@
 	memset(mac, 0, sizeof(ipacm_event_data_mac));
 	memcpy(mac->mac_addr, mac_addr, 6 * sizeof(uint8_t));
 	mac->if_index = ipa_if_num;
+	mac->ipa_if_cate = ipa_if_cate;
 
 	evt_data.event = evt;
 	evt_data.evt_data = (void*)mac;
-	IPACMDBG_H("Posting event: %d if_index: %d \n", evt, mac->if_index);
+	IPACMDBG_H("Posting event: %d if_index: %d if_cate: %d\n", evt, mac->if_index, mac->ipa_if_cate);
 	IPACM_EvtDispatcher::PostEvt(&evt_data);
 	return IPACM_SUCCESS;
 }
 
-int IPACM_Lan::eth_bridge_add_wlan_client_flt_rule(uint8_t* mac, ipa_ip_type iptype)
+int IPACM_Lan::eth_bridge_add_client_flt_rule(uint8_t* mac, ipa_ip_type iptype, int dest_if_cate)
 {
 	int i, len, res = IPACM_SUCCESS, client_position;
-	struct ipa_flt_rule_mdfy flt_rule;
-	struct ipa_ioc_mdfy_flt_rule* pFilteringTable = NULL;
+	struct ipa_flt_rule_add flt_rule_entry;
+	struct ipa_ioc_add_flt_rule_after *pFilteringTable = NULL;
+	struct ipa_ioc_get_rt_tbl rt_tbl;
+	enum ipa_hdr_l2_type hdr_type;
 	bool client_is_found = false;
+	uint32_t rule_hdl;
 
+#ifdef FEATURE_IPA_V3
 	if (rx_prop == NULL)
 	{
 		IPACMDBG_H("No rx properties registered for iface %s\n", dev_name);
@@ -5539,22 +5015,17 @@
 		IPACMERR("MAC address is empty.\n");
 		return IPACM_FAILURE;
 	}
-	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;
-	}
 
-	IPACMDBG_H("Received WLAN client MAC 0x%02x%02x%02x%02x%02x%02x.\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+	IPACMDBG_H("Received client MAC 0x%02x%02x%02x%02x%02x%02x.\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
 
-	for(i=0; i<wlan_client_flt_info_count; i++)
+	for(i=0; i<client_flt_info_count; i++)
 	{
-		if(memcmp(eth_bridge_wlan_client_flt_info[i].mac, mac, sizeof(eth_bridge_wlan_client_flt_info[i].mac)) == 0)
+		if(memcmp(eth_bridge_client_flt_info[i].mac, mac, sizeof(eth_bridge_client_flt_info[i].mac)) == 0)
 		{
 			client_is_found = true;
 			client_position = i;
-			if( (iptype == IPA_IP_v4 && eth_bridge_wlan_client_flt_info[i].flt_rule_set_v4 == true)
-				|| (iptype == IPA_IP_v6 && eth_bridge_wlan_client_flt_info[i].flt_rule_set_v6 == true))
+			if( (iptype == IPA_IP_v4 && eth_bridge_client_flt_info[i].flt_rule_set_v4 == true)
+				|| (iptype == IPA_IP_v6 && eth_bridge_client_flt_info[i].flt_rule_set_v6 == true))
 			{
 				IPACMDBG_H("Flt rule for iptype %d has been set.\n", iptype);
 				return IPACM_SUCCESS;
@@ -5563,146 +5034,107 @@
 		}
 	}
 
-	if(client_is_found == false && wlan_client_flt_info_count == IPA_LAN_TO_LAN_MAX_WLAN_CLIENT)
-	{
-		IPACMDBG_H("The wlan client flt table is already full.\n");
-		return IPACM_FAILURE;
-	}
-
-	len = sizeof(struct ipa_ioc_mdfy_flt_rule) + sizeof(struct ipa_flt_rule_mdfy);
-	pFilteringTable = (struct ipa_ioc_mdfy_flt_rule*)malloc(len);
-	if (!pFilteringTable)
-	{
-		IPACMERR("Failed to allocate ipa_ioc_mdfy_flt_rule memory...\n");
-		return IPACM_FAILURE;
-	}
-	memset(pFilteringTable, 0, len);
-
-	/* add mac based rule*/
-	pFilteringTable->commit = 1;
-	pFilteringTable->ip = iptype;
-	pFilteringTable->num_rules = 1;
-
-	memset(&flt_rule, 0, sizeof(struct ipa_flt_rule_mdfy));
-	flt_rule.status = -1;
-
-	flt_rule.rule.retain_hdr = 0;
-	flt_rule.rule.to_uc = 0;
-	flt_rule.rule.action = IPA_PASS_TO_ROUTING;
-	flt_rule.rule.eq_attrib_type = 0;
-
-	/* point to USB-WLAN routing table */
-	if(iptype == IPA_IP_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_lan_wlan_v4.hdl;
-		IPACMDBG_H("LAN->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_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_lan_wlan_v6.hdl;
-		IPACMDBG_H("LAN->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::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::lan_hdr_type == IPA_HDR_L2_802_3)
-	{
-		flt_rule.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_802_3;
-	}
-	else
-	{
-		IPACMERR("USB hdr type is not expected.\n");
-		res = IPACM_FAILURE;
-		goto fail;
-	}
-	memcpy(flt_rule.rule.attrib.dst_mac_addr, mac, sizeof(flt_rule.rule.attrib.dst_mac_addr));
-	memset(flt_rule.rule.attrib.dst_mac_addr_mask, 0xFF, sizeof(flt_rule.rule.attrib.dst_mac_addr_mask));
-
-	if(iptype == IPA_IP_v4)
-	{
-		for(i=0; i<IPA_LAN_TO_LAN_MAX_WLAN_CLIENT; i++)
-		{
-			if(wlan_client_flt_rule_hdl_v4[i].valid == true)
-			{
-				flt_rule.rule_hdl = wlan_client_flt_rule_hdl_v4[i].rule_hdl;
-				wlan_client_flt_rule_hdl_v4[i].valid = false;
-				break;
-			}
-		}
-		if(i == IPA_LAN_TO_LAN_MAX_WLAN_CLIENT)
-		{
-			IPACMDBG_H("Cannot find a valid flt rule hdl.\n");
-			res = IPACM_FAILURE;
-			goto fail;
-		}
-	}
-	else
-	{
-		for(i=0; i<IPA_LAN_TO_LAN_MAX_WLAN_CLIENT; i++)
-		{
-			if(wlan_client_flt_rule_hdl_v6[i].valid == true)
-			{
-				flt_rule.rule_hdl = wlan_client_flt_rule_hdl_v6[i].rule_hdl;
-				wlan_client_flt_rule_hdl_v6[i].valid = false;
-				break;
-			}
-		}
-		if(i == IPA_LAN_TO_LAN_MAX_WLAN_CLIENT)
-		{
-			IPACMDBG_H("Cannot find a valid flt rule hdl.\n");
-			res = IPACM_FAILURE;
-			goto fail;
-		}
-	}
-
-	memcpy(&(pFilteringTable->rules[0]), &flt_rule, sizeof(struct ipa_flt_rule_mdfy));
-	if (false == m_filtering.ModifyFilteringRule(pFilteringTable))
-	{
-		IPACMERR("Failed to add wlan client filtering rules.\n");
-		res = IPACM_FAILURE;
-		goto fail;
-	}
-
 	if(client_is_found == false)
 	{
-		client_position = wlan_client_flt_info_count;
-		wlan_client_flt_info_count++;
+		if(client_flt_info_count == IPA_LAN_TO_LAN_MAX_CLIENT)
+		{
+			IPACMDBG_H("The client flt table is already full.\n");
+			return IPACM_FAILURE;
+		}
+		else
+		{
+			client_position = client_flt_info_count;
+			client_flt_info_count++;
+		}
 	}
 
-	memcpy(eth_bridge_wlan_client_flt_info[client_position].mac, mac, sizeof(eth_bridge_wlan_client_flt_info[client_position].mac));
-	if(iptype == IPA_IP_v4)
+	hdr_type = eth_bridge_get_l2_hdr_type();
+
+	/* fetch appropriate routing table handle */
+	memset(&rt_tbl, 0, sizeof(rt_tbl));
+	rt_tbl.ip = iptype;
+	eth_bridge_get_rt_tbl_name(iptype, &rt_tbl, dest_if_cate);
+	if (false == m_routing.GetRoutingTable(&rt_tbl))
 	{
-		eth_bridge_wlan_client_flt_info[client_position].flt_rule_set_v4 = true;
-		eth_bridge_wlan_client_flt_info[client_position].flt_rule_hdl_v4 = wlan_client_flt_rule_hdl_v4[i].rule_hdl;
+		IPACMERR("Failed to get routing table handle.\n");
+		res = IPACM_FAILURE;
+		goto fail;
+	}
+
+	len = sizeof(struct ipa_ioc_add_flt_rule_after) + sizeof(struct ipa_flt_rule_add);
+	pFilteringTable = (struct ipa_ioc_add_flt_rule_after*)malloc(len);
+	if (!pFilteringTable)
+	{
+		IPACMERR("Failed to allocate ipa_ioc_add_flt_rule_after memory...\n");
+		return IPACM_FAILURE;
+	}
+	memset(pFilteringTable, 0, len);
+
+	/* add mac based rule*/
+	pFilteringTable->commit = 1;
+	pFilteringTable->ep = rx_prop->rx[0].src_pipe;
+	pFilteringTable->ip = iptype;
+	pFilteringTable->num_rules = 1;
+	pFilteringTable->add_after_hdl = iptype == IPA_IP_v4?
+		eth_bridge_flt_rule_offset_v4: eth_bridge_flt_rule_offset_v6;
+
+	memset(&flt_rule_entry, 0, sizeof(flt_rule_entry));
+	flt_rule_entry.at_rear = 1;
+
+	flt_rule_entry.rule.retain_hdr = 0;
+	flt_rule_entry.rule.to_uc = 0;
+	flt_rule_entry.rule.action = IPA_PASS_TO_ROUTING;
+	flt_rule_entry.rule.eq_attrib_type = 0;
+	flt_rule_entry.rule.rt_tbl_hdl = rt_tbl.hdl;
+	IPACMDBG_H("Filtering rule uses routing table: %s\n",rt_tbl.name);
+
+	memcpy(&flt_rule_entry.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule_entry.rule.attrib));
+	if(hdr_type == IPA_HDR_L2_ETHERNET_II)
+	{
+		flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_ETHER_II;
+	}
+	else if(hdr_type == IPA_HDR_L2_802_3)
+	{
+		flt_rule_entry.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_802_3;
 	}
 	else
 	{
-		eth_bridge_wlan_client_flt_info[client_position].flt_rule_set_v6 = true;
-		eth_bridge_wlan_client_flt_info[client_position].flt_rule_hdl_v6 = wlan_client_flt_rule_hdl_v6[i].rule_hdl;
+		IPACMERR("hdr type is not expected.\n");
+		res = IPACM_FAILURE;
+		goto fail;
+	}
+	memcpy(flt_rule_entry.rule.attrib.dst_mac_addr, mac, sizeof(flt_rule_entry.rule.attrib.dst_mac_addr));
+	memset(flt_rule_entry.rule.attrib.dst_mac_addr_mask, 0xFF, sizeof(flt_rule_entry.rule.attrib.dst_mac_addr_mask));
+
+	memcpy(&(pFilteringTable->rules[0]), &flt_rule_entry, sizeof(flt_rule_entry));
+	if (false == m_filtering.AddFilteringRuleAfter(pFilteringTable))
+	{
+		IPACMERR("Failed to add client filtering rules.\n");
+		res = IPACM_FAILURE;
+		goto fail;
+	}
+	rule_hdl = pFilteringTable->rules[0].flt_rule_hdl;
+
+	memcpy(eth_bridge_client_flt_info[client_position].mac, mac, sizeof(eth_bridge_client_flt_info[client_position].mac));
+	if(iptype == IPA_IP_v4)
+	{
+		eth_bridge_client_flt_info[client_position].flt_rule_set_v4 = true;
+		eth_bridge_client_flt_info[client_position].flt_rule_hdl_v4 = rule_hdl;
+	}
+	else
+	{
+		eth_bridge_client_flt_info[client_position].flt_rule_set_v6 = true;
+		eth_bridge_client_flt_info[client_position].flt_rule_hdl_v6 = rule_hdl;
 	}
 
 fail:
-	free(pFilteringTable);
-
+	if(pFilteringTable)
+		free(pFilteringTable);
+#endif
 	return res;
 }
 
-int IPACM_Lan::eth_bridge_del_wlan_client_flt_rule(uint8_t* mac)
+int IPACM_Lan::eth_bridge_del_client_flt_rule(uint8_t* mac)
 {
 	if(mac == NULL)
 	{
@@ -5710,347 +5142,43 @@
 		return IPACM_FAILURE;
 	}
 
-	IPACMDBG_H("Received WLAN client MAC 0x%02x%02x%02x%02x%02x%02x.\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+	IPACMDBG_H("Received client MAC 0x%02x%02x%02x%02x%02x%02x.\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
 
 	int i, j, res = IPACM_SUCCESS;
-	for(i=0; i<wlan_client_flt_info_count; i++)
+	for(i=0; i<client_flt_info_count; i++)
 	{
-		if(memcmp(eth_bridge_wlan_client_flt_info[i].mac, mac, sizeof(eth_bridge_wlan_client_flt_info[i].mac)) == 0)
+		if(memcmp(eth_bridge_client_flt_info[i].mac, mac, sizeof(eth_bridge_client_flt_info[i].mac)) == 0)
 		{
 			break;
 		}
 	}
 
-	if(i == wlan_client_flt_info_count)
+	if(i == client_flt_info_count)
 	{
-		IPACMERR("Do not find the wlan client.\n");
+		IPACMERR("Do not find the client.\n");
 		return IPACM_FAILURE;
 	}
 
-	if(eth_bridge_wlan_client_flt_info[i].flt_rule_set_v4 == true)
+	if(eth_bridge_client_flt_info[i].flt_rule_set_v4 == true)
 	{
-		if(reset_to_dummy_flt_rule(IPA_IP_v4, eth_bridge_wlan_client_flt_info[i].flt_rule_hdl_v4) == IPACM_SUCCESS)
+		if(m_filtering.DeleteFilteringHdls(&eth_bridge_client_flt_info[i].flt_rule_hdl_v4, IPA_IP_v4, 1) == false)
 		{
-			for(j=0; j<IPA_LAN_TO_LAN_MAX_WLAN_CLIENT; j++)
-			{
-				if(wlan_client_flt_rule_hdl_v4[j].rule_hdl == eth_bridge_wlan_client_flt_info[i].flt_rule_hdl_v4)
-				{
-					wlan_client_flt_rule_hdl_v4[j].valid = true;
-					break;
-				}
-			}
-			if(j == IPA_LAN_TO_LAN_MAX_WLAN_CLIENT)
-			{
-				IPACMERR("Not finding the rule handle in handle pool.\n");
-				return IPACM_FAILURE;
-			}
-		}
-		else
-		{
-			IPACMERR("Failed to delete the wlan client specific flt rule.\n");
+			IPACMERR("Failed to delete the client specific flt rule.\n");
 			return IPACM_FAILURE;
 		}
 	}
-	if(eth_bridge_wlan_client_flt_info[i].flt_rule_set_v6 == true)
+	if(eth_bridge_client_flt_info[i].flt_rule_set_v6 == true)
 	{
-		if(reset_to_dummy_flt_rule(IPA_IP_v6, eth_bridge_wlan_client_flt_info[i].flt_rule_hdl_v6) == IPACM_SUCCESS)
-		{
-			for(j=0; j<IPA_LAN_TO_LAN_MAX_WLAN_CLIENT; j++)
-			{
-				if(wlan_client_flt_rule_hdl_v6[j].rule_hdl == eth_bridge_wlan_client_flt_info[i].flt_rule_hdl_v6)
-				{
-					wlan_client_flt_rule_hdl_v6[j].valid = true;
-					break;
-				}
-			}
-			if(j == IPA_LAN_TO_LAN_MAX_WLAN_CLIENT)
-			{
-				IPACMERR("Not finding the rule handle in handle pool.\n");
-				return IPACM_FAILURE;
-			}
-		}
-		else
+		if(m_filtering.DeleteFilteringHdls(&eth_bridge_client_flt_info[i].flt_rule_hdl_v6, IPA_IP_v6, 1) == false)
 		{
 			IPACMERR("Failed to delete the wlan client specific flt rule.\n");
 			return IPACM_FAILURE;
 		}
 	}
 
-	for(j=i+1; j<wlan_client_flt_info_count; j++)
-	{
-		memcpy(&(eth_bridge_wlan_client_flt_info[j-1]), &(eth_bridge_wlan_client_flt_info[j]), sizeof(eth_bridge_client_flt_info));
-	}
-	memset(&(eth_bridge_wlan_client_flt_info[wlan_client_flt_info_count-1]), 0, sizeof(eth_bridge_client_flt_info));
-	wlan_client_flt_info_count--;
-
-	return res;
-}
-
-int IPACM_Lan::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;
-	struct ipa_ioc_mdfy_flt_rule* pFilteringTable = NULL;
-	bool client_is_found = false;
-
-	if (rx_prop == NULL)
-	{
-		IPACMDBG_H("No rx properties registered for iface %s\n", dev_name);
-		return IPACM_FAILURE;
-	}
-	if (mac == NULL)
-	{
-		IPACMERR("MAC address is empty.\n");
-		return IPACM_FAILURE;
-	}
-	if (IPACM_Lan::usb_to_cpe_hdr_proc_ctx.valid == false && IPACM_Lan::cpe_to_usb_hdr_proc_ctx.valid == false)
-	{
-		IPACMDBG_H("USB to CPE and CPE to USB hdr proc ctx have not been set, don't add client specific flt rule.\n");
-		return IPACM_FAILURE;
-	}
-
-	IPACMDBG_H("Received LAN client MAC 0x%02x%02x%02x%02x%02x%02x. if_cat: %d  \n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5],
-			IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat);
-
-	for (i=0; i<lan_client_flt_info_count; i++)
-	{
-		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_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;
-			}
-			break;
-		}
-	}
-
-	if (client_is_found == false && lan_client_flt_info_count == IPA_LAN_TO_LAN_MAX_LAN_CLIENT)
-	{
-		IPACMDBG_H("The lan client flt table is already full.\n");
-		return IPACM_FAILURE;
-	}
-
-	len = sizeof(struct ipa_ioc_mdfy_flt_rule) + sizeof(struct ipa_flt_rule_mdfy);
-	pFilteringTable = (struct ipa_ioc_mdfy_flt_rule*)malloc(len);
-	if (!pFilteringTable)
-	{
-		IPACMERR("Failed to allocate ipa_ioc_mdfy_flt_rule memory...\n");
-		return IPACM_FAILURE;
-	}
-	memset(pFilteringTable, 0, len);
-
-	/* add mac based rule*/
-	pFilteringTable->commit = 1;
-	pFilteringTable->ip = iptype;
-	pFilteringTable->num_rules = 1;
-
-	memset(&flt_rule, 0, sizeof(struct ipa_flt_rule_mdfy));
-	flt_rule.status = -1;
-
-	flt_rule.rule.retain_hdr = 0;
-	flt_rule.rule.to_uc = 0;
-	flt_rule.rule.action = IPA_PASS_TO_ROUTING;
-	flt_rule.rule.eq_attrib_type = 0;
-
-	/* point to LAN-LAN routing table */
-	if (iptype == IPA_IP_v4)
-	{
-		if (false == m_routing.GetRoutingTable(&IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_lan_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_lan_lan_v4.hdl;
-		IPACMDBG_H("LAN->LAN filter rule use table: %s\n", IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_lan_v4.name);
-	}
-	else
-	{
-		if (false == m_routing.GetRoutingTable(&IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_lan_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_lan_lan_v6.hdl;
-		IPACMDBG_H("LAN->LAN filter rule use table: %s\n", IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_lan_v6.name);
-	}
-
-	memcpy(&flt_rule.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule.rule.attrib));
-
-	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::lan_hdr_type == IPA_HDR_L2_802_3)
-	{
-		flt_rule.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_802_3;
-	}
-	else
-	{
-		IPACMERR("LAN hdr type is not expected.\n");
-		res = IPACM_FAILURE;
-		goto fail;
-	}
-
-	memcpy(flt_rule.rule.attrib.dst_mac_addr, mac, sizeof(flt_rule.rule.attrib.dst_mac_addr));
-	memset(flt_rule.rule.attrib.dst_mac_addr_mask, 0xFF, sizeof(flt_rule.rule.attrib.dst_mac_addr_mask));
-
-	if (iptype == IPA_IP_v4)
-	{
-		for (i=0; i<IPA_LAN_TO_LAN_MAX_LAN_CLIENT; i++)
-		{
-			if (lan_client_flt_rule_hdl_v4[i].valid == true)
-			{
-				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_LAN_CLIENT)
-		{
-			IPACMDBG_H("Cannot find a valid flt rule hdl.\n");
-			res = IPACM_FAILURE;
-			goto fail;
-		}
-	}
-	else
-	{
-		for (i=0; i<IPA_LAN_TO_LAN_MAX_LAN_CLIENT; i++)
-		{
-			if (lan_client_flt_rule_hdl_v6[i].valid == true)
-			{
-				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_LAN_CLIENT)
-		{
-			IPACMDBG_H("Cannot find a valid flt rule hdl.\n");
-			res = IPACM_FAILURE;
-			goto fail;
-		}
-	}
-
-	memcpy(&(pFilteringTable->rules[0]), &flt_rule, sizeof(struct ipa_flt_rule_mdfy));
-
-	if (false == m_filtering.ModifyFilteringRule(pFilteringTable))
-	{
-		IPACMERR("Failed to add wlan client filtering rules.\n");
-		res = IPACM_FAILURE;
-		goto fail;
-	}
-
-	if (client_is_found == false)
-	{
-		client_position = lan_client_flt_info_count;
-		lan_client_flt_info_count++;
-	}
-
-	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_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_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:
-	free(pFilteringTable);
-
-	return res;
-}
-
-int IPACM_Lan::eth_bridge_del_lan_client_flt_rule(uint8_t* mac)
-{
-	if (mac == NULL)
-	{
-		IPACMERR("Client MAC address is empty.\n");
-		return IPACM_FAILURE;
-	}
-
-	IPACMDBG_H("Received 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<lan_client_flt_info_count; i++)
-	{
-		if (memcmp(eth_bridge_lan_client_flt_info[i].mac, mac, sizeof(eth_bridge_lan_client_flt_info[i].mac)) == 0)
-		{
-			break;
-		}
-	}
-
-	if (i == lan_client_flt_info_count)
-	{
-		IPACMERR("Do not find the lan client.\n");
-		return IPACM_FAILURE;
-	}
-
-	if (eth_bridge_lan_client_flt_info[i].flt_rule_set_v4 == true)
-	{
-		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_LAN_CLIENT; j++)
-			{
-				if (lan_client_flt_rule_hdl_v4[j].rule_hdl == eth_bridge_lan_client_flt_info[i].flt_rule_hdl_v4)
-				{
-					lan_client_flt_rule_hdl_v4[j].valid = true;
-					break;
-				}
-			}
-			if (j == IPA_LAN_TO_LAN_MAX_LAN_CLIENT)
-			{
-				IPACMERR("Not finding the rule handle in handle pool.\n");
-				return IPACM_FAILURE;
-			}
-		}
-		else
-		{
-			IPACMERR("Failed to delete the lan client specific flt rule.\n");
-			return IPACM_FAILURE;
-		}
-	}
-	if (eth_bridge_lan_client_flt_info[i].flt_rule_set_v6 == true)
-	{
-		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_LAN_CLIENT; j++)
-			{
-				if (lan_client_flt_rule_hdl_v6[j].rule_hdl == eth_bridge_lan_client_flt_info[i].flt_rule_hdl_v6)
-				{
-					lan_client_flt_rule_hdl_v6[j].valid = true;
-					break;
-				}
-			}
-			if (j == IPA_LAN_TO_LAN_MAX_LAN_CLIENT)
-			{
-				IPACMERR("Not finding the rule handle in handle pool.\n");
-				return IPACM_FAILURE;
-			}
-		}
-		else
-		{
-			IPACMERR("Failed to delete the lan client specific flt rule.\n");
-			return IPACM_FAILURE;
-		}
-	}
-
-	for (j=i+1; j<lan_client_flt_info_count; j++)
-	{
-		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_lan_client_flt_info[lan_client_flt_info_count-1]), 0, sizeof(eth_bridge_client_flt_info));
-	lan_client_flt_info_count--;
+	memcpy(&(eth_bridge_client_flt_info[i]), &(eth_bridge_client_flt_info[client_flt_info_count-1]), sizeof(eth_bridge_subnet_client_flt_info));
+	memset(&(eth_bridge_client_flt_info[client_flt_info_count-1]), 0, sizeof(eth_bridge_subnet_client_flt_info));
+	client_flt_info_count--;
 
 	return res;
 }
@@ -6070,7 +5198,7 @@
 
 	if(IPACM_Lan::wlan_hdr_type != IPA_HDR_L2_NONE)
 	{
-		if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == WLAN_IF)
+		if(ipa_if_cate == WLAN_IF)
 		{
 			if(IPACM_Lan::wlan_to_wlan_hdr_proc_ctx.valid == false)
 			{
@@ -6126,7 +5254,7 @@
 					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;
+				cat->if_cat = ipa_if_cate;
 
 				evt_data.evt_data = cat;
 				evt_data.event = IPA_ETH_BRIDGE_HDR_PROC_CTX_SET_EVENT;
@@ -6181,8 +5309,7 @@
 
 	if(IPACM_Lan::lan_hdr_type != IPA_HDR_L2_NONE)
 	{
-		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))
+		if(ipa_if_cate == LAN_IF || ipa_if_cate == ODU_IF)
 		{
 			if(IPACM_Iface::ipacmcfg->ipacm_odu_router_mode == false)
 			{
@@ -6238,7 +5365,7 @@
 					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;
+				cat->if_cat = ipa_if_cate;
 
 				evt_data.evt_data = cat;
 				evt_data.event = IPA_ETH_BRIDGE_HDR_PROC_CTX_SET_EVENT;
@@ -6286,28 +5413,17 @@
 	return IPA_HDR_PROC_NONE;
 }
 
-int IPACM_Lan::eth_bridge_install_cache_wlan_client_flt_rule(ipa_ip_type iptype)
+int IPACM_Lan::eth_bridge_install_cache_client_flt_rule(ipa_ip_type iptype)
 {
 	int i;
 
-	IPACMDBG_H("There are %d wlan clients cached.\n",IPACM_Lan::num_wlan_client);
-	for(i=0; i<IPACM_Lan::num_wlan_client; i++)
+	IPACMDBG_H("There are %d clients cached.\n",IPACM_Lan::eth_bridge_num_client);
+	for(i=0; i<IPACM_Lan::eth_bridge_num_client; i++)
 	{
-		eth_bridge_add_wlan_client_flt_rule(IPACM_Lan::eth_bridge_wlan_client[i].mac, iptype);
-	}
-	return IPACM_SUCCESS;
-}
-
-int IPACM_Lan::eth_bridge_install_cache_lan_client_flt_rule(ipa_ip_type iptype)
-{
-	int 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++)
-	{
-		if (IPACM_Lan::eth_bridge_lan_client[i].ipa_if_num != ipa_if_num)
+		if(ipa_if_num != IPACM_Lan::eth_bridge_client[i].ipa_if_num)
 		{
-			eth_bridge_add_lan_client_flt_rule(IPACM_Lan::eth_bridge_lan_client[i].mac, iptype);
+			eth_bridge_add_client_flt_rule(IPACM_Lan::eth_bridge_client[i].mac, iptype,
+				IPACM_Lan::eth_bridge_client[i].ipa_if_cate);
 		}
 	}
 	return IPACM_SUCCESS;
@@ -6327,15 +5443,15 @@
 	}
 
 	IPACMDBG_H("Received client MAC 0x%02x%02x%02x%02x%02x%02x. src_iface: %d if_cat: %d \n",
-			mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], src, IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat );
+			mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], src, ipa_if_cate);
 
-	if (src == SRC_WLAN && IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == LAN_IF
+	if (src == SRC_WLAN && ipa_if_cate == 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 (src == SRC_WLAN && IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ODU_IF
+	if (src == SRC_WLAN && ipa_if_cate == 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");
@@ -6486,11 +5602,11 @@
 	rt_rule.rule.hdr_hdl = 0;
 	if(src == SRC_LAN)
 	{
-		if (IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == LAN_IF)
+		if (ipa_if_cate == LAN_IF)
 		{
 			rt_rule.rule.hdr_proc_ctx_hdl = IPACM_Lan::cpe_to_usb_hdr_proc_ctx.proc_ctx_hdl;
 		}
-		else if (IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == ODU_IF)
+		else if (ipa_if_cate == ODU_IF)
 		{
 			rt_rule.rule.hdr_proc_ctx_hdl = IPACM_Lan::usb_to_cpe_hdr_proc_ctx.proc_ctx_hdl;
 		}
@@ -6503,11 +5619,11 @@
 	}
 	else
 	{
-		if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == LAN_IF)
+		if(ipa_if_cate == 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)
+		else if(ipa_if_cate == ODU_IF)
 		{
 			rt_rule.rule.hdr_proc_ctx_hdl = IPACM_Lan::wlan_to_cpe_hdr_proc_ctx.proc_ctx_hdl;
 		}
@@ -6809,11 +5925,13 @@
 }
 
 
-void IPACM_Lan::eth_bridge_add_lan_client(uint8_t* mac)
+void IPACM_Lan::eth_bridge_add_client(uint8_t* mac)
 {
-	if(IPACM_Lan::num_lan_client == IPA_LAN_TO_LAN_MAX_LAN_CLIENT)
+	int i;
+	int num_client = IPACM_Lan::eth_bridge_num_client;
+	if(num_client == IPA_LAN_TO_LAN_MAX_CLIENT)
 	{
-		IPACMDBG_H("USB client table is already full.\n");
+		IPACMDBG_H("Client table is already full.\n");
 		return;
 	}
 
@@ -6823,57 +5941,103 @@
 		return;
 	}
 
-	int i;
-	for(i=0; i<IPACM_Lan::num_lan_client; i++)
+	for(i=0; i<num_client; i++)
 	{
-		if(memcmp(IPACM_Lan::eth_bridge_lan_client[i].mac, mac, sizeof(IPACM_Lan::eth_bridge_lan_client[i].mac)) == 0)
+		if(memcmp(IPACM_Lan::eth_bridge_client[i].mac, mac, sizeof(IPACM_Lan::eth_bridge_client[i].mac)) == 0)
 		{
-			IPACMDBG_H("The lan client mac has been added before at position %d.\n", i);
+			IPACMDBG_H("The 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);
+	memcpy(IPACM_Lan::eth_bridge_client[num_client].mac, mac, sizeof(IPACM_Lan::eth_bridge_client[num_client].mac));
+	IPACM_Lan::eth_bridge_client[num_client].ipa_if_num = ipa_if_num;
+	IPACM_Lan::eth_bridge_client[num_client].ipa_if_cate = ipa_if_cate;
+	IPACM_Lan::eth_bridge_num_client++;
+	IPACMDBG_H("Now total num of clients is %d\n", IPACM_Lan::eth_bridge_num_client);
 	return;
 }
 
-void IPACM_Lan::eth_bridge_del_lan_client(uint8_t* mac)
+void IPACM_Lan::eth_bridge_del_client(uint8_t* mac)
 {
+	int i, j, mem_size;
+	int num_client = IPACM_Lan::eth_bridge_num_client;
 	if(mac == NULL)
 	{
 		IPACMERR("Mac address is empty.\n");
 		return;
 	}
 
-	int i, j;
-	for(i=0; i<IPACM_Lan::num_lan_client; i++)
+	for(i=0; i<num_client; i++)
 	{
-		if(memcmp(IPACM_Lan::eth_bridge_lan_client[i].mac, mac, sizeof(IPACM_Lan::eth_bridge_lan_client[i].mac)) == 0)
+		if(memcmp(IPACM_Lan::eth_bridge_client[i].mac, mac, sizeof(IPACM_Lan::eth_bridge_client[i].mac)) == 0)
 		{
 			IPACMDBG_H("Found LAN client at position %d.\n", i);
 			break;
 		}
 	}
 
-	if(i == IPACM_Lan::num_lan_client)
+	if(i == num_client)
 	{
 		IPACMDBG_H("Not finding the LAN client.\n");
 		return;
 	}
 
-	for(j=i+1; j<IPACM_Lan::num_lan_client; j++)
+	mem_size = sizeof(eth_bridge_subnet_client_info);
+	for(j=i+1; j<num_client; j++)
 	{
-		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;
+		memcpy(&IPACM_Lan::eth_bridge_client[j-1], &IPACM_Lan::eth_bridge_client[j], mem_size);
 	}
-	IPACM_Lan::num_lan_client--;
-	IPACMDBG_H("Now total num of lan clients is %d\n", IPACM_Lan::num_lan_client);
+	IPACM_Lan::eth_bridge_num_client--;
+	IPACMDBG_H("Now total num of clients is %d\n", IPACM_Lan::eth_bridge_num_client);
 	return;
 }
 
+int IPACM_Lan::eth_bridge_remove_all_client_flt_rule(ipa_ip_type iptype)
+{
+	int i, j;
+	uint32_t temp_eth_bridge_flt_rule[IPA_LAN_TO_LAN_MAX_CLIENT];
+
+	i = 0;
+	j = 0;
+	while(i<client_flt_info_count)
+	{
+		if(iptype == IPA_IP_v4 && eth_bridge_client_flt_info[i].flt_rule_set_v4)
+		{
+			temp_eth_bridge_flt_rule[j] = eth_bridge_client_flt_info[i].flt_rule_hdl_v4;
+			eth_bridge_client_flt_info[i].flt_rule_set_v4 = false;
+			j++;
+		}
+		if(iptype == IPA_IP_v6 && eth_bridge_client_flt_info[i].flt_rule_set_v6)
+		{
+			temp_eth_bridge_flt_rule[j] = eth_bridge_client_flt_info[i].flt_rule_hdl_v6;
+			eth_bridge_client_flt_info[i].flt_rule_set_v6 = false;
+			j++;
+		}
+
+		/* if both IPv4/IPv6 flt rules have been removed, remove the client info from the array */
+		if(!eth_bridge_client_flt_info[i].flt_rule_set_v4 || !eth_bridge_client_flt_info[i].flt_rule_set_v6)
+		{
+			memcpy(&(eth_bridge_client_flt_info[i]), &(eth_bridge_client_flt_info[client_flt_info_count-1]), sizeof(eth_bridge_subnet_client_flt_info));
+			memset(&(eth_bridge_client_flt_info[client_flt_info_count-1]), 0, sizeof(eth_bridge_subnet_client_flt_info));
+			client_flt_info_count--;
+			IPACMDBG_H("Now client flt info count: %d\n", client_flt_info_count);
+		}
+		else
+		{
+			i++;
+		}
+	}
+	if (m_filtering.DeleteFilteringHdls(temp_eth_bridge_flt_rule, iptype, j) == false)
+	{
+		IPACMERR("Error Deleting Filtering Rule, aborting...\n");
+		return IPACM_FAILURE;
+	}
+
+	IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, iptype, j);
+	return IPACM_SUCCESS;
+}
+
 int IPACM_Lan::eth_bridge_get_hdr_template_hdl(uint32_t* hdr_hdl)
 {
 	if(hdr_hdl == NULL)
@@ -6900,7 +6064,7 @@
 {
 	if(IPACM_Lan::lan_to_wlan_hdr_proc_ctx.valid == true)
 	{
-		if((IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == WLAN_IF)
+		if((ipa_if_cate == WLAN_IF)
 			|| (IPACM_Lan::is_usb_up == false && IPACM_Lan::is_cpe_up == false))
 		{
 			if(m_header.DeleteHeaderProcCtx(IPACM_Lan::lan_to_wlan_hdr_proc_ctx.proc_ctx_hdl) == false)
@@ -6921,7 +6085,7 @@
 				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;
+			cat->if_cat = ipa_if_cate;
 
 			evt_data.evt_data = cat;
 			evt_data.event = IPA_ETH_BRIDGE_HDR_PROC_CTX_UNSET_EVENT;
@@ -6932,7 +6096,7 @@
 
 	if(IPACM_Lan::wlan_to_usb_hdr_proc_ctx.valid == true)
 	{
-		if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == WLAN_IF || IPACM_Lan::is_usb_up == false)
+		if(ipa_if_cate == WLAN_IF || IPACM_Lan::is_usb_up == false)
 		{
 			if(m_header.DeleteHeaderProcCtx(IPACM_Lan::wlan_to_usb_hdr_proc_ctx.proc_ctx_hdl) == false)
 			{
@@ -6945,7 +6109,7 @@
 
 	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(ipa_if_cate == WLAN_IF || IPACM_Lan::is_cpe_up == false)
 		{
 			if(m_header.DeleteHeaderProcCtx(IPACM_Lan::wlan_to_cpe_hdr_proc_ctx.proc_ctx_hdl) == false)
 			{
@@ -6956,9 +6120,9 @@
 		}
 	}
 
-	if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == WLAN_IF)
+	if(IPACM_Lan::wlan_to_wlan_hdr_proc_ctx.valid == true)
 	{
-		if(IPACM_Lan::wlan_to_wlan_hdr_proc_ctx.valid == true)
+		if(ipa_if_cate == WLAN_IF)
 		{
 			if(m_header.DeleteHeaderProcCtx(IPACM_Lan::wlan_to_wlan_hdr_proc_ctx.proc_ctx_hdl) == false)
 			{
@@ -6971,8 +6135,7 @@
 
 	if(IPACM_Lan::cpe_to_usb_hdr_proc_ctx.valid == true && IPACM_Lan::usb_to_cpe_hdr_proc_ctx.valid == true)
 	{
-		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))
+		if(ipa_if_cate == LAN_IF || ipa_if_cate == ODU_IF)
 		{
 			if(m_header.DeleteHeaderProcCtx(IPACM_Lan::cpe_to_usb_hdr_proc_ctx.proc_ctx_hdl) == false)
 			{
@@ -6999,7 +6162,7 @@
 				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;
+			cat->if_cat = ipa_if_cate;
 
 			evt_data.evt_data = cat;
 			evt_data.event = IPA_ETH_BRIDGE_HDR_PROC_CTX_UNSET_EVENT;
@@ -7010,6 +6173,92 @@
 	return IPACM_SUCCESS;
 }
 
+bool IPACM_Lan::eth_bridge_is_lan_client(int ipa_if_cate)
+{
+	if(ipa_if_cate == ODU_IF || ipa_if_cate == LAN_IF)
+	{
+		return true;
+	}
+	else
+	{
+		return false;
+	}
+}
+
+void IPACM_Lan::eth_bridge_get_rt_tbl_name(ipa_ip_type iptype, struct ipa_ioc_get_rt_tbl *rt_tbl, int dest_if_cate)
+{
+	if(iptype == IPA_IP_v4) //IPv4 case
+	{
+		if(eth_bridge_is_lan_client(dest_if_cate) != true) //dest is WLAN client
+		{
+			if(eth_bridge_is_lan_client(ipa_if_cate) == true) //self is LAN client
+			{
+				strlcpy(rt_tbl->name, IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_wlan_v4.name,
+						sizeof(rt_tbl->name));
+			}
+			else //self is WLAN client
+			{
+				strlcpy(rt_tbl->name, IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_wlan_wlan_v4.name,
+						sizeof(rt_tbl->name));
+			}
+		}
+		else //dest is LAN client
+		{
+			if(eth_bridge_is_lan_client(ipa_if_cate) == true) //self is LAN client
+			{
+				strlcpy(rt_tbl->name, IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_lan_v4.name,
+						sizeof(rt_tbl->name));
+			}
+			else //self is WLAN client
+			{
+				strlcpy(rt_tbl->name, IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_wlan_v4.name,
+						sizeof(rt_tbl->name));
+			}
+		}
+	}
+	else //IPv6 case
+	{
+		if(eth_bridge_is_lan_client(dest_if_cate) != true) //dest is WLAN client
+		{
+			if(eth_bridge_is_lan_client(ipa_if_cate) == true) //self is LAN client
+			{
+				strlcpy(rt_tbl->name, IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_wlan_v6.name,
+						sizeof(rt_tbl->name));
+			}
+			else //self is WLAN client
+			{
+				strlcpy(rt_tbl->name, IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_wlan_wlan_v6.name,
+						sizeof(rt_tbl->name));
+			}
+		}
+		else //dest is LAN client
+		{
+			if(eth_bridge_is_lan_client(ipa_if_cate) == true) //self is LAN client
+			{
+				strlcpy(rt_tbl->name, IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_lan_v6.name,
+						sizeof(rt_tbl->name));
+			}
+			else //self is WLAN client
+			{
+				strlcpy(rt_tbl->name, IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_lan_wlan_v6.name,
+						sizeof(rt_tbl->name));
+			}
+		}
+	}
+}
+
+enum ipa_hdr_l2_type IPACM_Lan::eth_bridge_get_l2_hdr_type()
+{
+	if(eth_bridge_is_lan_client(ipa_if_cate))
+	{
+		return IPACM_Lan::lan_hdr_type;
+	}
+	else
+	{
+		return IPACM_Lan::wlan_hdr_type;
+	}
+}
+
 int IPACM_Lan::handle_cradle_wan_mode_switch(bool is_wan_bridge_mode)
 {
 	struct ipa_flt_rule_mdfy flt_rule_entry;
diff --git a/ipacm/src/IPACM_Main.cpp b/ipacm/src/IPACM_Main.cpp
index 831243f..501aa0a 100644
--- a/ipacm/src/IPACM_Main.cpp
+++ b/ipacm/src/IPACM_Main.cpp
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
+Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
@@ -104,23 +104,38 @@
 	__stringify(IPA_HANDLE_WLAN_UP),                       /* 24 ipacm_event_iface_up */
 	__stringify(IPA_HANDLE_LAN_UP),                        /* 25 ipacm_event_iface_up */
 	__stringify(IPA_WLAN_CLIENT_ADD_EVENT_EX),             /* 26 ipacm_event_data_wlan_ex */
-	__stringify(IPA_HANDLE_WAN_UP_V6),					   /* 27 NULL */
-	__stringify(IPA_HANDLE_WAN_DOWN_V6),				   /* 28 NULL */
-	__stringify(IPA_LAN_CLIENT_ACTIVE),					   /* 29 ipacm_event_lan_client*/
-	__stringify(IPA_LAN_CLIENT_INACTIVE),				   /* 30 ipacm_event_lan_client*/
-	__stringify(IPA_LAN_CLIENT_DISCONNECT),				   /* 31 ipacm_event_lan_client*/
-	__stringify(IPA_LAN_CLIENT_POWER_SAVE),				   /* 32 ipacm_event_lan_client*/
-	__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_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 */
+	__stringify(IPA_HANDLE_WAN_UP_V6),                     /* 27 NULL */
+	__stringify(IPA_HANDLE_WAN_DOWN_V6),                   /* 28 NULL */
+	__stringify(IPA_LAN_CLIENT_ACTIVE),                    /* 29 ipacm_event_lan_client*/
+	__stringify(IPA_LAN_CLIENT_INACTIVE),                  /* 30 ipacm_event_lan_client*/
+	__stringify(IPA_LAN_CLIENT_DISCONNECT),                /* 31 ipacm_event_lan_client*/
+	__stringify(IPA_LAN_CLIENT_POWER_SAVE),                /* 32 ipacm_event_lan_client*/
+	__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_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_EMBMS_LINK_UP_EVENT),              /* 43 ipacm_event_data_mac */
+	__stringify(IPA_ETH_BRIDGE_CLIENT_ADD_EVENT),          /* 44 ipacm_event_data_mac */
+	__stringify(IPA_ETH_BRIDGE_CLIENT_DEL_EVENT),          /* 45 ipacm_event_data_mac */
+	__stringify(IPA_ETH_BRIDGE_HDR_PROC_CTX_SET_EVENT),    /* 46 ipacm_event_data_if_cat */
+	__stringify(IPA_ETH_BRIDGE_HDR_PROC_CTX_UNSET_EVENT),  /* 47 ipacm_event_data_if_cat */
+	__stringify(IPA_WLAN_SWITCH_TO_SCC),                   /* 48 No Data */
+	__stringify(IPA_WLAN_SWITCH_TO_MCC),                   /* 49 No Data */
+	__stringify(IPA_CRADLE_WAN_MODE_SWITCH),               /* 50 ipacm_event_cradle_wan_mode */
+	__stringify(IPA_WAN_XLAT_CONNECT_EVENT),               /* 51 ipacm_event_data_fid */
+	__stringify(IPA_TETHERING_STATS_UPDATE_EVENT),         /* 52 ipacm_event_data_fid */
+	__stringify(IPA_NETWORK_STATS_UPDATE_EVENT),           /* 53 ipacm_event_data_fid */
+	__stringify(IPA_HANDLE_WAN_UP_TETHER),                 /* 54 ipacm_event_iface_up_tehter */
+	__stringify(IPA_HANDLE_WAN_DOWN_TETHER),               /* 55 ipacm_event_iface_up_tehter */
+	__stringify(IPA_HANDLE_WAN_UP_V6_TETHER),		       /* 56 ipacm_event_iface_up_tehter */
+	__stringify(IPA_HANDLE_WAN_DOWN_V6_TETHER),		       /* 57 ipacm_event_iface_up_tehter */
+	__stringify(IPA_BRIDGE_LINK_UP_EVENT),                 /* 58 ipacm_event_data_all */
 };
 
 #define IPA_DRIVER  "/dev/ipa"
diff --git a/ipacm/src/IPACM_Wlan.cpp b/ipacm/src/IPACM_Wlan.cpp
index 3c92a4f..51e16e1 100644
--- a/ipacm/src/IPACM_Wlan.cpp
+++ b/ipacm/src/IPACM_Wlan.cpp
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
+Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
@@ -58,12 +58,6 @@
 uint32_t* IPACM_Wlan::dummy_flt_rule_hdl_v6 = NULL;
 int IPACM_Wlan::num_wlan_ap_iface = 0;
 
-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::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)
 {
 #define WLAN_AMPDU_DEFAULT_FILTER_RULES 3
@@ -110,32 +104,17 @@
 		return;
 	}
 
-#ifdef FEATURE_ETH_BRIDGE_LE
-	exp_index_v4 = 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 + NUM_IPV4_ICMP_FLT_RULE;
-	exp_index_v6 = IPV6_DEFAULT_FILTERTING_RULES + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_LAN_CLIENT
-			+ 2 * NUM_IPV6_PREFIX_FLT_RULE + NUM_IPV6_ICMP_FLT_RULE;
-#else
-#ifndef CT_OPT
-	exp_index_v4 = 2*(IPV4_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR + IPACM_Iface::ipacmcfg->ipa_num_private_subnet) + NUM_IPV4_ICMP_FLT_RULE;
-	exp_index_v6 = 2*(IPV6_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR + NUM_IPV6_PREFIX_FLT_RULE) + NUM_IPV6_ICMP_FLT_RULE;
-#else
-	exp_index_v4 = 2*(IPV4_DEFAULT_FILTERTING_RULES + NUM_TCP_CTL_FLT_RULE + MAX_OFFLOAD_PAIR + IPACM_Iface::ipacmcfg->ipa_num_private_subnet) + NUM_IPV4_ICMP_FLT_RULE;
-	exp_index_v6 = 2*(IPV6_DEFAULT_FILTERTING_RULES + NUM_TCP_CTL_FLT_RULE + MAX_OFFLOAD_PAIR + NUM_IPV6_PREFIX_FLT_RULE) + NUM_IPV6_ICMP_FLT_RULE;
-#endif
-#ifdef FEATURE_IPA_ANDROID
-	exp_index_v4 = exp_index_v4 + 2 * (IPA_MAX_PRIVATE_SUBNET_ENTRIES - IPACM_Iface::ipacmcfg->ipa_num_private_subnet);
-#endif
-#endif
-
 	IPACM_Wlan::num_wlan_ap_iface++;
 	IPACMDBG_H("Now the number of wlan AP iface is %d\n", IPACM_Wlan::num_wlan_ap_iface);
-	add_dummy_flt_rule();
 
 	is_guest_ap = false;
+	if (IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].wlan_mode == INTERNET)
+	{
+		is_guest_ap = true;
+	}
+	IPACMDBG_H("%s: guest ap enable: %d \n",
+		IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].iface_name, is_guest_ap);
 
-	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;
@@ -159,7 +138,7 @@
 #ifdef FEATURE_ETH_BRIDGE_LE
 	if(iface_query != NULL)
 	{
-		if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == WLAN_IF && tx_prop != NULL)
+		if(ipa_if_cate == WLAN_IF && tx_prop != NULL)
 		{
 			if(IPACM_Lan::wlan_hdr_type != IPA_HDR_L2_NONE && tx_prop->tx[0].hdr_l2_type != IPACM_Lan::wlan_hdr_type)
 			{
@@ -180,19 +159,13 @@
 					}
 				}
 			}
-			if (IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].wlan_mode == INTERNET)
-			{
-				is_guest_ap = true;
-			}
-			IPACMDBG_H("%s: guest ap enable: %d \n",
-				IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].iface_name, is_guest_ap);
 		}
 	}
 #endif
 
 #ifdef FEATURE_IPA_ANDROID
 	/* set the IPA-client pipe enum */
-	if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat == WLAN_IF)
+	if(ipa_if_cate == WLAN_IF)
 	{
 		handle_tethering_client(false, IPACM_CLIENT_WLAN);
 	}
@@ -234,7 +207,7 @@
 				IPACMDBG_H("Received IPA_WLAN_LINK_DOWN_EVENT\n");
 				handle_down_evt();
 				/* reset the AP-iface category to unknown */
-				IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_cat=UNKNOWN_IF;
+				ipa_if_cate = UNKNOWN_IF;
 				IPACM_Iface::ipacmcfg->DelNatIfaces(dev_name); // delete NAT-iface
 				IPACM_Wlan::total_num_wifi_clients = (IPACM_Wlan::total_num_wifi_clients) - \
                                                                      (num_wifi_client);
@@ -271,7 +244,6 @@
 		{
 			IPACM_Wlan::num_wlan_ap_iface--;
 			IPACMDBG_H("Now the number of wlan AP iface is %d\n", IPACM_Wlan::num_wlan_ap_iface);
-			del_dummy_flt_rule();
 
 			IPACMDBG_H("Received IPA_LAN_DELETE_SELF event.\n");
 			IPACMDBG_H("ipa_WLAN (%s):ipa_index (%d) instance close \n", IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].iface_name, ipa_if_num);
@@ -300,7 +272,7 @@
 				if( ((data->iptype != ip_type) && (ip_type != IPA_IP_MAX))
 				    || ((data->iptype==IPA_IP_v6) && (num_dft_rt_v6!=MAX_DEFAULT_v6_ROUTE_RULES)))
 				{
-				  IPACMDBG_H("Got IPA_ADDR_ADD_EVENT ip-family:%d, v6 num %d: \n",data->iptype,num_dft_rt_v6);
+					IPACMDBG_H("Got IPA_ADDR_ADD_EVENT ip-family:%d, v6 num %d: \n",data->iptype,num_dft_rt_v6);
 					/* Post event to NAT */
 					if (data->iptype == IPA_IP_v4)
 					{
@@ -328,27 +300,17 @@
 										 info->ipv4_addr, info->addr_mask);
 						IPACM_EvtDispatcher::PostEvt(&evt_data);
 					}
+
 					if(handle_addr_evt(data) == IPACM_FAILURE)
 					{
 						return;
 					}
-					if ((data->iptype == IPA_IP_v4) && (wlan_ap_index == 0))
-					{
-						IPACM_Lan::install_ipv4_icmp_flt_rule();
-					}
-					if ((num_dft_rt_v6 == 1) && (data->iptype == IPA_IP_v6) && (wlan_ap_index == 0))
-					{
-						install_ipv6_icmp_flt_rule();
-					}
 
 #ifdef FEATURE_IPA_ANDROID
 					add_dummy_private_subnet_flt_rule(data->iptype);
 					handle_private_subnet_android(data->iptype);
 #else
-					if(wlan_ap_index == 0)
-					{
-						handle_private_subnet(data->iptype);
-					}
+					handle_private_subnet(data->iptype);
 #endif
 
 					if (IPACM_Wan::isWanUP(ipa_if_num))
@@ -574,11 +536,6 @@
 			return;
 		}
 		IPACMDBG_H("Backhaul is sta mode?%d\n", data_wan->is_sta);
-		if(data_wan->is_sta == false && wlan_ap_index > 0)
-		{
-			IPACMDBG_H("This is not the first AP instance and not STA mode, ignore WAN_DOWN event.\n");
-			return;
-		}
 		if (rx_prop != NULL)
 		{
 			if(ip_type == IPA_IP_v4 || ip_type == IPA_IP_MAX)
@@ -623,29 +580,21 @@
 				{
 					if(data->attribs[i].attrib_type == WLAN_HDR_ATTRIB_MAC_ADDR)
 					{
-						if(IPACM_Lan::wlan_to_wlan_hdr_proc_ctx.valid == true)
-						{
-							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(ip_type == IPA_IP_v4 || ip_type == IPA_IP_MAX)
-						{
-							eth_bridge_add_self_client_flt_rule(data->attribs[i].u.mac_addr, IPA_IP_v4);
-						}
-						if(ip_type == IPA_IP_v6 || ip_type == IPA_IP_MAX)
-						{
-							eth_bridge_add_self_client_flt_rule(data->attribs[i].u.mac_addr, IPA_IP_v6);
-						}
 						if (is_guest_ap == false)
 						{
+							if(IPACM_Lan::wlan_to_wlan_hdr_proc_ctx.valid == true)
+							{
+								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::lan_to_wlan_hdr_proc_ctx.valid == true)
 							{
 								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);
 							}
-							eth_bridge_post_lan_client_event(data->attribs[i].u.mac_addr, IPA_ETH_BRIDGE_WLAN_CLIENT_ADD_EVENT);
+							eth_bridge_post_lan_client_event(data->attribs[i].u.mac_addr, IPA_ETH_BRIDGE_CLIENT_ADD_EVENT);
+							eth_bridge_add_client(data->attribs[i].u.mac_addr);
 						}
-						eth_bridge_add_wlan_client(data->attribs[i].u.mac_addr, ipa_if_num);
 						break;
 					}
 				}
@@ -664,17 +613,19 @@
 			{
 				IPACMDBG_H("Received IPA_WLAN_CLIENT_DEL_EVENT\n");
 #ifdef FEATURE_ETH_BRIDGE_LE
-				eth_bridge_del_self_client_flt_rule(data->mac_addr);
-				eth_bridge_del_wlan_client_rt_rule(data->mac_addr, SRC_WLAN);
 				if (is_guest_ap == false)
 				{
+					if(IPACM_Lan::wlan_to_wlan_hdr_proc_ctx.valid == true)
+					{
+						eth_bridge_del_wlan_client_rt_rule(data->mac_addr, SRC_WLAN);
+					}
 					if(IPACM_Lan::lan_to_wlan_hdr_proc_ctx.valid == true)
 					{
 						eth_bridge_del_wlan_client_rt_rule(data->mac_addr, SRC_LAN);
 					}
-					eth_bridge_post_lan_client_event(data->mac_addr, IPA_ETH_BRIDGE_WLAN_CLIENT_DEL_EVENT);
+					eth_bridge_post_lan_client_event(data->mac_addr, IPA_ETH_BRIDGE_CLIENT_DEL_EVENT);
+					eth_bridge_del_client(data->mac_addr);
 				}
-				eth_bridge_del_wlan_client(data->mac_addr);
 #endif
 				/* support lan2lan ipa-HW feature*/
 				handle_lan2lan_msg_post(data->mac_addr, IPA_LAN_CLIENT_DISCONNECT, IPA_IP_v4);
@@ -777,19 +728,25 @@
 		IPACM_Iface::handle_software_routing_disable();
 		break;
 
-	case IPA_ETH_BRIDGE_LAN_CLIENT_ADD_EVENT:
+	case IPA_ETH_BRIDGE_CLIENT_ADD_EVENT:
 		{
-			IPACMDBG_H("Received IPA_ETH_BRIDGE_LAN_CLIENT_ADD_EVENT event.\n");
+			IPACMDBG_H("Received IPA_ETH_BRIDGE_CLIENT_ADD_EVENT event.\n");
 			ipacm_event_data_mac* mac = (ipacm_event_data_mac*)param;
+			if(is_guest_ap == true)
+			{
+				IPACMDBG_H("%s iface is wlan guest ap, return.\n", dev_name);
+				return;
+			}
+
 			if(mac != NULL)
 			{
 				if(ip_type == IPA_IP_v4 || ip_type == IPA_IP_MAX)
 				{
-					eth_bridge_add_lan_client_flt_rule(mac->mac_addr, IPA_IP_v4);
+					eth_bridge_add_client_flt_rule(mac->mac_addr, IPA_IP_v4, mac->ipa_if_cate);
 				}
 				if(ip_type == IPA_IP_v6 || ip_type == IPA_IP_MAX)
 				{
-					eth_bridge_add_lan_client_flt_rule(mac->mac_addr, IPA_IP_v6);
+					eth_bridge_add_client_flt_rule(mac->mac_addr, IPA_IP_v6, mac->ipa_if_cate);
 				}
 			}
 			else
@@ -799,18 +756,20 @@
 		}
 		break;
 
-	case IPA_ETH_BRIDGE_LAN_CLIENT_DEL_EVENT:
+	case IPA_ETH_BRIDGE_CLIENT_DEL_EVENT:
 		{
-			IPACMDBG_H("Received IPA_ETH_BRIDGE_LAN_CLIENT_DEL_EVENT event.\n");
+			IPACMDBG_H("Received IPA_ETH_BRIDGE_CLIENT_DEL_EVENT event.\n");
 			ipacm_event_data_mac* mac = (ipacm_event_data_mac*)param;
+			if(is_guest_ap == true)
+			{
+				IPACMDBG_H("%s iface is wlan guest ap, return.\n", dev_name);
+				return;
+			}
 			if(mac != NULL)
 			{
-				if(wlan_ap_index == 0)
+				if(eth_bridge_del_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 lan client MAC based flt rule.\n");
-					}
+					IPACMDBG_H("Failed to delete client MAC based flt rule.\n");
 				}
 			}
 			else
@@ -835,17 +794,22 @@
 			IPACMDBG_H("The event was not sent by LAN interface, ignore.\n");
 			return;
 		}
+		if(is_guest_ap == true)
+		{
+			IPACMDBG_H("%s iface is wlan guest ap, return.\n", dev_name);
+			return;
+		}
 		if (IPACM_Lan::is_usb_up == true && IPACM_Lan::is_cpe_up == true)
 		{
 			IPACMDBG_H("USB and CPE both are up, lan-wlan routing rules are already installed. \n");
 			return;
 		}
-		for(i=0; i<IPACM_Lan::num_wlan_client; i++)
+		for(i=0; i<IPACM_Lan::eth_bridge_num_client; i++)
 		{
-			if(IPACM_Lan::eth_bridge_wlan_client[i].ipa_if_num == ipa_if_num)
+			if(IPACM_Lan::eth_bridge_client[i].ipa_if_num == ipa_if_num)
 			{
-				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);
+				eth_bridge_add_wlan_client_rt_rule(IPACM_Lan::eth_bridge_client[i].mac, SRC_LAN, IPA_IP_v4);
+				eth_bridge_add_wlan_client_rt_rule(IPACM_Lan::eth_bridge_client[i].mac, SRC_LAN, IPA_IP_v6);
 			}
 		}
 	}
@@ -866,16 +830,21 @@
 			IPACMDBG_H("The event was not sent by LAN interface, ignore.\n");
 			return;
 		}
+		if(is_guest_ap == true)
+		{
+			IPACMDBG_H("%s iface is wlan guest ap, return.\n", dev_name);
+			return;
+		}
 		if (IPACM_Lan::is_usb_up == true || IPACM_Lan::is_cpe_up == true)
 		{
 			IPACMDBG_H("USB or CPE is still up, so keep lan-wlan routing rule. \n");
 			return;
 		}
-		for(i=0; i<IPACM_Lan::num_wlan_client; i++)
+		for(i=0; i<IPACM_Lan::eth_bridge_num_client; i++)
 		{
-			if(IPACM_Lan::eth_bridge_wlan_client[i].ipa_if_num == ipa_if_num)
+			if(IPACM_Lan::eth_bridge_client[i].ipa_if_num == ipa_if_num)
 			{
-				eth_bridge_del_wlan_client_rt_rule(IPACM_Lan::eth_bridge_wlan_client[i].mac, SRC_LAN);
+				eth_bridge_del_wlan_client_rt_rule(IPACM_Lan::eth_bridge_client[i].mac, SRC_LAN);
 			}
 		}
 	}
@@ -935,8 +904,7 @@
 	break;
 	case IPA_CFG_CHANGE_EVENT:
 	{
-		int i;
-		IPACMDBG_H("Received IPA_CFG_CHANGE_EVENT event for %s with new wlan-mode: %s old wlan-mode: %s",
+		IPACMDBG_H("Received IPA_CFG_CHANGE_EVENT event for %s with new wlan-mode: %s old wlan-mode: %s\n",
 				IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].iface_name,
 				(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].wlan_mode == 0) ? "full" : "internet",
 				(is_guest_ap == true) ? "internet" : "full");
@@ -963,27 +931,6 @@
 		{
 			IPACMDBG_H("No change in %s access mode. \n",
 					IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].iface_name);
-
-			/* Handle the WLAN filtering rule */
-			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_modify_wlan_client_flt_rule(IPACM_Lan::eth_bridge_wlan_client[i].mac, DST_WLAN, IPA_IP_v4);
-					eth_bridge_modify_wlan_client_flt_rule(IPACM_Lan::eth_bridge_wlan_client[i].mac, DST_WLAN, IPA_IP_v6);
-				}
-			}
-			/* Handle the LAN filtering rule */
-			if (wlan_ap_index == 0 && is_guest_ap == false)
-			{
-				IPACMDBG_H("Modify LAN clients filtering rules. \n");
-				for (i=0; i<IPACM_Lan::num_lan_client; i++)
-				{
-					eth_bridge_modify_wlan_client_flt_rule(IPACM_Lan::eth_bridge_lan_client[i].mac, DST_LAN, IPA_IP_v4);
-					eth_bridge_modify_wlan_client_flt_rule(IPACM_Lan::eth_bridge_lan_client[i].mac, DST_LAN, IPA_IP_v6);
-				}
-			}
-			IPACMDBG_H("wlan access mode switch is successful. \n");
 		}
 	}
 	break;
@@ -1011,328 +958,6 @@
 	return;
 }
 
-/*Configure the initial filter rules */
-int IPACM_Wlan::init_fl_rule(ipa_ip_type iptype)
-{
-	int res = IPACM_SUCCESS, len, offset;
-	struct ipa_flt_rule_mdfy flt_rule;
-	struct ipa_ioc_mdfy_flt_rule* pFilteringTable;
-
-	/* update the iface ip-type to be IPA_IP_v4, IPA_IP_v6 or both*/
-	if (iptype == IPA_IP_v4)
-	{
-		if ((ip_type == IPA_IP_v4) || (ip_type == IPA_IP_MAX))
-		{
-			IPACMDBG_H("Interface(%s:%d) already in ip-type %d\n", dev_name, ipa_if_num, ip_type);
-			return res;
-		}
-
-		if (ip_type == IPA_IP_v6)
-		{
-			ip_type = IPA_IP_MAX;
-		}
-		else
-		{
-			ip_type = IPA_IP_v4;
-		}
-		IPACMDBG_H("Interface(%s:%d) now ip-type is %d\n", dev_name, ipa_if_num, ip_type);
-	}
-	else
-	{
-		if ((ip_type == IPA_IP_v6) || (ip_type == IPA_IP_MAX))
-		{
-			IPACMDBG_H("Interface(%s:%d) already in ip-type %d\n", dev_name, ipa_if_num, ip_type);
-			return res;
-		}
-
-		if (ip_type == IPA_IP_v4)
-		{
-			ip_type = IPA_IP_MAX;
-		}
-		else
-		{
-			ip_type = IPA_IP_v6;
-		}
-
-		IPACMDBG_H("Interface(%s:%d) now ip-type is %d\n", dev_name, ipa_if_num, ip_type);
-	}
-
-    /* ADD corresponding ipa_rm_resource_name of RX-endpoint before adding all IPV4V6 FT-rules */
-	if(rx_prop != NULL)
-	{
-		IPACMDBG_H("dev %s add producer dependency\n", dev_name);
-		IPACMDBG_H("depend Got pipe %d rm index : %d \n", rx_prop->rx[0].src_pipe, IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[rx_prop->rx[0].src_pipe]);
-		IPACM_Iface::ipacmcfg->AddRmDepend(IPACM_Iface::ipacmcfg->ipa_client_rm_map_tbl[rx_prop->rx[0].src_pipe],false);
-		IPACMDBG_H("Add producer dependency from %s with registered rx-prop\n", dev_name);
-	}
-	else
-	{
-		/* Adding the check if no Rx property registered, no filter rules will be added */
-		IPACMDBG_H("No rx properties registered for iface %s\n", dev_name);
-		return IPACM_SUCCESS;
-	}
-#ifdef FEATURE_ETH_BRIDGE_LE
-	if(wlan_ap_index != 0)
-	{
-		IPACMDBG_H("Install frag/multicast/broadcast rules only for the first AP.\n");
-		return IPACM_SUCCESS;
-	}
-#endif
-
-	/* construct ipa_ioc_add_flt_rule with default filter rules */
-	if (iptype == IPA_IP_v4)
-	{
-		if(IPACM_Wlan::dummy_flt_rule_hdl_v4 == NULL)
-		{
-			IPACMERR("Dummy ipv4 flt rule has not been installed.\n");
-			return IPACM_FAILURE;
-		}
-#ifdef FEATURE_ETH_BRIDGE_LE
-		offset = 0;
-#else
-#ifndef CT_OPT
-		offset = wlan_ap_index * (IPV4_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR + IPACM_Iface::ipacmcfg->ipa_num_private_subnet);
-#else
-		offset = wlan_ap_index * (IPV4_DEFAULT_FILTERTING_RULES + NUM_TCP_CTL_FLT_RULE + MAX_OFFLOAD_PAIR + IPACM_Iface::ipacmcfg->ipa_num_private_subnet)
-				+ NUM_TCP_CTL_FLT_RULE;
-#endif
-#endif
-
-#ifdef FEATURE_IPA_ANDROID
-		offset = offset + wlan_ap_index * (IPA_MAX_PRIVATE_SUBNET_ENTRIES - IPACM_Iface::ipacmcfg->ipa_num_private_subnet);
-#endif
-		len = sizeof(struct ipa_ioc_mdfy_flt_rule) + (IPV4_DEFAULT_FILTERTING_RULES * sizeof(struct ipa_flt_rule_mdfy));
-		pFilteringTable = (struct ipa_ioc_mdfy_flt_rule *)calloc(1, len);
-		if (!pFilteringTable)
-		{
-			IPACMERR("Error Locate ipa_ioc_mdfy_flt_rule memory...\n");
-			return IPACM_FAILURE;
-		}
-		memset(pFilteringTable, 0, len);
-
-		pFilteringTable->commit = 1;
-		pFilteringTable->ip = iptype;
-		pFilteringTable->num_rules = (uint8_t)IPV4_DEFAULT_FILTERTING_RULES;
-
-		memset(&flt_rule, 0, sizeof(struct ipa_flt_rule_mdfy));
-
-		flt_rule.status = -1;
-
-		flt_rule.rule.retain_hdr = 1;
-		flt_rule.rule.to_uc = 0;
-		flt_rule.rule.action = IPA_PASS_TO_EXCEPTION;
-		flt_rule.rule.eq_attrib_type = 0;
-
-		/* Configuring Fragment Filtering Rule */
-		IPACMDBG_H("rx property attrib mask:0x%x\n", rx_prop->rx[0].attrib.attrib_mask);
-		memcpy(&flt_rule.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule.rule.attrib));
-#ifdef FEATURE_ETH_BRIDGE_LE
-		/* remove meta data mask */
-		flt_rule.rule.attrib.attrib_mask &= ~((uint32_t)IPA_FLT_META_DATA);
-#endif
-		flt_rule.rule.attrib.attrib_mask |= IPA_FLT_FRAGMENT;
-		flt_rule.rule_hdl = IPACM_Wlan::dummy_flt_rule_hdl_v4[offset];
-		memcpy(&(pFilteringTable->rules[0]), &flt_rule, sizeof(struct ipa_flt_rule_mdfy));
-
-		/* Configuring Multicast Filtering Rule */
-		memcpy(&flt_rule.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule.rule.attrib));
-#ifdef FEATURE_ETH_BRIDGE_LE
-		/* remove meta data mask */
-		flt_rule.rule.attrib.attrib_mask &= ~((uint32_t)IPA_FLT_META_DATA);
-#endif
-		flt_rule.rule.attrib.attrib_mask |= IPA_FLT_DST_ADDR;
-		flt_rule.rule.attrib.u.v4.dst_addr_mask = 0xF0000000;
-		flt_rule.rule.attrib.u.v4.dst_addr = 0xE0000000;
-		flt_rule.rule_hdl = IPACM_Wlan::dummy_flt_rule_hdl_v4[offset+1];
-		memcpy(&(pFilteringTable->rules[1]), &flt_rule, sizeof(struct ipa_flt_rule_mdfy));
-
-		/* Configuring Broadcast Filtering Rule */
-		flt_rule.rule.attrib.u.v4.dst_addr_mask = 0xFFFFFFFF;
-		flt_rule.rule.attrib.u.v4.dst_addr = 0xFFFFFFFF;
-		flt_rule.rule_hdl = IPACM_Wlan::dummy_flt_rule_hdl_v4[offset+2];
-		memcpy(&(pFilteringTable->rules[2]), &flt_rule, sizeof(struct ipa_flt_rule_mdfy));
-
-		if (false == m_filtering.ModifyFilteringRule(pFilteringTable))
-		{
-			IPACMERR("Failed to modify default ipv4 filtering rules.\n");
-			res = IPACM_FAILURE;
-			goto fail;
-		}
-		else
-		{
-			/* copy filter hdls */
-			for (int i = 0; i < IPV4_DEFAULT_FILTERTING_RULES; i++)
-			{
-				if (pFilteringTable->rules[i].status == 0)
-				{
-					dft_v4fl_rule_hdl[i] = pFilteringTable->rules[i].rule_hdl;
-					IPACMDBG_H("Default v4 filter Rule %d HDL:0x%x\n", i, dft_v4fl_rule_hdl[i]);
-				}
-				else
-				{
-					IPACMERR("Failed adding default v4 Filtering rule %d\n", i);
-				}
-			}
-		}
-	}
-	else
-	{
-		if(IPACM_Wlan::dummy_flt_rule_hdl_v6 == NULL)
-		{
-			IPACMERR("Dummy ipv6 flt rule has not been installed.\n");
-			return IPACM_FAILURE;
-		}
-#ifdef FEATURE_ETH_BRIDGE_LE
-		offset = 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;
-#else
-		offset = wlan_ap_index * (IPV6_DEFAULT_FILTERTING_RULES + NUM_TCP_CTL_FLT_RULE + MAX_OFFLOAD_PAIR)
-				+ NUM_TCP_CTL_FLT_RULE + MAX_OFFLOAD_PAIR;
-#endif
-#endif
-
-		len = sizeof(struct ipa_ioc_mdfy_flt_rule) + (IPV6_DEFAULT_FILTERTING_RULES * sizeof(struct ipa_flt_rule_mdfy));
-		pFilteringTable = (struct ipa_ioc_mdfy_flt_rule *)calloc(1, len);
-		if (!pFilteringTable)
-		{
-			IPACMERR("Error Locate ipa_ioc_mdfy_flt_rule memory...\n");
-			return IPACM_FAILURE;
-		}
-		memset(pFilteringTable, 0, len);
-
-		pFilteringTable->commit = 1;
-		pFilteringTable->ip = iptype;
-		pFilteringTable->num_rules = (uint8_t)IPV6_DEFAULT_FILTERTING_RULES;
-
-		memset(&flt_rule, 0, sizeof(struct ipa_flt_rule_mdfy));
-
-		flt_rule.status = -1;
-
-		flt_rule.rule.retain_hdr = 1;
-		flt_rule.rule.to_uc = 0;
-		flt_rule.rule.action = IPA_PASS_TO_EXCEPTION;
-		flt_rule.rule.eq_attrib_type = 0;
-
-		/* Configuring Multicast Filtering Rule */
-		memcpy(&flt_rule.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule.rule.attrib));
-#ifdef FEATURE_ETH_BRIDGE_LE
-		/* remove meta data mask */
-		flt_rule.rule.attrib.attrib_mask &= ~((uint32_t)IPA_FLT_META_DATA);
-#endif
-		flt_rule.rule.attrib.attrib_mask |= IPA_FLT_DST_ADDR;
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[0] = 0xFF000000;
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[1] = 0x00000000;
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[2] = 0x00000000;
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[3] = 0x00000000;
-		flt_rule.rule.attrib.u.v6.dst_addr[0] = 0XFF000000;
-		flt_rule.rule.attrib.u.v6.dst_addr[1] = 0x00000000;
-		flt_rule.rule.attrib.u.v6.dst_addr[2] = 0x00000000;
-		flt_rule.rule.attrib.u.v6.dst_addr[3] = 0X00000000;
-		flt_rule.rule_hdl = IPACM_Wlan::dummy_flt_rule_hdl_v6[offset];
-		memcpy(&(pFilteringTable->rules[0]), &flt_rule, sizeof(struct ipa_flt_rule_mdfy));
-
-		/* Configuring fe80::/10 Link-Scoped Unicast Filtering Rule */
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[0] = 0XFFC00000;
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[1] = 0x00000000;
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[2] = 0x00000000;
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[3] = 0x00000000;
-		flt_rule.rule.attrib.u.v6.dst_addr[0] = 0xFE800000;
-		flt_rule.rule.attrib.u.v6.dst_addr[1] = 0x00000000;
-		flt_rule.rule.attrib.u.v6.dst_addr[2] = 0x00000000;
-		flt_rule.rule.attrib.u.v6.dst_addr[3] = 0X00000000;
-		flt_rule.rule_hdl = IPACM_Wlan::dummy_flt_rule_hdl_v6[offset+1];
-		memcpy(&(pFilteringTable->rules[1]), &flt_rule, sizeof(struct ipa_flt_rule_mdfy));
-
-		/* Configuring fec0::/10 Reserved by IETF Filtering Rule */
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[0] = 0XFFC00000;
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[1] = 0x00000000;
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[2] = 0x00000000;
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[3] = 0x00000000;
-		flt_rule.rule.attrib.u.v6.dst_addr[0] = 0xFEC00000;
-		flt_rule.rule.attrib.u.v6.dst_addr[1] = 0x00000000;
-		flt_rule.rule.attrib.u.v6.dst_addr[2] = 0x00000000;
-		flt_rule.rule.attrib.u.v6.dst_addr[3] = 0X00000000;
-		flt_rule.rule_hdl = IPACM_Wlan::dummy_flt_rule_hdl_v6[offset+2];
-		memcpy(&(pFilteringTable->rules[2]), &flt_rule, sizeof(struct ipa_flt_rule_mdfy));
-
-#ifdef FEATURE_IPA_ANDROID
-		memset(&flt_rule, 0, sizeof(struct ipa_flt_rule_mdfy));
-
-		flt_rule.status = -1;
-
-		flt_rule.rule.retain_hdr = 1;
-		flt_rule.rule.to_uc = 0;
-		flt_rule.rule.action = IPA_PASS_TO_EXCEPTION;
-		flt_rule.rule.eq_attrib_type = 1;
-
-		flt_rule.rule.eq_attrib.rule_eq_bitmap = 0;
-
-		if(rx_prop->rx[0].attrib.attrib_mask & IPA_FLT_META_DATA)
-		{
-			flt_rule.rule.eq_attrib.rule_eq_bitmap |= (1<<14);
-			flt_rule.rule.eq_attrib.metadata_meq32_present = 1;
-			flt_rule.rule.eq_attrib.metadata_meq32.offset = 0;
-			flt_rule.rule.eq_attrib.metadata_meq32.value = rx_prop->rx[0].attrib.meta_data;
-			flt_rule.rule.eq_attrib.metadata_meq32.mask = rx_prop->rx[0].attrib.meta_data_mask;
-		}
-
-		flt_rule.rule.eq_attrib.rule_eq_bitmap |= (1<<1);
-		flt_rule.rule.eq_attrib.protocol_eq_present = 1;
-		flt_rule.rule.eq_attrib.protocol_eq = IPACM_FIREWALL_IPPROTO_TCP;
-
-		flt_rule.rule.eq_attrib.rule_eq_bitmap |= (1<<8);
-		flt_rule.rule.eq_attrib.num_ihl_offset_meq_32 = 1;
-		flt_rule.rule.eq_attrib.ihl_offset_meq_32[0].offset = 12;
-
-		/* add TCP FIN rule*/
-		flt_rule.rule.eq_attrib.ihl_offset_meq_32[0].value = (((uint32_t)1)<<TCP_FIN_SHIFT);
-		flt_rule.rule.eq_attrib.ihl_offset_meq_32[0].mask = (((uint32_t)1)<<TCP_FIN_SHIFT);
-		flt_rule.rule_hdl = IPACM_Wlan::dummy_flt_rule_hdl_v6[offset+3];
-		memcpy(&(pFilteringTable->rules[3]), &flt_rule, sizeof(struct ipa_flt_rule_mdfy));
-
-		/* add TCP SYN rule*/
-		flt_rule.rule.eq_attrib.ihl_offset_meq_32[0].value = (((uint32_t)1)<<TCP_SYN_SHIFT);
-		flt_rule.rule.eq_attrib.ihl_offset_meq_32[0].mask = (((uint32_t)1)<<TCP_SYN_SHIFT);
-		flt_rule.rule_hdl = IPACM_Wlan::dummy_flt_rule_hdl_v6[offset+4];
-		memcpy(&(pFilteringTable->rules[4]), &flt_rule, sizeof(struct ipa_flt_rule_mdfy));
-
-		/* add TCP RST rule*/
-		flt_rule.rule.eq_attrib.ihl_offset_meq_32[0].value = (((uint32_t)1)<<TCP_RST_SHIFT);
-		flt_rule.rule.eq_attrib.ihl_offset_meq_32[0].mask = (((uint32_t)1)<<TCP_RST_SHIFT);
-		flt_rule.rule_hdl = IPACM_Wlan::dummy_flt_rule_hdl_v6[offset+5];
-		memcpy(&(pFilteringTable->rules[5]), &flt_rule, sizeof(struct ipa_flt_rule_mdfy));
-#endif
-
-		if (m_filtering.ModifyFilteringRule(pFilteringTable) == false)
-		{
-			IPACMERR("Failed to modify default ipv6 filtering rules.\n");
-			res = IPACM_FAILURE;
-			goto fail;
-		}
-		else
-		{
-			for (int i = 0; i < IPV6_DEFAULT_FILTERTING_RULES; i++)
-			{
-				if (pFilteringTable->rules[i].status == 0)
-				{
-					dft_v6fl_rule_hdl[i] = pFilteringTable->rules[i].rule_hdl;
-					IPACMDBG_H("Default v6 Filter Rule %d HDL:0x%x\n", i, dft_v6fl_rule_hdl[i]);
-				}
-				else
-				{
-					IPACMERR("Failing adding v6 default IPV6 rule %d\n", i);
-				}
-			}
-		}
-	}
-
-fail:
-	free(pFilteringTable);
-	return res;
-}
-
 int IPACM_Wlan::add_dummy_lan2lan_flt_rule(ipa_ip_type iptype)
 {
 	if(rx_prop == NULL)
@@ -1399,306 +1024,6 @@
 	return IPACM_SUCCESS;
 }
 
-/* configure private subnet filter rules*/
-int IPACM_Wlan::handle_private_subnet(ipa_ip_type iptype)
-{
-	int i, len, res = IPACM_SUCCESS, offset;
-	struct ipa_flt_rule_mdfy flt_rule;
-	struct ipa_ioc_mdfy_flt_rule* pFilteringTable;
-
-	if (rx_prop == NULL)
-	{
-		IPACMDBG_H("No rx properties registered for iface %s\n", dev_name);
-		return IPACM_SUCCESS;
-	}
-
-	if (iptype == IPA_IP_v4)
-	{
-		if(IPACM_Wlan::dummy_flt_rule_hdl_v4 == NULL)
-		{
-			IPACMERR("Dummy ipv4 flt rule has not been installed.\n");
-			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_LAN_CLIENT;
-#else
-#ifndef CT_OPT
-		offset = wlan_ap_index * (IPV4_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR + IPACM_Iface::ipacmcfg->ipa_num_private_subnet)
-				+ IPV4_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR;
-#else
-		offset = wlan_ap_index * (IPV4_DEFAULT_FILTERTING_RULES + NUM_TCP_CTL_FLT_RULE + MAX_OFFLOAD_PAIR + IPACM_Iface::ipacmcfg->ipa_num_private_subnet)
-				+ IPV4_DEFAULT_FILTERTING_RULES + NUM_TCP_CTL_FLT_RULE + MAX_OFFLOAD_PAIR;
-#endif
-#endif
-
-		len = sizeof(struct ipa_ioc_mdfy_flt_rule) + (IPACM_Iface::ipacmcfg->ipa_num_private_subnet) * sizeof(struct ipa_flt_rule_mdfy);
-		pFilteringTable = (struct ipa_ioc_mdfy_flt_rule*)malloc(len);
-		if (!pFilteringTable)
-		{
-			IPACMERR("Failed to allocate ipa_ioc_mdfy_flt_rule memory...\n");
-			return IPACM_FAILURE;
-		}
-		memset(pFilteringTable, 0, len);
-
-		pFilteringTable->commit = 1;
-		pFilteringTable->ip = iptype;
-		pFilteringTable->num_rules = (uint8_t)IPACM_Iface::ipacmcfg->ipa_num_private_subnet;
-
-		/* Make LAN-traffic always go A5, use default IPA-RT table */
-		if (false == m_routing.GetRoutingTable(&IPACM_Iface::ipacmcfg->rt_tbl_default_v4))
-		{
-			IPACMERR("Failed to get routing table handle.\n");
-			res = IPACM_FAILURE;
-			goto fail;
-		}
-
-		memset(&flt_rule, 0, sizeof(struct ipa_flt_rule_mdfy));
-		flt_rule.status = -1;
-
-		flt_rule.rule.retain_hdr = 1;
-		flt_rule.rule.to_uc = 0;
-		flt_rule.rule.action = IPA_PASS_TO_ROUTING;
-		flt_rule.rule.eq_attrib_type = 0;
-		flt_rule.rule.rt_tbl_hdl = IPACM_Iface::ipacmcfg->rt_tbl_default_v4.hdl;
-		IPACMDBG_H("Private filter rule use table: %s\n",IPACM_Iface::ipacmcfg->rt_tbl_default_v4.name);
-
-		memcpy(&flt_rule.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule.rule.attrib));
-		flt_rule.rule.attrib.attrib_mask |= IPA_FLT_DST_ADDR;
-#ifdef FEATURE_ETH_BRIDGE_LE
-		/* remove meta data mask */
-		flt_rule.rule.attrib.attrib_mask &= ~((uint32_t)IPA_FLT_META_DATA);
-#endif
-
-		for (i = 0; i < (IPACM_Iface::ipacmcfg->ipa_num_private_subnet); i++)
-		{
-			flt_rule.rule_hdl = IPACM_Wlan::dummy_flt_rule_hdl_v4[offset+i];
-			flt_rule.rule.attrib.u.v4.dst_addr_mask = IPACM_Iface::ipacmcfg->private_subnet_table[i].subnet_mask;
-			flt_rule.rule.attrib.u.v4.dst_addr = IPACM_Iface::ipacmcfg->private_subnet_table[i].subnet_addr;
-			memcpy(&(pFilteringTable->rules[i]), &flt_rule, sizeof(struct ipa_flt_rule_mdfy));
-		}
-
-		if (false == m_filtering.ModifyFilteringRule(pFilteringTable))
-		{
-			IPACMERR("Failed to modify private subnet filtering rules.\n");
-			res = IPACM_FAILURE;
-			goto fail;
-		}
-
-		/* copy filter rule hdls */
-		for (i = 0; i < IPACM_Iface::ipacmcfg->ipa_num_private_subnet; i++)
-		{
-			private_fl_rule_hdl[i] = pFilteringTable->rules[i].rule_hdl;
-		}
-	}
-	else
-	{
-		return IPACM_SUCCESS;
-	}
-fail:
-	free(pFilteringTable);
-	return res;
-}
-
-/* install UL filter rule from Q6 */
-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, i;
-	uint32_t value = 0;
-
-	IPACMDBG_H("Set extended property rules in WLAN\n");
-
-	if (rx_prop == NULL)
-	{
-		IPACMDBG_H("No rx properties registered for iface %s\n", dev_name);
-		return IPACM_SUCCESS;
-	}
-
-	if(prop == NULL || prop->num_ext_props <= 0)
-	{
-		IPACMDBG_H("No extended property.\n");
-		return IPACM_SUCCESS;
-	}
-
-	if(wlan_ap_index > 0)
-	{
-		IPACMDBG_H("This is not the first WLAN AP, do not install modem UL rules.\n");
-		return IPACM_SUCCESS;
-	}
-
-	fd = open(IPA_DEVICE_NAME, O_RDWR);
-	if (0 == fd)
-	{
-		IPACMERR("Failed opening %s.\n", IPA_DEVICE_NAME);
-		return IPACM_FAILURE;
-	}
-	if (prop->num_ext_props > MAX_WAN_UL_FILTER_RULES)
-	{
-		IPACMERR("number of modem UL rules > MAX_WAN_UL_FILTER_RULES, aborting...\n");
-		close(fd);
-		return IPACM_FAILURE;
-	}
-
-	memset(&flt_index, 0, sizeof(flt_index));
-	flt_index.source_pipe_index = ioctl(fd, IPA_IOC_QUERY_EP_MAPPING, rx_prop->rx[0].src_pipe);
-	flt_index.install_status = IPA_QMI_RESULT_SUCCESS_V01;
-#ifndef FEATURE_IPA_V3
-	flt_index.filter_index_list_len = prop->num_ext_props;
-#else  /* defined (FEATURE_IPA_V3) */
-	flt_index.rule_id_valid = 1;
-	flt_index.rule_id_len = prop->num_ext_props;
-#endif
-	flt_index.embedded_pipe_index_valid = 1;
-	flt_index.embedded_pipe_index = ioctl(fd, IPA_IOC_QUERY_EP_MAPPING, IPA_CLIENT_APPS_LAN_WAN_PROD);
-	flt_index.retain_header_valid = 1;
-	flt_index.retain_header = 0;
-	flt_index.embedded_call_mux_id_valid = 1;
-	flt_index.embedded_call_mux_id = IPACM_Iface::ipacmcfg->GetQmapId();
-#ifndef FEATURE_IPA_V3
-	IPACMDBG_H("flt_index: src pipe: %d, num of rules: %d, ebd pipe: %d, mux id: %d\n",
-		flt_index.source_pipe_index, flt_index.filter_index_list_len, flt_index.embedded_pipe_index, flt_index.embedded_call_mux_id);
-#else /* defined (FEATURE_IPA_V3) */
-	IPACMDBG_H("flt_index: src pipe: %d, num of rules: %d, ebd pipe: %d, mux id: %d\n",
-		flt_index.source_pipe_index, flt_index.rule_id_len, flt_index.embedded_pipe_index, flt_index.embedded_call_mux_id);
-#endif
-	len = sizeof(struct ipa_ioc_add_flt_rule) + prop->num_ext_props * sizeof(struct ipa_flt_rule_add);
-	pFilteringTable = (struct ipa_ioc_add_flt_rule*)malloc(len);
-	if (pFilteringTable == NULL)
-	{
-		IPACMERR("Error Locate ipa_flt_rule_add memory...\n");
-		close(fd);
-		return IPACM_FAILURE;
-	}
-	memset(pFilteringTable, 0, len);
-
-	pFilteringTable->commit = 1;
-	pFilteringTable->ep = rx_prop->rx[0].src_pipe;
-	pFilteringTable->global = false;
-	pFilteringTable->ip = iptype;
-	pFilteringTable->num_rules = prop->num_ext_props;
-
-	memset(&flt_rule_entry, 0, sizeof(struct ipa_flt_rule_add)); // Zero All Fields
-	flt_rule_entry.at_rear = 1;
-#ifdef FEATURE_IPA_V3
-	if (flt_rule_entry.rule.eq_attrib.ipv4_frag_eq_present)
-		flt_rule_entry.at_rear = 0;
-#endif
-	flt_rule_entry.flt_rule_hdl = -1;
-	flt_rule_entry.status = -1;
-
-	flt_rule_entry.rule.retain_hdr = 0;
-	flt_rule_entry.rule.to_uc = 0;
-	flt_rule_entry.rule.eq_attrib_type = 1;
-	if(iptype == IPA_IP_v4)
-		flt_rule_entry.rule.action = IPA_PASS_TO_SRC_NAT;
-	else if(iptype == IPA_IP_v6)
-		flt_rule_entry.rule.action = IPA_PASS_TO_ROUTING;
-	else
-	{
-		IPACMERR("IP type is not expected.\n");
-		ret = IPACM_FAILURE;
-		goto fail;
-	}
-
-	index = IPACM_Iface::ipacmcfg->getFltRuleCount(rx_prop->rx[0].src_pipe, iptype);
-
-#ifndef FEATURE_IPA_ANDROID
-	if(iptype == IPA_IP_v4 && index != exp_index_v4)
-	{
-		IPACMDBG_DMESG("### WARNING ### num flt rules for IPv4 on client %d is not expected: %d expected value: %d",
-			rx_prop->rx[0].src_pipe, index, exp_index_v4);
-	}
-	if(iptype == IPA_IP_v6 && index != exp_index_v6)
-	{
-		IPACMDBG_DMESG("### WARNING ### num flt rules for IPv6 on client %d is not expected: %d expected value: %d",
-			rx_prop->rx[0].src_pipe, index, exp_index_v6);
-	}
-#endif
-
-	for(cnt=0; cnt<prop->num_ext_props; cnt++)
-	{
-		memcpy(&flt_rule_entry.rule.eq_attrib,
-					 &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);
-                }
-#ifdef FEATURE_IPA_V3
-		flt_rule_entry.rule.hashable = prop->prop[cnt].is_rule_hashable;
-		flt_rule_entry.rule.rule_id = prop->prop[cnt].rule_id;
-#endif
-		memcpy(&pFilteringTable->rules[cnt], &flt_rule_entry, sizeof(flt_rule_entry));
-
-		IPACMDBG_H("Modem UL filtering rule %d has index %d\n", cnt, index);
-#ifndef FEATURE_IPA_V3
-		flt_index.filter_index_list[cnt].filter_index = index;
-		flt_index.filter_index_list[cnt].filter_handle = prop->prop[cnt].filter_hdl;
-#else /* defined (FEATURE_IPA_V3) */
-		flt_index.rule_id[cnt] = prop->prop[cnt].rule_id;
-#endif
-		index++;
-	}
-
-	if(false == m_filtering.SendFilteringRuleIndex(&flt_index))
-	{
-		IPACMERR("Error sending filtering rule index, aborting...\n");
-		ret = IPACM_FAILURE;
-		goto fail;
-	}
-
-	if(false == m_filtering.AddFilteringRule(pFilteringTable))
-	{
-		IPACMERR("Error Adding RuleTable to Filtering, aborting...\n");
-		ret = IPACM_FAILURE;
-		goto fail;
-	}
-	else
-	{
-		if(iptype == IPA_IP_v4)
-		{
-			for(i=0; i<pFilteringTable->num_rules; i++)
-			{
-				wan_ul_fl_rule_hdl_v4[num_wan_ul_fl_rule_v4] = pFilteringTable->rules[i].flt_rule_hdl;
-				num_wan_ul_fl_rule_v4++;
-			}
-			IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, iptype, pFilteringTable->num_rules);
-		}
-		else if(iptype == IPA_IP_v6)
-		{
-			for(i=0; i<pFilteringTable->num_rules; i++)
-			{
-				wan_ul_fl_rule_hdl_v6[num_wan_ul_fl_rule_v6] = pFilteringTable->rules[i].flt_rule_hdl;
-				num_wan_ul_fl_rule_v6++;
-			}
-			IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, iptype, pFilteringTable->num_rules);
-		}
-		else
-		{
-			IPACMERR("IP type is not expected.\n");
-			goto fail;
-		}
-	}
-
-fail:
-	free(pFilteringTable);
-	close(fd);
-	return ret;
-}
-
 /* handle wifi client initial,copy all partial headers (tx property) */
 int IPACM_Wlan::handle_wlan_client_init_ex(ipacm_event_data_wlan_ex *data)
 {
@@ -2513,163 +1838,77 @@
 	if (ip_type != IPA_IP_v6 && rx_prop != NULL)
 	{
 		/* delete IPv4 icmp filter rules */
-		if(wlan_ap_index == 0)
+		if(m_filtering.DeleteFilteringHdls(ipv4_icmp_flt_rule_hdl, IPA_IP_v4, NUM_IPV4_ICMP_FLT_RULE) == false)
 		{
-			if(m_filtering.DeleteFilteringHdls(ipv4_icmp_flt_rule_hdl, IPA_IP_v4, NUM_IPV4_ICMP_FLT_RULE) == false)
-			{
-				IPACMERR("Error Deleting ICMPv4 Filtering Rule, aborting...\n");
-				res = IPACM_FAILURE;
-				goto fail;
-			}
-			IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, NUM_IPV4_ICMP_FLT_RULE);
+			IPACMERR("Error Deleting ICMPv4 Filtering Rule, aborting...\n");
+			res = IPACM_FAILURE;
+			goto fail;
 		}
-#ifdef FEATURE_ETH_BRIDGE_LE
-		if(wlan_ap_index == 0)
-		{
-			/* delete default filter rules */
-			for(i=0; i<IPV4_DEFAULT_FILTERTING_RULES; i++)
-			{
-				if(reset_to_dummy_flt_rule(IPA_IP_v4, dft_v4fl_rule_hdl[i]) == IPACM_FAILURE)
-				{
-					IPACMERR("Error deleting dft IPv4 flt rules.\n");
-					res = IPACM_FAILURE;
-					goto fail;
-				}
-			}
-		}
-#else
-		/* delete default filter rules */
-		for(i=0; i<IPV4_DEFAULT_FILTERTING_RULES; i++)
-		{
-			if(reset_to_dummy_flt_rule(IPA_IP_v4, dft_v4fl_rule_hdl[i]) == IPACM_FAILURE)
-			{
-				IPACMERR("Error deleting dft IPv4 flt rules.\n");
-				res = IPACM_FAILURE;
-				goto fail;
-			}
-		}
-#endif
-		IPACMDBG_H("Deleted default v4 filter rules successfully.\n");
-#ifndef FEATURE_ETH_BRIDGE_LE
-#ifdef CT_OPT
-		IPACMDBG_H("Delete tcp control flt rules.\n");
-		/* Delete tcp control flt rules */
-		for(i=0; i<NUM_TCP_CTL_FLT_RULE; i++)
-		{
-			if(reset_to_dummy_flt_rule(IPA_IP_v4, tcp_ctl_flt_rule_hdl_v4[i]) == IPACM_FAILURE)
-			{
-				res = IPACM_FAILURE;
-				goto fail;
-			}
-		}
-#endif
-		IPACMDBG_H("Delete lan2lan v4 flt rules.\n");
-		/* delete lan2lan ipv4 flt rules */
-		for(i=0; i<MAX_OFFLOAD_PAIR; i++)
-		{
-			if(reset_to_dummy_flt_rule(IPA_IP_v4, lan2lan_flt_rule_hdl_v4[i].rule_hdl) == IPACM_FAILURE)
-			{
-				IPACMERR("Error deleting lan2lan IPv4 flt rules.\n");
-				res = IPACM_FAILURE;
-				goto fail;
-			}
-		}
-#endif
+		IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, NUM_IPV4_ICMP_FLT_RULE);
 
-		IPACMDBG_H("Delete private v4 filter rules\n");
+#ifdef FEATURE_ETH_BRIDGE_LE
+		if(is_guest_ap == false)	//delete eth bridge flt rules only when it is not guest ap
+		{
+			eth_bridge_remove_all_client_flt_rule(IPA_IP_v4);
+		}
+#endif
+		if (m_filtering.DeleteFilteringHdls(dft_v4fl_rule_hdl, IPA_IP_v4, IPV4_DEFAULT_FILTERTING_RULES) == false)
+		{
+			IPACMERR("Error Deleting Filtering Rule, aborting...\n");
+			res = IPACM_FAILURE;
+			goto fail;
+		}
+		IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, IPV4_DEFAULT_FILTERTING_RULES);
+		IPACMDBG_H("Deleted default v4 filter rules successfully.\n");
+
 		/* delete private-ipv4 filter rules */
 #ifdef FEATURE_IPA_ANDROID
-		for(i=0; i<IPA_MAX_PRIVATE_SUBNET_ENTRIES; i++)
+		if(m_filtering.DeleteFilteringHdls(private_fl_rule_hdl, IPA_IP_v4, IPA_MAX_PRIVATE_SUBNET_ENTRIES) == false)
 		{
-			if(reset_to_dummy_flt_rule(IPA_IP_v4, private_fl_rule_hdl[i]) == IPACM_FAILURE)
-			{
-				IPACMERR("Error deleting private subnet IPv4 flt rules.\n");
-				res = IPACM_FAILURE;
-				goto fail;
-			}
+			IPACMERR("Error deleting private subnet IPv4 flt rules.\n");
+			res = IPACM_FAILURE;
+			goto fail;
 		}
+		IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, IPA_MAX_PRIVATE_SUBNET_ENTRIES);
 #else
-		if(wlan_ap_index == 0)
+		if(m_filtering.DeleteFilteringHdls(private_fl_rule_hdl, IPA_IP_v4, IPACM_Iface::ipacmcfg->ipa_num_private_subnet) == false)
 		{
-			for(i=0; i<IPACM_Iface::ipacmcfg->ipa_num_private_subnet; i++)
-			{
-				if(reset_to_dummy_flt_rule(IPA_IP_v4, private_fl_rule_hdl[i]) == IPACM_FAILURE)
-				{
-					IPACMERR("Error deleting private subnet IPv4 flt rules.\n");
-					res = IPACM_FAILURE;
-					goto fail;
-				}
-			}
+			IPACMERR("Error deleting private subnet flt rules, aborting...\n");
+			res = IPACM_FAILURE;
+			goto fail;
 		}
-		IPACMDBG_H("Deleted private subnet v4 filter rules successfully.\n");
+		IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, IPACM_Iface::ipacmcfg->ipa_num_private_subnet);
 #endif
+		IPACMDBG_H("Deleted private subnet v4 filter rules successfully.\n");
 	}
 
 	/* Delete v6 filtering rules */
 	if (ip_type != IPA_IP_v4 && rx_prop != NULL)
 	{
 		/* delete icmp filter rules */
-		if(wlan_ap_index == 0)
+		if(m_filtering.DeleteFilteringHdls(ipv6_icmp_flt_rule_hdl, IPA_IP_v6, NUM_IPV6_ICMP_FLT_RULE) == false)
 		{
-			if(m_filtering.DeleteFilteringHdls(ipv6_icmp_flt_rule_hdl, IPA_IP_v6, NUM_IPV6_ICMP_FLT_RULE) == false)
-			{
-				IPACMERR("Error Deleting ICMPv6 Filtering Rule, aborting...\n");
-				res = IPACM_FAILURE;
-				goto fail;
-			}
-			IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, NUM_IPV6_ICMP_FLT_RULE);
+			IPACMERR("Error Deleting ICMPv6 Filtering Rule, aborting...\n");
+			res = IPACM_FAILURE;
+			goto fail;
 		}
-		IPACMDBG_H("Delete default %d v6 filter rules\n", IPV6_DEFAULT_FILTERTING_RULES);
-		/* delete default filter rules */
-#ifdef FEATURE_ETH_BRIDGE_LE
-		if(wlan_ap_index == 0)
-		{
-			for(i=0; i<IPV6_DEFAULT_FILTERTING_RULES; i++)
-			{
-				if(reset_to_dummy_flt_rule(IPA_IP_v6, dft_v6fl_rule_hdl[i]) == IPACM_FAILURE)
-				{
-					res = IPACM_FAILURE;
-					goto fail;
-				}
-			}
-		}
-#else
-		for(i=0; i<IPV6_DEFAULT_FILTERTING_RULES; i++)
-		{
-			if(reset_to_dummy_flt_rule(IPA_IP_v6, dft_v6fl_rule_hdl[i]) == IPACM_FAILURE)
-			{
-				res = IPACM_FAILURE;
-				goto fail;
-			}
-		}
-#endif
-		IPACMDBG_H("Deleted default v6 filter rules successfully.\n");
+		IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, NUM_IPV6_ICMP_FLT_RULE);
 
-#ifndef FEATURE_ETH_BRIDGE_LE
-#ifdef CT_OPT
-		IPACMDBG_H("Delete tcp control flt rules.\n");
-		/* Delete tcp control flt rules */
-		for(i=0; i<NUM_TCP_CTL_FLT_RULE; i++)
+#ifdef FEATURE_ETH_BRIDGE_LE
+		if(is_guest_ap == false)	//delete eth bridge flt rules only when it is not guest ap
 		{
-			if(reset_to_dummy_flt_rule(IPA_IP_v6, tcp_ctl_flt_rule_hdl_v6[i]) == IPACM_FAILURE)
-			{
-				res = IPACM_FAILURE;
-				goto fail;
-			}
+			eth_bridge_remove_all_client_flt_rule(IPA_IP_v6);
 		}
 #endif
-		IPACMDBG_H("Delete lan2lan v6 flt rules.\n");
-		/* delete lan2lan ipv4 flt rules */
-		for(i=0; i<MAX_OFFLOAD_PAIR; i++)
+
+		if (m_filtering.DeleteFilteringHdls(dft_v6fl_rule_hdl, IPA_IP_v6, IPV6_DEFAULT_FILTERTING_RULES) == false)
 		{
-			if(reset_to_dummy_flt_rule(IPA_IP_v6, lan2lan_flt_rule_hdl_v6[i].rule_hdl) == IPACM_FAILURE)
-			{
-				IPACMERR("Error deleting lan2lan IPv4 flt rules.\n");
-				res = IPACM_FAILURE;
-				goto fail;
-			}
+			IPACMERR("Error Adding RuleTable(1) to Filtering, aborting...\n");
+			res = IPACM_FAILURE;
+			goto fail;
 		}
-#endif
+		IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, IPV6_DEFAULT_FILTERTING_RULES);
+		IPACMDBG_H("Deleted default v6 filter rules successfully.\n");
 	}
 	IPACMDBG_H("finished delete filtering rules\n ");
 
@@ -2720,13 +1959,12 @@
 	for (i = 0; i < num_wifi_client; i++)
 	{
 #ifdef FEATURE_ETH_BRIDGE_LE
-		eth_bridge_del_self_client_flt_rule(get_client_memptr(wlan_client, i)->mac);
-		eth_bridge_del_wlan_client_rt_rule(get_client_memptr(wlan_client, i)->mac, SRC_WLAN);
-		eth_bridge_del_wlan_client(get_client_memptr(wlan_client, i)->mac);
 		if (is_guest_ap == false)
 		{
+			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_LAN);
-			eth_bridge_post_lan_client_event(get_client_memptr(wlan_client, i)->mac, IPA_ETH_BRIDGE_WLAN_CLIENT_DEL_EVENT);
+			eth_bridge_del_client(get_client_memptr(wlan_client, i)->mac);
+			eth_bridge_post_lan_client_event(get_client_memptr(wlan_client, i)->mac, IPA_ETH_BRIDGE_CLIENT_DEL_EVENT);
 		}
 #endif
 		/* First reset nat rules and then route rules */
@@ -3259,255 +2497,6 @@
 	return res;
 }
 
-/* add dummy filtering rules for WLAN AP-AP mode support */
-void IPACM_Wlan::add_dummy_flt_rule()
-{
-	int num_v4_dummy_rule, num_v6_dummy_rule;
-
-	if(IPACM_Wlan::num_wlan_ap_iface == 1)
-	{
-		if(IPACM_Wlan::dummy_flt_rule_hdl_v4 != NULL || IPACM_Wlan::dummy_flt_rule_hdl_v6 != NULL)
-		{
-			IPACMERR("Either v4 or v6 dummy filtering rule handle is not empty.\n");
-			return;
-		}
-#ifdef FEATURE_ETH_BRIDGE_LE
-		num_v4_dummy_rule = IPV4_DEFAULT_FILTERTING_RULES + 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 + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_LAN_CLIENT + 2 * NUM_IPV6_PREFIX_FLT_RULE;
-#else
-#ifndef CT_OPT
-		num_v4_dummy_rule = 2*(IPV4_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR + IPACM_Iface::ipacmcfg->ipa_num_private_subnet);
-		num_v6_dummy_rule = 2*(IPV6_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR + NUM_IPV6_PREFIX_FLT_RULE);
-#else
-		num_v4_dummy_rule = 2*(IPV4_DEFAULT_FILTERTING_RULES + NUM_TCP_CTL_FLT_RULE + MAX_OFFLOAD_PAIR + IPACM_Iface::ipacmcfg->ipa_num_private_subnet);
-		num_v6_dummy_rule = 2*(IPV6_DEFAULT_FILTERTING_RULES + NUM_TCP_CTL_FLT_RULE + MAX_OFFLOAD_PAIR + NUM_IPV6_PREFIX_FLT_RULE);
-#endif
-#ifdef FEATURE_IPA_ANDROID
-		num_v4_dummy_rule = num_v4_dummy_rule - 2* IPACM_Iface::ipacmcfg->ipa_num_private_subnet + 2 * IPA_MAX_PRIVATE_SUBNET_ENTRIES;
-#endif
-#endif
-
-		IPACM_Wlan::dummy_flt_rule_hdl_v4 = (uint32_t*)malloc(num_v4_dummy_rule * sizeof(uint32_t));
-		if(IPACM_Wlan::dummy_flt_rule_hdl_v4 == NULL)
-		{
-			IPACMERR("Failed to allocate memory.\n");
-			return;
-		}
-		IPACM_Wlan::dummy_flt_rule_hdl_v6 = (uint32_t*)malloc(num_v6_dummy_rule * sizeof(uint32_t));
-		if(IPACM_Wlan::dummy_flt_rule_hdl_v6 == NULL)
-		{
-			IPACMERR("Failed to allocate memory.\n");
-			free(IPACM_Wlan::dummy_flt_rule_hdl_v4);
-			IPACM_Wlan::dummy_flt_rule_hdl_v4 = NULL;
-			return;
-		}
-		memset(IPACM_Wlan::dummy_flt_rule_hdl_v4, 0, num_v4_dummy_rule * sizeof(uint32_t));
-		memset(IPACM_Wlan::dummy_flt_rule_hdl_v6, 0, num_v6_dummy_rule * sizeof(uint32_t));
-
-		install_dummy_flt_rule(IPA_IP_v4, num_v4_dummy_rule);
-		install_dummy_flt_rule(IPA_IP_v6, num_v6_dummy_rule);
-	}
-	return;
-}
-
-/* install dummy filtering rules for WLAN AP-AP mode support */
-int IPACM_Wlan::install_dummy_flt_rule(ipa_ip_type iptype, int num_rule)
-{
-	if(rx_prop == NULL)
-	{
-		IPACMDBG_H("There is no rx_prop for iface %s, not able to add dummy filtering rule.\n", dev_name);
-		return IPACM_FAILURE;
-	}
-
-	int i, len, res = IPACM_SUCCESS;
-	struct ipa_flt_rule_add flt_rule;
-	ipa_ioc_add_flt_rule* pFilteringTable;
-
-	len = sizeof(struct ipa_ioc_add_flt_rule) + num_rule * sizeof(struct ipa_flt_rule_add);
-
-	pFilteringTable = (struct ipa_ioc_add_flt_rule *)malloc(len);
-	if (pFilteringTable == NULL)
-	{
-		IPACMERR("Error allocate flt table memory...\n");
-		return IPACM_FAILURE;
-	}
-	memset(pFilteringTable, 0, len);
-
-	pFilteringTable->commit = 1;
-	pFilteringTable->ep = rx_prop->rx[0].src_pipe;
-	pFilteringTable->global = false;
-	pFilteringTable->ip = iptype;
-	pFilteringTable->num_rules = num_rule;
-
-	memset(&flt_rule, 0, sizeof(struct ipa_flt_rule_add));
-
-	flt_rule.rule.retain_hdr = 0;
-	flt_rule.at_rear = true;
-	flt_rule.flt_rule_hdl = -1;
-	flt_rule.status = -1;
-	flt_rule.rule.action = IPA_PASS_TO_EXCEPTION;
-#ifdef FEATURE_IPA_V3
-	flt_rule.rule.hashable = true;
-#endif
-	memcpy(&flt_rule.rule.attrib, &rx_prop->rx[0].attrib,
-			sizeof(flt_rule.rule.attrib));
-
-	if(iptype == IPA_IP_v4)
-	{
-		flt_rule.rule.attrib.attrib_mask = IPA_FLT_SRC_ADDR | IPA_FLT_DST_ADDR;
-		flt_rule.rule.attrib.u.v4.src_addr_mask = ~0;
-		flt_rule.rule.attrib.u.v4.src_addr = ~0;
-		flt_rule.rule.attrib.u.v4.dst_addr_mask = ~0;
-		flt_rule.rule.attrib.u.v4.dst_addr = ~0;
-
-		for(i=0; i<num_rule; i++)
-		{
-			memcpy(&(pFilteringTable->rules[i]), &flt_rule, sizeof(struct ipa_flt_rule_add));
-		}
-
-		if (false == m_filtering.AddFilteringRule(pFilteringTable))
-		{
-			IPACMERR("Error adding dummy ipv4 flt rule\n");
-			res = IPACM_FAILURE;
-			goto fail;
-		}
-		else
-		{
-			IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, iptype, num_rule);
-			/* copy filter rule hdls */
-			for (int i = 0; i < num_rule; i++)
-			{
-				if (pFilteringTable->rules[i].status == 0)
-				{
-					IPACM_Wlan::dummy_flt_rule_hdl_v4[i] = pFilteringTable->rules[i].flt_rule_hdl;
-					IPACMDBG("Dummy v4 flt rule %d hdl:0x%x\n", i, IPACM_Wlan::dummy_flt_rule_hdl_v4[i]);
-				}
-				else
-				{
-					IPACMERR("Failed adding dummy v4 flt rule %d\n", i);
-					res = IPACM_FAILURE;
-					goto fail;
-				}
-			}
-		}
-	}
-	else if(iptype == IPA_IP_v6)
-	{
-		flt_rule.rule.attrib.attrib_mask = IPA_FLT_SRC_ADDR | IPA_FLT_DST_ADDR;
-		flt_rule.rule.attrib.u.v6.src_addr_mask[0] = ~0;
-		flt_rule.rule.attrib.u.v6.src_addr_mask[1] = ~0;
-		flt_rule.rule.attrib.u.v6.src_addr_mask[2] = ~0;
-		flt_rule.rule.attrib.u.v6.src_addr_mask[3] = ~0;
-		flt_rule.rule.attrib.u.v6.src_addr[0] = ~0;
-		flt_rule.rule.attrib.u.v6.src_addr[1] = ~0;
-		flt_rule.rule.attrib.u.v6.src_addr[2] = ~0;
-		flt_rule.rule.attrib.u.v6.src_addr[3] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[0] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[1] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[2] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr_mask[3] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr[0] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr[1] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr[2] = ~0;
-		flt_rule.rule.attrib.u.v6.dst_addr[3] = ~0;
-
-		for(i=0; i<num_rule; i++)
-		{
-			memcpy(&(pFilteringTable->rules[i]), &flt_rule, sizeof(struct ipa_flt_rule_add));
-		}
-
-		if (false == m_filtering.AddFilteringRule(pFilteringTable))
-		{
-			IPACMERR("Error adding dummy ipv6 flt rule\n");
-			res = IPACM_FAILURE;
-			goto fail;
-		}
-		else
-		{
-			IPACM_Iface::ipacmcfg->increaseFltRuleCount(rx_prop->rx[0].src_pipe, iptype, num_rule);
-			/* copy filter rule hdls */
-			for (int i = 0; i < num_rule; i++)
-			{
-				if (pFilteringTable->rules[i].status == 0)
-				{
-					IPACM_Wlan::dummy_flt_rule_hdl_v6[i] = pFilteringTable->rules[i].flt_rule_hdl;
-					IPACMDBG("Lan2lan v6 flt rule %d hdl:0x%x\n", i, IPACM_Wlan::dummy_flt_rule_hdl_v6[i]);
-				}
-				else
-				{
-					IPACMERR("Failed adding v6 flt rule %d\n", i);
-					res = IPACM_FAILURE;
-					goto fail;
-				}
-			}
-		}
-	}
-	else
-	{
-		IPACMERR("IP type is not expected.\n");
-		goto fail;
-	}
-
-fail:
-	free(pFilteringTable);
-	return res;
-}
-
-/* delete dummy flt rule for WLAN AP-AP mode support*/
-void IPACM_Wlan::del_dummy_flt_rule()
-{
-	int num_v4_dummy_rule, num_v6_dummy_rule;
-
-	if(IPACM_Wlan::num_wlan_ap_iface == 0)
-	{
-		if(IPACM_Wlan::dummy_flt_rule_hdl_v4 == NULL || IPACM_Wlan::dummy_flt_rule_hdl_v4 == NULL)
-		{
-			IPACMERR("Either v4 or v6 dummy flt rule is empty.\n");
-			return;
-		}
-#ifndef CT_OPT
-		num_v4_dummy_rule = 2*(IPV4_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR + IPACM_Iface::ipacmcfg->ipa_num_private_subnet);
-		num_v6_dummy_rule = 2*(IPV6_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR + NUM_IPV6_PREFIX_FLT_RULE);
-#else
-		num_v4_dummy_rule = 2*(IPV4_DEFAULT_FILTERTING_RULES + NUM_TCP_CTL_FLT_RULE + MAX_OFFLOAD_PAIR + IPACM_Iface::ipacmcfg->ipa_num_private_subnet);
-		num_v6_dummy_rule = 2*(IPV6_DEFAULT_FILTERTING_RULES + NUM_TCP_CTL_FLT_RULE + MAX_OFFLOAD_PAIR + NUM_IPV6_PREFIX_FLT_RULE);
-#endif
-#ifdef FEATURE_IPA_ANDROID
-		num_v4_dummy_rule = num_v4_dummy_rule - 2* IPACM_Iface::ipacmcfg->ipa_num_private_subnet + 2 * IPA_MAX_PRIVATE_SUBNET_ENTRIES;
-#endif
-
-#ifdef FEATURE_ETH_BRIDGE_LE
-		num_v4_dummy_rule = IPV4_DEFAULT_FILTERTING_RULES + 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 + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_LAN_CLIENT + 2 * NUM_IPV6_PREFIX_FLT_RULE;
-#endif
-
-		if(m_filtering.DeleteFilteringHdls(IPACM_Wlan::dummy_flt_rule_hdl_v4, IPA_IP_v4, num_v4_dummy_rule) == false)
-		{
-			IPACMERR("Failed to delete ipv4 dummy flt rules.\n");
-			return;
-		}
-		IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v4, num_v4_dummy_rule);
-		if(m_filtering.DeleteFilteringHdls(IPACM_Wlan::dummy_flt_rule_hdl_v6, IPA_IP_v6, num_v6_dummy_rule) == false)
-		{
-			IPACMERR("Failed to delete ipv6 dummy flt rules.\n");
-			return;
-		}
-		IPACM_Iface::ipacmcfg->decreaseFltRuleCount(rx_prop->rx[0].src_pipe, IPA_IP_v6, num_v6_dummy_rule);
-
-		free(IPACM_Wlan::dummy_flt_rule_hdl_v4);
-		IPACM_Wlan::dummy_flt_rule_hdl_v4 = NULL;
-		free(IPACM_Wlan::dummy_flt_rule_hdl_v6);
-		IPACM_Wlan::dummy_flt_rule_hdl_v6 = NULL;
-#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(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;
-}
-
 /* install TCP control filter rules */
 void IPACM_Wlan::install_tcp_ctl_flt_rule(ipa_ip_type iptype)
 {
@@ -3649,666 +2638,21 @@
 	return;
 }
 
-int IPACM_Wlan::add_dummy_private_subnet_flt_rule(ipa_ip_type iptype)
-{
-	if(rx_prop == NULL)
-	{
-		IPACMDBG_H("There is no rx_prop for iface %s, not able to add dummy lan2lan filtering rule.\n", dev_name);
-		return IPACM_FAILURE;
-	}
-
-	int offset;
-	if(iptype == IPA_IP_v4)
-	{
-		if(IPACM_Wlan::dummy_flt_rule_hdl_v4 == NULL)
-		{
-			IPACMERR("Dummy ipv4 flt rule has not been installed.\n");
-			return IPACM_FAILURE;
-		}
-
-#ifndef CT_OPT
-		offset = wlan_ap_index * (IPV4_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR + IPACM_Iface::ipacmcfg->ipa_num_private_subnet)
-						+ IPV4_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR;
-#else
-		offset = wlan_ap_index * (IPV4_DEFAULT_FILTERTING_RULES + NUM_TCP_CTL_FLT_RULE + MAX_OFFLOAD_PAIR + IPACM_Iface::ipacmcfg->ipa_num_private_subnet)
-						+ IPV4_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR + NUM_TCP_CTL_FLT_RULE;
-#endif
-
-#ifdef FEATURE_IPA_ANDROID
-		offset = offset + wlan_ap_index * (IPA_MAX_PRIVATE_SUBNET_ENTRIES - IPACM_Iface::ipacmcfg->ipa_num_private_subnet);
-#endif
-		for (int i = 0; i < IPA_MAX_PRIVATE_SUBNET_ENTRIES; i++)
-		{
-			private_fl_rule_hdl[i] = IPACM_Wlan::dummy_flt_rule_hdl_v4[offset+i];
-			IPACMDBG_H("Private subnet v4 flt rule %d hdl:0x%x\n", i, private_fl_rule_hdl[i]);
-		}
-	}
-	return IPACM_SUCCESS;
-}
-
-int IPACM_Wlan::eth_bridge_handle_dummy_wlan_client_flt_rule(ipa_ip_type iptype)
-{
-	int i, offset;
-	if(wlan_ap_index == 0)
-	{
-		if(iptype == IPA_IP_v4)
-		{
-			offset = IPV4_DEFAULT_FILTERTING_RULES;
-			for(i=0; i<IPA_LAN_TO_LAN_MAX_WLAN_CLIENT; i++)
-			{
-				self_client_flt_rule_hdl_v4[i].rule_hdl = IPACM_Wlan::dummy_flt_rule_hdl_v4[offset+i];
-				self_client_flt_rule_hdl_v4[i].valid = true;
-			}
-		}
-		else
-		{
-			offset = 0;
-			for(i=0; i<IPA_LAN_TO_LAN_MAX_WLAN_CLIENT; i++)
-			{
-				self_client_flt_rule_hdl_v6[i].rule_hdl = IPACM_Wlan::dummy_flt_rule_hdl_v6[offset+i];
-				self_client_flt_rule_hdl_v6[i].valid = true;
-			}
-		}
-		IPACMDBG_H("Get %d flt rule hdls for wlan clients ip type: %d.\n", IPA_LAN_TO_LAN_MAX_WLAN_CLIENT, iptype);
-	}
-	return IPACM_SUCCESS;
-}
-
-int IPACM_Wlan::eth_bridge_handle_dummy_lan_client_flt_rule(ipa_ip_type iptype)
-{
-	int i, offset;
-	if(wlan_ap_index == 0)
-	{
-		if(iptype == IPA_IP_v4)
-		{
-			offset = IPV4_DEFAULT_FILTERTING_RULES + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT;
-			for(i=0; i<IPA_LAN_TO_LAN_MAX_LAN_CLIENT; i++)
-			{
-				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 = IPA_LAN_TO_LAN_MAX_WLAN_CLIENT;
-			for(i=0; i<IPA_LAN_TO_LAN_MAX_LAN_CLIENT; i++)
-			{
-				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 lan clients ip type: %d.\n", IPA_LAN_TO_LAN_MAX_LAN_CLIENT, iptype);
-	}
-	return IPACM_SUCCESS;
-}
-
-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;
-	struct ipa_ioc_mdfy_flt_rule* pFilteringTable = NULL;
-	bool client_is_found = false;
-
-	if (rx_prop == NULL)
-	{
-		IPACMDBG_H("No rx properties registered for iface %s\n", dev_name);
-		return IPACM_FAILURE;
-	}
-	if(mac == NULL)
-	{
-		IPACMERR("MAC address is empty.\n");
-		return IPACM_FAILURE;
-	}
-	if(is_guest_ap)
-	{
-		IPACMDBG_H("This is guest AP WLAN interface index %d, ignore.\n", wlan_ap_index);
-		return IPACM_SUCCESS;
-	}
-	if(wlan_ap_index != 0)
-	{
-		IPACMDBG_H("This is WLAN interface index %d, ignore.\n", wlan_ap_index);
-		return IPACM_SUCCESS;
-	}
-
-	for(i=0; i<lan_client_flt_info_count; i++)
-	{
-		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_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;
-			}
-			break;
-		}
-	}
-
-	if(client_is_found == false && lan_client_flt_info_count == IPA_LAN_TO_LAN_MAX_LAN_CLIENT)
-	{
-		IPACMDBG_H("The lan client flt table is already full.\n");
-		return IPACM_FAILURE;
-	}
-
-	len = sizeof(struct ipa_ioc_mdfy_flt_rule) + sizeof(struct ipa_flt_rule_mdfy);
-	pFilteringTable = (struct ipa_ioc_mdfy_flt_rule*)malloc(len);
-	if (!pFilteringTable)
-	{
-		IPACMERR("Failed to allocate ipa_ioc_mdfy_flt_rule memory...\n");
-		return IPACM_FAILURE;
-	}
-	memset(pFilteringTable, 0, len);
-
-	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 LAN-WLAN routing table */
-	memset(&flt_rule, 0, sizeof(struct ipa_flt_rule_mdfy));
-	flt_rule.status = -1;
-
-	flt_rule.rule.retain_hdr = 0;
-	flt_rule.rule.to_uc = 0;
-	flt_rule.rule.action = IPA_PASS_TO_ROUTING;
-	flt_rule.rule.eq_attrib_type = 0;
-
-	if(iptype == IPA_IP_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_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_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_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));
-
-	/* Install meta-data if self or other ap is guest ap */
-	if ((is_guest_ap == false &&  IPACM_Wlan::num_wlan_ap_iface == 1) ||
-			IPACM_Iface::ipacmcfg->ipa_num_wlan_guest_ap == 0)
-	{
-		flt_rule.rule.attrib.attrib_mask &= ~((uint32_t)IPA_FLT_META_DATA);	//remove meta data mask
-	}
-
-	if(IPACM_Lan::wlan_hdr_type == IPA_HDR_L2_ETHERNET_II)
-	{
-		flt_rule.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_ETHER_II;
-	}
-	else if(IPACM_Lan::wlan_hdr_type == IPA_HDR_L2_802_3)
-	{
-		flt_rule.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_802_3;
-	}
-	else
-	{
-		IPACMERR("WLAN hdr type is not expected.\n");
-		res = IPACM_FAILURE;
-		goto fail;
-	}
-	memcpy(flt_rule.rule.attrib.dst_mac_addr, mac, sizeof(flt_rule.rule.attrib.dst_mac_addr));
-	memset(flt_rule.rule.attrib.dst_mac_addr_mask, 0xFF, sizeof(flt_rule.rule.attrib.dst_mac_addr_mask));
-
-	if(iptype == IPA_IP_v4)
-	{
-		for(i=0; i<IPA_LAN_TO_LAN_MAX_LAN_CLIENT; i++)
-		{
-			if(lan_client_flt_rule_hdl_v4[i].valid == true)
-			{
-				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_LAN_CLIENT)
-		{
-			IPACMDBG_H("Cannot find a valid flt rule hdl.\n");
-			res = IPACM_FAILURE;
-			goto fail;
-		}
-	}
-	else
-	{
-		for(i=0; i<IPA_LAN_TO_LAN_MAX_LAN_CLIENT; i++)
-		{
-			if(lan_client_flt_rule_hdl_v6[i].valid == true)
-			{
-				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_LAN_CLIENT)
-		{
-			IPACMDBG_H("Cannot find a valid flt rule hdl.\n");
-			res = IPACM_FAILURE;
-			goto fail;
-		}
-	}
-
-	memcpy(&(pFilteringTable->rules[0]), &flt_rule, sizeof(struct ipa_flt_rule_mdfy));
-	if (false == m_filtering.ModifyFilteringRule(pFilteringTable))
-	{
-		IPACMERR("Failed to add wlan client filtering rules.\n");
-		res = IPACM_FAILURE;
-		goto fail;
-	}
-
-	if(client_is_found == false)
-	{
-		client_position = lan_client_flt_info_count;
-		lan_client_flt_info_count++;
-	}
-
-	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_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_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:
-	free(pFilteringTable);
-	return res;
-}
-
-int IPACM_Wlan::eth_bridge_del_lan_client_flt_rule(uint8_t* mac)
-{
-	if(mac == NULL)
-	{
-		IPACMERR("Client MAC address is empty.\n");
-		return IPACM_FAILURE;
-	}
-
-	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<lan_client_flt_info_count; i++)
-	{
-		if(memcmp(eth_bridge_lan_client_flt_info[i].mac, mac, sizeof(eth_bridge_lan_client_flt_info[i].mac)) == 0)
-		{
-			break;
-		}
-	}
-
-	if(i == lan_client_flt_info_count)
-	{
-		IPACMERR("Do not find the lan client.\n");
-		return IPACM_FAILURE;
-	}
-
-	if(eth_bridge_lan_client_flt_info[i].flt_rule_set_v4 == true)
-	{
-		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_LAN_CLIENT; j++)
-			{
-				if(lan_client_flt_rule_hdl_v4[j].rule_hdl == eth_bridge_lan_client_flt_info[i].flt_rule_hdl_v4)
-				{
-					lan_client_flt_rule_hdl_v4[j].valid = true;
-					break;
-				}
-			}
-			if(j == IPA_LAN_TO_LAN_MAX_LAN_CLIENT)
-			{
-				IPACMERR("Not finding the rule handle in handle pool.\n");
-				return IPACM_FAILURE;
-			}
-		}
-		else
-		{
-			IPACMERR("Failed to delete the lan client specific flt rule.\n");
-			return IPACM_FAILURE;
-		}
-	}
-	if(eth_bridge_lan_client_flt_info[i].flt_rule_set_v6 == true)
-	{
-		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_LAN_CLIENT; j++)
-			{
-				if(lan_client_flt_rule_hdl_v6[j].rule_hdl == eth_bridge_lan_client_flt_info[i].flt_rule_hdl_v6)
-				{
-					lan_client_flt_rule_hdl_v6[j].valid = true;
-					break;
-				}
-			}
-			if(j == IPA_LAN_TO_LAN_MAX_LAN_CLIENT)
-			{
-				IPACMERR("Not finding the rule handle in handle pool.\n");
-				return IPACM_FAILURE;
-			}
-		}
-		else
-		{
-			IPACMERR("Failed to delete the lan client specific flt rule.\n");
-			return IPACM_FAILURE;
-		}
-	}
-
-	for(j=i+1; j<lan_client_flt_info_count; j++)
-	{
-		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_lan_client_flt_info[lan_client_flt_info_count-1]), 0, sizeof(eth_bridge_client_flt_info));
-	lan_client_flt_info_count--;
-
-	return res;
-}
-
-int IPACM_Wlan::eth_bridge_add_self_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;
-	struct ipa_ioc_mdfy_flt_rule* pFilteringTable = NULL;
-	bool client_is_found = false;
-
-	if (rx_prop == NULL)
-	{
-		IPACMDBG_H("No rx properties registered for iface %s\n", dev_name);
-		return IPACM_FAILURE;
-	}
-	if(mac == NULL)
-	{
-		IPACMERR("MAC address is empty.\n");
-		return IPACM_FAILURE;
-	}
-	if(IPACM_Lan::wlan_to_wlan_hdr_proc_ctx.valid == false)
-	{
-		IPACMDBG_H("WLAN to WLAN hdr proc ctx has not been set, don't add WLAN client specific flt rule.\n");
-		return IPACM_FAILURE;
-	}
-
-	for(i=0; i<wlan_client_flt_info_count; i++)
-	{
-		if(memcmp(eth_bridge_wlan_client_flt_info[i].mac, mac, sizeof(eth_bridge_wlan_client_flt_info[i].mac)) == 0)
-		{
-			client_is_found = true;
-			client_position = i;
-			if( (iptype == IPA_IP_v4 && eth_bridge_wlan_client_flt_info[i].flt_rule_set_v4 == true)
-				|| (iptype == IPA_IP_v6 && eth_bridge_wlan_client_flt_info[i].flt_rule_set_v6 == true))
-			{
-				IPACMDBG_H("Flt rule for iptype %d has been set.\n", iptype);
-				return IPACM_SUCCESS;
-			}
-			break;
-		}
-	}
-
-	if(client_is_found == false && wlan_client_flt_info_count == IPA_LAN_TO_LAN_MAX_WLAN_CLIENT)
-	{
-		IPACMDBG_H("The wlan client flt table is already full.\n");
-		return IPACM_FAILURE;
-	}
-
-	len = sizeof(struct ipa_ioc_mdfy_flt_rule) + sizeof(struct ipa_flt_rule_mdfy);
-	pFilteringTable = (struct ipa_ioc_mdfy_flt_rule*)malloc(len);
-	if (!pFilteringTable)
-	{
-		IPACMERR("Failed to allocate ipa_ioc_mdfy_flt_rule memory...\n");
-		return IPACM_FAILURE;
-	}
-	memset(pFilteringTable, 0, len);
-
-	IPACMDBG_H("Receive WLAN 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 IPv4 table */
-	pFilteringTable->commit = 1;
-	pFilteringTable->ip = iptype;
-	pFilteringTable->num_rules = 1;
-
-	/* point to LAN-WLAN routing table */
-	memset(&flt_rule, 0, sizeof(struct ipa_flt_rule_mdfy));
-	flt_rule.status = -1;
-
-	flt_rule.rule.retain_hdr = 0;
-	flt_rule.rule.to_uc = 0;
-	flt_rule.rule.action = IPA_PASS_TO_ROUTING;
-	flt_rule.rule.eq_attrib_type = 0;
-
-	if(iptype == IPA_IP_v4)
-	{
-		if (false == m_routing.GetRoutingTable(&IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_wlan_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_wlan_wlan_v4.hdl;
-		IPACMDBG_H("WLAN->WLAN IPv4 filter rule use table: %s\n",IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_wlan_wlan_v4.name);
-	}
-	else
-	{
-		if (false == m_routing.GetRoutingTable(&IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_wlan_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_wlan_wlan_v6.hdl;
-		IPACMDBG_H("WLAN->WLAN IPv4 filter rule use table: %s\n",IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_wlan_wlan_v6.name);
-	}
-
-	memcpy(&flt_rule.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule.rule.attrib));
-
-	/* Install meta-data if self or other ap is guest ap */
-	if ((is_guest_ap == false &&  IPACM_Wlan::num_wlan_ap_iface == 1) ||
-		IPACM_Iface::ipacmcfg->ipa_num_wlan_guest_ap == 0)
-	{
-		flt_rule.rule.attrib.attrib_mask &= ~((uint32_t)IPA_FLT_META_DATA);	//remove meta data mask
-	}
-
-	if(IPACM_Lan::wlan_hdr_type == IPA_HDR_L2_ETHERNET_II)
-	{
-		flt_rule.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_ETHER_II;
-	}
-	else if(IPACM_Lan::wlan_hdr_type == IPA_HDR_L2_802_3)
-	{
-		flt_rule.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_802_3;
-	}
-	else
-	{
-		IPACMERR("WLAN hdr type is not expected.\n");
-		res = IPACM_FAILURE;
-		goto fail;
-	}
-	memcpy(flt_rule.rule.attrib.dst_mac_addr, mac, sizeof(flt_rule.rule.attrib.dst_mac_addr));
-	memset(flt_rule.rule.attrib.dst_mac_addr_mask, 0xFF, sizeof(flt_rule.rule.attrib.dst_mac_addr_mask));
-
-	if(iptype == IPA_IP_v4)
-	{
-		for(i=0; i<IPA_LAN_TO_LAN_MAX_WLAN_CLIENT; i++)
-		{
-			if(self_client_flt_rule_hdl_v4[i].valid == true)
-			{
-				flt_rule.rule_hdl = self_client_flt_rule_hdl_v4[i].rule_hdl;
-				self_client_flt_rule_hdl_v4[i].valid = false;
-				break;
-			}
-		}
-		if(i == IPA_LAN_TO_LAN_MAX_WLAN_CLIENT)
-		{
-			IPACMDBG_H("Cannot find a valid flt rule hdl.\n");
-			res = IPACM_FAILURE;
-			goto fail;
-		}
-	}
-	else
-	{
-		for(i=0; i<IPA_LAN_TO_LAN_MAX_WLAN_CLIENT; i++)
-		{
-			if(self_client_flt_rule_hdl_v6[i].valid == true)
-			{
-				flt_rule.rule_hdl = self_client_flt_rule_hdl_v6[i].rule_hdl;
-				self_client_flt_rule_hdl_v6[i].valid = false;
-				break;
-			}
-		}
-		if(i == IPA_LAN_TO_LAN_MAX_WLAN_CLIENT)
-		{
-			IPACMDBG_H("Cannot find a valid flt rule hdl.\n");
-			res = IPACM_FAILURE;
-			goto fail;
-		}
-	}
-
-	memcpy(&(pFilteringTable->rules[0]), &flt_rule, sizeof(struct ipa_flt_rule_mdfy));
-	if (false == m_filtering.ModifyFilteringRule(pFilteringTable))
-	{
-		IPACMERR("Failed to add self client filtering rules.\n");
-		res = IPACM_FAILURE;
-		goto fail;
-	}
-
-	if(client_is_found == false)
-	{
-		client_position = wlan_client_flt_info_count;
-		wlan_client_flt_info_count++;
-	}
-
-	memcpy(eth_bridge_wlan_client_flt_info[client_position].mac, mac, sizeof(eth_bridge_wlan_client_flt_info[client_position].mac));
-	if(iptype == IPA_IP_v4)
-	{
-		eth_bridge_wlan_client_flt_info[client_position].flt_rule_set_v4 = true;
-		eth_bridge_wlan_client_flt_info[client_position].flt_rule_hdl_v4 = self_client_flt_rule_hdl_v4[i].rule_hdl;
-	}
-	else
-	{
-		eth_bridge_wlan_client_flt_info[client_position].flt_rule_set_v6 = true;
-		eth_bridge_wlan_client_flt_info[client_position].flt_rule_hdl_v6 = self_client_flt_rule_hdl_v6[i].rule_hdl;
-	}
-
-fail:
-	free(pFilteringTable);
-	return res;
-}
-
-int IPACM_Wlan::eth_bridge_del_self_client_flt_rule(uint8_t* mac)
-{
-	if(mac == NULL)
-	{
-		IPACMERR("Client MAC address is empty.\n");
-		return IPACM_FAILURE;
-	}
-
-	IPACMDBG_H("Receive WLAN 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<wlan_client_flt_info_count; i++)
-	{
-		if(memcmp(eth_bridge_wlan_client_flt_info[i].mac, mac, sizeof(eth_bridge_wlan_client_flt_info[i].mac)) == 0)
-		{
-			break;
-		}
-	}
-
-	if(i == wlan_client_flt_info_count)
-	{
-		IPACMERR("Do not find the wlan client.\n");
-		return IPACM_FAILURE;
-	}
-
-	if(eth_bridge_wlan_client_flt_info[i].flt_rule_set_v4 == true)
-	{
-		if(reset_to_dummy_flt_rule(IPA_IP_v4, eth_bridge_wlan_client_flt_info[i].flt_rule_hdl_v4) == IPACM_SUCCESS)
-		{
-			for(j=0; j<IPA_LAN_TO_LAN_MAX_WLAN_CLIENT; j++)
-			{
-				if(self_client_flt_rule_hdl_v4[j].rule_hdl == eth_bridge_wlan_client_flt_info[i].flt_rule_hdl_v4)
-				{
-					self_client_flt_rule_hdl_v4[j].valid = true;
-					break;
-				}
-			}
-			if(j == IPA_LAN_TO_LAN_MAX_WLAN_CLIENT)
-			{
-				IPACMERR("Not finding the rule handle in handle pool.\n");
-				return IPACM_FAILURE;
-			}
-		}
-		else
-		{
-			IPACMERR("Failed to delete the wlan client specific flt rule.\n");
-			return IPACM_FAILURE;
-		}
-	}
-	if(eth_bridge_wlan_client_flt_info[i].flt_rule_set_v6 == true)
-	{
-		if(reset_to_dummy_flt_rule(IPA_IP_v6, eth_bridge_wlan_client_flt_info[i].flt_rule_hdl_v6) == IPACM_SUCCESS)
-		{
-			for(j=0; j<IPA_LAN_TO_LAN_MAX_WLAN_CLIENT; j++)
-			{
-				if(self_client_flt_rule_hdl_v6[j].rule_hdl == eth_bridge_wlan_client_flt_info[i].flt_rule_hdl_v6)
-				{
-					self_client_flt_rule_hdl_v6[j].valid = true;
-					break;
-				}
-			}
-			if(j == IPA_LAN_TO_LAN_MAX_WLAN_CLIENT)
-			{
-				IPACMERR("Not finding the rule handle in handle pool.\n");
-				return IPACM_FAILURE;
-			}
-		}
-		else
-		{
-			IPACMERR("Failed to delete the wlan client specific flt rule.\n");
-			return IPACM_FAILURE;
-		}
-	}
-
-	for(j=i+1; j<wlan_client_flt_info_count; j++)
-	{
-		memcpy(&(eth_bridge_wlan_client_flt_info[j-1]), &(eth_bridge_wlan_client_flt_info[j]), sizeof(eth_bridge_client_flt_info));
-	}
-	memset(&(eth_bridge_wlan_client_flt_info[wlan_client_flt_info_count-1]), 0, sizeof(eth_bridge_client_flt_info));
-	wlan_client_flt_info_count--;
-
-	return res;
-}
-
-int IPACM_Wlan::eth_bridge_install_cache_lan_client_flt_rule(ipa_ip_type iptype)
+int IPACM_Wlan::eth_bridge_install_cache_client_flt_rule(ipa_ip_type iptype)
 {
 	int 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++)
+	if(is_guest_ap == true)
 	{
-		eth_bridge_add_lan_client_flt_rule(IPACM_Lan::eth_bridge_lan_client[i].mac, iptype);
+		IPACMDBG_H("%s iface is wlan guest ap, return.\n", dev_name);
+		return IPACM_SUCCESS;
 	}
-	return IPACM_SUCCESS;
-}
 
-int IPACM_Wlan::eth_bridge_install_cache_wlan_client_flt_rule(ipa_ip_type iptype)
-{
-	int i;
-
-	IPACMDBG_H("There are %d wlan clients cached.\n", IPACM_Lan::num_wlan_client);
-	for(i=0; i<IPACM_Lan::num_wlan_client; i++)
+	IPACMDBG_H("There are %d clients cached.\n", IPACM_Lan::eth_bridge_num_client);
+	for(i=0; i<IPACM_Lan::eth_bridge_num_client; i++)
 	{
-		eth_bridge_add_self_client_flt_rule(IPACM_Lan::eth_bridge_wlan_client[i].mac, iptype);
+		eth_bridge_add_client_flt_rule(IPACM_Lan::eth_bridge_client[i].mac, iptype,
+			IPACM_Lan::eth_bridge_client[i].ipa_if_cate);
 	}
 	return IPACM_SUCCESS;
 }
@@ -4778,71 +3122,6 @@
 	return (eth_bridge_client_rt_info*)result;
 }
 
-void IPACM_Wlan::eth_bridge_add_wlan_client(uint8_t* mac, int if_num)
-{
-	if(IPACM_Lan::num_wlan_client == IPA_LAN_TO_LAN_MAX_WLAN_CLIENT)
-	{
-		IPACMDBG_H("WLAN client table is already full.\n");
-		return;
-	}
-
-	if(mac == NULL)
-	{
-		IPACMERR("Mac address is empty.\n");
-		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;
-}
-
-void IPACM_Wlan::eth_bridge_del_wlan_client(uint8_t* mac)
-{
-	if(mac == NULL)
-	{
-		IPACMERR("Mac address is empty.\n");
-		return;
-	}
-
-	int i, j;
-	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("Found WLAN client at position %d.\n", i);
-			break;
-		}
-	}
-
-	if(i == IPACM_Lan::num_wlan_client)
-	{
-		IPACMDBG_H("Not finding the WLAN client.\n");
-		return;
-	}
-
-	for(j=i+1; j<IPACM_Lan::num_wlan_client; j++)
-	{
-		memcpy(IPACM_Lan::eth_bridge_wlan_client[j-1].mac, IPACM_Lan::eth_bridge_wlan_client[j].mac, sizeof(IPACM_Lan::eth_bridge_wlan_client[j].mac));
-		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;
-}
-
 void IPACM_Wlan::handle_SCC_MCC_switch(ipa_ip_type iptype)
 {
 	struct ipa_ioc_mdfy_rt_rule *rt_rule = NULL;
@@ -5053,13 +3332,13 @@
 void IPACM_Wlan::eth_bridge_handle_wlan_SCC_MCC_switch(ipa_ip_type iptype)
 {
 
-	for (int i= 0; i < IPACM_Lan::num_wlan_client; i++)
+	for (int i= 0; i < IPACM_Lan::eth_bridge_num_client; i++)
 	{
-		if (IPACM_Lan::eth_bridge_wlan_client[i].ipa_if_num == ipa_if_num)
+		if (IPACM_Lan::eth_bridge_client[i].ipa_if_num == ipa_if_num)
 		{
 			if (IPACM_Lan::wlan_to_wlan_hdr_proc_ctx.valid == true)
 			{
-				if (eth_bridge_modify_wlan_rt_rule(IPACM_Lan::eth_bridge_wlan_client[i].mac, SRC_WLAN, iptype) == IPACM_FAILURE)
+				if (eth_bridge_modify_wlan_rt_rule(IPACM_Lan::eth_bridge_client[i].mac, SRC_WLAN, iptype) == IPACM_FAILURE)
 				{
 					IPACMDBG_H("SCC/MCC switch is failed for iptype: %d src_iface: %d \n", iptype, SRC_WLAN);
 					return;
@@ -5067,7 +3346,7 @@
 			}
 			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_LAN, iptype) == IPACM_FAILURE)
+				if (eth_bridge_modify_wlan_rt_rule(IPACM_Lan::eth_bridge_client[i].mac, SRC_LAN, iptype) == IPACM_FAILURE)
 				{
 					IPACMDBG_H("SCC/MCC switch is failed for iptype: %d src_iface: %d \n", iptype, SRC_LAN);
 					return;
@@ -5307,319 +3586,76 @@
 void IPACM_Wlan::eth_bridge_handle_wlan_mode_switch()
 {
 	int i;
+	uint8_t mac[IPA_MAC_ADDR_SIZE];
 
-	for (i=0; i<IPACM_Lan::num_wlan_client; i++)
+	if(is_guest_ap == true)	//switch from FULL to INTERNET mode
 	{
-		if (IPACM_Lan::eth_bridge_wlan_client[i].ipa_if_num == ipa_if_num)
+		/* first delete all eth bridge flt rules */
+		if(ip_type == IPA_IP_v4 || ip_type == IPA_IP_MAX)
 		{
-			eth_bridge_modify_wlan_client_flt_rule(IPACM_Lan::eth_bridge_wlan_client[i].mac, DST_WLAN, IPA_IP_v4);
-			eth_bridge_modify_wlan_client_flt_rule(IPACM_Lan::eth_bridge_wlan_client[i].mac, DST_WLAN, IPA_IP_v6);
+			eth_bridge_remove_all_client_flt_rule(IPA_IP_v4);
+		}
+		if(ip_type == IPA_IP_v6 || ip_type == IPA_IP_MAX)
+		{
+			eth_bridge_remove_all_client_flt_rule(IPA_IP_v6);
+		}
 
+		for(i=0; i<num_wifi_client; i++)
+		{
+			memcpy(mac, get_client_memptr(wlan_client, i)->mac, sizeof(mac));
+
+			/* remove client info from the client array */
+			eth_bridge_del_client(mac);
+
+			/* delete all eth bridge rt rules */
 			if(IPACM_Lan::lan_to_wlan_hdr_proc_ctx.valid == true)
 			{
-				if (is_guest_ap == true)
-				{
-					eth_bridge_del_wlan_client_rt_rule(IPACM_Lan::eth_bridge_wlan_client[i].mac, SRC_LAN);
-					eth_bridge_post_lan_client_event(IPACM_Lan::eth_bridge_wlan_client[i].mac, IPA_ETH_BRIDGE_WLAN_CLIENT_DEL_EVENT);
-				}
-				else
-				{
-					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);
-					eth_bridge_post_lan_client_event(IPACM_Lan::eth_bridge_wlan_client[i].mac, IPA_ETH_BRIDGE_WLAN_CLIENT_ADD_EVENT);
-				}
+				eth_bridge_del_wlan_client_rt_rule(mac, SRC_LAN);
 			}
-		}
-	}
-}
-
-
-int IPACM_Wlan::eth_bridge_modify_wlan_client_flt_rule(uint8_t* mac, eth_bridge_dst_iface dst_iface, ipa_ip_type iptype)
-{
-
-	int index, len, res = IPACM_SUCCESS, client_position;
-	struct ipa_flt_rule_mdfy flt_rule;
-	struct ipa_ioc_mdfy_flt_rule* pFilteringTable = NULL;
-
-	if (rx_prop == NULL)
-	{
-		IPACMDBG_H("No rx properties registered for iface %s\n", dev_name);
-		return IPACM_FAILURE;
-	}
-	if (mac == NULL)
-	{
-		IPACMERR("MAC address is empty.\n");
-		return IPACM_FAILURE;
-	}
-	IPACMDBG_H("Received client MAC 0x%02x%02x%02x%02x%02x%02x. dst_iface: %d \n",
-			mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], dst_iface);
-
-	if (dst_iface == DST_WLAN && IPACM_Lan::wlan_to_wlan_hdr_proc_ctx.valid == false)
-	{
-		IPACMDBG_H("WLAN to WLAN hdr proc ctx has not been set, don't modify client specific flt rule.\n");
-		return IPACM_FAILURE;
-	}
-	if (dst_iface == DST_LAN && IPACM_Lan::lan_to_wlan_hdr_proc_ctx.valid == false)
-	{
-		IPACMDBG_H("WLAN to LAN hdr proc ctx has not been set, don't modify client specific flt rule.\n");
-		return IPACM_FAILURE;
-	}
-
-	if (dst_iface == DST_WLAN)
-	{
-		for (index=0; index<wlan_client_flt_info_count; index++)
-		{
-			if(memcmp(eth_bridge_wlan_client_flt_info[index].mac, mac, sizeof(eth_bridge_wlan_client_flt_info[index].mac)) == 0)
+			if(IPACM_Lan::wlan_to_wlan_hdr_proc_ctx.valid == true)
 			{
-				client_position = index;
-				IPACMDBG_H("The client is found at position %d.\n", client_position);
-				break;
+				eth_bridge_del_wlan_client_rt_rule(mac, SRC_WLAN);
 			}
-		}
-		if(index == wlan_client_flt_info_count)
-		{
-			IPACMDBG_H("The wlan client is not found.\n");
-			return IPACM_FAILURE;
+
+			/* post client delete event */
+			eth_bridge_post_lan_client_event(mac, IPA_ETH_BRIDGE_CLIENT_DEL_EVENT);
 		}
 	}
-	else
+	else	//switch from INTERNET to FULL mode
 	{
-		for(index=0; index<lan_client_flt_info_count; index++)
+		for(i=0; i<num_wifi_client; i++)
 		{
-			if(memcmp(eth_bridge_lan_client_flt_info[index].mac, mac, sizeof(eth_bridge_lan_client_flt_info[index].mac)) == 0)
+			memcpy(mac, get_client_memptr(wlan_client, i)->mac, sizeof(mac));
+
+			/* add client info from the client array */
+			eth_bridge_add_client(mac);
+
+			/* add client rt rules */
+			if(IPACM_Lan::lan_to_wlan_hdr_proc_ctx.valid == true)
 			{
-				client_position = index;
-				IPACMDBG_H("The client is found at position %d.\n", client_position);
-				break;
+				eth_bridge_add_wlan_client_rt_rule(mac, SRC_LAN, IPA_IP_v4);
+				eth_bridge_add_wlan_client_rt_rule(mac, SRC_LAN, IPA_IP_v6);
 			}
-		}
-		if(index == lan_client_flt_info_count)
-		{
-			IPACMDBG_H("The lan client is not found.\n");
-			return IPACM_FAILURE;
-		}
-	}
-
-	len = sizeof(struct ipa_ioc_mdfy_flt_rule) + sizeof(struct ipa_flt_rule_mdfy);
-	pFilteringTable = (struct ipa_ioc_mdfy_flt_rule*)malloc(len);
-	if (!pFilteringTable)
-	{
-		IPACMERR("Failed to allocate ipa_ioc_mdfy_flt_rule memory...\n");
-		return IPACM_FAILURE;
-	}
-	memset(pFilteringTable, 0, len);
-
-	/* add mac based rule on IPv4 table */
-	pFilteringTable->commit = 1;
-	pFilteringTable->ip = iptype;
-	pFilteringTable->num_rules = 1;
-
-	/* point to WLAN-WLAN routing table */
-	memset(&flt_rule, 0, sizeof(struct ipa_flt_rule_mdfy));
-	flt_rule.status = -1;
-	flt_rule.rule.retain_hdr = 0;
-	flt_rule.rule.to_uc = 0;
-	flt_rule.rule.action = IPA_PASS_TO_ROUTING;
-	flt_rule.rule.eq_attrib_type = 0;
-
-	if (dst_iface == DST_WLAN)
-	{
-		if(iptype == IPA_IP_v4)
-		{
-			if (false == m_routing.GetRoutingTable(&IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_wlan_wlan_v4))
+			if(IPACM_Lan::wlan_to_wlan_hdr_proc_ctx.valid == true)
 			{
-				IPACMERR("Failed to get routing table handle.\n");
-				res = IPACM_FAILURE;
-				goto fail;
+				eth_bridge_add_wlan_client_rt_rule(mac, SRC_WLAN, IPA_IP_v4);
+				eth_bridge_add_wlan_client_rt_rule(mac, SRC_WLAN, IPA_IP_v6);
 			}
-			flt_rule.rule.rt_tbl_hdl = IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_wlan_wlan_v4.hdl;
-			IPACMDBG_H("WLAN->WLAN IPv4 filter rule use table: %s\n",IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_wlan_wlan_v4.name);
+
+			/* post client add event */
+			eth_bridge_post_lan_client_event(mac, IPA_ETH_BRIDGE_CLIENT_ADD_EVENT);
 		}
-		else
+
+		/* add client flt rules */
+		IPACMDBG_H("ip_type: %d\n", ip_type);
+		if(ip_type == IPA_IP_v4 || ip_type == IPA_IP_MAX)
 		{
-			if (false == m_routing.GetRoutingTable(&IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_wlan_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_wlan_wlan_v6.hdl;
-			IPACMDBG_H("WLAN->WLAN IPv6 filter rule use table: %s\n",IPACM_Iface::ipacmcfg->rt_tbl_eth_bridge_wlan_wlan_v6.name);
+			eth_bridge_install_cache_client_flt_rule(IPA_IP_v4);
 		}
-	}
-	else
-	{
-		if(iptype == IPA_IP_v4)
+		if(ip_type == IPA_IP_v6 || ip_type == IPA_IP_MAX)
 		{
-			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_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);
+			eth_bridge_install_cache_client_flt_rule(IPA_IP_v6);
 		}
-		else
-		{
-			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;
-			}
-			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));
-
-	/* Install meta-data if self or other ap is guest ap */
-	if ((is_guest_ap == false &&  IPACM_Wlan::num_wlan_ap_iface == 1) ||
-			IPACM_Iface::ipacmcfg->ipa_num_wlan_guest_ap == 0)
-	{
-		flt_rule.rule.attrib.attrib_mask &= ~((uint32_t)IPA_FLT_META_DATA); //remove meta data mask
-	}
-
-	if(IPACM_Lan::wlan_hdr_type == IPA_HDR_L2_ETHERNET_II)
-	{
-		flt_rule.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_ETHER_II;
-	}
-	else if(IPACM_Lan::wlan_hdr_type == IPA_HDR_L2_802_3)
-	{
-		flt_rule.rule.attrib.attrib_mask |= IPA_FLT_MAC_DST_ADDR_802_3;
-	}
-	else
-	{
-		IPACMERR("WLAN hdr type is not expected.\n");
-		res = IPACM_FAILURE;
-		goto fail;
-	}
-	memcpy(flt_rule.rule.attrib.dst_mac_addr, mac, sizeof(flt_rule.rule.attrib.dst_mac_addr));
-	memset(flt_rule.rule.attrib.dst_mac_addr_mask, 0xFF, sizeof(flt_rule.rule.attrib.dst_mac_addr_mask));
-
-	if (dst_iface == DST_WLAN)
-	{
-		if(iptype == IPA_IP_v4)
-		{
-			flt_rule.rule_hdl = eth_bridge_wlan_client_flt_info[client_position].flt_rule_hdl_v4;
-		}
-		else
-		{
-			flt_rule.rule_hdl = eth_bridge_wlan_client_flt_info[client_position].flt_rule_hdl_v6;
-		}
-	}
-	else
-	{
-		if(iptype == IPA_IP_v4)
-		{
-			flt_rule.rule_hdl = eth_bridge_lan_client_flt_info[client_position].flt_rule_hdl_v4;
-		}
-		else
-		{
-			flt_rule.rule_hdl = eth_bridge_lan_client_flt_info[client_position].flt_rule_hdl_v6;
-		}
-	}
-	memcpy(&(pFilteringTable->rules[0]), &flt_rule, sizeof(struct ipa_flt_rule_mdfy));
-	if (false == m_filtering.ModifyFilteringRule(pFilteringTable))
-	{
-		IPACMERR("Failed to modify wlan client filtering rule.\n");
-		res = IPACM_FAILURE;
-		goto fail;
-	}
-fail:
-	free(pFilteringTable);
-	return res;
-}
-
-int IPACM_Wlan::install_ipv6_prefix_flt_rule(uint32_t* prefix)
-{
-	int i, len, res = IPACM_SUCCESS, offset;
-	struct ipa_flt_rule_mdfy flt_rule;
-	struct ipa_ioc_mdfy_flt_rule* pFilteringTable;
-
-	if (rx_prop == NULL)
-	{
-		IPACMDBG_H("No rx properties registered for iface %s\n", dev_name);
-		return IPACM_SUCCESS;
-	}
-
-	if(IPACM_Wlan::dummy_flt_rule_hdl_v6 == NULL)
-	{
-		IPACMERR("Dummy ipv6 flt rule has not been installed.\n");
-		return IPACM_FAILURE;
-	}
-	if(wlan_ap_index >= 2)
-	{
-		IPACMERR("Cannot support more than 2 WLAN AP, abort.\n");
-		return IPACM_FAILURE;
-	}
-
-#ifdef FEATURE_ETH_BRIDGE_LE
-	offset = IPV6_DEFAULT_FILTERTING_RULES + IPA_LAN_TO_LAN_MAX_WLAN_CLIENT + IPA_LAN_TO_LAN_MAX_LAN_CLIENT + wlan_ap_index;
-#else
-#ifndef CT_OPT
-	offset = 2*(IPV6_DEFAULT_FILTERTING_RULES + MAX_OFFLOAD_PAIR) + wlan_ap_index;
-#else
-	offset = 2*(IPV6_DEFAULT_FILTERTING_RULES + NUM_TCP_CTL_FLT_RULE + MAX_OFFLOAD_PAIR) + wlan_ap_index;
-#endif
-#endif
-
-	len = sizeof(struct ipa_ioc_mdfy_flt_rule) + sizeof(struct ipa_flt_rule_mdfy);
-	pFilteringTable = (struct ipa_ioc_mdfy_flt_rule*)malloc(len);
-	if (!pFilteringTable)
-	{
-		IPACMERR("Failed to allocate ipa_ioc_mdfy_flt_rule memory...\n");
-		return IPACM_FAILURE;
-	}
-	memset(pFilteringTable, 0, len);
-
-	pFilteringTable->commit = 1;
-	pFilteringTable->ip = IPA_IP_v6;
-	pFilteringTable->num_rules = 1;
-
-	memset(&flt_rule, 0, sizeof(flt_rule));
-	flt_rule.status = -1;
-	flt_rule.rule_hdl = IPACM_Wlan::dummy_flt_rule_hdl_v6[offset];
-
-	flt_rule.rule.retain_hdr = 1;
-	flt_rule.rule.to_uc = 0;
-	flt_rule.rule.action = IPA_PASS_TO_EXCEPTION;
-	flt_rule.rule.eq_attrib_type = 0;
-
-	memcpy(&flt_rule.rule.attrib, &rx_prop->rx[0].attrib, sizeof(flt_rule.rule.attrib));
-	flt_rule.rule.attrib.attrib_mask |= IPA_FLT_DST_ADDR;
-	flt_rule.rule.attrib.u.v6.dst_addr[0] = prefix[0];
-	flt_rule.rule.attrib.u.v6.dst_addr[1] = prefix[1];
-	flt_rule.rule.attrib.u.v6.dst_addr[2] = 0x0;
-	flt_rule.rule.attrib.u.v6.dst_addr[3] = 0x0;
-	flt_rule.rule.attrib.u.v6.dst_addr_mask[0] = 0xFFFFFFFF;
-	flt_rule.rule.attrib.u.v6.dst_addr_mask[1] = 0xFFFFFFFF;
-	flt_rule.rule.attrib.u.v6.dst_addr_mask[2] = 0x0;
-	flt_rule.rule.attrib.u.v6.dst_addr_mask[3] = 0x0;
-	memcpy(&(pFilteringTable->rules[0]), &flt_rule, sizeof(flt_rule));
-
-	if (false == m_filtering.ModifyFilteringRule(pFilteringTable))
-	{
-		IPACMERR("Failed to modify tcp control filtering rules.\n");
-		free(pFilteringTable);
-		return IPACM_FAILURE;
-	}
-	else
-	{
-		ipv6_prefix_flt_rule_hdl[0] = IPACM_Wlan::dummy_flt_rule_hdl_v6[offset];
-		IPACMDBG_H("IPv6 prefix filter rule HDL:0x%x\n", ipv6_prefix_flt_rule_hdl[0]);
-	}
-
-	free(pFilteringTable);
-	return IPACM_SUCCESS;
-}
-
-void IPACM_Wlan::delete_ipv6_prefix_flt_rule()
-{
-	if(reset_to_dummy_flt_rule(IPA_IP_v6, ipv6_prefix_flt_rule_hdl[0]) == IPACM_FAILURE)
-	{
-		IPACMERR("Failed to delete ipv6 prefix flt rule.\n");
 	}
 	return;
 }
