diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 03146ac7a439244d8057f6e9ae5d660f075b85e3..526f4918a62225a18abfaec705b23b92c2c1e823 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,15 +1,11 @@
+variables:
+  SOURCE_FOLDER: "src"
+
 include:
   - project: 'iopsys/gitlab-ci-pipeline'
     file: '/static-code-analysis.yml'
-    ref: '0.31'
+    ref: '1.2'
 
 stages:
     - static_code_analysis
 
-variables:
-  DEBUG: 'TRUE'
-  SOURCE_FOLDER: "./src"
-  FLAWFINDER_OPTIONS: "-m 4 --error-level=5"
-  CPPCHECK_OPTIONS: "--enable=all --error-exitcode=1"
-  COMPILE: "./gitlab-ci/compile.sh"
-
diff --git a/gitlab-ci/compile.sh b/gitlab-ci/compile.sh
deleted file mode 100755
index 34948b5dd4db644e3481a2552c579297bba787c2..0000000000000000000000000000000000000000
--- a/gitlab-ci/compile.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-echo "Install dependencies"
-orig_dir=$(pwd)
-echo $orig_dir
-
-source ./gitlab-ci/shared.sh
-
-# install bbfdm
-install_bbfdm
-
-# compile
-set -e
-echo "build stage"
-cd $orig_dir/src/
-pwd
diff --git a/gitlab-ci/install-dependencies.sh b/gitlab-ci/install-dependencies.sh
new file mode 100755
index 0000000000000000000000000000000000000000..285cc185721796dab4b7e8dba2c5292c8a88c21f
--- /dev/null
+++ b/gitlab-ci/install-dependencies.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+echo "install dependencies for tests"
+source ./gitlab-ci/shared.sh
+
+# install bbfdm
+install_bbfdm
diff --git a/gitlab-ci/shared.sh b/gitlab-ci/shared.sh
index f098751729cd67463d6d4912bc1bf7ffab42ee40..dc606510de3df2aea40656ed8fb4bd4c8a414169 100644
--- a/gitlab-ci/shared.sh
+++ b/gitlab-ci/shared.sh
@@ -13,7 +13,7 @@ function exec_cmd()
 
 function install_bbfdm()
 {
-	[ -d "/opt/dev/bbfdm" ] && rm -rf /opt/dev/bbfdm
+	[ -d "/opt/dev/bbfdm" ] && return 0
 
 	if [ -n "${BBFDM_BRANCH}" ]; then
 		exec_cmd git clone -b ${BBFDM_BRANCH} https://dev.iopsys.eu/bbf/bbfdm.git /opt/dev/bbfdm
diff --git a/src/dhcpmngr.c b/src/dhcpmngr.c
index 89d90ac93ff37680c21101bc145a235e43e4f80b..1b1b3abbcec26e48f55aedbf5dbbc6202bfe98bf 100644
--- a/src/dhcpmngr.c
+++ b/src/dhcpmngr.c
@@ -180,7 +180,12 @@ void dhcpmngr_convert_str_option_to_hex(unsigned int tag, const char *str, char
 			if (size - pos < DHCPMNGR_DHCP_OPTIONS_ARRAY[idx].len * 2)
 				return;
 
-			pos += snprintf(&hex[pos], size - pos, (DHCPMNGR_DHCP_OPTIONS_ARRAY[idx].len == 4) ? "%08lX" : (DHCPMNGR_DHCP_OPTIONS_ARRAY[idx].len == 2) ? "%04lX" : "%02lX", val);
+			if (DHCPMNGR_DHCP_OPTIONS_ARRAY[idx].len == 4)
+				pos += snprintf(&hex[pos], size - pos, "%08lX", val);
+			else if (DHCPMNGR_DHCP_OPTIONS_ARRAY[idx].len == 2)
+				pos += snprintf(&hex[pos], size - pos, "%04lX", val);
+			else
+				pos += snprintf(&hex[pos], size - pos, "%02lX", val);
 		}
 	}
 }
diff --git a/src/dhcpv4.c b/src/dhcpv4.c
index e956718e150453c11e10ba936c396dd3dc1829d7..c1efe5cd3f6fb3e5a695bcefa3b7a8f4388e85e1 100644
--- a/src/dhcpv4.c
+++ b/src/dhcpv4.c
@@ -20,10 +20,10 @@
 #define DHCP_CLIENT_INFO "/tmp/dhcp_client_info"
 
 struct dhcp_lease {
+	struct list_head list;
 	uint64_t ts;
 	char hwaddr[24];
 	char ipaddr[16];
-	struct list_head list;
 };
 
 struct dhcp_iface_args {
@@ -57,7 +57,7 @@ static char *get_dnsmasq_section_name(void)
 	return "";
 }
 
