Skip to content

Conversation

@luckyfunky
Copy link

This is untested with U-Boot. I'm hope to get some feedback whether such feature is desirable or even makes sense before invensting more time in it (starting the counter-part in U-Boot).

As a use-case I see general validation for variables to prevent system misconfiguration.

Here the commit message/usage information:

Add range check for variables using the ".flags" variable. Different types of ranges can be specified for strings, decimals and hex-values.

  • For string one can specify a regular expression for valid string.
  • For decimals one can specify an integer range
  • For hex values one can specify a bitmask

The range is added by the '@' character after the access flags.

Example:

Environment:

.flags=foo:sw@r"aaab+",bla:dw@100-200,blub:xw@0xffff foo=aaab
bla=123
blub=0x1234

Commandline:

$ fw_setenv foo aaac
libuboot_set_env failed: -1

$ fw_setenv foo aaabbbb
$ fw_printenv
bla=123
blub=0x1234
foo=aaabbb

Add range check for variables using the ".flags" variable. Different
types of ranges can be specified for strings, decimals and hex-values.

- For string one can specify a regular expression for valid string.
- For decimals one can specify an integer range
- For hex values one can specify a bitmask

The range is added by the '@' character after the access flags.

Example:

Environment:

.flags=foo:sw@r"aaab+",bla:dw@100-200,blub:xw@0xffff
foo=aaab
bla=123
blub=0x1234

Commandline:

$ fw_setenv foo aaac
libuboot_set_env failed: -1

$ fw_setenv foo aaabbbb
$ fw_printenv
bla=123
blub=0x1234
foo=aaabbb

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant