History log of /u-boot/include/env_flags.h
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 5e541c48 15-Feb-2023 Sean Edmond <seanedmond@microsoft.com>

net: ipv6: IPv6 environment variable cleanup

Fix "setenv gatewayip6".

Synchronize IPv6 local variables with environment variables
in netboot_update_env()

Signed-off-by: Sean Edmond <seanedmond@microsoft.com>

# 906bad3c 03-Feb-2023 Jan Kiszka <jan.kiszka@siemens.com>

env: Couple networking-related variable flags to CONFIG_NET

Boards may set networking variables programmatically, thus may have
CONFIG_NET on but CONFIG_CMD_NET off. The IOT2050 is an example.

CC: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# acf29d8c 04-Dec-2022 Tom Rini <trini@konsulko.com>

global: Migrate CONFIG_ENV_FLAGS_LIST_STATIC to CFG

Perform a simple rename of CONFIG_ENV_FLAGS_LIST_STATIC to CFG_ENV_FLAGS_LIST_STATIC

Signed-off-by: Tom Rini <trini@konsulko.com>

# 1dfa4ef1 01-Dec-2022 Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>

net: ipv6: Add callbacks declarations to get access to IPv6 variables

Set up callbacks for main IPv6 variables ip6add, serverip6, gatewayip6
and set options to them in flag file. These variables are often set up by
users.

Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d045cbac 07-Jul-2020 Marek Vasut <marex@denx.de>

env: Add support for explicit write access list

This option marks any U-Boot variable which does not have explicit 'w'
writeable flag set as read-only. This way the environment can be locked
down and only variables explicitly configured to be writeable can ever
be changed by either 'env import', 'env set' or loading user environment
from environment storage.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cccc05ee 02-Sep-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

env: net: U_BOOT_ENV_CALLBACKs should not depend on CMD_NET

Some environment variables are relevant for networking. For these
U_BOOT_ENV_CALLBACKs have been defined. When the corresponding environment
variable is updated the callback updates the state of the network
sub-system.

In the UEFI subsystem we can use the network even if CONFIG_CMD_NET is not
defined.

Let the usage of the U_BOOT_ENV_CALLBACKs depend on CONFIG_NET and not on
CONFIG_CMD_NET.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# dd2408ca 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Drop the ENTRY typedef

U-Boot is not supposed to use typedef for structs anymore. Also this name
is the same as the ENTRY() macro used in assembler files, and 'entry'
itself is widely used in U-Boot (>8k matches).

Drop the typedef and rename the struct to env_entry to reduce confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fb625ce 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_set() to env.h

Move env_set() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# be09f5bc 22-Nov-2018 Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

net: fix env flags for eth10addr and above

With CONFIG_REGEX enabled, ETHADDR_WILDCARD is set up for up to 10
interfaces (0..9) as the number can only have one digit.

On boards with more than 10 interfaces, this leads to the protection
and format checks being absent for eth10addr and above.

Fix this by changing ETHADDR_WILDCARD from "\\d?" to "\\d*" to allow
more than one digit.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 0299cee5 13-Apr-2016 Stefan Agner <stefan@agner.ch>

net: fix vlan validation

VLAN identifiers are 12-bit decimal numbers, not IP addresses.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 167f5258 09-Dec-2015 Andreas Fenkart <andreas.fenkart@digitalstrom.com>

tools: env validate: pass values as 0-based array

passing argv/argc can produce off-by-one errors

Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>

# 0118e83b 09-Sep-2015 Codrin Ciubotariu <codrin.ciubotariu@freescale.com>

common/env_flags.c: Add function to validate a MAC address

The code that checks if a string has the format of a MAC address has been
moved to a separate function called eth_validate_ethaddr_str().

This has been done to allow other components (such as vsc9953 driver)
to validate a MAC address.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@freescale.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# c0a93440 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

net: Add default flags for common net env vars

Check that the common network stack's env vars conform to the proper
format for IP addresses.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 73c2bbee 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

net: Apply default format rules to all ethaddr

Use a regular expression to apply the default formatting flags for all
ethaddr env vars.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# 1d6cd0a3 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Handle write-once ethaddr and serial# generically

Use the variable access flags to implement the protection for ethaddr
and serial# instead of hard-coding them.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 267541f7 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Add support for access control to .flags

Add support for read-only, write-once, and change-default.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# fffad71b 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Add a command to display details about env flags

Similar to the env callback command, this will show details about the
options available, the static list, and the currently active variables.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 30fd4fad 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

tools/env: Add environment variable flags support

Currently just validates variable types as decimal, hexidecimal,
boolean, ip address, and mac address. Call
env_acl_validate_setenv_params() from setenv() in fw_env.c.

If the entry is not found in the env .flags, then look in the static
one. This allows the env to override the static definitions, but prevents
the need to have every definition in the environment distracting you.

Need to build in _ctype for isdigit for Linux.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 2598090b 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Add environment variable flags

Currently just validates variable types as decimal, hexidecimal,
boolean, ip address, and mac address.

If the entry is not found in the env ".flags", then look in the static
one. This allows the env to override the static definitions, but prevents
the need to have every definition in the environment distracting you.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 906bad3c 03-Feb-2023 Jan Kiszka <jan.kiszka@siemens.com>

env: Couple networking-related variable flags to CONFIG_NET

Boards may set networking variables programmatically, thus may have
CONFIG_NET on but CONFIG_CMD_NET off. The IOT2050 is an example.

CC: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# acf29d8c 04-Dec-2022 Tom Rini <trini@konsulko.com>

global: Migrate CONFIG_ENV_FLAGS_LIST_STATIC to CFG

Perform a simple rename of CONFIG_ENV_FLAGS_LIST_STATIC to CFG_ENV_FLAGS_LIST_STATIC

Signed-off-by: Tom Rini <trini@konsulko.com>

# 1dfa4ef1 01-Dec-2022 Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>

net: ipv6: Add callbacks declarations to get access to IPv6 variables

Set up callbacks for main IPv6 variables ip6add, serverip6, gatewayip6
and set options to them in flag file. These variables are often set up by
users.

Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d045cbac 07-Jul-2020 Marek Vasut <marex@denx.de>

env: Add support for explicit write access list

This option marks any U-Boot variable which does not have explicit 'w'
writeable flag set as read-only. This way the environment can be locked
down and only variables explicitly configured to be writeable can ever
be changed by either 'env import', 'env set' or loading user environment
from environment storage.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cccc05ee 02-Sep-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

env: net: U_BOOT_ENV_CALLBACKs should not depend on CMD_NET

Some environment variables are relevant for networking. For these
U_BOOT_ENV_CALLBACKs have been defined. When the corresponding environment
variable is updated the callback updates the state of the network
sub-system.

In the UEFI subsystem we can use the network even if CONFIG_CMD_NET is not
defined.

Let the usage of the U_BOOT_ENV_CALLBACKs depend on CONFIG_NET and not on
CONFIG_CMD_NET.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# dd2408ca 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Drop the ENTRY typedef

U-Boot is not supposed to use typedef for structs anymore. Also this name
is the same as the ENTRY() macro used in assembler files, and 'entry'
itself is widely used in U-Boot (>8k matches).

Drop the typedef and rename the struct to env_entry to reduce confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fb625ce 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_set() to env.h

Move env_set() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# be09f5bc 22-Nov-2018 Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

net: fix env flags for eth10addr and above

With CONFIG_REGEX enabled, ETHADDR_WILDCARD is set up for up to 10
interfaces (0..9) as the number can only have one digit.

On boards with more than 10 interfaces, this leads to the protection
and format checks being absent for eth10addr and above.

Fix this by changing ETHADDR_WILDCARD from "\\d?" to "\\d*" to allow
more than one digit.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 0299cee5 13-Apr-2016 Stefan Agner <stefan@agner.ch>

net: fix vlan validation

VLAN identifiers are 12-bit decimal numbers, not IP addresses.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 167f5258 09-Dec-2015 Andreas Fenkart <andreas.fenkart@digitalstrom.com>

