diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2015-04-21 06:28:08 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-04-21 06:28:08 -0700 |
commit | 53251c6f1aff7c4343ee2baa4cfe687fa6635ea6 (patch) | |
tree | 66a0c2739c26e8681798880904a75b99fcf841d8 /ipacm/src/IPACM_Conntrack_NATApp.cpp | |
parent | 343fefc7d7511a260c639d4e763713a2b1b4657e (diff) | |
parent | bc9fa75d233819c9212f15fb9be5a1a6f25f6cb3 (diff) | |
download | ipacfg-mgr-53251c6f1aff7c4343ee2baa4cfe687fa6635ea6.tar.gz |
Merge "IPACM: Delete nat entries from cache"
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 ff02c2a..4e7338e 100644 --- a/ipacm/src/IPACM_Conntrack_NATApp.cpp +++ b/ipacm/src/IPACM_Conntrack_NATApp.cpp @@ -468,7 +468,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 { @@ -677,12 +678,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 && @@ -694,7 +713,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; } @@ -722,7 +741,7 @@ void NatApp::DeleteTempEntry(const nat_table_entry *entry) } } - IPACMDBG("No Such Entry exists\n"); + IPACMDBG("No Such Temp Entry exists\n"); return; } @@ -816,6 +835,7 @@ int NatApp::DelEntriesOnSTAClntDiscon(uint32_t ip_addr) return -1; } + for(cnt = 0; cnt < max_entries; cnt++) { if(cache[cnt].target_ip == ip_addr) |