-static struct uci_section *exist_other_section_same_order(struct uci_section *dmmap_sect, char *package, char *sect_type, char *order)
+static struct uci_section *exist_other_section_same_order(struct uci_section *dmmap_sect, const char *package, const char *sect_type, const char *order)
 {
 	struct uci_section *s = NULL;
 
@@ -69,7 +69,7 @@ static struct uci_section *exist_other_section_same_order(struct uci_section *dm
 	return NULL;
 }
 
-int set_section_order(char *package, char *dmpackage, char *sect_type, struct uci_section *dmmap_sect, struct uci_section *conf, int set_force, char *order)
+int set_section_order(const char *package, const char *dmpackage, const char *sect_type, struct uci_section *dmmap_sect, struct uci_section *conf, int set_force, const char *order)
 {
 	char *v = NULL, *sect_name, *incrorder;
 	struct uci_section *s, *dm;
@@ -104,7 +104,7 @@ int set_section_order(char *package, char *dmpackage, char *sect_type, struct uc
 	return 0;
 }
 
-int get_value_in_mac_format(struct uci_section *s, char *option_name, bool type, char **value)
+int get_value_in_mac_format(struct uci_section *s, const char *option_name, bool type, char **value)
 {
 	char *option_value = NULL, **macarray, buf[32];
 	unsigned pos = 0;
@@ -154,7 +154,7 @@ int get_dhcp_client_interface(struct dmctx *ctx, void *data, char **value)
 	return 0;
 }
 
-static bool is_dhcp_section_exist(char *dmmap_file, char *sec_name)
+static bool is_dhcp_section_exist(const char *dmmap_file, const char *sec_name)
 {
 	struct uci_section *s = NULL;
 
@@ -245,6 +245,7 @@ static void dmmap_synchronizeDHCPv4RelayForwarding(struct dmctx *dmctx, DMNODE *
 
 static void dhcp_leases_load(struct list_head *head)
 {
+	// cppcheck-suppress cert-MSC24-C
 	FILE *f = fopen(DHCP_LEASES_FILE, "r");
 	char line[128];
 
@@ -392,7 +393,7 @@ static void dhcp_leases_assign_to_interface(struct dhcp_args *dhcp, struct list_
 	}
 }
 
-static bool check_dhcp_host_option_exists(char *dhcp_pool_name, char *option, char *value)
+static bool check_dhcp_host_option_exists(const char *dhcp_pool_name, const char *option, const char *value)
 {
 	struct uci_section *s = NULL;
 	char *opt_value;
@@ -464,7 +465,7 @@ static int fill_dhcp_iface_args(struct dm_data *curr_data, struct dhcp_args *dhc
 	return 0;
 }
 
-static int check_ipv4_in_dhcp_pool(struct dhcp_iface_args *dhcp_iface, char *ip)
+static int check_ipv4_in_dhcp_pool(struct dhcp_iface_args *dhcp_iface, const char *ip)
 {
 	unsigned addr, net;
 
@@ -477,7 +478,7 @@ static int check_ipv4_in_dhcp_pool(struct dhcp_iface_args *dhcp_iface, char *ip)
 	return 0;
 }
 
-static char *get_dhcp_network_from_relay_list(char *net_list)
+static char *get_dhcp_network_from_relay_list(const char *net_list)
 {
 	struct uci_section *s = NULL;
 	size_t length = 0;
@@ -499,7 +500,7 @@ static char *get_dhcp_network_from_relay_list(char *net_list)
 	return "";
 }
 
-static struct uci_section *get_dhcp_classifier(char *classifier_name, char *network)
+static struct uci_section *get_dhcp_classifier(const char *classifier_name, const char *network)
 {
 	struct uci_section* s = NULL;
 	char *networkid;
@@ -513,7 +514,7 @@ static struct uci_section *get_dhcp_classifier(char *classifier_name, char *netw
 	return NULL;
 }
 
-bool tag_option_exists(char *dmmap_package, char *section, char *opt_check, char *value_check, char *tag_name, char *tag_value)
+bool tag_option_exists(const char *dmmap_package, const char *section, const char *opt_check, const char *value_check, const char *tag_name, const char *tag_value)
 {
 	struct uci_section *s = NULL;
 
@@ -528,12 +529,9 @@ bool tag_option_exists(char *dmmap_package, char *section, char *opt_check, char
 	return false;
 }
 
-char *generate_tag_option(char *dmmap_package, char *section, char *opt_check, char *value_check, char *tag_name)
+char *generate_tag_option(const char *dmmap_package, const char *section, const char *opt_check, const char *value_check, const char *tag_name)
 {
-	char *option_tag = "0";
-	int i;
-
-	for (i = 1; i <= 254; i++) {
+	for (int i = 1; i <= 254; i++) {
 
 		char tag_value[16] = {0};
 		snprintf(tag_value, sizeof(tag_value), "%d", i);
@@ -544,7 +542,7 @@ char *generate_tag_option(char *dmmap_package, char *section, char *opt_check, c
 		return dmstrdup(tag_value);
 	}
 
-	return option_tag;
+	return "0";
 }
 
 static int get_DHCPv4ServerPool_Option_Value(struct uci_section *s, const char *option, char **value)
@@ -573,7 +571,7 @@ static int get_DHCPv4ServerPool_Option_Value(struct uci_section *s, const char *
 	return -1;
 }
 
-static int set_DHCPv4ServerPool_Option_Value(struct uci_section *s, const char *option, char *value)
+static int set_DHCPv4ServerPool_Option_Value(struct uci_section *s, const char *option, const char *value)
 {
 	struct uci_list *dhcp_option = NULL;
 	char new_dhcp_option[256] = {0};
@@ -620,7 +618,7 @@ static char *get_dhcp_option_name(int tag)
 	}
 }
 
-static void create_dhcp_client_option_instance(char *sec_name, char *key, char *tag, char *value)
+static void create_dhcp_client_option_instance(const char *sec_name, const char *key, const char *tag, const char *value)
 {
 	struct uci_section *dmmap_s = NULL;
 
@@ -672,7 +670,7 @@ static void fill_dhcp_option_value(char *option, char *tag, size_t tag_size, cha
 	snprintf(tag, tag_size, "%ld", tag_num);
 }
 
-static void create_dhcp_sent_option_list(struct uci_section *iface_s, char *key)
+static void create_dhcp_sent_option_list(struct uci_section *iface_s, const char *key)
 {
 	struct uci_section *dmmap_s = NULL;
 	char buf[1024] = {0};
@@ -708,7 +706,7 @@ static void create_dhcp_sent_option_list(struct uci_section *iface_s, char *key)
 	dmuci_set_value_by_section(iface_s, "sendopts", buf);
 }
 
-static void create_dhcp_req_option_list(struct uci_section *iface_s, char *key)
+static void create_dhcp_req_option_list(struct uci_section *iface_s, const char *key)
 {
 	struct uci_section *dmmap_s = NULL;
 	char buf[256] = {0};
@@ -733,7 +731,7 @@ static void create_dhcp_req_option_list(struct uci_section *iface_s, char *key)
 	dmuci_set_value_by_section(iface_s, "reqopts", buf);
 }
 
-static char *remove_option_from_str_list(char *str_list, long tag)
+static char *remove_option_from_str_list(const char *str_list, long tag)
 {
 	char *pch = NULL, *spch = NULL;
 	unsigned pos = 0;
@@ -884,6 +882,7 @@ static int browseDhcpClientIPv4Inst(struct dmctx *dmctx, DMNODE *parent_node, vo
 
 static int browseDHCPv4ServerPoolClientOptionInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
 {
+	// cppcheck-suppress cert-MSC24-C
 	FILE *f = fopen(DHCP_CLIENT_OPTIONS_FILE, "r");
 	if (f == NULL)
 		return 0;
@@ -906,12 +905,13 @@ static int browseDHCPv4ServerPoolClientOptionInst(struct dmctx *dmctx, DMNODE *p
 				sscanf(p, "vcid=%127s ", vcid);
 				if (DM_LSTRCMP(vcid, "-") != 0) {
 
-					curr_client_options_args.tag = "60";
+					curr_client_options_args.tag = dmstrdup("60");
 					curr_client_options_args.value = dmstrdup(vcid);
+					id++;
 
 					curr_data.additional_data = (void *)&curr_client_options_args;
 
-					inst = handle_instance_without_section(dmctx, parent_node, ++id);
+					inst = handle_instance_without_section(dmctx, parent_node, id);
 
 					if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP)
 						break;
@@ -923,12 +923,13 @@ static int browseDHCPv4ServerPoolClientOptionInst(struct dmctx *dmctx, DMNODE *p
 				sscanf(p, "clid=%127s ", clid);
 				if (DM_LSTRCMP(clid, "-") != 0) {
 
-					curr_client_options_args.tag = "61";
+					curr_client_options_args.tag = dmstrdup("61");
 					curr_client_options_args.value = dmstrdup(clid);
+					id++;
 
 					curr_data.additional_data = (void *)&curr_client_options_args;
 
-					inst = handle_instance_without_section(dmctx, parent_node, ++id);
+					inst = handle_instance_without_section(dmctx, parent_node, id);
 
 					if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP)
 						break;
@@ -941,12 +942,13 @@ static int browseDHCPv4ServerPoolClientOptionInst(struct dmctx *dmctx, DMNODE *p
 				sscanf(p, "ucid=%127s ", ucid);
 				if (DM_LSTRCMP(ucid, "-") != 0) {
 
-					curr_client_options_args.tag = "77";
+					curr_client_options_args.tag = dmstrdup("77");
 					curr_client_options_args.value = dmstrdup(ucid);
+					id++;
 
 					curr_data.additional_data = (void *)&curr_client_options_args;
 
-					inst = handle_instance_without_section(dmctx, parent_node, ++id);
+					inst = handle_instance_without_section(dmctx, parent_node, id);
 
 					if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP)
 						break;
@@ -958,12 +960,13 @@ static int browseDHCPv4ServerPoolClientOptionInst(struct dmctx *dmctx, DMNODE *p
 				sscanf(p, "hostname=%127s ", hostname);
 				if (DM_LSTRCMP(hostname, "-") != 0) {
 
-					curr_client_options_args.tag = "12";
+					curr_client_options_args.tag = dmstrdup("12");
 					curr_client_options_args.value = dmstrdup(hostname);
+					id++;
 
 					curr_data.additional_data = (void *)&curr_client_options_args;
 
-					inst = handle_instance_without_section(dmctx, parent_node, ++id);
+					inst = handle_instance_without_section(dmctx, parent_node, id);
 
 					if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP)
 						break;
@@ -975,12 +978,13 @@ static int browseDHCPv4ServerPoolClientOptionInst(struct dmctx *dmctx, DMNODE *p
 				sscanf(p, "paramlist=%255s ", paramlist);
 				if (DM_LSTRCMP(paramlist, "-") != 0) {
 
-					curr_client_options_args.tag = "55";
+					curr_client_options_args.tag = dmstrdup("55");
 					curr_client_options_args.value = dmstrdup(paramlist);
+					id++;
 
 					curr_data.additional_data = (void *)&curr_client_options_args;
 
-					inst = handle_instance_without_section(dmctx, parent_node, ++id);
+					inst = handle_instance_without_section(dmctx, parent_node, id);
 
 					if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_data, inst) == DM_STOP)
 						break;
@@ -1234,24 +1238,8 @@ static int addObjDHCPv4ServerPool(char *refparam, struct dmctx *ctx, void *data,
 
 static int delObjDHCPv4ServerPool(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
 {
-	struct uci_section *s = NULL, *stmp = NULL;
-
-	switch (del_action) {
-	case DEL_INST:
-		dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL);
-		dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL);
-		break;
-	case DEL_ALL:
-		uci_foreach_sections_safe("dhcp", "dhcp", stmp, s) {
-			struct uci_section *dmmap_section = NULL;
-
-			get_dmmap_section_of_config_section("dmmap_dhcp", "dhcp", section_name(s), &dmmap_section);
-			dmuci_delete_by_section(dmmap_section, NULL, NULL);
-
-			dmuci_delete_by_section(s, NULL, NULL);
-		}
-		break;
-	}
+	dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL);
+	dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL);
 	return 0;
 }
 
@@ -1276,14 +1264,8 @@ static int addObjDHCPv4ServerPoolStaticAddress(char *refparam, struct dmctx *ctx
 
 static int delObjDHCPv4ServerPoolStaticAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
 {
-	switch (del_action) {
-		case DEL_INST:
-			dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL);
-			dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL);
-			break;
-		case DEL_ALL:
-			break;
-	}
+	dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL);
+	dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL);
 	return 0;
 }
 
@@ -1308,77 +1290,34 @@ static int delObjDHCPv4Client(char *refparam, struct dmctx *ctx, void *data, cha
 	struct uci_section *s = NULL, *stmp = NULL;
 	char *dhcp_client_key = NULL;
 
-	switch (del_action) {
-		case DEL_INST:
-			dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "dhcp_client_key", &dhcp_client_key);
-
-			if (((struct dm_data *)data)->config_section) {
-				char *ip_instance = NULL;
-
-				struct uci_section *dmmap_s = get_dup_section_in_dmmap("dmmap_network", "interface", section_name(((struct dm_data *)data)->config_section));
-				dmuci_get_value_by_section_string(dmmap_s, "ip_int_instance", &ip_instance);
-				if (dmmap_s && DM_STRLEN(ip_instance) == 0) {
-					dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL);
-				} else {
-					dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "proto", "none");
-					dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "clientid", "");
-					dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "vendorid", "");
-					dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "hostname", "");
-					dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "sendopts", "");
-					dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "reqopts", "");
-				}
-			}
-
-			uci_path_foreach_option_eq_safe(bbfdm, "dmmap_dhcp_client", "send_option", "dhcp_client_key", dhcp_client_key, stmp, s) {
-				dmuci_delete_by_section(s, NULL, NULL);
-			}
-
-			uci_path_foreach_option_eq_safe(bbfdm, "dmmap_dhcp_client", "req_option", "dhcp_client_key", dhcp_client_key, stmp, s) {
-				dmuci_delete_by_section(s, NULL, NULL);
-			}
+	dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "dhcp_client_key", &dhcp_client_key);
 
-			dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL);
-			break;
-		case DEL_ALL:
-			uci_path_foreach_sections_safe(bbfdm, "dmmap_dhcp_client", "interface", stmp, s) {
-				struct uci_section *ss = NULL, *sstmp = NULL;
-				struct uci_section *iface_s = NULL;
-				char *iface_name = NULL;
-
-				dmuci_get_value_by_section_string(s, "dhcp_client_key", &dhcp_client_key);
-				dmuci_get_value_by_section_string(s, "iface_name", &iface_name);
-				if (DM_STRLEN(iface_name))
-					get_config_section_of_dmmap_section("network", "interface", iface_name, &iface_s);
-
-				if (iface_s) {
-					char *ip_instance = NULL;
-
-					struct uci_section *dmmap_s = get_dup_section_in_dmmap("dmmap_network", "interface", section_name(iface_s));
-					dmuci_get_value_by_section_string(dmmap_s, "ip_int_instance", &ip_instance);
-					if (dmmap_s && DM_STRLEN(ip_instance) == 0) {
-						dmuci_delete_by_section(iface_s, NULL, NULL);
-					} else {
-						dmuci_set_value_by_section(iface_s, "proto", "none");
-						dmuci_set_value_by_section(iface_s, "clientid", "");
-						dmuci_set_value_by_section(iface_s, "vendorid", "");
-						dmuci_set_value_by_section(iface_s, "hostname", "");
-						dmuci_set_value_by_section(iface_s, "sendopts", "");
-						dmuci_set_value_by_section(iface_s, "reqopts", "");
-					}
-				}
+	if (((struct dm_data *)data)->config_section) {
+		char *ip_instance = NULL;
 
-				uci_path_foreach_option_eq_safe(bbfdm, "dmmap_dhcp_client", "send_option", "dhcp_client_key", dhcp_client_key, sstmp, ss) {
-					dmuci_delete_by_section(ss, NULL, NULL);
-				}
+		struct uci_section *dmmap_s = get_dup_section_in_dmmap("dmmap_network", "interface", section_name(((struct dm_data *)data)->config_section));
+		dmuci_get_value_by_section_string(dmmap_s, "ip_int_instance", &ip_instance);
+		if (dmmap_s && DM_STRLEN(ip_instance) == 0) {
+			dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL);
+		} else {
+			dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "proto", "none");
+			dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "clientid", "");
+			dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "vendorid", "");
+			dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "hostname", "");
+			dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "sendopts", "");
+			dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "reqopts", "");
+		}
+	}
 
-				uci_path_foreach_option_eq_safe(bbfdm, "dmmap_dhcp_client", "req_option", "dhcp_client_key", dhcp_client_key, sstmp, ss) {
-					dmuci_delete_by_section(ss, NULL, NULL);
-				}
+	uci_path_foreach_option_eq_safe(bbfdm, "dmmap_dhcp_client", "send_option", "dhcp_client_key", dhcp_client_key, stmp, s) {
+		dmuci_delete_by_section(s, NULL, NULL);
+	}
 
-				dmuci_delete_by_section(s, NULL, NULL);
-			}
-			break;
+	uci_path_foreach_option_eq_safe(bbfdm, "dmmap_dhcp_client", "req_option", "dhcp_client_key", dhcp_client_key, stmp, s) {
+		dmuci_delete_by_section(s, NULL, NULL);
 	}
+
+	dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL);
 	return 0;
 }
 
@@ -1400,45 +1339,24 @@ static int addObjDHCPv4ClientSentOption(char *refparam, struct dmctx *ctx, void
 
 static int delObjDHCPv4ClientSentOption(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
 {
-	struct uci_section *s = NULL, *stmp = NULL;
-	char *dhcp_client_key = NULL;
-
-	switch (del_action) {
-		case DEL_INST:
-			if (((struct dm_data *)data)->config_section) {
-				struct option_args *option = (struct option_args *)((struct dm_data *)data)->additional_data;
-				char *option_name = get_dhcp_option_name(DM_STRTOL(option->tag));
-
-				if (DM_LSTRCMP(option_name, "sendopts") == 0) {
-					char *sendopts = NULL;
-
-					dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "sendopts", &sendopts);
-					if (DM_STRLEN(sendopts)) {
-						sendopts = remove_option_from_str_list(sendopts, DM_STRTOL(option->tag));
-						dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "sendopts", sendopts);
-					}
-				} else {
-					dmuci_set_value_by_section(((struct dm_data *) data)->config_section, option_name, "");
-				}
-			}
-
-			dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL);
-			break;
-		case DEL_ALL:
-			if (((struct dm_data *)data)->config_section) {
-				dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "clientid", "");
-				dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "vendorid", "");
-				dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "hostname", "");
-				dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "sendopts", "");
-			}
+	if (((struct dm_data *)data)->config_section) {
+		struct option_args *option = (struct option_args *)((struct dm_data *)data)->additional_data;
+		char *option_name = get_dhcp_option_name(DM_STRTOL(option->tag));
 
-			dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "dhcp_client_key", &dhcp_client_key);
+		if (DM_LSTRCMP(option_name, "sendopts") == 0) {
+			char *sendopts = NULL;
 
-			uci_path_foreach_option_eq_safe(bbfdm, "dmmap_dhcp_client", "send_option", "dhcp_client_key", dhcp_client_key, stmp, s) {
-				dmuci_delete_by_section(s, NULL, NULL);
+			dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "sendopts", &sendopts);
+			if (DM_STRLEN(sendopts)) {
+				sendopts = remove_option_from_str_list(sendopts, DM_STRTOL(option->tag));
+				dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "sendopts", sendopts);
 			}
