Index: /branches/rel_ag_9_4_5/ui/backend/sync_ui.c
===================================================================
--- /branches/rel_ag_9_4_5/ui/backend/sync_ui.c	(revision 20336)
+++ /branches/rel_ag_9_4_5/ui/backend/sync_ui.c	(working copy)
@@ -556,6 +556,20 @@
 }
 
 int
+checkActive()
+{
+	int i, local_status;
+	int active_num = 0;
+	for (i = 0; i < MAX_HA_GROUP; i++) {
+		local_status = uland_ha_units[LOCAL_UNIT].ha_condition_table[i].current_status;
+		if (local_status == Status_Active) {
+			active_num++;
+		}
+	}
+	return active_num;
+}
+
+int
 ui_sync_peer(char *name)
 {
 	int ret;
@@ -563,6 +577,8 @@
 	char localip[INET6_ADDRSTRLEN];
 	int isipv6_local = 0, isipv6_peer = 0;
 	char passwd[MAX_CHALLENGE_LEN];
+	int local_active;
+	char buf[64];
 
 	bzero(peerips, sizeof(peerips));
 	bzero(localip, sizeof(localip));
@@ -585,6 +601,25 @@
 		ui_printf("Error: Internal error, Please try again\n");
 		return -1;
 	}
+
+	if (!(local_active = checkActive())) {
+		ui_printf("Error: Local peer is not active, unable to sync to other peers\n");
+		return -1;
+	}
+
+	ui_printf("Warning: This will clean and override the running configuration on %s\n", name);
+	ui_printf("The traffic of %s will be impacted as the configuration will be updated\n", name);
+	ui_printf("Type \"YES\" to confirm and continue: ");  
+
+	if (fgets(buf, sizeof(buf), stdin) == NULL) {
+		ui_printf("synconf to aborted by the user\n");
+		return -1;
+	}
+
+	if (strcmp(buf, "YES\n") != 0) {
+		ui_printf("synconf to aborted by the user\n");
+		return -1;
+	}
 #if 0
 	unlink("/ca/conf/uconf/sync_1234567.cfg");
 	ui_write_config_file("all", "sync_1234567"); 
