diff options
author | Skylar Chang <chiaweic@codeaurora.org> | 2015-04-15 17:06:36 -0700 |
---|---|---|
committer | Skylar Chang <chiaweic@codeaurora.org> | 2015-04-15 17:14:49 -0700 |
commit | bc9fa75d233819c9212f15fb9be5a1a6f25f6cb3 (patch) | |
tree | 58d269f3b69ab4e38ad5a74950be5e32a6014fb5 /ipacm/src/IPACM_Conntrack_NATApp.cpp | |
parent | d2c7e32758b4bc2cb7273c0ec94b61766c0ff9d5 (diff) | |
download | ipacfg-mgr-bc9fa75d233819c9212f15fb9be5a1a6f25f6cb3.tar.gz |
IPACM: Delete nat entries from cache
On receiving connection destroy event delete nat
entries from both temp and cache
Acked-by: Sunil Paidimarri <hisunil@qti.qualcomm.com>
Change-Id: I500430fe4ae22d74433c4d9f664869c1dc2140d8
Diffstat (limited to 'ipacm/src/IPACM_Conntrack_NATApp.cpp')
-rw-r--r-- | ipacm/src/IPACM_Conntrack_NATApp.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/ipacm/src/IPACM_Conntrack_NATApp.cpp b/ipacm/src/IPACM_Conntrack_NATApp.cpp index bf0daac..9f49f20 100644 --- a/ipacm/src/IPACM_Conntrack_NATApp.cpp +++ b/ipacm/src/IPACM_Conntrack_NATApp.cpp @@ -479,7 +479,8 @@ void NatApp::UpdateCTUdpTs(nat_table_entry *rule, uint32_t new_ts) ret = nfct_query(ct_hdl, NFCT_Q_UPDATE, ct); if(ret == -1) { - PERROR("unable to update time stamp"); + IPACMERR("unable to update time stamp"); + DeleteEntry(rule); } else { @@ -688,12 +689,30 @@ void NatApp::AddTempEntry(const nat_table_entry *new_entry) { int cnt; - IPACMDBG("Received below nat entry\n"); + IPACMDBG("Received below Temp Nat entry\n"); iptodot("Private IP", new_entry->private_ip); iptodot("Target IP", new_entry->target_ip); IPACMDBG("Private Port: %d\t Target Port: %d\t", new_entry->private_port, new_entry->target_port); IPACMDBG("protocolcol: %d\n", new_entry->protocol); + if(ChkForDup(new_entry)) + { + return; + } + + for(cnt=0; cnt<MAX_TEMP_ENTRIES; cnt++) + { + if(temp[cnt].private_ip == new_entry->private_ip && + temp[cnt].target_ip == new_entry->target_ip && + temp[cnt].private_port == new_entry->private_port && + temp[cnt].target_port == new_entry->target_port && + temp[cnt].protocol == new_entry->protocol) + { + IPACMDBG("Received duplicate Temp entry\n"); + return; + } + } + for(cnt=0; cnt<MAX_TEMP_ENTRIES; cnt++) { if(temp[cnt].private_ip == 0 && @@ -705,7 +724,7 @@ void NatApp::AddTempEntry(const nat_table_entry *new_entry) } } - IPACMDBG("unable to add temp entry, cache full\n"); + IPACMDBG("Unable to add temp entry, cache full\n"); return; } @@ -733,7 +752,7 @@ void NatApp::DeleteTempEntry(const nat_table_entry *entry) } } - IPACMDBG("No Such Entry exists\n"); + IPACMDBG("No Such Temp Entry exists\n"); return; } @@ -827,6 +846,7 @@ int NatApp::DelEntriesOnSTAClntDiscon(uint32_t ip_addr) return -1; } + for(cnt = 0; cnt < max_entries; cnt++) { if(cache[cnt].target_ip == ip_addr) |