-			break;
+		} else {
+			dmuci_set_value_by_section(((struct dm_data *) data)->config_section, option_name, "");
+		}
 	}
+
+	dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL);
 	return 0;
 }
 
@@ -1460,35 +1378,18 @@ static int addObjDHCPv4ClientReqOption(char *refparam, struct dmctx *ctx, void *
 
 static int delObjDHCPv4ClientReqOption(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
 {
-	struct uci_section *s = NULL, *stmp = NULL;
-	char *dhcp_client_key = NULL;
-
-	switch (del_action) {
-		case DEL_INST:
-			if (((struct dm_data *)data)->config_section) {
-				char *reqopts = NULL;
-
-				dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "reqopts", &reqopts);
-				if (reqopts && *reqopts) {
-					struct option_args *option = (struct option_args *)((struct dm_data *)data)->additional_data;
-					reqopts = remove_str_from_str_list(reqopts, " ", option->tag);
-					dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "reqopts", reqopts);
-				}
-			}
-
-			dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL);
-			break;
-		case DEL_ALL:
-			if (((struct dm_data *)data)->config_section)
-				dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "reqopts", "");
-
-			dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "dhcp_client_key", &dhcp_client_key);
+	if (((struct dm_data *)data)->config_section) {
+		char *reqopts = NULL;
 
-			uci_path_foreach_option_eq_safe(bbfdm, "dmmap_dhcp_client", "req_option", "dhcp_client_key", dhcp_client_key, stmp, s) {
-				dmuci_delete_by_section(s, NULL, NULL);
-			}
-			break;
+		dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "reqopts", &reqopts);
+		if (reqopts && *reqopts) {
+			struct option_args *option = (struct option_args *)((struct dm_data *)data)->additional_data;
+			reqopts = remove_str_from_str_list(reqopts, " ", option->tag);
+			dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "reqopts", reqopts);
+		}
 	}
+
+	dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL);
 	return 0;
 }
 
@@ -1506,29 +1407,18 @@ static int addObjDHCPv4ServerPoolOption(char *refparam, struct dmctx *ctx, void
 
 static int delObjDHCPv4ServerPoolOption(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
 {
-	struct uci_section *s = NULL, *stmp = NULL;
 	struct uci_list *dhcp_options_list = NULL;
 
-	switch (del_action) {
-		case DEL_INST:
-			dmuci_get_value_by_section_list(((struct dm_data *)data)->config_section, "dhcp_option", &dhcp_options_list);
-			if (dhcp_options_list != NULL) {
-				struct option_args *option = (struct option_args *)((struct dm_data *)data)->additional_data;
-				char tag_value[128] = {0};
-
-				snprintf(tag_value, sizeof(tag_value), "%s,%s", option->tag, option->value);
-				dmuci_del_list_value_by_section(((struct dm_data *)data)->config_section, "dhcp_option", tag_value);
-			}
+	dmuci_get_value_by_section_list(((struct dm_data *)data)->config_section, "dhcp_option", &dhcp_options_list);
+	if (dhcp_options_list != NULL) {
+		struct option_args *option = (struct option_args *)((struct dm_data *)data)->additional_data;
+		char tag_value[128] = {0};
 
-			dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL);
-			break;
-		case DEL_ALL:
-			dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "dhcp_option", "");
-			uci_path_foreach_sections_safe(bbfdm, "dmmap_dhcp", "servpool_option", stmp, s) {
-				dmuci_delete_by_section(s, NULL, NULL);
-			}
-			break;
+		snprintf(tag_value, sizeof(tag_value), "%s,%s", option->tag, option->value);
+		dmuci_del_list_value_by_section(((struct dm_data *)data)->config_section, "dhcp_option", tag_value);
 	}
+
+	dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL);
 	return 0;
 }
 
