summaryrefslogtreecommitdiff
path: root/ipacm/src/IPACM_Conntrack_NATApp.cpp
diff options
context:
space:
mode:
authorSkylar Chang <chiaweic@codeaurora.org>2015-03-27 20:28:35 -0700
committerSkylar Chang <chiaweic@codeaurora.org>2015-04-02 18:23:08 -0700
commit9b85a079490fe3dd3bf176af6aa3f81eb178eb63 (patch)
tree1ff83c7675464e5058268b5ae9044eff0350c52d /ipacm/src/IPACM_Conntrack_NATApp.cpp
parent82e8c94ab624502e9628f93e23bc947200369840 (diff)
downloadipacfg-mgr-9b85a079490fe3dd3bf176af6aa3f81eb178eb63.tar.gz
IPACM: First AP+STA connection is taking sw path
cache the nat connection if external AP client neighbour ip address event doest not received Add the cached connection to IPA HW table on receiving external AP client neighbour ip address event Change-Id: I92f7f934ef83cb539e340ff1f0aaaa2dd23b56f8 Acked-by: Sunil Paidimarri <hisunil@qti.qualcomm.com>
Diffstat (limited to 'ipacm/src/IPACM_Conntrack_NATApp.cpp')
-rw-r--r--ipacm/src/IPACM_Conntrack_NATApp.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/ipacm/src/IPACM_Conntrack_NATApp.cpp b/ipacm/src/IPACM_Conntrack_NATApp.cpp
index 0915fda..bf0daac 100644
--- a/ipacm/src/IPACM_Conntrack_NATApp.cpp
+++ b/ipacm/src/IPACM_Conntrack_NATApp.cpp
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
+Copyright (c) 2013-2015, 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
@@ -573,7 +573,6 @@ int NatApp::UpdatePwrSaveIf(uint32_t client_lan_ip)
}
}
-
for(cnt = 0; cnt < IPA_MAX_NUM_WIFI_CLIENTS; cnt++)
{
if(PwrSaveIfs[cnt] == 0)
@@ -772,7 +771,7 @@ void NatApp::FlushTempEntries(uint32_t ip_addr, bool isAdd)
int NatApp::DelEntriesOnClntDiscon(uint32_t ip_addr)
{
- int cnt, tmp = curCnt;
+ int cnt, tmp = 0;
IPACMDBG("Received IP address: 0x%x\n", ip_addr);
if(ip_addr == INVALID_IP_ADDR)
@@ -781,39 +780,40 @@ int NatApp::DelEntriesOnClntDiscon(uint32_t ip_addr)
return -1;
}
+ for(cnt = 0; cnt < IPA_MAX_NUM_WIFI_CLIENTS; cnt++)
+ {
+ if(PwrSaveIfs[cnt] == ip_addr)
+ {
+ PwrSaveIfs[cnt] = 0;
+ IPACMDBG("Remove %d power save entry\n", cnt);
+ break;
+ }
+ }
- for(cnt = 0; cnt < IPA_MAX_NUM_WIFI_CLIENTS; cnt++)
- {
- if(PwrSaveIfs[cnt] == ip_addr)
- {
- PwrSaveIfs[cnt] = 0;
- IPACMDBG("Remove %d power save entry\n", cnt);
- break;
- }
- }
-
- for(cnt = 0; cnt < max_entries; cnt++)
- {
- if(cache[cnt].private_ip == ip_addr)
+ for(cnt = 0; cnt < max_entries; cnt++)
{
- if(cache[cnt].enabled == true)
- {
- if(ipa_nat_del_ipv4_rule(nat_table_hdl, cache[cnt].rule_hdl) < 0)
+ if(cache[cnt].private_ip == ip_addr)
+ {
+ if(cache[cnt].enabled == true)
{
- IPACMERR("unable to delete the rule\n");
- continue;
+ if(ipa_nat_del_ipv4_rule(nat_table_hdl, cache[cnt].rule_hdl) < 0)
+ {
+ IPACMERR("unable to delete the rule\n");
+ continue;
+ }
+ else
+ {
+ IPACMDBG("won't delete the rule\n");
+ cache[cnt].enabled = false;
+ tmp++;
+ }
}
- else
- {
- IPACMDBG("won't delete the rule\n");
- cache[cnt].enabled = false;
- }
- }
- IPACMDBG("won't delete the rule for entry %d, enabled %d\n",cnt, cache[cnt].enabled);
+ IPACMDBG("won't delete the rule for entry %d, enabled %d\n",cnt, cache[cnt].enabled);
+ }
}
- }
- IPACMDBG("Deleted %d entries\n", (tmp - curCnt));
- return 0;
+
+ IPACMDBG("Deleted (but cached) %d entries\n", tmp);
+ return 0;
}
int NatApp::DelEntriesOnSTAClntDiscon(uint32_t ip_addr)
@@ -827,7 +827,6 @@ int NatApp::DelEntriesOnSTAClntDiscon(uint32_t ip_addr)
return -1;
}
-
for(cnt = 0; cnt < max_entries; cnt++)
{
if(cache[cnt].target_ip == ip_addr)
@@ -893,6 +892,7 @@ void NatApp::CacheEntry(const nat_table_entry *rule)
cache[cnt].protocol = rule->protocol;
cache[cnt].timestamp = 0;
cache[cnt].public_port = rule->public_port;
+ cache[cnt].public_ip = rule->public_ip;
cache[cnt].dst_nat = rule->dst_nat;
curCnt++;
}