All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] env: add w flags for net config in explicit write mode
@ 2026-01-24  5:40 Heiko Schocher
  2026-01-24 11:35 ` Benjamin ROBIN
  0 siblings, 1 reply; 6+ messages in thread
From: Heiko Schocher @ 2026-01-24  5:40 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Adrian Freihofer, Heiko Schocher, Benjamin ROBIN,
	Jerome Forissier, Joe Hershberger, Marek Vasut, Quentin Schulz,
	Tom Rini

From: Adrian Freihofer <adrian.freihofer@siemens.com>

In explicit write access mode (CONFIG_ENV_WRITEABLE_LIST) the
environment variables listed in NET_FLAGS and NET6_FLAGS are
probably intended to be writeable. Therefore add the 'w' flag
to these variables.

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Heiko Schocher <hs@nabladev.com>
---

 include/env_flags.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Azure build (patch is in a bunch of siemens patches sending
now to mainline):
https://dev.azure.com/hs0298/hs/_build/results?buildId=202&view=results

diff --git a/include/env_flags.h b/include/env_flags.h
index 0c48874690f..fc65dcaba21 100644
--- a/include/env_flags.h
+++ b/include/env_flags.h
@@ -56,6 +56,16 @@ enum env_flags_varaccess {
 #define ETHADDR_FLAGS "eth" ETHADDR_WILDCARD "addr:mo,"
 #endif
 #endif
+#ifdef CONFIG_ENV_WRITEABLE_LIST
+#define NET_FLAGS \
+	"ipaddr:iw," \
+	"gatewayip:iw," \
+	"netmask:iw," \
+	"serverip:iw," \
+	"nvlan:dw," \
+	"vlan:dw," \
+	"dnsip:iw,"
+#else
 #define NET_FLAGS \
 	"ipaddr:i," \
 	"gatewayip:i," \
@@ -64,16 +74,24 @@ enum env_flags_varaccess {
 	"nvlan:d," \
 	"vlan:d," \
 	"dnsip:i,"
+#endif
 #else
 #define ETHADDR_FLAGS
 #define NET_FLAGS
 #endif
 
 #ifdef CONFIG_IPV6
+#ifdef CONFIG_ENV_WRITEABLE_LIST
+#define NET6_FLAGS \
+	"ip6addr:sw," \
+	"serverip6:sw," \
+	"gatewayip6:sw,"
+#else
 #define NET6_FLAGS \
 	"ip6addr:s," \
 	"serverip6:s," \
 	"gatewayip6:s,"
+#endif
 #else
 #define NET6_FLAGS
 #endif
-- 
2.20.1

base-commit: 6b2d05748cf3cd6ba417a96c00602b0122e10af6

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] env: add w flags for net config in explicit write mode
  2026-01-24  5:40 [PATCH v1] env: add w flags for net config in explicit write mode Heiko Schocher
@ 2026-01-24 11:35 ` Benjamin ROBIN
  2026-01-25 13:03   ` Heiko Schocher
  0 siblings, 1 reply; 6+ messages in thread
From: Benjamin ROBIN @ 2026-01-24 11:35 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Adrian Freihofer, Heiko Schocher, Benjamin ROBIN,
	Jerome Forissier, Joe Hershberger, Marek Vasut, Quentin Schulz,
	Tom Rini

Hello,

On Saturday, January 24, 2026 at 6:40 AM, Heiko Schocher wrote:
> From: Adrian Freihofer <adrian.freihofer@siemens.com>
> 
> In explicit write access mode (CONFIG_ENV_WRITEABLE_LIST) the
> environment variables listed in NET_FLAGS and NET6_FLAGS are
> probably intended to be writeable. Therefore add the 'w' flag
> to these variables.

Users who enable CONFIG_ENV_WRITEABLE_LIST typically want full control over 
which environment variables are writable. The new default behavior introduced 
by your patch might not align with what all users expect or want.

Would overriding the flags using CFG_ENV_FLAGS_LIST_STATIC not work in this 
case?

> diff --git a/include/env_flags.h b/include/env_flags.h
> index 0c48874690f..fc65dcaba21 100644
> --- a/include/env_flags.h
> +++ b/include/env_flags.h
> @@ -56,6 +56,16 @@ enum env_flags_varaccess {
>  #define ETHADDR_FLAGS "eth" ETHADDR_WILDCARD "addr:mo,"
>  #endif
>  #endif
> +#ifdef CONFIG_ENV_WRITEABLE_LIST
> +#define NET_FLAGS \
> +	"ipaddr:iw," \
> +	"gatewayip:iw," \
> +	"netmask:iw," \
> +	"serverip:iw," \
> +	"nvlan:dw," \
> +	"vlan:dw," \
> +	"dnsip:iw,"
> +#else
>  #define NET_FLAGS \
>  	"ipaddr:i," \
>  	"gatewayip:i," \
> @@ -64,16 +74,24 @@ enum env_flags_varaccess {
>  	"nvlan:d," \
>  	"vlan:d," \
>  	"dnsip:i,"
> +#endif
>  #else
>  #define ETHADDR_FLAGS
>  #define NET_FLAGS
>  #endif
> 
>  #ifdef CONFIG_IPV6
> +#ifdef CONFIG_ENV_WRITEABLE_LIST
> +#define NET6_FLAGS \
> +	"ip6addr:sw," \
> +	"serverip6:sw," \
> +	"gatewayip6:sw,"
> +#else
>  #define NET6_FLAGS \
>  	"ip6addr:s," \
>  	"serverip6:s," \
>  	"gatewayip6:s,"
> +#endif
>  #else
>  #define NET6_FLAGS
>  #endif

Best regards,
-- 
Benjamin Robin, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] env: add w flags for net config in explicit write mode
  2026-01-24 11:35 ` Benjamin ROBIN