@@ -1546,31 +1436,11 @@ static int addObjDHCPv4RelayForwarding(char *refparam, struct dmctx *ctx, void *
 
 static int delObjDHCPv4RelayForwarding(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
 {
-	struct uci_section *s = NULL, *stmp = NULL;
-
-	switch (del_action) {
-		case DEL_INST:
-			dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL);
-
-			if (((struct dm_data *)data)->config_section)
-				dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "proto", "none");
-			break;
-		case DEL_ALL:
-			uci_path_foreach_sections_safe(bbfdm, "dmmap_dhcp_relay", "interface", stmp, s) {
-				struct uci_section *iface_s = NULL;
-				char *iface_name = NULL;
+	dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL);
 
-				dmuci_get_value_by_section_string(s, "iface_name", &iface_name);
-				if (DM_STRLEN(iface_name))
-					get_config_section_of_dmmap_section("network", "interface", iface_name, &iface_s);
+	if (((struct dm_data *)data)->config_section)
+		dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "proto", "none");
 
-				dmuci_delete_by_section(s, NULL, NULL);
-
-				if (iface_s)
-					dmuci_set_value_by_section(iface_s, "proto", "none");
-			}
-			break;
-	}
 	return 0;
 }
 
@@ -1609,11 +1479,11 @@ static int get_DHCPv4ServerPool_Status(char *refparam, struct dmctx *ctx, void *
 	dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "dhcpv4", &status);
 
 	if (DM_LSTRCMP(status, "disabled") == 0) {
-		*value = "Disabled";
+		*value = dmstrdup("Disabled");
 	} else {
 		unsigned iface_addr, iface_cidr, iface_bits, iface_net;
 
-		*value = "Error_Misconfigured";
+		*value = dmstrdup("Error_Misconfigured");
 
 		if (DM_STRLEN(((struct dhcp_args *)((struct dm_data *)data)->additional_data)->iface_args.iface_name) == 0)
 			return 0;
@@ -1630,7 +1500,7 @@ static int get_DHCPv4ServerPool_Status(char *refparam, struct dmctx *ctx, void *
 		if (iface_net != ((struct dhcp_args *)((struct dm_data *)data)->additional_data)->iface_args.net_start || iface_net != ((struct dhcp_args *)((struct dm_data *)data)->additional_data)->iface_args.net_end)
 			return 0;
 
-		*value = "Enabled";
+		*value = dmstrdup("Enabled");
 	}
 
 	return 0;
@@ -1704,14 +1574,14 @@ static int get_DHCPv4ServerPool_AllowedDevices(char *refparam, struct dmctx *ctx
 {
 	char *allowed_dev = NULL;
 
-	*value = "All";
+	*value = dmstrdup("All");
 
 	dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "allowed_devices", &allowed_dev);
 	if (DM_STRLEN(allowed_dev)) {
 		if (strcasecmp(allowed_dev, "known") == 0)
-			*value = "Known";
+			*value = dmstrdup("Known");
 		else if(strcasecmp(allowed_dev, "unknown") == 0)
-			*value = "UnKnown";
+			*value = dmstrdup("UnKnown");
 	}
 
 	return 0;
@@ -1720,7 +1590,7 @@ static int get_DHCPv4ServerPool_AllowedDevices(char *refparam, struct dmctx *ctx
 static int set_DHCPv4ServerPool_AllowedDevices(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
 {
 	char *allowed_devices[] = {"All", "Known", "UnKnown", NULL};
-	char *allowed_dev = "";
+	char allowed_dev[8] = {0};
 
 	switch (action)	{
 		case VALUECHECK:
@@ -1729,11 +1599,11 @@ static int set_DHCPv4ServerPool_AllowedDevices(char *refparam, struct dmctx *ctx
 			break;
 		case VALUESET:
 			if (strcasecmp(value, "Known") == 0)
-				allowed_dev = "known";
+				snprintf(allowed_dev, sizeof(allowed_dev), "%s", "known");
 			else if(strcasecmp(value, "UnKnown") == 0)
-				allowed_dev = "unknown";
+				snprintf(allowed_dev, sizeof(allowed_dev), "%s", "unknown");
 			else
-				allowed_dev = "all";
+				snprintf(allowed_dev, sizeof(allowed_dev), "%s", "all");
 
 			dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "allowed_devices", allowed_dev);
 			break;
@@ -2042,7 +1912,7 @@ static int get_DHCPv4ServerPool_LeaseTime(char *refparam, struct dmctx *ctx, voi
 	char *ltime = NULL, *pch = NULL, *pchr = NULL;
 	int leasetime = 0;
 
-	*value = "-1";
+	*value = dmstrdup("-1");
 	dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "leasetime", &ltime);
 	if (ltime == NULL || *ltime == '\0')
 		return 0;
@@ -2267,13 +2137,13 @@ static int get_DHCPv4ServerPoolClient_Chaddr(char *refparam, struct dmctx *ctx,
 
 static int get_DHCPv4ServerPoolClient_Active(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
 {
-	*value = "true";
+	*value = dmstrdup("true");
 	return 0;
 }
 
 static int get_DHCPv4ServerPoolClient_IPv4AddressNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
 {
-	*value = "1";
+	*value = dmstrdup("1");
 	return 0;
 }
 
@@ -2491,19 +2361,19 @@ static int get_DHCPv4Client_DHCPStatus(char *refparam, struct dmctx *ctx, void *
 
 		char *if_name = section_name(dhcpv4_s);
 		dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", if_name, String}}, 1, &res);
-		DM_ASSERT(res, *value = "Requesting");
+		DM_ASSERT(res, *value = dmstrdup("Requesting"));
 		json_object *jobj = dmjson_select_obj_in_array_idx(res, 0, 1, "ipv4-address");
 		char *ipaddr = dmjson_get_value(jobj, 1, "address");
 		*value = (ipaddr[0] == '\0') ? "Requesting" : "Bound";
 	} else {
-		*value = "Requesting";
+		*value = dmstrdup("Requesting");
 	}
 	return 0;
 }
 
 static int get_DHCPv4Client_Renew(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
 {
-	*value = "false";
+	*value = dmstrdup("false");
 	return 0;
 }
 
@@ -2532,7 +2402,7 @@ static int set_DHCPv4Client_Renew(char *refparam, struct dmctx *ctx, void *data,
 static int get_DHCPv4Client_IPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
 {
 	struct uci_section *dhcpv4_s = ((struct dm_data *)data)->config_section;
-	char *ipaddr = "";
+	char *ipaddr = NULL;
 
 	if (dhcpv4_s) {
 
@@ -2542,21 +2412,21 @@ static int get_DHCPv4Client_IPAddress(char *refparam, struct dmctx *ctx, void *d
 
 			char *if_name = section_name(dhcpv4_s);
 			dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", if_name, String}}, 1, &res);
-			DM_ASSERT(res, *value = "");
+			DM_ASSERT(res, *value = dmstrdup(""));
 
 			json_object *jobj = dmjson_select_obj_in_array_idx(res, 0, 1, "ipv4-address");
 			ipaddr = dmjson_get_value(jobj, 1, "address");
 		}
 	}
 
-	*value = ipaddr;
+	*value = ipaddr ? ipaddr : "";
 	return 0;
 }
 
 static int get_DHCPv4Client_SubnetMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
 {
 	struct uci_section *dhcpv4_s = ((struct dm_data *)data)->config_section;
-	char *mask = "";
+	char *mask = NULL;
 
 	if (dhcpv4_s) {
 
@@ -2566,7 +2436,7 @@ static int get_DHCPv4Client_SubnetMask(char *refparam, struct dmctx *ctx, void *
 
 			char *if_name = section_name(dhcpv4_s);
 			dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", if_name, String}}, 1, &res);
-			DM_ASSERT(res, *value = "");
+			DM_ASSERT(res, *value = dmstrdup(""));
 
 			json_object *jobj = dmjson_select_obj_in_array_idx(res, 0, 1, "ipv4-address");
 			mask = dmjson_get_value(jobj, 1, "mask");
@@ -2574,7 +2444,7 @@ static int get_DHCPv4Client_SubnetMask(char *refparam, struct dmctx *ctx, void *
 		}
 	}
 
-	*value = mask;
+	*value = mask ? mask : "";
 	return 0;
 }
 
@@ -2590,7 +2460,7 @@ static int get_DHCPv4Client_IPRouters(char *refparam, struct dmctx *ctx, void *d
 
 		char *if_name = section_name(dhcpv4_s);
 		dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", if_name, String}}, 1, &res);
-		DM_ASSERT(res, *value = "");
+		DM_ASSERT(res, *value = dmstrdup(""));
 
 		list_ip[0] = 0;
 		dmjson_foreach_obj_in_array(res, arrobj, route, idx, 1, "route") {
@@ -2617,7 +2487,7 @@ static int get_DHCPv4Client_DNSServers(char *refparam, struct dmctx *ctx, void *
 
 		char *if_name = section_name(dhcpv4_s);
 		dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", if_name, String}}, 1, &res);
-		DM_ASSERT(res, *value = "");
+		DM_ASSERT(res, *value = dmstrdup(""));
 		*value = dmjson_get_value_array_all(res, ",", 1, "dns-server");
 	}
 	return 0;
@@ -2627,9 +2497,10 @@ static int get_DHCPv4Client_DNSServers(char *refparam, struct dmctx *ctx, void *
 static void get_lease_time_remaining(const char *ifname, char **value)
 {
 	/* assume wrong unless we find appropriate value */
-	*value = "-1";
+	*value = dmstrdup("-1");
 
 	if (DM_STRLEN(ifname)) {
+		// cppcheck-suppress cert-MSC24-C
 		FILE *fp = fopen(DHCP_CLIENT_INFO, "r");
 
 		if (fp != NULL) {
@@ -2994,7 +2865,7 @@ static int get_DHCPv4Server_Enable(char *refparam, struct dmctx *ctx, void *data
 			dhcpv4_server = dmuci_get_option_value_fallback_def("dhcp", "lan", "dhcpv4", "");
 			// if mode is server
 			if (DM_STRNCMP(dhcpv4_server, "server", 6) == 0) {
-				*value = "1";
+				*value = dmstrdup("1");
 			}
 		}
 	} else {
@@ -3056,12 +2927,12 @@ static int get_DHCPv4ServerPoolOption_Enable(char *refparam, struct dmctx *ctx,
 		uci_foreach_element(option_list, e) {
 			char **buf = strsplit(e->name, ",", &length);
 			if (buf && *buf && DM_STRCMP(buf[0], option->tag) == 0) {
-				*value = "1";
+				*value = dmstrdup("1");
 				return 0;
 			}
 		}
 	}
-	*value = "0";
+	*value = dmstrdup("0");
 	return 0;
 }
 
@@ -3227,11 +3098,11 @@ static int set_DHCPv4ServerPoolOption_Value(char *refparam, struct dmctx *ctx, v
 
 static int get_DHCPv4Relay_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
 {
-	char *path = "/etc/rc.d/*relayd";
+	const char *path = "/etc/rc.d/*relayd";
 	if (check_file(path))
-		*value = "1";
+		*value = dmstrdup("1");
 	else
-		*value = "0";
+		*value = dmstrdup("0");
 	return 0;
 }
 
@@ -3254,11 +3125,11 @@ static int set_DHCPv4Relay_Enable(char *refparam, struct dmctx *ctx, void *data,
 
 static int get_DHCPv4Relay_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
 {
-	char *path = "/etc/rc.d/*relayd";
+	const char *path = "/etc/rc.d/*relayd";
 	if (check_file(path))
-		*value = "Enabled";
+		*value = dmstrdup("Enabled");
 	else
-		*value = "Disabled";
+		*value = dmstrdup("Disabled");
 	return 0;
 }
 
@@ -3275,7 +3146,7 @@ static int get_DHCPv4RelayForwarding_Enable(char *refparam, struct dmctx *ctx, v
 	char *disabled = NULL;
 
 	dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section ? ((struct dm_data *)data)->config_section : ((struct dm_data *)data)->dmmap_section, "disabled", &disabled);
-	*value = (disabled[0] == '1') ? "0" : "1";
+	*value = (disabled[0] == '1') ? dmstrdup("0") : dmstrdup("1");
 	return 0;
 }
 
@@ -3302,7 +3173,7 @@ static int set_DHCPv4RelayForwarding_Enable(char *refparam, struct dmctx *ctx, v
 static int get_DHCPv4RelayForwarding_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
 {
 	get_DHCPv4RelayForwarding_Enable(refparam, ctx, data, instance, value);
-	*value = (DM_LSTRCMP(*value, "1") == 0) ? "Enabled" : "Disabled";
+	*value = (DM_LSTRCMP(*value, "1") == 0) ? dmstrdup("Enabled") : dmstrdup("Disabled");
 	return 0;
 }
 
diff --git a/src/dhcpv4.h b/src/dhcpv4.h
index f8e4205b4f21e1ccb33d83b2c2510791c231de4e..caf9d9b549910394c58b0a247ec90af544572cdc 100644
--- a/src/dhcpv4.h
+++ b/src/dhcpv4.h
@@ -43,9 +43,9 @@ struct option_args
 	char *value;
 };
 
-int set_section_order(char *package, char *dmpackage, char* sect_type, struct uci_section *dmmap_sect, struct uci_section *conf, int set_force, char* order);
-int get_value_in_mac_format(struct uci_section *s, char *option_name, bool type, char **value);
-bool tag_option_exists(char *dmmap_package, char *section, char *opt_check, char *value_check, char *tag_name, char *tag_value);
-char *generate_tag_option(char *dmmap_package, char *section, char *opt_check, char *value_check, char *tag_name);
+int set_section_order(const char *package, const char *dmpackage, const char *sect_type, struct uci_section *dmmap_sect, struct uci_section *conf, int set_force, const char *order);
+int get_value_in_mac_format(struct uci_section *s, const char *option_name, bool type, char **value);
+bool tag_option_exists(const char *dmmap_package, const char *section, const char *opt_check, const char *value_check, const char *tag_name, const char *tag_value);
+char *generate_tag_option(const char *dmmap_package, const char *section, const char *opt_check, const char *value_check, const char *tag_name);
 int get_dhcp_client_interface(struct dmctx *ctx, void *data, char **value);
 #endif
diff --git a/src/dhcpv6.c b/src/dhcpv6.c
index 1aa290b2944e9d20468c1cd2857fe51ead3b6a3f..ef51c9bcca2ae3f49e2ce2c14d9b1f97945d327c 100644
--- a/src/dhcpv6.c
+++ b/src/dhcpv6.c
@@ -15,7 +15,7 @@
 /*************************************************************
 * COMMON FUNCTIONS
 **************************************************************/
-static bool is_dhcpv6_client_section_exist(char *sec_name)
+static bool is_dhcpv6_client_section_exist(const char *sec_name)
 {
 	struct uci_section *s = NULL;
 
@@ -65,12 +65,13 @@ static void dmmap_synchronizeDHCPv6Client(struct dmctx *dmctx, DMNODE *parent_no
 	}
 }
 
-static struct uci_section *get_dhcpv6_classifier(char *classifier_name, const char *network)
+static struct uci_section *get_dhcpv6_classifier(const char *classifier_name, const char *network)
 {
 	struct uci_section *s = NULL;
-	char *v;
 
 	uci_foreach_sections("dhcp", classifier_name, s) {
+		char *v = NULL;
+
 		dmuci_get_value_by_section_string(s, "networkid", &v);
 		if (DM_STRCMP(v, network) == 0)
 			return s;
@@ -78,7 +79,7 @@ static struct uci_section *get_dhcpv6_classifier(char *classifier_name, const ch
 	return NULL;
 }
 
-static int get_value_in_date_time_format(json_object *json_obj, char *option_name, char **value)
+static int get_value_in_date_time_format(json_object *json_obj, const char *option_name, char **value)
 {
 	const char *option_value = dmjson_get_value(json_obj, 1, option_name);
 	if (option_value && *option_value != '\0' && DM_STRTOL(option_value) > 0) {
@@ -285,55 +286,23 @@ static int addObjDHCPv6Client(char *refparam, struct dmctx *ctx, void *data, cha
 
 static int delObjDHCPv6Client(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
 {
-	struct uci_section *s = NULL, *stmp = NULL;
-
-	switch (del_action) {
-		case DEL_INST:
-			dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL);
-
-			if (((struct dm_data *)data)->config_section) {
-				char *ip_instance = NULL;
+	dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL);
 
-				struct uci_section *dmmap_s = get_dup_section_in_dmmap("dmmap_network", "interface", section_name(((struct dm_data *)data)->config_section));
-				dmuci_get_value_by_section_string(dmmap_s, "ip_int_instance", &ip_instance);
-				if (dmmap_s && DM_STRLEN(ip_instance) == 0) {
-					dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL);
-				} else {
-					dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "proto", "none");
-					dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "reqaddress", "");
-					dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "reqprefix", "");
-					dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "reqopts", "");
-				}
-			}
-			break;
-		case DEL_ALL:
-			uci_path_foreach_sections_safe(bbfdm, "dmmap_dhcpv6", "interface", stmp, s) {
-				struct uci_section *iface_s = NULL;
-				char *iface_name = NULL;
-
-				dmuci_get_value_by_section_string(s, "iface_name", &iface_name);
-				if (DM_STRLEN(iface_name))
-					get_config_section_of_dmmap_section("network", "interface", iface_name, &iface_s);
-
-				if (iface_s) {
-					char *ip_instance = NULL;
-
-					struct uci_section *dmmap_s = get_dup_section_in_dmmap("dmmap_network", "interface", section_name(iface_s));
-					dmuci_get_value_by_section_string(dmmap_s, "ip_int_instance", &ip_instance);
-					if (dmmap_s && DM_STRLEN(ip_instance) == 0) {
-						dmuci_delete_by_section(iface_s, NULL, NULL);
-					} else {
-						dmuci_set_value_by_section(iface_s, "proto", "none");
-						dmuci_set_value_by_section(iface_s, "reqaddress", "");
-						dmuci_set_value_by_section(iface_s, "reqprefix", "");
-						dmuci_set_value_by_section(iface_s, "reqopts", "");
-					}
-				}
+	if (((struct dm_data *)data)->config_section) {
+		char *ip_instance = NULL;
 
-				dmuci_delete_by_section(s, NULL, NULL);
-			}
-			break;
+		struct uci_section *dmmap_s = get_dup_section_in_dmmap("dmmap_network", "interface", section_name(((struct dm_data *)data)->config_section));
+		dmuci_get_value_by_section_string(dmmap_s, "ip_int_instance", &ip_instance);
+		if (dmmap_s && DM_STRLEN(ip_instance) == 0) {
+			dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL);
+		} else {
+			dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "proto", "none");
+			dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "reqaddress", "");
+			dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "reqprefix", "");
+			dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "reqopts", "");
+		}
 	}
+
 	return 0;
 }
 
@@ -357,29 +326,8 @@ static int addObjDHCPv6ServerPool(char *refparam, struct dmctx *ctx, void *data,
 
 static int delObjDHCPv6ServerPool(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
 {
-	struct uci_section *s = NULL, *stmp = NULL;
-
-	switch (del_action) {
-		case DEL_INST:
-			dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL);
-			dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL);
-			break;
-		case DEL_ALL:
-			uci_foreach_sections_safe("dhcp", "dhcp", stmp, s) {
-				char *dhcpv6 = NULL;
-
-				dmuci_get_value_by_section_string(s, "dhcpv6", &dhcpv6);
-				if (DM_LSTRCMP(dhcpv6, "server") == 0) {
-					struct uci_section *dmmap_section = NULL;
-
-					get_dmmap_section_of_config_section("dmmap_dhcpv6", "dhcp", section_name(s), &dmmap_section);
-					dmuci_delete_by_section(dmmap_section, NULL, NULL);
-
-					dmuci_delete_by_section(s, NULL, NULL);
-				}
-			}
-			break;
-	}
+	dmuci_delete_by_section(((struct dm_data *)data)->config_section, NULL, NULL);
+	dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL);
 	return 0;
 }
 
@@ -398,29 +346,18 @@ static int addObjDHCPv6ServerPoolOption(char *refparam, struct dmctx *ctx, void
 
 static int delObjDHCPv6ServerPoolOption(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action)
 {
-	struct uci_section *s = NULL, *stmp = NULL;
 	struct uci_list *dhcp_options_list = NULL;
 
-	switch (del_action) {
-		case DEL_INST:
-			dmuci_get_value_by_section_list(((struct dm_data *)data)->config_section, "dhcp_option", &dhcp_options_list);
-			if (dhcp_options_list != NULL) {
-				struct option_args *option = (struct option_args *)((struct dm_data *)data)->additional_data;
-				char tag_value[128] = {0};
-
-				snprintf(tag_value, sizeof(tag_value), "%s,%s", option->tag, option->value);
-				dmuci_del_list_value_by_section(((struct dm_data *)data)->config_section, "dhcp_option", tag_value);
-			}
+	dmuci_get_value_by_section_list(((struct dm_data *)data)->config_section, "dhcp_option", &dhcp_options_list);
+	if (dhcp_options_list != NULL) {
+		struct option_args *option = (struct option_args *)((struct dm_data *)data)->additional_data;
+		char tag_value[128] = {0};
 
-			dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL);
-			break;
-		case DEL_ALL:
-			dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "dhcp_option", "");
-			uci_path_foreach_sections_safe(bbfdm, "dmmap_dhcpv6", "servpool_option", stmp, s) {
-				dmuci_delete_by_section(s, NULL, NULL);
-			}
-			break;
+		snprintf(tag_value, sizeof(tag_value), "%s,%s", option->tag, option->value);
+		dmuci_del_list_value_by_section(((struct dm_data *)data)->config_section, "dhcp_option", tag_value);
 	}
+
+	dmuci_delete_by_section(((struct dm_data *)data)->dmmap_section, NULL, NULL);
 	return 0;
 }
 
@@ -584,7 +521,7 @@ static int get_DHCPv6Client_DUID(char *refparam, struct dmctx *ctx, void *data,
 
 		char *if_name = section_name(dhcpv6_s);
 		dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", if_name, String}}, 1, &res);
-		DM_ASSERT(res, *value = "");
+		DM_ASSERT(res, *value = dmstrdup(""));
 		*value = dmjson_get_value(res, 2, "data", "passthru");
 	}
 	return 0;
@@ -654,7 +591,7 @@ static int set_DHCPv6Client_RequestPrefixes(char *refparam, struct dmctx *ctx, v
 
 static int get_DHCPv6Client_Renew(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
 {
-	*value = "false";
+	*value = dmstrdup("false");
 	return 0;
 }
 
@@ -709,11 +646,11 @@ static int set_DHCPv6Client_RequestedOptions(char *refparam, struct dmctx *ctx,
 
 static int get_DHCPv6Server_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
 {
-	char *path = "/etc/rc.d/*odhcpd";
+	const char *path = "/etc/rc.d/*odhcpd";
 	if (check_file(path))
-		*value = "1";
+		*value = dmstrdup("1");
 	else
-		*value = "0";
+		*value = dmstrdup("0");
 	return 0;
 }
 
@@ -916,7 +853,7 @@ static int get_DHCPv6ServerPool_SourceAddress(char *refparam, struct dmctx *ctx,
 {
 	struct uci_section *classifier_s = get_dhcpv6_classifier("mac", (char *)((struct dm_data *)data)->additional_data);
 	if (classifier_s == NULL) {
-		*value = "";
+		*value = dmstrdup("");
 		return 0;
 	}
 
@@ -940,7 +877,7 @@ static int get_DHCPv6ServerPool_SourceAddressMask(char *refparam, struct dmctx *
 {
 	struct uci_section *classifier_s = get_dhcpv6_classifier("mac", (char *)((struct dm_data *)data)->additional_data);
 	if (classifier_s == NULL) {
-		*value = "";
+		*value = dmstrdup("");
 		return 0;
 	}
 
@@ -977,7 +914,7 @@ static int get_DHCPv6ServerPool_OptionNumberOfEntries(char *refparam, struct dmc
 static int get_DHCPv6ServerPoolClient_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
 {
 	struct uci_section *s = NULL;
-	char *src_addr = ""; //should be updated when SourceAddress parameter is implemented
+	const char *src_addr = ""; //should be updated when SourceAddress parameter is implemented
 
 	uci_path_foreach_sections(bbfdm, "dmmap", "dhcpv6clients", s) {
 		char *srcaddr;
@@ -995,7 +932,7 @@ static int get_DHCPv6ServerPoolClient_Alias(char *refparam, struct dmctx *ctx, v
 static int set_DHCPv6ServerPoolClient_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
 {
 	struct uci_section *s = NULL, *dmmap = NULL;
-	char *src_addr = "";
+	const char *src_addr = "";
 
 	switch (action)	{
 		case VALUECHECK:
@@ -1053,7 +990,7 @@ static int get_DHCPv6ServerPoolClientIPv6Prefix_Prefix(char *refparam, struct dm
 
 static int get_DHCPv6ServerPoolClientIPv6Prefix_PreferredLifetime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
 {
-	*value = "0001-01-01T00:00:00Z";
+	*value = dmstrdup("0001-01-01T00:00:00Z");
 
 	char *preferred = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "preferred-lifetime");
 	if (preferred && *preferred != '\0' && DM_STRTOL(preferred) > 0) {
@@ -1069,7 +1006,7 @@ static int get_DHCPv6ServerPoolClientIPv6Prefix_PreferredLifetime(char *refparam
 
 static int get_DHCPv6ServerPoolClientIPv6Prefix_ValidLifetime(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
 {
-	*value = "0001-01-01T00:00:00Z";
+	*value = dmstrdup("0001-01-01T00:00:00Z");
 
 	char *valid = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "valid-lifetime");
 	if (valid && *valid != '\0' && DM_STRTOL(valid) > 0) {
@@ -1096,13 +1033,13 @@ static int get_DHCPv6ServerPoolOption_Enable(char *refparam, struct dmctx *ctx,
 		uci_foreach_element(option_list, e) {
 			char **buf = strsplit(e->name, ",", &length);
 			if (buf && *buf && DM_STRCMP(buf[0], option->tag) == 0) {
-				*value = "1";
+				*value = dmstrdup("1");
 				return 0;
 			}
 		}
 	}
 
-	*value = "0";
+	*value = dmstrdup("0");
 	return 0;
 }