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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>