tools: env validate: pass values as 0-based array

passing argv/argc can produce off-by-one errors

Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>

# 0118e83b 09-Sep-2015 Codrin Ciubotariu <codrin.ciubotariu@freescale.com>

common/env_flags.c: Add function to validate a MAC address

The code that checks if a string has the format of a MAC address has been
moved to a separate function called eth_validate_ethaddr_str().

This has been done to allow other components (such as vsc9953 driver)
to validate a MAC address.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@freescale.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# c0a93440 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

net: Add default flags for common net env vars

Check that the common network stack's env vars conform to the proper
format for IP addresses.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 73c2bbee 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

net: Apply default format rules to all ethaddr

Use a regular expression to apply the default formatting flags for all
ethaddr env vars.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# 1d6cd0a3 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Handle write-once ethaddr and serial# generically

Use the variable access flags to implement the protection for ethaddr
and serial# instead of hard-coding them.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 267541f7 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Add support for access control to .flags

Add support for read-only, write-once, and change-default.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# fffad71b 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Add a command to display details about env flags

Similar to the env callback command, this will show details about the
options available, the static list, and the currently active variables.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 30fd4fad 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

tools/env: Add environment variable flags support

Currently just validates variable types as decimal, hexidecimal,
boolean, ip address, and mac address. Call
env_acl_validate_setenv_params() from setenv() in fw_env.c.

If the entry is not found in the env .flags, then look in the static
one. This allows the env to override the static definitions, but prevents
the need to have every definition in the environment distracting you.

Need to build in _ctype for isdigit for Linux.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 2598090b 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Add environment variable flags

Currently just validates variable types as decimal, hexidecimal,
boolean, ip address, and mac address.

If the entry is not found in the env ".flags", then look in the static
one. This allows the env to override the static definitions, but prevents
the need to have every definition in the environment distracting you.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# acf29d8c 04-Dec-2022 Tom Rini <trini@konsulko.com>

global: Migrate CONFIG_ENV_FLAGS_LIST_STATIC to CFG

Perform a simple rename of CONFIG_ENV_FLAGS_LIST_STATIC to CFG_ENV_FLAGS_LIST_STATIC

Signed-off-by: Tom Rini <trini@konsulko.com>

# 1dfa4ef1 01-Dec-2022 Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>

net: ipv6: Add callbacks declarations to get access to IPv6 variables

Set up callbacks for main IPv6 variables ip6add, serverip6, gatewayip6
and set options to them in flag file. These variables are often set up by
users.

Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d045cbac 07-Jul-2020 Marek Vasut <marex@denx.de>

env: Add support for explicit write access list

This option marks any U-Boot variable which does not have explicit 'w'
writeable flag set as read-only. This way the environment can be locked
down and only variables explicitly configured to be writeable can ever
be changed by either 'env import', 'env set' or loading user environment
from environment storage.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cccc05ee 02-Sep-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

env: net: U_BOOT_ENV_CALLBACKs should not depend on CMD_NET

Some environment variables are relevant for networking. For these
U_BOOT_ENV_CALLBACKs have been defined. When the corresponding environment
variable is updated the callback updates the state of the network
sub-system.

In the UEFI subsystem we can use the network even if CONFIG_CMD_NET is not
defined.

Let the usage of the U_BOOT_ENV_CALLBACKs depend on CONFIG_NET and not on
CONFIG_CMD_NET.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# dd2408ca 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Drop the ENTRY typedef

U-Boot is not supposed to use typedef for structs anymore. Also this name
is the same as the ENTRY() macro used in assembler files, and 'entry'
itself is widely used in U-Boot (>8k matches).

Drop the typedef and rename the struct to env_entry to reduce confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fb625ce 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_set() to env.h

Move env_set() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# be09f5bc 22-Nov-2018 Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

net: fix env flags for eth10addr and above

With CONFIG_REGEX enabled, ETHADDR_WILDCARD is set up for up to 10
interfaces (0..9) as the number can only have one digit.

