Merge "IPACM: Routing/Filtering support for IPAv3"
diff --git a/ipacm/inc/IPACM_Defs.h b/ipacm/inc/IPACM_Defs.h
index 559daca..dcc55d0 100644
--- a/ipacm/inc/IPACM_Defs.h
+++ b/ipacm/inc/IPACM_Defs.h
@@ -310,6 +310,7 @@
uint32_t ipv4_addr_mask;
uint32_t ipv6_addr[4];
uint32_t ipv6_addr_mask[4];
+ uint32_t ipv6_addr_gw[4];
} ipacm_event_data_addr;
typedef struct _ipacm_event_data_mac
diff --git a/ipacm/inc/IPACM_Wan.h b/ipacm/inc/IPACM_Wan.h
index 65f788f..711f276 100644
--- a/ipacm/inc/IPACM_Wan.h
+++ b/ipacm/inc/IPACM_Wan.h
@@ -104,10 +104,12 @@
{
#ifdef FEATURE_IPA_ANDROID
int i;
- for (i=1; i < ipa_if_num_tether_v4_total;i++)
+ for (i=0; i < ipa_if_num_tether_v4_total;i++)
{
if (ipa_if_num_tether_v4[i] == ipa_if_num_tether)
{
+ IPACMDBG_H("support ipv4 tether_iface(%s)\n",
+ IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether].iface_name);
return wan_up;
break;
}
@@ -122,10 +124,12 @@
{
#ifdef FEATURE_IPA_ANDROID
int i;
- for (i=1; i < ipa_if_num_tether_v6_total;i++)
+ for (i=0; i < ipa_if_num_tether_v6_total;i++)
{
if (ipa_if_num_tether_v6[i] == ipa_if_num_tether)
{
+ IPACMDBG_H("support ipv6 tether_iface(%s)\n",
+ IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether].iface_name);
return wan_up_v6;
break;
}
@@ -187,8 +191,10 @@
int num_firewall_v4,num_firewall_v6;
uint32_t wan_v4_addr;
uint32_t wan_v4_addr_gw;
+ uint32_t wan_v6_addr_gw[4];
bool wan_v4_addr_set;
bool wan_v4_addr_gw_set;
+ bool wan_v6_addr_gw_set;
bool active_v4;
bool active_v6;
bool header_set_v4;
@@ -293,6 +299,49 @@
return IPACM_INVALID_INDEX;
}
+ inline int get_wan_client_index_ipv6(uint32_t* ipv6_addr)
+ {
+ int cnt, v6_num;
+ int num_wan_client_tmp = num_wan_client;
+
+ IPACMDBG_H("Get ipv6 address 0x%08x.0x%08x.0x%08x.0x%08x\n", ipv6_addr[0], ipv6_addr[1], ipv6_addr[2], ipv6_addr[3]);
+
+ for(cnt = 0; cnt < num_wan_client_tmp; cnt++)
+ {
+ if (get_client_memptr(wan_client, cnt)->ipv6_set)
+ {
+ for(v6_num=0;v6_num < get_client_memptr(wan_client, cnt)->ipv6_set;v6_num++)
+ {
+
+ IPACMDBG_H("stored IPv6 0x%08x.0x%08x.0x%08x.0x%08x\n", get_client_memptr(wan_client, cnt)->v6_addr[v6_num][0],
+ get_client_memptr(wan_client, cnt)->v6_addr[v6_num][1],
+ get_client_memptr(wan_client, cnt)->v6_addr[v6_num][2],
+ get_client_memptr(wan_client, cnt)->v6_addr[v6_num][3]);
+
+ if(ipv6_addr[0] == get_client_memptr(wan_client, cnt)->v6_addr[v6_num][0] &&
+ ipv6_addr[1] == get_client_memptr(wan_client, cnt)->v6_addr[v6_num][1] &&
+ ipv6_addr[2]== get_client_memptr(wan_client, cnt)->v6_addr[v6_num][2] &&
+ ipv6_addr[3] == get_client_memptr(wan_client, cnt)->v6_addr[v6_num][3])
+ {
+ IPACMDBG_H("Matched client index: %d\n", cnt);
+ IPACMDBG_H("The MAC is %02x:%02x:%02x:%02x:%02x:%02x\n",
+ get_client_memptr(wan_client, cnt)->mac[0],
+ get_client_memptr(wan_client, cnt)->mac[1],
+ get_client_memptr(wan_client, cnt)->mac[2],
+ get_client_memptr(wan_client, cnt)->mac[3],
+ get_client_memptr(wan_client, cnt)->mac[4],
+ get_client_memptr(wan_client, cnt)->mac[5]);
+ IPACMDBG_H("header set ipv4(%d) ipv6(%d)\n",
+ get_client_memptr(wan_client, cnt)->ipv4_header_set,
+ get_client_memptr(wan_client, cnt)->ipv6_header_set);
+ return cnt;
+ }
+ }
+ }
+ }
+ return IPACM_INVALID_INDEX;
+ }
+
inline int delete_wan_rtrules(int clt_indx, ipa_ip_type iptype)
{
uint32_t tx_index;
@@ -400,6 +449,9 @@
int config_dft_firewall_rules_ex(struct ipa_flt_rule_add* rules, int rule_offset,
ipa_ip_type iptype);
+ /* Change IP Type.*/
+ void config_ip_type(ipa_ip_type iptype);
+
/* init filtering rule in wan dl filtering table */
int init_fl_rule_ex(ipa_ip_type iptype);
diff --git a/ipacm/src/IPACM_Lan.cpp b/ipacm/src/IPACM_Lan.cpp
index aa57dd6..98eea6e 100644
--- a/ipacm/src/IPACM_Lan.cpp
+++ b/ipacm/src/IPACM_Lan.cpp
@@ -586,9 +586,10 @@
IPACMERR("No event data is found.\n");
return;
}
- IPACMDBG_H("Backhaul is sta mode?%d, if_index_tether:%d\n", data_wan_tether->is_sta,
- data_wan_tether->if_index_tether);
- if (iface_ipa_index_query(data_wan_tether->if_index_tether) == ipa_if_num)
+ IPACMDBG_H("Backhaul is sta mode?%d, if_index_tether:%d tether_if_name:%s\n", data_wan_tether->is_sta,
+ data_wan_tether->if_index_tether,
+ IPACM_Iface::ipacmcfg->iface_table[data_wan_tether->if_index_tether].iface_name);
+ if (data_wan_tether->if_index_tether == ipa_if_num)
{
if(ip_type == IPA_IP_v4 || ip_type == IPA_IP_MAX)
{
@@ -614,9 +615,10 @@
IPACMERR("No event data is found.\n");
return;
}
- IPACMDBG_H("Backhaul is sta mode?%d, if_index_tether:%d\n", data_wan_tether->is_sta,
- data_wan_tether->if_index_tether);
- if (iface_ipa_index_query(data_wan_tether->if_index_tether) == ipa_if_num)
+ IPACMDBG_H("Backhaul is sta mode?%d, if_index_tether:%d tether_if_name:%s\n", data_wan_tether->is_sta,
+ data_wan_tether->if_index_tether,
+ IPACM_Iface::ipacmcfg->iface_table[data_wan_tether->if_index_tether].iface_name);
+ if (data_wan_tether->if_index_tether == ipa_if_num)
{
if(ip_type == IPA_IP_v6 || ip_type == IPA_IP_MAX)
{
@@ -642,9 +644,10 @@
IPACMERR("No event data is found.\n");
return;
}
- IPACMDBG_H("Backhaul is sta mode?%d, if_index_tether:%d\n", data_wan_tether->is_sta,
- data_wan_tether->if_index_tether);
- if (iface_ipa_index_query(data_wan_tether->if_index_tether) == ipa_if_num)
+ IPACMDBG_H("Backhaul is sta mode?%d, if_index_tether:%d tether_if_name:%s\n", data_wan_tether->is_sta,
+ data_wan_tether->if_index_tether,
+ IPACM_Iface::ipacmcfg->iface_table[data_wan_tether->if_index_tether].iface_name);
+ if (data_wan_tether->if_index_tether == ipa_if_num)
{
if(ip_type == IPA_IP_v4 || ip_type == IPA_IP_MAX)
{
@@ -661,9 +664,10 @@
IPACMERR("No event data is found.\n");
return;
}
- IPACMDBG_H("Backhaul is sta mode?%d, if_index_tether:%d\n", data_wan_tether->is_sta,
- data_wan_tether->if_index_tether);
- if (iface_ipa_index_query(data_wan_tether->if_index_tether) == ipa_if_num)
+ IPACMDBG_H("Backhaul is sta mode?%d, if_index_tether:%d tether_if_name:%s\n", data_wan_tether->is_sta,
+ data_wan_tether->if_index_tether,
+ IPACM_Iface::ipacmcfg->iface_table[data_wan_tether->if_index_tether].iface_name);
+ if (data_wan_tether->if_index_tether == ipa_if_num)
{
/* clean up v6 RT rules*/
IPACMDBG_H("Received IPA_HANDLE_WAN_DOWN_V6_TETHER in LAN-instance and need clean up client IPv6 address \n");
diff --git a/ipacm/src/IPACM_Netlink.cpp b/ipacm/src/IPACM_Netlink.cpp
index 3dfc514..a343e24 100644
--- a/ipacm/src/IPACM_Netlink.cpp
+++ b/ipacm/src/IPACM_Netlink.cpp
@@ -879,7 +879,6 @@
IPACMDBG("In case RTM_NEWROUTE\n");
IPACMDBG("rtm_type: %d\n", msg_ptr->nl_route_info.metainfo.rtm_type);
- IPACMDBG("rtm_type: %d\n", msg_ptr->nl_route_info.metainfo.rtm_type);
IPACMDBG("protocol: %d\n", msg_ptr->nl_route_info.metainfo.rtm_protocol);
IPACMDBG("rtm_scope: %d\n", msg_ptr->nl_route_info.metainfo.rtm_scope);
IPACMDBG("rtm_table: %d\n", msg_ptr->nl_route_info.metainfo.rtm_table);
@@ -888,7 +887,8 @@
/* take care of route add default route & uniroute */
if((msg_ptr->nl_route_info.metainfo.rtm_type == RTN_UNICAST) &&
- (msg_ptr->nl_route_info.metainfo.rtm_protocol == RTPROT_BOOT) &&
+ ((msg_ptr->nl_route_info.metainfo.rtm_protocol == RTPROT_BOOT) ||
+ (msg_ptr->nl_route_info.metainfo.rtm_protocol == RTPROT_RA)) &&
(msg_ptr->nl_route_info.metainfo.rtm_scope == RT_SCOPE_UNIVERSE) &&
(msg_ptr->nl_route_info.metainfo.rtm_table == RT_TABLE_MAIN))
{
@@ -967,13 +967,20 @@
data_addr->ipv6_addr[1] = ntohl(data_addr->ipv6_addr[1]);
data_addr->ipv6_addr[2] = ntohl(data_addr->ipv6_addr[2]);
data_addr->ipv6_addr[3] = ntohl(data_addr->ipv6_addr[3]);
- IPACM_EVENT_COPY_ADDR_v6( data_addr->ipv6_addr_mask, msg_ptr->nl_route_info.attr_info.dst_addr);
+ IPACM_EVENT_COPY_ADDR_v6( data_addr->ipv6_addr_mask, msg_ptr->nl_route_info.attr_info.dst_addr);
data_addr->ipv6_addr_mask[0] = ntohl(data_addr->ipv6_addr_mask[0]);
data_addr->ipv6_addr_mask[1] = ntohl(data_addr->ipv6_addr_mask[1]);
data_addr->ipv6_addr_mask[2] = ntohl(data_addr->ipv6_addr_mask[2]);
data_addr->ipv6_addr_mask[3] = ntohl(data_addr->ipv6_addr_mask[3]);
+ IPACM_EVENT_COPY_ADDR_v6( data_addr->ipv6_addr_gw, msg_ptr->nl_route_info.attr_info.gateway_addr);
+ data_addr->ipv6_addr_gw[0] = ntohl(data_addr->ipv6_addr_gw[0]);
+ data_addr->ipv6_addr_gw[1] = ntohl(data_addr->ipv6_addr_gw[1]);
+ data_addr->ipv6_addr_gw[2] = ntohl(data_addr->ipv6_addr_gw[2]);
+ data_addr->ipv6_addr_gw[3] = ntohl(data_addr->ipv6_addr_gw[3]);
+ IPACM_NL_REPORT_ADDR( " ", msg_ptr->nl_route_info.attr_info.gateway_addr);
+
evt_data.event = IPA_ROUTE_ADD_EVENT;
data_addr->if_index = msg_ptr->nl_route_info.attr_info.oif_index;
data_addr->iptype = IPA_IP_v6;
@@ -1146,7 +1153,8 @@
}
/* take care of route delete of default route & uniroute */
if((msg_ptr->nl_route_info.metainfo.rtm_type == RTN_UNICAST) &&
- (msg_ptr->nl_route_info.metainfo.rtm_protocol == RTPROT_BOOT) &&
+ ((msg_ptr->nl_route_info.metainfo.rtm_protocol == RTPROT_BOOT) ||
+ (msg_ptr->nl_route_info.metainfo.rtm_protocol == RTPROT_RA)) &&
(msg_ptr->nl_route_info.metainfo.rtm_scope == 0) &&
(msg_ptr->nl_route_info.metainfo.rtm_table == RT_TABLE_MAIN))
{
@@ -1217,19 +1225,24 @@
{
IPACMDBG("ip -6 route del default dev %s\n", dev_name);
}
- IPACM_EVENT_COPY_ADDR_v6( data_addr->ipv6_addr, msg_ptr->nl_route_info.attr_info.dst_addr);
-
+ IPACM_EVENT_COPY_ADDR_v6( data_addr->ipv6_addr, msg_ptr->nl_route_info.attr_info.dst_addr);
data_addr->ipv6_addr[0] = ntohl(data_addr->ipv6_addr[0]);
data_addr->ipv6_addr[1] = ntohl(data_addr->ipv6_addr[1]);
data_addr->ipv6_addr[2] = ntohl(data_addr->ipv6_addr[2]);
data_addr->ipv6_addr[3] = ntohl(data_addr->ipv6_addr[3]);
IPACM_EVENT_COPY_ADDR_v6( data_addr->ipv6_addr_mask, msg_ptr->nl_route_info.attr_info.dst_addr);
-
data_addr->ipv6_addr_mask[0] = ntohl(data_addr->ipv6_addr_mask[0]);
data_addr->ipv6_addr_mask[1] = ntohl(data_addr->ipv6_addr_mask[1]);
data_addr->ipv6_addr_mask[2] = ntohl(data_addr->ipv6_addr_mask[2]);
data_addr->ipv6_addr_mask[3] = ntohl(data_addr->ipv6_addr_mask[3]);
+
+ IPACM_EVENT_COPY_ADDR_v6( data_addr->ipv6_addr_gw, msg_ptr->nl_route_info.attr_info.gateway_addr);
+ data_addr->ipv6_addr_gw[0] = ntohl(data_addr->ipv6_addr_gw[0]);
+ data_addr->ipv6_addr_gw[1] = ntohl(data_addr->ipv6_addr_gw[1]);
+ data_addr->ipv6_addr_gw[2] = ntohl(data_addr->ipv6_addr_gw[2]);
+ data_addr->ipv6_addr_gw[3] = ntohl(data_addr->ipv6_addr_gw[3]);
+ IPACM_NL_REPORT_ADDR( " ", msg_ptr->nl_route_info.attr_info.gateway_addr);
data_addr->iptype = IPA_IP_v6;
}
else
diff --git a/ipacm/src/IPACM_Wan.cpp b/ipacm/src/IPACM_Wan.cpp
index 3c27ba3..74408c3 100644
--- a/ipacm/src/IPACM_Wan.cpp
+++ b/ipacm/src/IPACM_Wan.cpp
@@ -104,6 +104,7 @@
wan_v4_addr_set = false;
wan_v4_addr_gw_set = false;
+ wan_v6_addr_gw_set = false;
active_v4 = false;
active_v6 = false;
header_set_v4 = false;
@@ -115,6 +116,7 @@
num_ipv6_dest_flt_rule = 0;
memset(ipv6_dest_flt_rule_hdl, 0, MAX_DEFAULT_v6_ROUTE_RULES*sizeof(uint32_t));
memset(ipv6_prefix, 0, sizeof(ipv6_prefix));
+ memset(wan_v6_addr_gw, 0, sizeof(wan_v6_addr_gw));
ext_prop = NULL;
num_wan_client = 0;
@@ -306,9 +308,12 @@
dft_rt_rule_hdl[MAX_DEFAULT_v4_ROUTE_RULES + 2*num_dft_rt_v6],
dft_rt_rule_hdl[MAX_DEFAULT_v4_ROUTE_RULES + 2*num_dft_rt_v6+1],num_dft_rt_v6);
+ /* Update the IP Type. */
+ config_ip_type(data->iptype);
+
/* add default filtering rules when wan-iface get global v6-prefix */
- if (num_dft_rt_v6 == 1)
- {
+ if (num_dft_rt_v6 == 1)
+ {
if(m_is_sta_mode == Q6_WAN)
{
modem_ipv6_pdn_index = num_ipv6_modem_pdn;
@@ -320,7 +325,7 @@
{
init_fl_rule(data->iptype);
}
- }
+ }
/* add WAN DL interface IP specific flt rule for IPv6 when backhaul is not Q6 */
if(m_is_sta_mode != Q6_WAN)
@@ -465,6 +470,9 @@
IPACMDBG_H("ipv4 wan iface rt-rule hdll=0x%x\n", dft_rt_rule_hdl[0]);
/* initial multicast/broadcast/fragment filter rule */
+ /* Update the IP Type. */
+ config_ip_type(data->iptype);
+
/* only do one time */
if(!wan_v4_addr_set)
{
@@ -712,7 +720,8 @@
handle_route_add_evt(data->iptype);
}
#ifdef FEATURE_IPA_ANDROID
- post_wan_up_tether_evt(data->iptype, data->if_index_tether);
+ /* using ipa_if_index, not netdev_index */
+ post_wan_up_tether_evt(data->iptype, iface_ipa_index_query(data->if_index_tether));
#endif
}
else if ((data->iptype == IPA_IP_v6) && (ip_type == IPA_IP_v6 || ip_type == IPA_IP_MAX))
@@ -723,7 +732,8 @@
handle_route_add_evt(data->iptype);
}
#ifdef FEATURE_IPA_ANDROID
- post_wan_up_tether_evt(data->iptype, data->if_index_tether);
+ /* using ipa_if_index, not netdev_index */
+ post_wan_up_tether_evt(data->iptype, iface_ipa_index_query(data->if_index_tether));
#endif
}
}
@@ -778,7 +788,8 @@
IPACMDBG_H("get del default v4 route (dst:0.0.0.0)\n");
// wan_v4_addr_gw_set = false; /* android requires CnE change too */
#ifdef FEATURE_IPA_ANDROID
- post_wan_down_tether_evt(data->iptype, data->if_index_tether);
+ /* using ipa_if_index, not netdev_index */
+ post_wan_down_tether_evt(data->iptype, iface_ipa_index_query(data->if_index_tether));
/* no any ipv4 tether iface support*/
if(IPACM_Wan::ipa_if_num_tether_v4_total != 0)
{
@@ -801,7 +812,8 @@
else if ((data->iptype == IPA_IP_v6) && (active_v6 == true))
{
#ifdef FEATURE_IPA_ANDROID
- post_wan_down_tether_evt(data->iptype, data->if_index_tether);
+ /* using ipa_if_index, not netdev_index */
+ post_wan_down_tether_evt(data->iptype, iface_ipa_index_query(data->if_index_tether));
/* no any ipv6 tether iface support*/
if(IPACM_Wan::ipa_if_num_tether_v6_total != 0)
{
@@ -870,8 +882,17 @@
(active_v6 == false) && (ip_type == IPA_IP_v6 || ip_type == IPA_IP_MAX))
{
IPACMDBG_H("\n get default v6 route (dst:00.00.00.00)\n");
- IPACMDBG_H(" IPV6 value: %08x:%08x:%08x:%08x \n",
+ IPACMDBG_H(" IPV6 dst: %08x:%08x:%08x:%08x \n",
data->ipv6_addr[0], data->ipv6_addr[1], data->ipv6_addr[2], data->ipv6_addr[3]);
+ IPACMDBG_H(" IPV6 gateway: %08x:%08x:%08x:%08x \n",
+ data->ipv6_addr_gw[0], data->ipv6_addr_gw[1], data->ipv6_addr_gw[2], data->ipv6_addr_gw[3]);
+ wan_v6_addr_gw[0] = data->ipv6_addr_gw[0];
+ wan_v6_addr_gw[1] = data->ipv6_addr_gw[1];
+ wan_v6_addr_gw[2] = data->ipv6_addr_gw[2];
+ wan_v6_addr_gw[3] = data->ipv6_addr_gw[3];
+ wan_v6_addr_gw_set = true;
+ /* Check & construct STA header */
+ handle_sta_header_add_evt();
handle_route_add_evt(data->iptype);
}
}
@@ -1563,7 +1584,7 @@
}
IPACMDBG_H("Posting IPA_HANDLE_WAN_UP_TETHER with below information:\n");
IPACMDBG_H("tether_if_name:%s, is sta mode:%d\n",
- IPACM_Iface::ipacmcfg->iface_table[iface_ipa_index_query(ipa_if_num_tether)].iface_name, wanup_data->is_sta);
+ IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether].iface_name, wanup_data->is_sta);
memset(&evt_data, 0, sizeof(evt_data));
if (iptype == IPA_IP_v4)
@@ -1571,9 +1592,10 @@
evt_data.event = IPA_HANDLE_WAN_UP_TETHER;
/* Add support tether ifaces to its array*/
IPACM_Wan::ipa_if_num_tether_v4[IPACM_Wan::ipa_if_num_tether_v4_total] = ipa_if_num_tether;
- IPACMDBG_H("adding tether iface(%s) ipa_if_num_tether_v4_total(%d)\n",
- IPACM_Iface::ipacmcfg->iface_table[iface_ipa_index_query(ipa_if_num_tether)].iface_name,
- IPACM_Wan::ipa_if_num_tether_v4_total);
+ IPACMDBG_H("adding tether iface(%s) ipa_if_num_tether_v4_total(%d) on wan_iface(%s)\n",
+ IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether].iface_name,
+ IPACM_Wan::ipa_if_num_tether_v4_total,
+ IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].iface_name);
IPACM_Wan::ipa_if_num_tether_v4_total++;
}
else
@@ -1582,9 +1604,10 @@
memcpy(wanup_data->ipv6_prefix, ipv6_prefix, sizeof(wanup_data->ipv6_prefix));
/* Add support tether ifaces to its array*/
IPACM_Wan::ipa_if_num_tether_v6[IPACM_Wan::ipa_if_num_tether_v6_total] = ipa_if_num_tether;
- IPACMDBG_H("adding tether iface(%s) ipa_if_num_tether_v6_total(%d)\n",
- IPACM_Iface::ipacmcfg->iface_table[iface_ipa_index_query(ipa_if_num_tether)].iface_name,
- IPACM_Wan::ipa_if_num_tether_v6_total);
+ IPACMDBG_H("adding tether iface(%s) ipa_if_num_tether_v6_total(%d) on wan_iface(%s)\n",
+ IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether].iface_name,
+ IPACM_Wan::ipa_if_num_tether_v6_total,
+ IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].iface_name);
IPACM_Wan::ipa_if_num_tether_v6_total++;
}
evt_data.evt_data = (void *)wanup_data;
@@ -1619,7 +1642,7 @@
}
IPACMDBG_H("Posting IPA_HANDLE_WAN_DOWN_TETHER with below information:\n");
IPACMDBG_H("tether_if_name:%s, is sta mode:%d\n",
- IPACM_Iface::ipacmcfg->iface_table[iface_ipa_index_query(ipa_if_num_tether)].iface_name, wandown_data->is_sta);
+ IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether].iface_name, wandown_data->is_sta);
memset(&evt_data, 0, sizeof(evt_data));
if (iptype == IPA_IP_v4)
@@ -1630,7 +1653,8 @@
{
if(IPACM_Wan::ipa_if_num_tether_v4[i] == ipa_if_num_tether)
{
- IPACMDBG_H("Found tether client at position %d.\n", i);
+ IPACMDBG_H("Found tether client at position %d name(%s)\n", i,
+ IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether].iface_name);
break;
}
}
@@ -1645,7 +1669,9 @@
IPACM_Wan::ipa_if_num_tether_v4[j-1] = IPACM_Wan::ipa_if_num_tether_v4[j];
}
IPACM_Wan::ipa_if_num_tether_v4_total--;
- IPACMDBG_H("Now the total num of ipa_if_num_tether_v4_total is %d \n", IPACM_Wan::ipa_if_num_tether_v4_total);
+ IPACMDBG_H("Now the total num of ipa_if_num_tether_v4_total is %d on wan-iface(%s)\n",
+ IPACM_Wan::ipa_if_num_tether_v4_total,
+ IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].iface_name);
}
else
{
@@ -1655,7 +1681,8 @@
{
if(IPACM_Wan::ipa_if_num_tether_v6[i] == ipa_if_num_tether)
{
- IPACMDBG_H("Found tether client at position %d.\n", i);
+ IPACMDBG_H("Found tether client at position %d name(%s)\n", i,
+ IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether].iface_name);
break;
}
}
@@ -1670,7 +1697,9 @@
IPACM_Wan::ipa_if_num_tether_v6[j-1] = IPACM_Wan::ipa_if_num_tether_v6[j];
}
IPACM_Wan::ipa_if_num_tether_v6_total--;
- IPACMDBG_H("Now the total num of ipa_if_num_tether_v6_total is %d \n", IPACM_Wan::ipa_if_num_tether_v6_total);
+ IPACMDBG_H("Now the total num of ipa_if_num_tether_v6_total is %d on wan-iface(%s)\n",
+ IPACM_Wan::ipa_if_num_tether_v6_total,
+ IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].iface_name);
}
evt_data.evt_data = (void *)wandown_data;
IPACM_EvtDispatcher::PostEvt(&evt_data);
@@ -1733,6 +1762,51 @@
}
}
+ /* checking if the ipv4 same as default route */
+ if(wan_v6_addr_gw_set)
+ {
+ index = get_wan_client_index_ipv6(wan_v6_addr_gw);
+ if (index != IPACM_INVALID_INDEX)
+ {
+ IPACMDBG_H("Matched client index: %d\n", index);
+ IPACMDBG_H("Received Client MAC %02x:%02x:%02x:%02x:%02x:%02x\n",
+ get_client_memptr(wan_client, index)->mac[0],
+ get_client_memptr(wan_client, index)->mac[1],
+ get_client_memptr(wan_client, index)->mac[2],
+ get_client_memptr(wan_client, index)->mac[3],
+ get_client_memptr(wan_client, index)->mac[4],
+ get_client_memptr(wan_client, index)->mac[5]);
+ if(get_client_memptr(wan_client, index)->ipv6_header_set)
+ {
+ hdr_hdl_sta_v6 = get_client_memptr(wan_client, index)->hdr_hdl_v6;
+ header_set_v6 = true;
+ IPACMDBG_H("add full ipv6 header hdl: (%x)\n", get_client_memptr(wan_client, index)->hdr_hdl_v6);
+ }
+ else
+ {
+ IPACMERR(" wan-client got ipv6 however didn't construct complete ipv4 header \n");
+ return IPACM_FAILURE;
+ }
+
+ if(get_client_memptr(wan_client, index)->ipv4_header_set)
+ {
+ hdr_hdl_sta_v4 = get_client_memptr(wan_client, index)->hdr_hdl_v4;
+ header_set_v4 = true;
+ IPACMDBG_H("add full ipv4 header hdl: (%x)\n", get_client_memptr(wan_client, index)->hdr_hdl_v4);
+ }
+ else
+ {
+ IPACMERR(" wan-client got ipv4 however didn't construct complete ipv4 header \n");
+ return IPACM_FAILURE;
+ }
+ }
+ else
+ {
+ IPACMDBG_H(" currently can't find matched wan-client's MAC-addr, waiting for header construction\n");
+ return IPACM_SUCCESS;
+ }
+ }
+
/* see if default routes are setup before constructing full header */
if(header_partial_default_wan_v4 == true)
{
@@ -2988,13 +3062,8 @@
return IPACM_SUCCESS;
}
-int IPACM_Wan::init_fl_rule_ex(ipa_ip_type iptype)
+void IPACM_Wan::config_ip_type(ipa_ip_type iptype)
{
- int res = IPACM_SUCCESS;
-
- char *dev_wlan0="wlan0";
- char *dev_wlan1="wlan1";
- char *dev_ecm0="ecm0";
/* update the iface ip-type to be IPA_IP_v4, IPA_IP_v6 or both*/
if (iptype == IPA_IP_v4)
@@ -3003,7 +3072,7 @@
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;
+ return;
}
if (ip_type == IPA_IP_v6)
@@ -3021,7 +3090,7 @@
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;
+ return;
}
if (ip_type == IPA_IP_v4)
@@ -3036,6 +3105,17 @@
IPACMDBG_H(" interface(%s:%d) now ip-type is %d\n", dev_name, ipa_if_num, ip_type);
}
+ return;
+}
+
+int IPACM_Wan::init_fl_rule_ex(ipa_ip_type iptype)
+{
+ int res = IPACM_SUCCESS;
+
+ char *dev_wlan0="wlan0";
+ char *dev_wlan1="wlan1";
+ char *dev_ecm0="ecm0";
+
/* ADD corresponding ipa_rm_resource_name of RX-endpoint before adding all IPV4V6 FT-rules */
IPACMDBG_H(" dun add producer dependency from %s with registered rx-prop\n", dev_name);
@@ -5375,10 +5455,19 @@
IPACM_Iface::ipacmcfg->rt_tbl_v6.name,
sizeof(rt_rule->rt_tbl_name));
rt_rule->rt_tbl_name[IPA_RESOURCE_NAME_MAX-1] = '\0';
- /* Support QCMAP LAN traffic feature, send to A5 */
- rt_rule_entry->rule.dst = iface_query->excp_pipe;
+ /* Uplink going to wan clients should go to IPA */
+ if (IPACM_Iface::ipacmcfg->isMCC_Mode == true)
+ {
+ IPACMDBG_H("In MCC mode, use alt dst pipe: %d\n",
+ tx_prop->tx[tx_index].alt_dst_pipe);
+ rt_rule_entry->rule.dst = tx_prop->tx[tx_index].alt_dst_pipe;
+ }
+ else
+ {
+ rt_rule_entry->rule.dst = tx_prop->tx[tx_index].dst_pipe;
+ }
memset(&rt_rule_entry->rule.attrib, 0, sizeof(rt_rule_entry->rule.attrib));
- rt_rule_entry->rule.hdr_hdl = 0;
+ rt_rule_entry->rule.hdr_hdl = get_client_memptr(wan_client, wan_index)->hdr_hdl_v6;;
rt_rule_entry->rule.attrib.attrib_mask |= IPA_FLT_DST_ADDR;
rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = get_client_memptr(wan_client, wan_index)->v6_addr[v6_num][0];
rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = get_client_memptr(wan_client, wan_index)->v6_addr[v6_num][1];
@@ -5404,21 +5493,12 @@
IPACM_Iface::ipacmcfg->rt_tbl_wan_v6.name,
sizeof(rt_rule->rt_tbl_name));
rt_rule->rt_tbl_name[IPA_RESOURCE_NAME_MAX-1] = '\0';
- /* Downlink traffic from Wan iface, directly through IPA */
- if (IPACM_Iface::ipacmcfg->isMCC_Mode == true)
- {
- IPACMDBG_H("In MCC mode, use alt dst pipe: %d\n",
- tx_prop->tx[tx_index].alt_dst_pipe);
- rt_rule_entry->rule.dst = tx_prop->tx[tx_index].alt_dst_pipe;
- }
- else
- {
- rt_rule_entry->rule.dst = tx_prop->tx[tx_index].dst_pipe;
- }
+ /* Downlink traffic from Wan clients, should go exception */
+ rt_rule_entry->rule.dst = iface_query->excp_pipe;
memcpy(&rt_rule_entry->rule.attrib,
&tx_prop->tx[tx_index].attrib,
sizeof(rt_rule_entry->rule.attrib));
- rt_rule_entry->rule.hdr_hdl = get_client_memptr(wan_client, wan_index)->hdr_hdl_v6;
+ rt_rule_entry->rule.hdr_hdl = 0;
rt_rule_entry->rule.attrib.attrib_mask |= IPA_FLT_DST_ADDR;
rt_rule_entry->rule.attrib.u.v6.dst_addr[0] = get_client_memptr(wan_client, wan_index)->v6_addr[v6_num][0];
rt_rule_entry->rule.attrib.u.v6.dst_addr[1] = get_client_memptr(wan_client, wan_index)->v6_addr[v6_num][1];
diff --git a/ipacm/src/IPACM_Wlan.cpp b/ipacm/src/IPACM_Wlan.cpp
index be2b89d..921eddb 100644
--- a/ipacm/src/IPACM_Wlan.cpp
+++ b/ipacm/src/IPACM_Wlan.cpp
@@ -410,9 +410,10 @@
IPACMERR("No event data is found.\n");
return;
}
- IPACMDBG_H("Backhaul is sta mode?%d, if_index_tether:%d\n", data_wan_tether->is_sta,
- data_wan_tether->if_index_tether);
- if (iface_ipa_index_query(data_wan_tether->if_index_tether) == ipa_if_num)
+ IPACMDBG_H("Backhaul is sta mode?%d, if_index_tether:%d tether_if_name:%s\n", data_wan_tether->is_sta,
+ data_wan_tether->if_index_tether,
+ IPACM_Iface::ipacmcfg->iface_table[data_wan_tether->if_index_tether].iface_name);
+ if (data_wan_tether->if_index_tether == ipa_if_num)
{
if(ip_type == IPA_IP_v4 || ip_type == IPA_IP_MAX)
{
@@ -438,9 +439,10 @@
IPACMERR("No event data is found.\n");
return;
}
- IPACMDBG_H("Backhaul is sta mode?%d, if_index_tether:%d\n", data_wan_tether->is_sta,
- data_wan_tether->if_index_tether);
- if (iface_ipa_index_query(data_wan_tether->if_index_tether) == ipa_if_num)
+ IPACMDBG_H("Backhaul is sta mode?%d, if_index_tether:%d tether_if_name:%s\n", data_wan_tether->is_sta,
+ data_wan_tether->if_index_tether,
+ IPACM_Iface::ipacmcfg->iface_table[data_wan_tether->if_index_tether].iface_name);
+ if (data_wan_tether->if_index_tether == ipa_if_num)
{
if(ip_type == IPA_IP_v6 || ip_type == IPA_IP_MAX)
{
@@ -469,10 +471,10 @@
IPACMERR("No event data is found.\n");
return;
}
- IPACMDBG_H("Backhaul is sta mode?%d, if_index_tether:%d, itself %d\n", data_wan_tether->is_sta,
- iface_ipa_index_query(data_wan_tether->if_index_tether),
- ipa_if_num);
- if (iface_ipa_index_query(data_wan_tether->if_index_tether) == ipa_if_num)
+ IPACMDBG_H("Backhaul is sta mode?%d, if_index_tether:%d tether_if_name:%s\n", data_wan_tether->is_sta,
+ data_wan_tether->if_index_tether,
+ IPACM_Iface::ipacmcfg->iface_table[data_wan_tether->if_index_tether].iface_name);
+ if (data_wan_tether->if_index_tether == ipa_if_num)
{
if(data_wan_tether->is_sta == false && wlan_ap_index > 0)
{
@@ -497,10 +499,10 @@
IPACMERR("No event data is found.\n");
return;
}
- IPACMDBG_H("Backhaul is sta mode?%d, if_index_tether:%d, itself %d\n", data_wan_tether->is_sta,
- iface_ipa_index_query(data_wan_tether->if_index_tether),
- ipa_if_num);
- if (iface_ipa_index_query(data_wan_tether->if_index_tether) == ipa_if_num)
+ IPACMDBG_H("Backhaul is sta mode?%d, if_index_tether:%d tether_if_name:%s\n", data_wan_tether->is_sta,
+ data_wan_tether->if_index_tether,
+ IPACM_Iface::ipacmcfg->iface_table[data_wan_tether->if_index_tether].iface_name);
+ if (data_wan_tether->if_index_tether == ipa_if_num)
{
/* clean up v6 RT rules*/
IPACMDBG_H("Received IPA_WAN_V6_DOWN in WLAN-instance and need clean up client IPv6 address \n");