@ 2026-01-25 13:03   ` Heiko Schocher
  2026-01-25 13:33     ` Benjamin ROBIN
  0 siblings, 1 reply; 6+ messages in thread
From: Heiko Schocher @ 2026-01-25 13:03 UTC (permalink / raw)
  To: Benjamin ROBIN, U-Boot Mailing List, Adrian Freihofer
  Cc: Benjamin ROBIN, Jerome Forissier, Joe Hershberger, Marek Vasut,
	Quentin Schulz, Tom Rini

Hello Benjamin,

On 24.01.26 12:35, Benjamin ROBIN wrote:
> Hello,
> 
> On Saturday, January 24, 2026 at 6:40 AM, Heiko Schocher wrote:
>> From: Adrian Freihofer <adrian.freihofer@siemens.com>
>>
>> In explicit write access mode (CONFIG_ENV_WRITEABLE_LIST) the
>> environment variables listed in NET_FLAGS and NET6_FLAGS are
>> probably intended to be writeable. Therefore add the 'w' flag
>> to these variables.
> 
> Users who enable CONFIG_ENV_WRITEABLE_LIST typically want full control over
> which environment variables are writable. The new default behavior introduced
> by your patch might not align with what all users expect or want.
> 
> Would overriding the flags using CFG_ENV_FLAGS_LIST_STATIC not work in this
> case?

Good question, I have to test... or may Adrian has already done
such tests...

But looking into code.. if we add this variables in ENV_WRITEABLE_LIST
the results would be, that this variables are twice in ENV_FLAGS_LIST_STATIC

include/env_flags.h
  87 #define ENV_FLAGS_LIST_STATIC \
  88         ETHADDR_FLAGS \
  89         NET_FLAGS \
  90         NET6_FLAGS \
  91         SERIAL_FLAGS \
  92         CFG_ENV_FLAGS_LIST_STATIC

once through NET_FLAGS and once through CFG_ENV_FLAGS_LIST_STATIC

So, that is not good, and I think, code will find the first
entry, and parse it -> so it will not work.

Should we instead in case CONFIG_ENV_WRITEABLE_LIST is enabled
only set/allow CFG_ENV_FLAGS_LIST_STATIC in ENV_FLAGS_LIST_STATIC ?