On boards with more than 10 interfaces, this leads to the protection
and format checks being absent for eth10addr and above.

Fix this by changing ETHADDR_WILDCARD from "\\d?" to "\\d*" to allow
more than one digit.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 0299cee5 13-Apr-2016 Stefan Agner <stefan@agner.ch>

net: fix vlan validation

VLAN identifiers are 12-bit decimal numbers, not IP addresses.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 167f5258 09-Dec-2015 Andreas Fenkart <andreas.fenkart@digitalstrom.com>

tools: env validate: pass values as 0-based array

passing argv/argc can produce off-by-one errors

Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>

# 0118e83b 09-Sep-2015 Codrin Ciubotariu <codrin.ciubotariu@freescale.com>

common/env_flags.c: Add function to validate a MAC address

The code that checks if a string has the format of a MAC address has been
moved to a separate function called eth_validate_ethaddr_str().

This has been done to allow other components (such as vsc9953 driver)
to validate a MAC address.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@freescale.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# c0a93440 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

net: Add default flags for common net env vars

Check that the common network stack's env vars conform to the proper
format for IP addresses.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 73c2bbee 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

net: Apply default format rules to all ethaddr

Use a regular expression to apply the default formatting flags for all
ethaddr env vars.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# 1d6cd0a3 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Handle write-once ethaddr and serial# generically

Use the variable access flags to implement the protection for ethaddr
and serial# instead of hard-coding them.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 267541f7 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Add support for access control to .flags

Add support for read-only, write-once, and change-default.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# fffad71b 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Add a command to display details about env flags

Similar to the env callback command, this will show details about the
options available, the static list, and the currently active variables.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 30fd4fad 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

tools/env: Add environment variable flags support

Currently just validates variable types as decimal, hexidecimal,
boolean, ip address, and mac address. Call
env_acl_validate_setenv_params() from setenv() in fw_env.c.

If the entry is not found in the env .flags, then look in the static
one. This allows the env to override the static definitions, but prevents
the need to have every definition in the environment distracting you.

Need to build in _ctype for isdigit for Linux.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 2598090b 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Add environment variable flags

Currently just validates variable types as decimal, hexidecimal,
boolean, ip address, and mac address.

If the entry is not found in the env ".flags", then look in the static
one. This allows the env to override the static definitions, but prevents
the need to have every definition in the environment distracting you.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 1dfa4ef1 01-Dec-2022 Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>

net: ipv6: Add callbacks declarations to get access to IPv6 variables

Set up callbacks for main IPv6 variables ip6add, serverip6, gatewayip6
and set options to them in flag file. These variables are often set up by
users.

Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d045cbac 07-Jul-2020 Marek Vasut <marex@denx.de>

env: Add support for explicit write access list

This option marks any U-Boot variable which does not have explicit 'w'
writeable flag set as read-only. This way the environment can be locked
down and only variables explicitly configured to be writeable can ever
be changed by either 'env import', 'env set' or loading user environment
from environment storage.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cccc05ee 02-Sep-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

env: net: U_BOOT_ENV_CALLBACKs should not depend on CMD_NET

Some environment variables are relevant for networking. For these
U_BOOT_ENV_CALLBACKs have been defined. When the corresponding environment
variable is updated the callback updates the state of the network
sub-system.

In the UEFI subsystem we can use the network even if CONFIG_CMD_NET is not
defined.

Let the usage of the U_BOOT_ENV_CALLBACKs depend on CONFIG_NET and not on
CONFIG_CMD_NET.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# dd2408ca 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Drop the ENTRY typedef

U-Boot is not supposed to use typedef for structs anymore. Also this name
is the same as the ENTRY() macro used in assembler files, and 'entry'
itself is widely used in U-Boot (>8k matches).

Drop the typedef and rename the struct to env_entry to reduce confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fb625ce 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_set() to env.h

Move env_set() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# be09f5bc 22-Nov-2018 Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

net: fix env flags for eth10addr and above

With CONFIG_REGEX enabled, ETHADDR_WILDCARD is set up for up to 10
interfaces (0..9) as the number can only have one digit.

