Index: /branches/rel_apv_10_7/usr/click/lib/libnatd_cli/natd_cli.c
===================================================================
--- /branches/rel_apv_10_7/usr/click/lib/libnatd_cli/natd_cli.c	(revision 38166)
+++ /branches/rel_apv_10_7/usr/click/lib/libnatd_cli/natd_cli.c	(working copy)
@@ -381,7 +381,7 @@
 nat_static(char *vip, char *inside_ip, uint32_t timeout, char *gw, char* description) 
 {
 #ifdef VIP_MANAGEMENT_NAT
-	int newvip = 0;
+	int ret;
 #endif
 	struct in_addr vip4;
 	struct in_addr inside_ip4;
@@ -431,11 +431,9 @@
 		return -1;
 	}
 #ifdef VIP_MANAGEMENT_NAT
-	if (get_vip_exist(isipv6, thevip, MVIP_FWD) == 0) {
-		newvip = 1;
-	}
+	ret = find_managed_vip(NULL, MVIP_FWD, (void*)&vip4.s_addr, (void*)&vip6, isipv6);
 	/* bug 13980, tangmeng, 20060911 */
-	if (newvip) {                 /*bug38294,20120827*/
+	if (ret == 0) {                 /*bug38294,20120827*/
 		if (create_managed_vip(NULL, MVIP_FWD, thevip, isipv6) < 0 ) {
 			printf("failed to assign IP to interface\n");
 			return -1;
@@ -445,7 +443,7 @@
 #endif
 	if (nat_static_kern(vip, inside_ip, timeout, gw, description) != 0) {
 #ifdef VIP_MANAGEMENT_NAT
-		if (newvip) {             /*bug38294 ,20120827*/
+		if (ret == 0) {             /*bug38294 ,20120827*/
 			/* bug 13980, tangmeng, 20060911 */
 			delete_managed_vip(NULL, MVIP_FWD, thevip, isipv6);
 			/* bug 13980, end */
@@ -754,6 +752,7 @@
 	{
 #ifdef VIP_MANAGEMENT_NAT
 		void *vip;
+		int ret;
 		struct in_addr vip4;
 		struct in6_addr vip6;
 
@@ -765,10 +764,13 @@
 			vip = &vip4;
 		}
 
-		if (create_managed_vip(NULL, MVIP_FWD, vip, isipv6) < 0 ) 
-		{
-			printf("failed to assign IP to interface\n");
-			return -1;
+		ret = find_managed_vip(NULL, MVIP_FWD, (void*)&vip4.s_addr, (void*)&vip6, isipv6);
+		if (ret == 0) {
+			if (create_managed_vip(NULL, MVIP_FWD, vip, isipv6) < 0 ) 
+			{
+				printf("failed to assign IP to interface\n");
+				return -1;
+			}
 		}
 #endif	
 		return 0;
