From 2e0b44cc7059f9a90e131ef26b6b3c52fc6f686f Mon Sep 17 00:00:00 2001 From: Mohammed Javid Date: Mon, 22 Jan 2018 12:11:41 +0530 Subject: ipacm: Fix KW issue Fix KW issue and remove conditional check which is always true. Change-Id: I902b56c3eab262798813e3c9c6d920665e5ecb99 --- ipacm/src/IPACM_CmdQueue.cpp | 13 +++++-- ipacm/src/IPACM_ConntrackClient.cpp | 6 +-- ipacm/src/IPACM_ConntrackListener.cpp | 73 ++++++++++++++++------------------- ipacm/src/IPACM_Conntrack_NATApp.cpp | 23 +++++++---- ipacm/src/IPACM_EvtDispatcher.cpp | 6 +-- ipacm/src/IPACM_Filtering.cpp | 24 ++++++------ 6 files changed, 75 insertions(+), 70 deletions(-) diff --git a/ipacm/src/IPACM_CmdQueue.cpp b/ipacm/src/IPACM_CmdQueue.cpp index c612b7f..3a2d470 100644 --- a/ipacm/src/IPACM_CmdQueue.cpp +++ b/ipacm/src/IPACM_CmdQueue.cpp @@ -1,5 +1,5 @@ /* -Copyright (c) 2013-2016, The Linux Foundation. All rights reserved. +Copyright (c) 2013-2018, 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 @@ -123,6 +123,7 @@ void* MessageQueue::Process(void *param) MessageQueue *MsgQueueExternal = NULL; Message *item = NULL; param = NULL; + const char *eventName = NULL; IPACMDBG("MessageQueue::Process()\n"); @@ -160,8 +161,12 @@ void* MessageQueue::Process(void *param) } else { - IPACMDBG("Get event %s from internal queue.\n", - IPACM_Iface::ipacmcfg->getEventName(item->evt.data.event)); + eventName = IPACM_Iface::ipacmcfg->getEventName(item->evt.data.event); + if (eventName != NULL) + { + IPACMDBG("Get event %s from internal queue.\n", + eventName); + } } if(item == NULL) @@ -196,7 +201,7 @@ void* MessageQueue::Process(void *param) return NULL; } - IPACMDBG("Processing item %p event ID: %d\n",item,item->evt.data.event); + IPACMDBG("Processing item %pK event ID: %d\n",item,item->evt.data.event); item->evt.callback_ptr(&item->evt.data); delete item; item = NULL; diff --git a/ipacm/src/IPACM_ConntrackClient.cpp b/ipacm/src/IPACM_ConntrackClient.cpp index 3eab6fa..8a2499c 100644 --- a/ipacm/src/IPACM_ConntrackClient.cpp +++ b/ipacm/src/IPACM_ConntrackClient.cpp @@ -1,5 +1,5 @@ /* -Copyright (c) 2013-2016, The Linux Foundation. All rights reserved. +Copyright (c) 2013-2018, 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 @@ -177,8 +177,6 @@ int IPACM_ConntrackClient::IPA_Conntrack_Filters_Ignore_Bridge_Addrs /* retrieve bridge interface ipv4 address */ memset(&ifr, 0, sizeof(struct ifreq)); ifr.ifr_addr.sa_family = AF_INET; - (void)strlcpy(ifr.ifr_name, IPACM_Iface::ipacmcfg->ipa_virtual_iface_name, sizeof(ifr.ifr_name)); - IPACMDBG("bridge interface name (%s)\n", ifr.ifr_name); if(strlen(IPACM_Iface::ipacmcfg->ipa_virtual_iface_name) >= sizeof(ifr.ifr_name)) { @@ -187,6 +185,8 @@ int IPACM_ConntrackClient::IPA_Conntrack_Filters_Ignore_Bridge_Addrs close(fd); return -1; } + (void)strlcpy(ifr.ifr_name, IPACM_Iface::ipacmcfg->ipa_virtual_iface_name, sizeof(ifr.ifr_name)); + IPACMDBG("bridge interface name (%s)\n", ifr.ifr_name); ret = ioctl(fd, SIOCGIFADDR, &ifr); if (ret < 0) diff --git a/ipacm/src/IPACM_ConntrackListener.cpp b/ipacm/src/IPACM_ConntrackListener.cpp index 4a0c1c1..29a70b9 100644 --- a/ipacm/src/IPACM_ConntrackListener.cpp +++ b/ipacm/src/IPACM_ConntrackListener.cpp @@ -1,5 +1,5 @@ /* -Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. +Copyright (c) 2013-2018, 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 @@ -1037,9 +1037,9 @@ void IPACM_ConntrackListener::ProcessTCPorUDPMsg( nat_entry.ct = ct; nat_entry.type = type; - memset(&rule, 0, sizeof(rule)); - IPACMDBG("Received type:%d with proto:%d\n", type, l4proto); - status = nfct_get_attr_u32(ct, ATTR_STATUS); + memset(&rule, 0, sizeof(rule)); + IPACMDBG("Received type:%d with proto:%d\n", type, l4proto); + status = nfct_get_attr_u32(ct, ATTR_STATUS); /* Retrieve Protocol */ rule.protocol = nfct_get_attr_u8(ct, ATTR_REPL_L4PROTO); @@ -1089,47 +1089,40 @@ void IPACM_ConntrackListener::ProcessTCPorUDPMsg( #ifdef CT_OPT HandleLan2Lan(ct, type, &rule); #endif - return; + IPACMDBG("Neither source Nor destination nat\n"); + goto IGNORE; } - } + } - if(IPS_DST_NAT == status || IPS_SRC_NAT == status) - { - PopulateTCPorUDPEntry(ct, status, &rule); - rule.public_ip = wan_ipaddr; - } - else - { - IPACMDBG("Neither source Nor destination nat\n"); - goto IGNORE; - } + PopulateTCPorUDPEntry(ct, status, &rule); + rule.public_ip = wan_ipaddr; - if (rule.private_ip != wan_ipaddr) - { - isAdd = AddIface(&rule, &nat_entry.isTempEntry); - if (!isAdd) - { - goto IGNORE; - } - } - else - { - if (isStaMode) - { - IPACMDBG("In STA mode, ignore connections destinated to STA interface\n"); - goto IGNORE; - } + if (rule.private_ip != wan_ipaddr) + { + isAdd = AddIface(&rule, &nat_entry.isTempEntry); + if (!isAdd) + { + goto IGNORE; + } + } + else + { + if (isStaMode) + { + IPACMDBG("In STA mode, ignore connections destinated to STA interface\n"); + goto IGNORE; + } - IPACMDBG("For embedded connections add dummy nat rule\n"); - IPACMDBG("Change private port %d to %d\n", - rule.private_port, rule.public_port); - rule.private_port = rule.public_port; - } + IPACMDBG("For embedded connections add dummy nat rule\n"); + IPACMDBG("Change private port %d to %d\n", + rule.private_port, rule.public_port); + rule.private_port = rule.public_port; + } - CheckSTAClient(&rule, &nat_entry.isTempEntry); - nat_entry.rule = &rule; - AddORDeleteNatEntry(&nat_entry); - return; + CheckSTAClient(&rule, &nat_entry.isTempEntry); + nat_entry.rule = &rule; + AddORDeleteNatEntry(&nat_entry); + return; IGNORE: IPACMDBG_H("ignoring below Nat Entry\n"); diff --git a/ipacm/src/IPACM_Conntrack_NATApp.cpp b/ipacm/src/IPACM_Conntrack_NATApp.cpp index 27bf95a..4004597 100644 --- a/ipacm/src/IPACM_Conntrack_NATApp.cpp +++ b/ipacm/src/IPACM_Conntrack_NATApp.cpp @@ -1,5 +1,5 @@ /* -Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. +Copyright (c) 2013-2018, 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 @@ -94,11 +94,7 @@ int NatApp::Init(void) } memset(pALGPorts, 0, sizeof(ipacm_alg) * nALGPort); - if(pConfig->GetAlgPorts(nALGPort, pALGPorts) != 0) - { - IPACMERR("Unable to retrieve ALG prots\n"); - goto fail; - } + pConfig->GetAlgPorts(nALGPort, pALGPorts); IPACMDBG("Printing %d alg ports information\n", nALGPort); for(int cnt=0; cntenqueue(item); - IPACMDBG("Enqueued item %p\n", item); + IPACMDBG("Enqueued item %pK\n", item); if(pthread_cond_signal(&cond_var) != 0) { @@ -141,7 +141,7 @@ void IPACM_EvtDispatcher::ProcessEvt(ipacm_cmd_q_data *data) if(data->evt_data != NULL) { - IPACMDBG("free the event:%d data: %p\n", data->event, data->evt_data); + IPACMDBG("free the event:%d data: %pK\n", data->event, data->evt_data); free(data->evt_data); } return; diff --git a/ipacm/src/IPACM_Filtering.cpp b/ipacm/src/IPACM_Filtering.cpp index 411fe90..3545d81 100644 --- a/ipacm/src/IPACM_Filtering.cpp +++ b/ipacm/src/IPACM_Filtering.cpp @@ -1,5 +1,5 @@ /* -Copyright (c) 2013-2016, The Linux Foundation. All rights reserved. +Copyright (c) 2013-2018, 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 @@ -87,7 +87,7 @@ bool IPACM_Filtering::AddFilteringRule(struct ipa_ioc_add_flt_rule const *ruleTa retval = ioctl(fd, IPA_IOC_ADD_FLT_RULE, ruleTable); if (retval != 0) { - IPACMERR("Failed adding Filtering rule %p\n", ruleTable); + IPACMERR("Failed adding Filtering rule %pK\n", ruleTable); PERROR("unable to add filter rule:"); for (int cnt = 0; cnt < ruleTable->num_rules; cnt++) @@ -110,7 +110,7 @@ bool IPACM_Filtering::AddFilteringRule(struct ipa_ioc_add_flt_rule const *ruleTa } } - IPACMDBG("Added Filtering rule %p\n", ruleTable); + IPACMDBG("Added Filtering rule %pK\n", ruleTable); return true; } @@ -138,13 +138,13 @@ bool IPACM_Filtering::AddFilteringRuleAfter(struct ipa_ioc_add_flt_rule_after co if (retval != 0) { - IPACMERR("Failed adding Filtering rule %p\n", ruleTable); + IPACMERR("Failed adding Filtering rule %pK\n", ruleTable); return false; } - IPACMDBG("Added Filtering rule %p\n", ruleTable); + IPACMDBG("Added Filtering rule %pK\n", ruleTable); #else if (ruleTable) - IPACMERR("Not support adding Filtering rule %p\n", ruleTable); + IPACMERR("Not support adding Filtering rule %pK\n", ruleTable); #endif return true; } @@ -156,11 +156,11 @@ bool IPACM_Filtering::DeleteFilteringRule(struct ipa_ioc_del_flt_rule *ruleTable retval = ioctl(fd, IPA_IOC_DEL_FLT_RULE, ruleTable); if (retval != 0) { - IPACMERR("Failed deleting Filtering rule %p\n", ruleTable); + IPACMERR("Failed deleting Filtering rule %pK\n", ruleTable); return false; } - IPACMDBG("Deleted Filtering rule %p\n", ruleTable); + IPACMDBG("Deleted Filtering rule %pK\n", ruleTable); return true; } @@ -450,7 +450,7 @@ bool IPACM_Filtering::AddWanDLFilteringRule(struct ipa_ioc_add_flt_rule const *r ret = ioctl(fd_wwan_ioctl, WAN_IOC_ADD_FLT_RULE_EX, &qmi_rule_ex_msg); if (ret != 0) { - IPACMERR("Failed adding Filtering rule %p with ret %d\n ", &qmi_rule_ex_msg, ret); + IPACMERR("Failed adding Filtering rule %pK with ret %d\n ", &qmi_rule_ex_msg, ret); close(fd_wwan_ioctl); return false; } @@ -474,12 +474,12 @@ bool IPACM_Filtering::SendFilteringRuleIndex(struct ipa_fltr_installed_notif_req ret = ioctl(fd_wwan_ioctl, WAN_IOC_ADD_FLT_RULE_INDEX, table); if (ret != 0) { - IPACMERR("Failed adding filtering rule index %p with ret %d\n", table, ret); + IPACMERR("Failed adding filtering rule index %pK with ret %d\n", table, ret); close(fd_wwan_ioctl); return false; } - IPACMDBG("Added Filtering rule index %p\n", table); + IPACMDBG("Added Filtering rule index %pK\n", table); close(fd_wwan_ioctl); return true; } @@ -520,7 +520,7 @@ bool IPACM_Filtering::ModifyFilteringRule(struct ipa_ioc_mdfy_flt_rule* ruleTabl ret = ioctl(fd, IPA_IOC_MDFY_FLT_RULE, ruleTable); if (ret != 0) { - IPACMERR("Failed modifying filtering rule %p\n", ruleTable); + IPACMERR("Failed modifying filtering rule %pK\n", ruleTable); for (i = 0; i < ruleTable->num_rules; i++) { -- cgit v1.2.3 From c4a4e3385d82da37738b14e8c582a2d9685fc35e Mon Sep 17 00:00:00 2001 From: Skylar Chang Date: Fri, 26 Jan 2018 14:56:28 -0800 Subject: ipacm: put rndis under wifi using SW-path When device in WIFI backhaul, make usb-tethering not ipa-offload because of the wifi-stats issue and wlan-team will only support WDI enable when WIFI + SoftAP enable at the same time Change-Id: I6b4ce88ec16fa49d5c0ba269b30cae6845af6ae1 --- ipacm/src/IPACM_Lan.cpp | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/ipacm/src/IPACM_Lan.cpp b/ipacm/src/IPACM_Lan.cpp index a1d2ab6..532269f 100644 --- a/ipacm/src/IPACM_Lan.cpp +++ b/ipacm/src/IPACM_Lan.cpp @@ -193,6 +193,14 @@ IPACM_Lan::IPACM_Lan(int iface_index) : IPACM_Iface(iface_index) memset(&prefix, 0, sizeof(prefix)); #ifdef FEATURE_IPACM_HAL + + /* check if Upstream was set before as WIFI with RNDIS case */ + if(ipa_if_cate == LAN_IF && IPACM_Wan::backhaul_is_sta_mode == true) /* LTE */ + { + IPACMDBG_H(" Skip the Upstream falg set on LAN instance (%d) with WIFI backhaul (%d)\n", ipa_if_cate, IPACM_Wan::backhaul_is_sta_mode ); /* RNDIS+WIFI not support on msm*/ + return; + } + /* check if Upstream was set before */ if (IPACM_Wan::isWanUP(ipa_if_num)) { @@ -227,6 +235,7 @@ void IPACM_Lan::event_callback(ipa_cm_event_id event, void *param) } int ipa_interface_index; + uint32_t i; ipacm_ext_prop* ext_prop; ipacm_event_iface_up_tehter* data_wan_tether; @@ -516,6 +525,45 @@ void IPACM_Lan::event_callback(ipa_cm_event_id event, void *param) IPACMERR("IPA_HANDLE_WAN_UP_TETHER tether_if(%d), not valid (%d) ignore\n", data_wan_tether->if_index_tether, ipa_if_num); return; } +#else /* not offload rndis on WIFI mode on MSM targets sky*/ + if (data_wan_tether->is_sta) + { + IPACMERR("Not support RNDIS offload on WIFI mode, dun install UL filter rules for WIFI mode\n"); + + /* clean rndis header, routing rules */ + IPACMDBG_H("left %d eth clients need to be deleted \n ", num_eth_client); + for (i = 0; i < num_eth_client; i++) + { + /* First reset nat rules and then route rules */ + if(get_client_memptr(eth_client, i)->ipv4_set == true) + { + IPACMDBG_H("Clean Nat Rules for ipv4:0x%x\n", get_client_memptr(eth_client, i)->v4_addr); + CtList->HandleNeighIpAddrDelEvt(get_client_memptr(eth_client, i)->v4_addr); + } + if (delete_eth_rtrules(i, IPA_IP_v4)) + IPACMERR("unbale to delete usb-client v4 route rules for index %d\n", i); + + if (delete_eth_rtrules(i, IPA_IP_v6)) + IPACMERR("unbale to delete ecm-client v6 route rules for index %d\n", i); + + IPACMDBG_H("Delete %d client header\n", num_eth_client); + + if(get_client_memptr(eth_client, i)->ipv4_header_set == true) + { + if (m_header.DeleteHeaderHdl(get_client_memptr(eth_client, i)->hdr_hdl_v4) + == false) + IPACMERR("unbale to delete usb-client v4 header for index %d\n", i); + } + + if(get_client_memptr(eth_client, i)->ipv6_header_set == true) + { + if (m_header.DeleteHeaderHdl(get_client_memptr(eth_client, i)->hdr_hdl_v6) + == false) + IPACMERR("unbale to delete usb-client v6 header for index %d\n", i); + } + } /* end of for loop */ + return; + } #endif if (ip_type == IPA_IP_v4 || ip_type == IPA_IP_MAX) { @@ -847,6 +895,14 @@ void IPACM_Lan::event_callback(ipa_cm_event_id event, void *param) IPACMDBG_H("Recieved IPA_NEIGH_CLIENT_IP_ADDR_ADD_EVENT event \n"); IPACMDBG_H("check iface %s category: %d\n", dev_name, ipa_if_cate); + /* if RNDIS under WIFI mode in MSM, dun add RT rule*/ +#ifdef FEATURE_IPACM_HAL + if(IPACM_Wan::backhaul_is_sta_mode == true) /* WIFI */ + { + IPACMDBG_H(" dun construct header and RT-rules for RNDIS-PC in WIFI mode on MSM targets (STA %d) \n", IPACM_Wan::backhaul_is_sta_mode); + return; + } +#endif if (ipa_interface_index == ipa_if_num && ipa_if_cate == ODU_IF) { IPACMDBG_H("ODU iface got v4-ip \n"); -- cgit v1.2.3 From ecbbf811402846cffd587a2a41c19210b39d0ec7 Mon Sep 17 00:00:00 2001 From: Mohammed Javid Date: Thu, 4 Jan 2018 12:45:45 +0530 Subject: ipacm: Support dynamic backhaul switch between LTE and STA Support dynamic backhaul switch between LTE and STA if framework failed to clean up previous backhaul settings Change-Id: I5b330f81ad5594c5e4c84730cdb414ee722818c3 --- ipacm/src/IPACM_OffloadManager.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ipacm/src/IPACM_OffloadManager.cpp b/ipacm/src/IPACM_OffloadManager.cpp index a42f919..85ef7e4 100644 --- a/ipacm/src/IPACM_OffloadManager.cpp +++ b/ipacm/src/IPACM_OffloadManager.cpp @@ -442,6 +442,17 @@ RET IPACM_OffloadManager::setUpstream(const char *upstream_name, const Prefix& g /* reset the stats when switch from LTE->STA */ if (index != default_gw_index) { IPACMDBG_H(" interface switched to %s\n", upstream_name); + if (upstream_v4_up == true) { + IPACMDBG_H("clean upstream for ipv4-fam(%d) upstream_v4_up(%d)\n", gw_addr_v4.fam, upstream_v4_up); + post_route_evt(IPA_IP_v4, default_gw_index, IPA_WAN_UPSTREAM_ROUTE_DEL_EVENT, gw_addr_v4); + upstream_v4_up = false; + } + if (upstream_v6_up == true) { + IPACMDBG_H("clean upstream for ipv6-fam(%d) upstream_v6_up(%d)\n", gw_addr_v6.fam, upstream_v6_up); + post_route_evt(IPA_IP_v6, default_gw_index, IPA_WAN_UPSTREAM_ROUTE_DEL_EVENT, gw_addr_v6); + upstream_v6_up = false; + } + default_gw_index = INVALID_IFACE; if(memcmp(upstream_name, "wlan0", sizeof("wlan0")) == 0) { IPACMDBG_H("switch to STA mode, need reset wlan-fw stats\n"); -- cgit v1.2.3 From 6e15ea2330039cf1d53af9e4cfab6162dbd709bc Mon Sep 17 00:00:00 2001 From: Mohammed Javid Date: Tue, 20 Feb 2018 17:06:13 +0530 Subject: ipacm: clean upstream if STA disconnected earlier If STA is disconnected, since interface is already down so clean upstream is not getting handled. Handle wan down event when interface is going down. Change-Id: I03d041db10eb072ef87d5f0c8ad88436e9744ab3 --- ipacm/src/IPACM_Wan.cpp | 65 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 59 insertions(+), 6 deletions(-) diff --git a/ipacm/src/IPACM_Wan.cpp b/ipacm/src/IPACM_Wan.cpp index 87ecb6d..a902457 100644 --- a/ipacm/src/IPACM_Wan.cpp +++ b/ipacm/src/IPACM_Wan.cpp @@ -4375,7 +4375,11 @@ int IPACM_Wan::config_dft_embms_rules(ipa_ioc_add_flt_rule *pFilteringTable_v4, int IPACM_Wan::handle_down_evt() { int res = IPACM_SUCCESS; - uint32_t i; + uint32_t i, tether_total; + int ipa_if_num_tether_tmp[IPA_MAX_IFACE_ENTRIES]; + + tether_total = 0; + memset(ipa_if_num_tether_tmp, 0, IPA_MAX_IFACE_ENTRIES); IPACMDBG_H(" wan handle_down_evt \n"); @@ -4396,22 +4400,61 @@ int IPACM_Wan::handle_down_evt() /* make sure default routing rules and firewall rules are deleted*/ if (active_v4) { - if (rx_prop != NULL) - { + if (rx_prop != NULL) + { del_dft_firewall_rules(IPA_IP_v4); } handle_route_del_evt(IPA_IP_v4); IPACMDBG_H("Delete default v4 routing rules\n"); + +#ifdef FEATURE_IPA_ANDROID + /* posting wan_down_tether for lan clients */ +#ifdef FEATURE_IPACM_HAL + IPACMDBG_H("Posting IPA_WAN_DOWN_TETHER_EVENT for IPV4\n"); + post_wan_down_tether_evt(IPA_IP_v4, 0); +#else + for (i=0; i < IPACM_Wan::ipa_if_num_tether_v4_total; i++) + { + ipa_if_num_tether_tmp[i] = IPACM_Wan::ipa_if_num_tether_v4[i]; + } + tether_total = IPACM_Wan::ipa_if_num_tether_v4_total; + for (i=0; i < tether_total; i++) + { + post_wan_down_tether_evt(IPA_IP_v4, ipa_if_num_tether_tmp[i]); + IPACMDBG_H("post_wan_down_tether_v4 iface(%d: %s)\n", + i, IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether_tmp[i]].iface_name); + } +#endif +#endif } if (active_v6) { - if (rx_prop != NULL) - { + if (rx_prop != NULL) + { del_dft_firewall_rules(IPA_IP_v6); } handle_route_del_evt(IPA_IP_v6); IPACMDBG_H("Delete default v6 routing rules\n"); +#ifdef FEATURE_IPA_ANDROID + /* posting wan_down_tether for lan clients */ +#ifdef FEATURE_IPACM_HAL + IPACMDBG_H("Posting IPA_WAN_DOWN_TETHER_EVENT for IPV6\n"); + post_wan_down_tether_evt(IPA_IP_v6, 0); +#else + for (i=0; i < IPACM_Wan::ipa_if_num_tether_v6_total; i++) + { + ipa_if_num_tether_tmp[i] = IPACM_Wan::ipa_if_num_tether_v6[i]; + } + tether_total = IPACM_Wan::ipa_if_num_tether_v6_total; + for (i=0; i < tether_total; i++) + { + post_wan_down_tether_evt(IPA_IP_v6, ipa_if_num_tether_tmp[i]); + IPACMDBG_H("post_wan_down_tether_v6 iface(%d: %s)\n", + i, IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether_tmp[i]].iface_name); + } +#endif +#endif } /* Delete default v4 RT rule */ @@ -4420,7 +4463,7 @@ int IPACM_Wan::handle_down_evt() IPACMDBG_H("Delete default v4 routing rules\n"); if (m_routing.DeleteRoutingHdl(dft_rt_rule_hdl[0], IPA_IP_v4) == false) { - IPACMERR("Routing rule deletion failed!\n"); + IPACMERR("Routing rule deletion failed!\n"); res = IPACM_FAILURE; goto fail; } @@ -4755,6 +4798,10 @@ int IPACM_Wan::handle_down_evt_ex() handle_route_del_evt_ex(IPA_IP_v4); #ifdef FEATURE_IPA_ANDROID /* posting wan_down_tether for all lan clients */ +#ifdef FEATURE_IPACM_HAL + IPACMDBG_H("Posting IPA_WAN_DOWN_TETHER_EVENT for IPV4\n"); + post_wan_down_tether_evt(IPA_IP_v4, 0); +#else for (i=0; i < IPACM_Wan::ipa_if_num_tether_v4_total; i++) { ipa_if_num_tether_tmp[i] = IPACM_Wan::ipa_if_num_tether_v4[i]; @@ -4766,12 +4813,17 @@ int IPACM_Wan::handle_down_evt_ex() IPACMDBG_H("post_wan_down_tether_v4 iface(%d: %s)\n", i, IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether_tmp[i]].iface_name); } +#endif #endif IPACM_Wan::wan_up_v6 = false; del_wan_firewall_rule(IPA_IP_v6); handle_route_del_evt_ex(IPA_IP_v6); #ifdef FEATURE_IPA_ANDROID /* posting wan_down_tether for all lan clients */ +#ifdef FEATURE_IPACM_HAL + IPACMDBG_H("Posting IPA_WAN_DOWN_TETHER_EVENT for IPV6\n"); + post_wan_down_tether_evt(IPA_IP_v6, 0); +#else for (i=0; i < IPACM_Wan::ipa_if_num_tether_v6_total; i++) { ipa_if_num_tether_tmp[i] = IPACM_Wan::ipa_if_num_tether_v6[i]; @@ -4783,6 +4835,7 @@ int IPACM_Wan::handle_down_evt_ex() IPACMDBG_H("post_wan_down_tether_v6 iface(%d: %s)\n", i, IPACM_Iface::ipacmcfg->iface_table[ipa_if_num_tether_tmp[i]].iface_name); } +#endif #endif memset(IPACM_Wan::wan_up_dev_name, 0, sizeof(IPACM_Wan::wan_up_dev_name)); -- cgit v1.2.3 From 55d5b035bd4ff1014da622833d970c5514c42d5a Mon Sep 17 00:00:00 2001 From: Mohammed Javid Date: Fri, 23 Feb 2018 02:56:54 +0530 Subject: ipacm: set upstream flag if downstream IP addr event come later If IPA_ADDR_EVENT for downstream event comes after IPA_WAN_UP_TETHER event, upstream flag is not getting set. So later even after receiving downstream event UL rules will not be installed. Set upstream flag after receiving IPA_WAN_UP_TETHER event Change-Id: I96c23b0e2e8aea20b5cdbf67a7f4d0d50b75e6db --- ipacm/src/IPACM_Lan.cpp | 12 ++++++++++++ ipacm/src/IPACM_Wlan.cpp | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/ipacm/src/IPACM_Lan.cpp b/ipacm/src/IPACM_Lan.cpp index 532269f..f7544e8 100644 --- a/ipacm/src/IPACM_Lan.cpp +++ b/ipacm/src/IPACM_Lan.cpp @@ -462,6 +462,18 @@ void IPACM_Lan::event_callback(ipa_cm_event_id event, void *param) } else { IPACMDBG_H("Wan_V6 haven't up yet\n"); } +#else + /* check if Upstream was set before */ + if (IPACM_Wan::isWanUP(ipa_if_num)) + { + IPACMDBG_H("Upstream was set previously for ipv4, change is_upstream_set flag\n"); + is_upstream_set[IPA_IP_v4] = true; + } + if (IPACM_Wan::isWanUP_V6(ipa_if_num)) + { + IPACMDBG_H("Upstream was set previously for ipv6, change is_upstream_set flag\n"); + is_upstream_set[IPA_IP_v6] = true; + } #endif /* Post event to NAT */ if (data->iptype == IPA_IP_v4) diff --git a/ipacm/src/IPACM_Wlan.cpp b/ipacm/src/IPACM_Wlan.cpp index 0669b80..a97c0a0 100644 --- a/ipacm/src/IPACM_Wlan.cpp +++ b/ipacm/src/IPACM_Wlan.cpp @@ -323,6 +323,18 @@ void IPACM_Wlan::event_callback(ipa_cm_event_id event, void *param) } else { IPACMDBG_H("Wan_V6 haven't up yet \n"); } +#else + /* check if Upstream was set before */ + if (IPACM_Wan::isWanUP(ipa_if_num)) + { + IPACMDBG_H("Upstream was set previously for ipv4, change is_upstream_set flag\n"); + is_upstream_set[IPA_IP_v4] = true; + } + if (IPACM_Wan::isWanUP_V6(ipa_if_num)) + { + IPACMDBG_H("Upstream was set previously for ipv6, change is_upstream_set flag\n"); + is_upstream_set[IPA_IP_v6] = true; + } #endif /* checking if SW-RT_enable */ if (IPACM_Iface::ipacmcfg->ipa_sw_rt_enable == true) -- cgit v1.2.3