On boards with more than 10 interfaces, this leads to the protection
and format checks being absent for eth10addr and above.

Fix this by changing ETHADDR_WILDCARD from "\\d?" to "\\d*" to allow
more than one digit.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 0299cee5 13-Apr-2016 Stefan Agner <stefan@agner.ch>

net: fix vlan validation

VLAN identifiers are 12-bit decimal numbers, not IP addresses.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 167f5258 09-Dec-2015 Andreas Fenkart <andreas.fenkart@digitalstrom.com>

tools: env validate: pass values as 0-based array

passing argv/argc can produce off-by-one errors

Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>

# 0118e83b 09-Sep-2015 Codrin Ciubotariu <codrin.ciubotariu@freescale.com>

common/env_flags.c: Add function to validate a MAC address

The code that checks if a string has the format of a MAC address has been
moved to a separate function called eth_validate_ethaddr_str().

This has been done to allow other components (such as vsc9953 driver)
to validate a MAC address.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@freescale.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# c0a93440 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

net: Add default flags for common net env vars

Check that the common network stack's env vars conform to the proper
format for IP addresses.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 73c2bbee 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

net: Apply default format rules to all ethaddr

Use a regular expression to apply the default formatting flags for all
ethaddr env vars.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# 1d6cd0a3 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Handle write-once ethaddr and serial# generically

Use the variable access flags to implement the protection for ethaddr
and serial# instead of hard-coding them.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 267541f7 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Add support for access control to .flags

Add support for read-only, write-once, and change-default.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# fffad71b 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Add a command to display details about env flags

Similar to the env callback command, this will show details about the
options available, the static list, and the currently active variables.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 30fd4fad 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

tools/env: Add environment variable flags support

Currently just validates variable types as decimal, hexidecimal,
boolean, ip address, and mac address. Call
env_acl_validate_setenv_params() from setenv() in fw_env.c.

If the entry is not found in the env .flags, then look in the static
one. This allows the env to override the static definitions, but prevents
the need to have every definition in the environment distracting you.

Need to build in _ctype for isdigit for Linux.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 2598090b 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Add environment variable flags

Currently just validates variable types as decimal, hexidecimal,
boolean, ip address, and mac address.

If the entry is not found in the env ".flags", then look in the static
one. This allows the env to override the static definitions, but prevents
the need to have every definition in the environment distracting you.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# d045cbac 07-Jul-2020 Marek Vasut <marex@denx.de>

env: Add support for explicit write access list

This option marks any U-Boot variable which does not have explicit 'w'
writeable flag set as read-only. This way the environment can be locked
down and only variables explicitly configured to be writeable can ever
be changed by either 'env import', 'env set' or loading user environment
from environment storage.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cccc05ee 02-Sep-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

env: net: U_BOOT_ENV_CALLBACKs should not depend on CMD_NET

Some environment variables are relevant for networking. For these
U_BOOT_ENV_CALLBACKs have been defined. When the corresponding environment
variable is updated the callback updates the state of the network
sub-system.

In the UEFI subsystem we can use the network even if CONFIG_CMD_NET is not
defined.

Let the usage of the U_BOOT_ENV_CALLBACKs depend on CONFIG_NET and not on
CONFIG_CMD_NET.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# dd2408ca 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Drop the ENTRY typedef

U-Boot is not supposed to use typedef for structs anymore. Also this name
is the same as the ENTRY() macro used in assembler files, and 'entry'
itself is widely used in U-Boot (>8k matches).

Drop the typedef and rename the struct to env_entry to reduce confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fb625ce 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_set() to env.h

Move env_set() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# be09f5bc 22-Nov-2018 Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

net: fix env flags for eth10addr and above

With CONFIG_REGEX enabled, ETHADDR_WILDCARD is set up for up to 10
interfaces (0..9) as the number can only have one digit.

On boards with more than 10 interfaces, this leads to the protection
and format checks being absent for eth10addr and above.