bye,
Heiko
-- 
Nabla Software Engineering
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: office@nabladev.com
Geschäftsführer : Stefano Babic

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] env: add w flags for net config in explicit write mode
  2026-01-25 13:03   ` Heiko Schocher
@ 2026-01-25 13:33     ` Benjamin ROBIN
  2026-01-25 13:40       ` Heiko Schocher
  0 siblings, 1 reply; 6+ messages in thread
From: Benjamin ROBIN @ 2026-01-25 13:33 UTC (permalink / raw)
  To: U-Boot Mailing List, Adrian Freihofer, Heiko Schocher
  Cc: Benjamin ROBIN, Jerome Forissier, Joe Hershberger, Marek Vasut,
	Quentin Schulz, Tom Rini

Hello Heiko,

On Sunday, January 25, 2026 at 2:03 PM, Heiko Schocher wrote:
> > Users who enable CONFIG_ENV_WRITEABLE_LIST typically want full control
> > over
> > which environment variables are writable. The new default behavior
> > introduced by your patch might not align with what all users expect or
> > want.
> > 
> > Would overriding the flags using CFG_ENV_FLAGS_LIST_STATIC not work in
> > this
> > case?
> 
> Good question, I have to test... or may Adrian has already done
> such tests...

Please test.

> But looking into code.. if we add this variables in ENV_WRITEABLE_LIST
> the results would be, that this variables are twice in ENV_FLAGS_LIST_STATIC
>
> include/env_flags.h
>   87 #define ENV_FLAGS_LIST_STATIC \
>   88         ETHADDR_FLAGS \
>   89         NET_FLAGS \
>   90         NET6_FLAGS \
>   91         SERIAL_FLAGS \
>   92         CFG_ENV_FLAGS_LIST_STATIC
> 
> once through NET_FLAGS and once through CFG_ENV_FLAGS_LIST_STATIC

Yes, the variables with the flags would be declared twice.
 
> So, that is not good, and I think, code will find the first
> entry, and parse it -> so it will not work.

What leads you to this assumption?

If you examine the code, you'll notice that:
 - The env_attr_lookup() function returns the last entry.
 - When iterating over the flags using env_attr_walk(), any previous attribute
   flags are overridden by subsequent flag declarations.

> Should we instead in case CONFIG_ENV_WRITEABLE_LIST is enabled
> only set/allow CFG_ENV_FLAGS_LIST_STATIC in ENV_FLAGS_LIST_STATIC ?

I haven't tested this myself, as I currently don't have a test environment 
available. Please test it, and if it doesn't work, the correct fix would be to 
ensure that any future flag declaration overrides previous ones.

-- 
Benjamin Robin, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] env: add w flags for net config in explicit write mode
  2026-01-25 13:33     ` Benjamin ROBIN
@ 2026-01-25 13:40       ` Heiko Schocher
  2026-01-26 13:25         ` Heiko Schocher
  0 siblings, 1 reply; 6+ messages in thread
From: Heiko Schocher @ 2026-01-25 13:40 UTC (permalink / raw)
  To: Benjamin ROBIN, U-Boot Mailing List, Adrian Freihofer
  Cc: Benjamin ROBIN, Jerome Forissier, Joe Hershberger, Marek Vasut,
	Quentin Schulz, Tom Rini

Hello Benjamin,

On 25.01.26 14:33, Benjamin ROBIN wrote:
> Hello Heiko,
> 
> On Sunday, January 25, 2026 at 2:03 PM, Heiko Schocher wrote:
>>> Users who enable CONFIG_ENV_WRITEABLE_LIST typically want full control
>>> over
>>> which environment variables are writable. The new default behavior
>>> introduced by your patch might not align with what all users expect or
>>> want.
>>>
>>> Would overriding the flags using CFG_ENV_FLAGS_LIST_STATIC not work in
>>> this
>>> case?
>>
>> Good question, I have to test... or may Adrian has already done
>> such tests...
> 
> Please test.

We will do.

> 
>> But looking into code.. if we add this variables in ENV_WRITEABLE_LIST
>> the results would be, that this variables are twice in ENV_FLAGS_LIST_STATIC
>>
>> include/env_flags.h
>>    87 #define ENV_FLAGS_LIST_STATIC \
>>    88         ETHADDR_FLAGS \
>>    89         NET_FLAGS \
>>    90         NET6_FLAGS \
>>    91         SERIAL_FLAGS \
>>    92         CFG_ENV_FLAGS_LIST_STATIC
>>
>> once through NET_FLAGS and once through CFG_ENV_FLAGS_LIST_STATIC
> 
> Yes, the variables with the flags would be declared twice.
>   
>> So, that is not good, and I think, code will find the first
>> entry, and parse it -> so it will not work.
> 
> What leads you to this assumption?
> 
> If you examine the code, you'll notice that:
>   - The env_attr_lookup() function returns the last entry.
>   - When iterating over the flags using env_attr_walk(), any previous attribute
>     flags are overridden by subsequent flag declarations.

