diff --git a/src/agent_map.c b/src/agent_map.c
index 002487c592a4bbc1a806a331a0d57e7a856ed03e..f910d652be314bd16009e9c455817b707ba6c383 100644
--- a/src/agent_map.c
+++ b/src/agent_map.c
@@ -4653,6 +4653,7 @@ int handle_hld_message(void *agent, struct cmdu_buff *rx_cmdu)
 		cmdu_free(cmdu);
 	} else if (proto == 0xac && cntlr_sync) {
 		struct sync_config out = {0};
+		char enabled[2] = {0};
 
 		dbg("*** Process dyn-controller-config-sync response ***\n");
 		/*
@@ -4677,9 +4678,14 @@ int handle_hld_message(void *agent, struct cmdu_buff *rx_cmdu)
 			return ret;
 		}
 
+		agent_get_controller_enabled(a, enabled);
+
 		ret = writeto_configfile("/etc/config/mapcontroller", out.data, out.len);
 		if (ret)
 			fprintf(stderr, "failed to write file\n");
+		set_value_by_string("mapcontroller", "controller", "enabled",
+				enabled, UCI_TYPE_STRING);
+
 	}
 #endif /* AGENT_SYNC_DYNAMIC_CNTLR_CONFIG */
 
diff --git a/src/config.c b/src/config.c
index fce99f6e8bc7b6a30416cc7d015e25a00db0c88a..656a071f29412d19383585f73e3589f0e538aef2 100644
--- a/src/config.c
+++ b/src/config.c
@@ -249,6 +249,39 @@ out_pkg:
 }
 #endif
 
+/* expects buf to len 2 */
+char *agent_get_controller_enabled(struct agent *a, char *buf)
+{
+	struct uci_context *ctx;
+	struct uci_ptr ptr = {0};
+	int ret = -1;
+
+	ctx = uci_alloc_context();
+	if (!ctx)
+		return -1;
+
+	ptr.package = "mapcontroller";
+	ptr.section = "controller";
+	ptr.option = "enabled";
+	ptr.target = UCI_TYPE_OPTION;
+
+	ret = uci_lookup_ptr(ctx, &ptr, NULL, false);
+	if (ret != UCI_OK ||!(ptr.flags & UCI_LOOKUP_DONE)) {
+		goto error;
+	}
+
+	if (ptr.flags & UCI_LOOKUP_COMPLETE) {
+		/* option found */
+		strncpy(buf, ptr.o->v.string, 1);
+	}
+
+	uci_unload(ctx, ptr.p);
+error:
+	uci_free_context(ctx);
+	return ret;
+}
+
+
 int wifi_get_iface_bssid(char *ifname, uint8_t *bssid)
 {
 	struct uci_context *ctx = NULL;
diff --git a/src/config.h b/src/config.h
index 485ce3e4626050f4d38317e62642a58a7ead953b..327fc193a955514dec2fe43a825ed629084c4185 100644
--- a/src/config.h
+++ b/src/config.h
@@ -222,6 +222,7 @@ int set_value(struct uci_context *ctx, struct uci_package *pkg,
 		const char *value, enum uci_option_type type);
 int set_value_by_string(const char *package, const char *section,
 		const char *key, const char *value, enum uci_option_type type);
+char *agent_get_controller_enabled(struct agent *a, char *buf);
 struct uci_section *config_get_iface_section(struct uci_context *ctx,
 		struct uci_package *pkg, const char *type, const char *ifname);
 bool uci_reload_services(char *services);