summaryrefslogtreecommitdiff
path: root/env
diff options
context:
space:
mode:
Diffstat (limited to 'env')
-rw-r--r--env/Kconfig1
-rw-r--r--env/env.c8
-rw-r--r--env/flags.c10
3 files changed, 14 insertions, 5 deletions
diff --git a/env/Kconfig b/env/Kconfig
index c409ea71fe5..6e24eee55f2 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -733,6 +733,7 @@ config ENV_APPEND
config ENV_WRITEABLE_LIST
bool "Permit write access only to listed variables"
+ select ENV_APPEND
help
If defined, only environment variables which explicitly set the 'w'
writeable flag can be written and modified at runtime. No variables
diff --git a/env/env.c b/env/env.c
index 0f73ebc08e0..ad774f41175 100644
--- a/env/env.c
+++ b/env/env.c
@@ -192,6 +192,14 @@ int env_load(void)
int best_prio = -1;
int prio;
+ if (CONFIG_IS_ENABLED(ENV_WRITEABLE_LIST)) {
+ /*
+ * When using a list of writeable variables, the baseline comes
+ * from the built-in default env. So load this first.
+ */
+ env_set_default(NULL, 0);
+ }
+
for (prio = 0; (drv = env_driver_lookup(ENVOP_LOAD, prio)); prio++) {
int ret;
diff --git a/env/flags.c b/env/flags.c
index e3e833c4333..e2866361dfe 100644
--- a/env/flags.c
+++ b/env/flags.c
@@ -22,7 +22,7 @@
#include <env_internal.h>
#endif
-#ifdef CONFIG_CMD_NET
+#ifdef CONFIG_NET
#define ENV_FLAGS_NET_VARTYPE_REPS "im"
#else
#define ENV_FLAGS_NET_VARTYPE_REPS ""
@@ -57,7 +57,7 @@ static const char * const env_flags_vartype_names[] = {
"decimal",
"hexadecimal",
"boolean",
-#ifdef CONFIG_CMD_NET
+#ifdef CONFIG_NET
"IP address",
"MAC address",
#endif
@@ -211,7 +211,7 @@ static void skip_num(int hex, const char *value, const char **end,
*end = value;
}
-#ifdef CONFIG_CMD_NET
+#ifdef CONFIG_NET
int eth_validate_ethaddr_str(const char *addr)
{
const char *end;
@@ -244,7 +244,7 @@ static int _env_flags_validate_type(const char *value,
enum env_flags_vartype type)
{
const char *end;
-#ifdef CONFIG_CMD_NET
+#ifdef CONFIG_NET
const char *cur;
int i;
#endif
@@ -273,7 +273,7 @@ static int _env_flags_validate_type(const char *value,
if (value[1] != '\0')
return -1;
break;
-#ifdef CONFIG_CMD_NET
+#ifdef CONFIG_NET
case env_flags_vartype_ipaddr:
cur = value;
for (i = 0; i < 4; i++) {