Ah, thats the trick! If this is the case, I aggree, and we can
simply drop this patch!

> 
>> Should we instead in case CONFIG_ENV_WRITEABLE_LIST is enabled
>> only set/allow CFG_ENV_FLAGS_LIST_STATIC in ENV_FLAGS_LIST_STATIC ?
> 
> I haven't tested this myself, as I currently don't have a test environment
> available. Please test it, and if it doesn't work, the correct fix would be to
> ensure that any future flag declaration overrides previous ones.

We will test, thanks!

bye,
Heiko
-- 
Nabla Software Engineering
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: office@nabladev.com
Geschäftsführer : Stefano Babic

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] env: add w flags for net config in explicit write mode
  2026-01-25 13:40       ` Heiko Schocher
@ 2026-01-26 13:25         ` Heiko Schocher
  0 siblings, 0 replies; 6+ messages in thread
From: Heiko Schocher @ 2026-01-26 13:25 UTC (permalink / raw)
  To: Benjamin ROBIN, U-Boot Mailing List, Adrian Freihofer
  Cc: Benjamin ROBIN, Jerome Forissier, Joe Hershberger, Marek Vasut,
	Quentin Schulz, Tom Rini

Hello Benjamin

On 25.01.26 14:40, Heiko Schocher wrote:
> Hello Benjamin,
> 
> On 25.01.26 14:33, Benjamin ROBIN wrote:
>> Hello Heiko,
>>
>> On Sunday, January 25, 2026 at 2:03 PM, Heiko Schocher wrote:
>>>> Users who enable CONFIG_ENV_WRITEABLE_LIST typically want full control
>>>> over
>>>> which environment variables are writable. The new default behavior
>>>> introduced by your patch might not align with what all users expect or
>>>> want.
>>>>
>>>> Would overriding the flags using CFG_ENV_FLAGS_LIST_STATIC not work in
>>>> this
>>>> case?
>>>
>>> Good question, I have to test... or may Adrian has already done
>>> such tests...
>>
>> Please test.
> 
> We will do.
> 
>>
>>> But looking into code.. if we add this variables in ENV_WRITEABLE_LIST
>>> the results would be, that this variables are twice in ENV_FLAGS_LIST_STATIC
>>>
>>> include/env_flags.h
>>>    87 #define ENV_FLAGS_LIST_STATIC \
>>>    88         ETHADDR_FLAGS \
>>>    89         NET_FLAGS \
>>>    90         NET6_FLAGS \
>>>    91         SERIAL_FLAGS \
>>>    92         CFG_ENV_FLAGS_LIST_STATIC
>>>
>>> once through NET_FLAGS and once through CFG_ENV_FLAGS_LIST_STATIC
>>
>> Yes, the variables with the flags would be declared twice.
>>> So, that is not good, and I think, code will find the first
>>> entry, and parse it -> so it will not work.
>>
>> What leads you to this assumption?
>>
>> If you examine the code, you'll notice that:
>>   - The env_attr_lookup() function returns the last entry.
>>   - When iterating over the flags using env_attr_walk(), any previous attribute
>>     flags are overridden by subsequent flag declarations.
> 
> Ah, thats the trick! If this is the case, I aggree, and we can
> simply drop this patch!
> 
>>
>>> Should we instead in case CONFIG_ENV_WRITEABLE_LIST is enabled
>>> only set/allow CFG_ENV_FLAGS_LIST_STATIC in ENV_FLAGS_LIST_STATIC ?
>>
>> I haven't tested this myself, as I currently don't have a test environment
>> available. Please test it, and if it doesn't work, the correct fix would be to
>> ensure that any future flag declaration overrides previous ones.
> 
> We will test, thanks!

Thanks for this hint, we tested your suggestion and it works!

So this patch can be ignored, I already changed the state in
patchwork to superseded!

Thanks!

bye,
Heiko
> 
> bye,
> Heiko

-- 
Nabla Software Engineering
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: office@nabladev.com
Geschäftsführer : Stefano Babic

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-01-26 13:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-24  5:40 [PATCH v1] env: add w flags for net config in explicit write mode Heiko Schocher
2026-01-24 11:35 ` Benjamin ROBIN
2026-01-25 13:03   ` Heiko Schocher
2026-01-25 13:33     ` Benjamin ROBIN
2026-01-25 13:40       ` Heiko Schocher
2026-01-26 13:25         ` Heiko Schocher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.