diff options
author | Skylar Chang <chiaweic@codeaurora.org> | 2013-06-24 13:23:16 -0700 |
---|---|---|
committer | Skylar Chang <chiaweic@codeaurora.org> | 2013-06-24 13:33:58 -0700 |
commit | a781bccfec39e3bdf9e0668225e3a018f5f4f687 (patch) | |
tree | ee858ff2aab708ec35fa159ff563c554a12d3831 /ipanat | |
parent | 3dc1e7586d95cb290f68a1b57c476d59eeba432c (diff) | |
download | ipacfg-mgr-a781bccfec39e3bdf9e0668225e3a018f5f4f687.tar.gz |
Fix loop issue in IPANAT table
while deleting nat entry from ipa nat table, we see
previous index is not properly edited which is causing
ipa nat table to go in bad state. Fix ti to reset the
previous index value during delete operation
before doing any operation
Change-Id: I7a46837096124f4cf78062953988a71c50604b97
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
Diffstat (limited to 'ipanat')
-rwxr-xr-x[-rw-r--r--] | ipanat/src/ipa_nat_drvi.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/ipanat/src/ipa_nat_drvi.c b/ipanat/src/ipa_nat_drvi.c index a46bab2..692509f 100644..100755 --- a/ipanat/src/ipa_nat_drvi.c +++ b/ipanat/src/ipa_nat_drvi.c @@ -56,6 +56,11 @@ void UpdateSwSpecParams(struct ipa_nat_rule *rule, if(IPA_NAT_SW_PARAM_INDX_TBL_ENTRY_BYTE == param_type) { value = (value << INDX_TBL_ENTRY_SIZE_IN_BITS); + temp &= 0x0000FFFF; + } + else + { + temp &= 0xFFFF0000; } temp = (temp | value); @@ -571,7 +576,7 @@ uint16_t ipa_nati_make_rule_hdl(uint16_t tbl_hdl, } } - return cnt; + return 0; } /** @@ -2242,7 +2247,7 @@ void ipa_nat_dump_ipv4_table(uint32_t tbl_hdl) { atl_one = 1; ipa_nati_print_rule(&tbl_ptr[cnt], - (cnt + ipv4_nat_cache.ip4_tbl[tbl_hdl-1].table_entries -1)); + (cnt + ipv4_nat_cache.ip4_tbl[tbl_hdl-1].table_entries)); } } if(!atl_one) @@ -2288,7 +2293,7 @@ void ipa_nat_dump_ipv4_table(uint32_t tbl_hdl) { atl_one = 1; ipa_nati_print_index_rule(&indx_tbl_ptr[cnt], - (cnt + ipv4_nat_cache.ip4_tbl[tbl_hdl-1].table_entries -1)); + (cnt + ipv4_nat_cache.ip4_tbl[tbl_hdl-1].table_entries)); } } if(!atl_one) @@ -2302,15 +2307,27 @@ void ipa_nat_dump_ipv4_table(uint32_t tbl_hdl) void ipa_nati_print_rule(struct ipa_nat_rule *param, uint32_t rule_id) { - struct ipa_nat_sw_rule sw_rule; - memcpy(&sw_rule, param, sizeof(sw_rule)); + struct ipa_nat_sw_rule sw_rule; + memcpy(&sw_rule, param, sizeof(sw_rule)); + uint32_t ip_addr = 0; + + IPADUMP("rule-id:%d ",rule_id); + ip_addr = sw_rule.target_ip; + IPADUMP("Trgt-IP:%d.%d.%d.%d ", + ((ip_addr & 0xFF000000) >> 24), ((ip_addr & 0x00FF0000) >> 16), + ((ip_addr & 0x0000FF00) >> 8), ((ip_addr & 0x000000FF))); + + IPADUMP("Trgt-Port:%d Priv-Port:%d ",sw_rule.target_port, sw_rule.private_port); + + ip_addr = sw_rule.private_ip; + IPADUMP("Priv-IP:%d.%d.%d.%d ", + ((ip_addr & 0xFF000000) >> 24), ((ip_addr & 0x00FF0000) >> 16), + ((ip_addr & 0x0000FF00) >> 8), ((ip_addr & 0x000000FF))); - IPADUMP("rule-id:%d Trgt-IP:0x%x Trgt-Port:%d ",rule_id, sw_rule.target_ip, sw_rule.target_port); - IPADUMP("Priv-IP:0x%x Priv-Port:%d ", sw_rule.private_ip, sw_rule.private_port); IPADUMP("Pub-Port:%d Nxt-indx:%d ", sw_rule.public_port, sw_rule.next_index); IPADUMP("IP-cksm-delta:0x%x En-bit:0x%x ", sw_rule.ip_chksum, sw_rule.enable); IPADUMP("TS:0x%x Proto:0x%x ", sw_rule.time_stamp, sw_rule.protocol); - IPADUMP("Prv-indx:%d nxt-indx:%d Tcp-udp-cksum-delta:0x%x", sw_rule.prev_index, sw_rule.next_index, sw_rule.tcp_udp_chksum); + IPADUMP("Prv-indx:%d Tcp-udp-cksum-delta:0x%x", sw_rule.prev_index, sw_rule.tcp_udp_chksum); IPADUMP("\n"); return; } |