[PATCH v1] env: add w flags for net config in explicit write mode

Heiko Schocher hs at nabladev.com
Mon Jan 26 14:25:55 CET 2026


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 at nabladev.com
Geschäftsführer : Stefano Babic


More information about the U-Boot mailing list