mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-11-30 07:01:32 +01:00
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>
This commit is contained in:
parent
94b467b14e
commit
73c2bbeea3
@ -38,13 +38,18 @@ enum env_flags_varaccess {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_CMD_NET
|
#ifdef CONFIG_CMD_NET
|
||||||
|
#ifdef CONFIG_REGEX
|
||||||
|
#define ETHADDR_WILDCARD "\\d?"
|
||||||
|
#else
|
||||||
|
#define ETHADDR_WILDCARD
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_ENV_OVERWRITE
|
#ifdef CONFIG_ENV_OVERWRITE
|
||||||
#define ETHADDR_FLAGS "ethaddr:ma,"
|
#define ETHADDR_FLAGS "eth" ETHADDR_WILDCARD "addr:ma,"
|
||||||
#else
|
#else
|
||||||
#ifdef CONFIG_OVERWRITE_ETHADDR_ONCE
|
#ifdef CONFIG_OVERWRITE_ETHADDR_ONCE
|
||||||
#define ETHADDR_FLAGS "ethaddr:mc,"
|
#define ETHADDR_FLAGS "eth" ETHADDR_WILDCARD "addr:mc,"
|
||||||
#else
|
#else
|
||||||
#define ETHADDR_FLAGS "ethaddr:mo,"
|
#define ETHADDR_FLAGS "eth" ETHADDR_WILDCARD "addr:mo,"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
|
|||||||
@ -89,6 +89,8 @@ static int dm_test_eth_rotate(struct dm_test_state *dms)
|
|||||||
/* Invalidate eth1's MAC address */
|
/* Invalidate eth1's MAC address */
|
||||||
net_ping_ip = string_to_ip("1.1.2.2");
|
net_ping_ip = string_to_ip("1.1.2.2");
|
||||||
strcpy(ethaddr, getenv("eth1addr"));
|
strcpy(ethaddr, getenv("eth1addr"));
|
||||||
|
/* Must disable access protection for eth1addr before clearing */
|
||||||
|
setenv(".flags", "eth1addr");
|
||||||
setenv("eth1addr", NULL);
|
setenv("eth1addr", NULL);
|
||||||
|
|
||||||
/* Make sure that the default is to rotate to the next interface */
|
/* Make sure that the default is to rotate to the next interface */
|
||||||
@ -108,6 +110,7 @@ static int dm_test_eth_rotate(struct dm_test_state *dms)
|
|||||||
|
|
||||||
/* Invalidate eth0's MAC address */
|
/* Invalidate eth0's MAC address */
|
||||||
strcpy(ethaddr, getenv("ethaddr"));
|
strcpy(ethaddr, getenv("ethaddr"));
|
||||||
|
/* Must disable access protection for ethaddr before clearing */
|
||||||
setenv(".flags", "ethaddr");
|
setenv(".flags", "ethaddr");
|
||||||
setenv("ethaddr", NULL);
|
setenv("ethaddr", NULL);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user