IPACM: ignore early IPv6 default route event
Ignore IPv6 default route event that comes earlier than
global IP.
Change-Id: I24f10d59568712aab000619313bb3abc9ac91f6a
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
diff --git a/ipacm/src/IPACM_Wan.cpp b/ipacm/src/IPACM_Wan.cpp
index 90bd1ce..dabc6d5 100644
--- a/ipacm/src/IPACM_Wan.cpp
+++ b/ipacm/src/IPACM_Wan.cpp
@@ -730,6 +730,12 @@
}
else if ((data->iptype == IPA_IP_v6) && (ip_type == IPA_IP_v6 || ip_type == IPA_IP_MAX))
{
+ if(ipv6_prefix[0] == 0 && ipv6_prefix[1] == 0)
+ {
+ IPACMDBG_H("IPv6 default route comes earlier than global IP, ignore.\n");
+ return;
+ }
+
if (active_v6 == false)
{
IPACMDBG_H("\n get default v6 route (dst:00.00.00.00) upstream\n");
@@ -885,6 +891,12 @@
(!data->ipv6_addr[0]) && (!data->ipv6_addr[1]) && (!data->ipv6_addr[2]) && (!data->ipv6_addr[3]) &&
(active_v6 == false) && (ip_type == IPA_IP_v6 || ip_type == IPA_IP_MAX))
{
+ if(ipv6_prefix[0] == 0 && ipv6_prefix[1] == 0)
+ {
+ IPACMDBG_H("IPv6 default route comes earlier than global IP, ignore.\n");
+ return;
+ }
+
IPACMDBG_H("\n get default v6 route (dst:00.00.00.00)\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]);
@@ -1206,8 +1218,6 @@
is_default_gateway = true;
IPACMDBG_H("Default route is added to iface %s.\n", dev_name);
- memcpy(backhaul_ipv6_prefix, ipv6_prefix, sizeof(backhaul_ipv6_prefix));
- IPACMDBG_H("Setup backhaul ipv6 prefix to be 0x%08x%08x.\n", backhaul_ipv6_prefix[0], backhaul_ipv6_prefix[1]);
if(IPACM_Iface::ipacmcfg->iface_table[ipa_if_num].if_mode == BRIDGE)
{
@@ -1533,6 +1543,9 @@
}
else
{
+ memcpy(backhaul_ipv6_prefix, ipv6_prefix, sizeof(backhaul_ipv6_prefix));
+ IPACMDBG_H("Setup backhaul ipv6 prefix to be 0x%08x%08x.\n", backhaul_ipv6_prefix[0], backhaul_ipv6_prefix[1]);
+
IPACM_Wan::wan_up_v6 = true;
active_v6 = true;
memcpy(IPACM_Wan::wan_up_dev_name,