Fix this by changing ETHADDR_WILDCARD from "\\d?" to "\\d*" to allow
more than one digit.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 0299cee5 13-Apr-2016 Stefan Agner <stefan@agner.ch>

net: fix vlan validation

VLAN identifiers are 12-bit decimal numbers, not IP addresses.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 167f5258 09-Dec-2015 Andreas Fenkart <andreas.fenkart@digitalstrom.com>

tools: env validate: pass values as 0-based array

passing argv/argc can produce off-by-one errors

Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>

# 0118e83b 09-Sep-2015 Codrin Ciubotariu <codrin.ciubotariu@freescale.com>

common/env_flags.c: Add function to validate a MAC address

The code that checks if a string has the format of a MAC address has been
moved to a separate function called eth_validate_ethaddr_str().

This has been done to allow other components (such as vsc9953 driver)
to validate a MAC address.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@freescale.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# c0a93440 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

net: Add default flags for common net env vars

Check that the common network stack's env vars conform to the proper
format for IP addresses.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 73c2bbee 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

net: Apply default format rules to all ethaddr

Use a regular expression to apply the default formatting flags for all
ethaddr env vars.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# 1d6cd0a3 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Handle write-once ethaddr and serial# generically

Use the variable access flags to implement the protection for ethaddr
and serial# instead of hard-coding them.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 267541f7 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Add support for access control to .flags

Add support for read-only, write-once, and change-default.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# fffad71b 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Add a command to display details about env flags

Similar to the env callback command, this will show details about the
options available, the static list, and the currently active variables.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 30fd4fad 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

tools/env: Add environment variable flags support

Currently just validates variable types as decimal, hexidecimal,
boolean, ip address, and mac address. Call
env_acl_validate_setenv_params() from setenv() in fw_env.c.

If the entry is not found in the env .flags, then look in the static
one. This allows the env to override the static definitions, but prevents
the need to have every definition in the environment distracting you.

Need to build in _ctype for isdigit for Linux.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 2598090b 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Add environment variable flags

Currently just validates variable types as decimal, hexidecimal,
boolean, ip address, and mac address.

If the entry is not found in the env ".flags", then look in the static
one. This allows the env to override the static definitions, but prevents
the need to have every definition in the environment distracting you.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# cccc05ee 02-Sep-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

env: net: U_BOOT_ENV_CALLBACKs should not depend on CMD_NET

Some environment variables are relevant for networking. For these
U_BOOT_ENV_CALLBACKs have been defined. When the corresponding environment
variable is updated the callback updates the state of the network
sub-system.

In the UEFI subsystem we can use the network even if CONFIG_CMD_NET is not
defined.

Let the usage of the U_BOOT_ENV_CALLBACKs depend on CONFIG_NET and not on
CONFIG_CMD_NET.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# dd2408ca 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Drop the ENTRY typedef

U-Boot is not supposed to use typedef for structs anymore. Also this name
is the same as the ENTRY() macro used in assembler files, and 'entry'
itself is widely used in U-Boot (>8k matches).

Drop the typedef and rename the struct to env_entry to reduce confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fb625ce 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_set() to env.h

Move env_set() over to the new header file.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# be09f5bc 22-Nov-2018 Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

net: fix env flags for eth10addr and above

With CONFIG_REGEX enabled, ETHADDR_WILDCARD is set up for up to 10
interfaces (0..9) as the number can only have one digit.

On boards with more than 10 interfaces, this leads to the protection
and format checks being absent for eth10addr and above.

Fix this by changing ETHADDR_WILDCARD from "\\d?" to "\\d*" to allow
more than one digit.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 0299cee5 13-Apr-2016 Stefan Agner <stefan@agner.ch>

net: fix vlan validation

VLAN identifiers are 12-bit decimal numbers, not IP addresses.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 167f5258 09-Dec-2015 Andreas Fenkart <andreas.fenkart@digitalstrom.com>

tools: env validate: pass values as 0-based array

passing argv/argc can produce off-by-one errors

Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>

# 0118e83b 09-Sep-2015 Codrin Ciubotariu <codrin.ciubotariu@freescale.com>

