File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -690,20 +690,26 @@ int dp_allocate_network_snat_port(struct snat_data *snat_data, struct dp_flow *d
690690
691691 }
692692
693- ret = rte_hash_add_key (ipv4_netnat_portoverload_tbl , ( const void * ) & portoverload_tbl_key );
693+ ret = rte_hash_add_key (ipv4_netnat_portoverload_tbl , & portoverload_tbl_key );
694694 if (DP_FAILED (ret )) {
695695 DPS_LOG_ERR ("Failed to add ipv4 network nat port overload key" , DP_LOG_RET (ret ));
696696 return ret ;
697697 }
698698
699699 if (need_to_find_new_port ) {
700700 portmap_data = rte_zmalloc ("netnat_portmap_val" , sizeof (struct netnat_portmap_data ), RTE_CACHE_LINE_SIZE );
701+ if (!portmap_data ) {
702+ rte_hash_del_key (ipv4_netnat_portoverload_tbl , & portoverload_tbl_key );
703+ DPS_LOG_ERR ("Failed to allocate ipv4 network nat portmap data" );
704+ return DP_ERROR ;
705+ }
701706 portmap_data -> nat_ip = snat_data -> nat_ip ;
702707 portmap_data -> nat_port = allocated_port ;
703- portmap_data -> flow_cnt ++ ;
708+ portmap_data -> flow_cnt = 1 ;
704709
705- ret = rte_hash_add_key_data (ipv4_netnat_portmap_tbl , ( const void * ) & portmap_key , ( void * ) portmap_data );
710+ ret = rte_hash_add_key_data (ipv4_netnat_portmap_tbl , & portmap_key , portmap_data );
706711 if (DP_FAILED (ret )) {
712+ rte_hash_del_key (ipv4_netnat_portoverload_tbl , & portoverload_tbl_key );
707713 rte_free (portmap_data );
708714 DPS_LOG_ERR ("Failed to add ipv4 network nat portmap data" , DP_LOG_RET (ret ));
709715 return ret ;
You can’t perform that action at this time.
0 commit comments