common/env_flags.c: Add function to validate a MAC address

The code that checks if a string has the format of a MAC address has been
moved to a separate function called eth_validate_ethaddr_str().

This has been done to allow other components (such as vsc9953 driver)
to validate a MAC address.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@freescale.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# c0a93440 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

net: Add default flags for common net env vars

Check that the common network stack's env vars conform to the proper
format for IP addresses.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 73c2bbee 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

net: Apply default format rules to all ethaddr

Use a regular expression to apply the default formatting flags for all
ethaddr env vars.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# 1d6cd0a3 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Handle write-once ethaddr and serial# generically

Use the variable access flags to implement the protection for ethaddr
and serial# instead of hard-coding them.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 267541f7 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Add support for access control to .flags

Add support for read-only, write-once, and change-default.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# fffad71b 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Add a command to display details about env flags

Similar to the env callback command, this will show details about the
options available, the static list, and the currently active variables.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 30fd4fad 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

tools/env: Add environment variable flags support

Currently just validates variable types as decimal, hexidecimal,
boolean, ip address, and mac address. Call
env_acl_validate_setenv_params() from setenv() in fw_env.c.

If the entry is not found in the env .flags, then look in the static
one. This allows the env to override the static definitions, but prevents
the need to have every definition in the environment distracting you.

Need to build in _ctype for isdigit for Linux.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 2598090b 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Add environment variable flags

Currently just validates variable types as decimal, hexidecimal,
boolean, ip address, and mac address.

If the entry is not found in the env ".flags", then look in the static
one. This allows the env to override the static definitions, but prevents
the need to have every definition in the environment distracting you.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>


# 0299cee5 13-Apr-2016 Stefan Agner <stefan@agner.ch>

net: fix vlan validation

VLAN identifiers are 12-bit decimal numbers, not IP addresses.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>


# 167f5258 09-Dec-2015 Andreas Fenkart <andreas.fenkart@digitalstrom.com>

tools: env validate: pass values as 0-based array

passing argv/argc can produce off-by-one errors

Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>


# 0118e83b 09-Sep-2015 Codrin Ciubotariu <codrin.ciubotariu@freescale.com>

common/env_flags.c: Add function to validate a MAC address

The code that checks if a string has the format of a MAC address has been
moved to a separate function called eth_validate_ethaddr_str().

This has been done to allow other components (such as vsc9953 driver)
to validate a MAC address.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@freescale.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: York Sun <yorksun@freescale.com>


# c0a93440 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

net: Add default flags for common net env vars

Check that the common network stack's env vars conform to the proper
format for IP addresses.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# 73c2bbee 20-May-2015 Joe Hershberger <joe.hershberger@ni.com>

net: Apply default format rules to all ethaddr

Use a regular expression to apply the default formatting flags for all
ethaddr env vars.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>


# 1d6cd0a3 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Handle write-once ethaddr and serial# generically

Use the variable access flags to implement the protection for ethaddr
and serial# instead of hard-coding them.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>


# 267541f7 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Add support for access control to .flags

Add support for read-only, write-once, and change-default.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>


# fffad71b 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Add a command to display details about env flags

Similar to the env callback command, this will show details about the
options available, the static list, and the currently active variables.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>


# 30fd4fad 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

tools/env: Add environment variable flags support

Currently just validates variable types as decimal, hexidecimal,
boolean, ip address, and mac address. Call
env_acl_validate_setenv_params() from setenv() in fw_env.c.

If the entry is not found in the env .flags, then look in the static
one. This allows the env to override the static definitions, but prevents
the need to have every definition in the environment distracting you.

Need to build in _ctype for isdigit for Linux.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>


# 2598090b 11-Dec-2012 Joe Hershberger <joe.hershberger@ni.com>

env: Add environment variable flags

Currently just validates variable types as decimal, hexidecimal,
boolean, ip address, and mac address.

If the entry is not found in the env ".flags", then look in the static
one. This allows the env to override the static definitions, but prevents
the need to have every definition in the environment distracting you.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>