From: Alex Kiernan Date: Sun, 1 Apr 2018 09:22:38 +0000 (+0000) Subject: net: Move enetaddr env access code to env config instead of net config X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=9925f1dbc38c0ef7220c6fca5968c708b8e48764;p=u-boot.git net: Move enetaddr env access code to env config instead of net config In order that we can use eth_env_* even when CONFIG_NET isn't set, move these functions to environment code from net code. This fixes failures such as: board/ti/am335x/built-in.o: In function `board_late_init': board/ti/am335x/board.c:752: undefined reference to `eth_env_set_enetaddr' u-boot/board/ti/am335x/board.c:766: undefined reference to `eth_env_set_enetaddr' which caters for use cases such as: commit f411b5cca48f ("board: am335x: Always set eth/eth1addr environment variable") when Ethernet is required in Linux, but not U-Boot. Signed-off-by: Alex Kiernan --- diff --git a/arch/arm/cpu/arm926ejs/spear/spr_misc.c b/arch/arm/cpu/arm926ejs/spear/spr_misc.c index a02304f49e..f072f2e474 100644 --- a/arch/arm/cpu/arm926ejs/spear/spr_misc.c +++ b/arch/arm/cpu/arm926ejs/spear/spr_misc.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include diff --git a/arch/arm/mach-davinci/misc.c b/arch/arm/mach-davinci/misc.c index 461ff778c2..7b9d9619bb 100644 --- a/arch/arm/mach-davinci/misc.c +++ b/arch/arm/mach-davinci/misc.c @@ -10,6 +10,7 @@ */ #include +#include #include #include #include diff --git a/arch/arm/mach-omap2/utils.c b/arch/arm/mach-omap2/utils.c index 7d1ca274bf..1d3962500d 100644 --- a/arch/arm/mach-omap2/utils.c +++ b/arch/arm/mach-omap2/utils.c @@ -5,6 +5,7 @@ * SPDX-License-Identifier: GPL-2.0+ */ #include +#include #include #include #include diff --git a/arch/powerpc/cpu/mpc85xx/fdt.c b/arch/powerpc/cpu/mpc85xx/fdt.c index e1fee11540..3bdaa5fe7b 100644 --- a/arch/powerpc/cpu/mpc85xx/fdt.c +++ b/arch/powerpc/cpu/mpc85xx/fdt.c @@ -8,6 +8,7 @@ */ #include +#include #include #include #include diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c index d82b8cdfe2..f0a97faa95 100644 --- a/board/BuR/common/common.c +++ b/board/BuR/common/common.c @@ -11,6 +11,7 @@ */ #include #include +#include #include #include #include diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index b03c0a3714..c693aaef63 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -9,6 +9,7 @@ */ #include +#include #include #include #include diff --git a/board/LaCie/net2big_v2/net2big_v2.c b/board/LaCie/net2big_v2/net2big_v2.c index f639a37d4d..3e070d2b01 100644 --- a/board/LaCie/net2big_v2/net2big_v2.c +++ b/board/LaCie/net2big_v2/net2big_v2.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include diff --git a/board/LaCie/netspace_v2/netspace_v2.c b/board/LaCie/netspace_v2/netspace_v2.c index 52f36644a3..3bd9fa9633 100644 --- a/board/LaCie/netspace_v2/netspace_v2.c +++ b/board/LaCie/netspace_v2/netspace_v2.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include diff --git a/board/amlogic/khadas-vim/khadas-vim.c b/board/amlogic/khadas-vim/khadas-vim.c index 5e198569db..83b1b6ed6f 100644 --- a/board/amlogic/khadas-vim/khadas-vim.c +++ b/board/amlogic/khadas-vim/khadas-vim.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include diff --git a/board/amlogic/libretech-cc/libretech-cc.c b/board/amlogic/libretech-cc/libretech-cc.c index 6be6e2ae93..57953404fe 100644 --- a/board/amlogic/libretech-cc/libretech-cc.c +++ b/board/amlogic/libretech-cc/libretech-cc.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include diff --git a/board/amlogic/odroid-c2/odroid-c2.c b/board/amlogic/odroid-c2/odroid-c2.c index 0cb571432f..8645f22e87 100644 --- a/board/amlogic/odroid-c2/odroid-c2.c +++ b/board/amlogic/odroid-c2/odroid-c2.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include diff --git a/board/amlogic/p212/p212.c b/board/amlogic/p212/p212.c index 5fde53438e..7c0abbcc0a 100644 --- a/board/amlogic/p212/p212.c +++ b/board/amlogic/p212/p212.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include diff --git a/board/atmel/common/mac_eeprom.c b/board/atmel/common/mac_eeprom.c index 60ddf00d45..91b86e0c62 100644 --- a/board/atmel/common/mac_eeprom.c +++ b/board/atmel/common/mac_eeprom.c @@ -7,6 +7,7 @@ #include #include +#include #include #include diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c index 2d01ac25d8..8ae420740d 100644 --- a/board/buffalo/lsxl/lsxl.c +++ b/board/buffalo/lsxl/lsxl.c @@ -9,6 +9,7 @@ */ #include +#include #include #include #include diff --git a/board/compulab/cl-som-am57x/eth.c b/board/compulab/cl-som-am57x/eth.c index b615fb9e7e..9f9525eeb0 100644 --- a/board/compulab/cl-som-am57x/eth.c +++ b/board/compulab/cl-som-am57x/eth.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include diff --git a/board/compulab/cl-som-imx7/cl-som-imx7.c b/board/compulab/cl-som-imx7/cl-som-imx7.c index f8b1cda5bb..dfa81f5221 100644 --- a/board/compulab/cl-som-imx7/cl-som-imx7.c +++ b/board/compulab/cl-som-imx7/cl-som-imx7.c @@ -9,6 +9,7 @@ */ #include +#include #include #include #include diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c index 673de03071..c72efc5964 100644 --- a/board/compulab/cm_fx6/cm_fx6.c +++ b/board/compulab/cm_fx6/cm_fx6.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/board/compulab/cm_t335/cm_t335.c b/board/compulab/cm_t335/cm_t335.c index 6f6ba49af5..6eabd38375 100644 --- a/board/compulab/cm_t335/cm_t335.c +++ b/board/compulab/cm_t335/cm_t335.c @@ -9,6 +9,7 @@ */ #include +#include #include #include #include diff --git a/board/compulab/cm_t35/cm_t35.c b/board/compulab/cm_t35/cm_t35.c index d5cfba4270..e8f604f5db 100644 --- a/board/compulab/cm_t35/cm_t35.c +++ b/board/compulab/cm_t35/cm_t35.c @@ -13,6 +13,7 @@ */ #include +#include #include #include #include diff --git a/board/compulab/cm_t3517/cm_t3517.c b/board/compulab/cm_t3517/cm_t3517.c index 0ff49dcdcc..e4e346077c 100644 --- a/board/compulab/cm_t3517/cm_t3517.c +++ b/board/compulab/cm_t3517/cm_t3517.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include diff --git a/board/compulab/cm_t54/cm_t54.c b/board/compulab/cm_t54/cm_t54.c index 3e6235a3b7..a1aeafbafd 100644 --- a/board/compulab/cm_t54/cm_t54.c +++ b/board/compulab/cm_t54/cm_t54.c @@ -9,6 +9,7 @@ */ #include +#include #include #include #include diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c index 83c9f2940f..37a0d72fe1 100644 --- a/board/davinci/da8xxevm/da850evm.c +++ b/board/davinci/da8xxevm/da850evm.c @@ -10,6 +10,7 @@ */ #include +#include #include #include #include diff --git a/board/dhelectronics/dh_imx6/dh_imx6.c b/board/dhelectronics/dh_imx6/dh_imx6.c index b00d0e4b6d..1d8b831054 100644 --- a/board/dhelectronics/dh_imx6/dh_imx6.c +++ b/board/dhelectronics/dh_imx6/dh_imx6.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c index 4ddc7e1fa2..332c506dfe 100644 --- a/board/gateworks/gw_ventana/gw_ventana.c +++ b/board/gateworks/gw_ventana/gw_ventana.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/board/ge/mx53ppd/mx53ppd.c b/board/ge/mx53ppd/mx53ppd.c index 90dbccc5ed..0010998d66 100644 --- a/board/ge/mx53ppd/mx53ppd.c +++ b/board/ge/mx53ppd/mx53ppd.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c index f0ace03009..91bc9c2651 100644 --- a/board/kosagi/novena/novena.c +++ b/board/kosagi/novena/novena.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c index e6c2526ea1..fe1183b0bd 100644 --- a/board/logicpd/zoom1/zoom1.c +++ b/board/logicpd/zoom1/zoom1.c @@ -16,6 +16,7 @@ */ #include #include +#include #include #include #include diff --git a/board/phytec/pcm051/board.c b/board/phytec/pcm051/board.c index 52ad5b64de..c57625b041 100644 --- a/board/phytec/pcm051/board.c +++ b/board/phytec/pcm051/board.c @@ -10,6 +10,7 @@ */ #include +#include #include #include #include diff --git a/board/phytec/phycore_rk3288/phycore-rk3288.c b/board/phytec/phycore_rk3288/phycore-rk3288.c index 47b069e2ad..a1b407d707 100644 --- a/board/phytec/phycore_rk3288/phycore-rk3288.c +++ b/board/phytec/phycore_rk3288/phycore-rk3288.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index de8e308f6c..30495057d1 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include diff --git a/board/renesas/alt/alt.c b/board/renesas/alt/alt.c index 0bf8160f1f..f2200ef081 100644 --- a/board/renesas/alt/alt.c +++ b/board/renesas/alt/alt.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/board/renesas/blanche/blanche.c b/board/renesas/blanche/blanche.c index 574dcda01b..5dc307370d 100644 --- a/board/renesas/blanche/blanche.c +++ b/board/renesas/blanche/blanche.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/board/renesas/gose/gose.c b/board/renesas/gose/gose.c index 54e126985b..99d4ba6fd8 100644 --- a/board/renesas/gose/gose.c +++ b/board/renesas/gose/gose.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/board/renesas/koelsch/koelsch.c b/board/renesas/koelsch/koelsch.c index 8fa648e40a..e7b47ae299 100644 --- a/board/renesas/koelsch/koelsch.c +++ b/board/renesas/koelsch/koelsch.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/board/renesas/lager/lager.c b/board/renesas/lager/lager.c index 562be04760..3566bcc788 100644 --- a/board/renesas/lager/lager.c +++ b/board/renesas/lager/lager.c @@ -9,6 +9,7 @@ */ #include +#include #include #include #include diff --git a/board/renesas/sh7752evb/sh7752evb.c b/board/renesas/sh7752evb/sh7752evb.c index 4a76fb73ee..5da6f39ae3 100644 --- a/board/renesas/sh7752evb/sh7752evb.c +++ b/board/renesas/sh7752evb/sh7752evb.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include diff --git a/board/renesas/sh7753evb/sh7753evb.c b/board/renesas/sh7753evb/sh7753evb.c index ca9e144743..8604d88247 100644 --- a/board/renesas/sh7753evb/sh7753evb.c +++ b/board/renesas/sh7753evb/sh7753evb.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include diff --git a/board/renesas/sh7757lcr/sh7757lcr.c b/board/renesas/sh7757lcr/sh7757lcr.c index 3f970fc401..1c598fbedd 100644 --- a/board/renesas/sh7757lcr/sh7757lcr.c +++ b/board/renesas/sh7757lcr/sh7757lcr.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include diff --git a/board/renesas/silk/silk.c b/board/renesas/silk/silk.c index a8de402d20..9e2080bcea 100644 --- a/board/renesas/silk/silk.c +++ b/board/renesas/silk/silk.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/board/renesas/stout/stout.c b/board/renesas/stout/stout.c index d681148273..3cb16db10f 100644 --- a/board/renesas/stout/stout.c +++ b/board/renesas/stout/stout.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include diff --git a/board/rockchip/tinker_rk3288/tinker-rk3288.c b/board/rockchip/tinker_rk3288/tinker-rk3288.c index 790a921515..0f2abe2f53 100644 --- a/board/rockchip/tinker_rk3288/tinker-rk3288.c +++ b/board/rockchip/tinker_rk3288/tinker-rk3288.c @@ -6,6 +6,7 @@ #include #include +#include #include #include diff --git a/board/samtec/vining_2000/vining_2000.c b/board/samtec/vining_2000/vining_2000.c index cced08b8b8..0cc842116d 100644 --- a/board/samtec/vining_2000/vining_2000.c +++ b/board/samtec/vining_2000/vining_2000.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include diff --git a/board/samtec/vining_fpga/socfpga.c b/board/samtec/vining_fpga/socfpga.c index 229b12f308..14ac7efb8b 100644 --- a/board/samtec/vining_fpga/socfpga.c +++ b/board/samtec/vining_fpga/socfpga.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include diff --git a/board/siemens/common/factoryset.c b/board/siemens/common/factoryset.c index 7fa2673c2b..f3e82d4f18 100644 --- a/board/siemens/common/factoryset.c +++ b/board/siemens/common/factoryset.c @@ -9,6 +9,7 @@ #if !defined(CONFIG_SPL_BUILD) #include +#include #include #include #include diff --git a/board/siemens/pxm2/board.c b/board/siemens/pxm2/board.c index 8bbb03561b..ab54e58861 100644 --- a/board/siemens/pxm2/board.c +++ b/board/siemens/pxm2/board.c @@ -14,6 +14,7 @@ */ #include +#include #include #include #include diff --git a/board/silica/pengwyn/board.c b/board/silica/pengwyn/board.c index 0429e6f0c7..e736afbf93 100644 --- a/board/silica/pengwyn/board.c +++ b/board/silica/pengwyn/board.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include diff --git a/board/technologic/ts4800/ts4800.c b/board/technologic/ts4800/ts4800.c index e5bec57f4f..c4dad69110 100644 --- a/board/technologic/ts4800/ts4800.c +++ b/board/technologic/ts4800/ts4800.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c index c6690fa069..1d8b605b69 100644 --- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c +++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c index 0564df2c00..0431cd4606 100644 --- a/board/ti/am43xx/board.c +++ b/board/ti/am43xx/board.c @@ -9,6 +9,7 @@ */ #include +#include #include #include #include diff --git a/board/ti/ti814x/evm.c b/board/ti/ti814x/evm.c index cdde6a8ca3..4a0f82975a 100644 --- a/board/ti/ti814x/evm.c +++ b/board/ti/ti814x/evm.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include diff --git a/board/ti/ti816x/evm.c b/board/ti/ti816x/evm.c index cb40cc5f47..abc961a86e 100644 --- a/board/ti/ti816x/evm.c +++ b/board/ti/ti816x/evm.c @@ -8,6 +8,7 @@ */ #include +#include #include #include #include diff --git a/board/timll/devkit8000/devkit8000.c b/board/timll/devkit8000/devkit8000.c index 741b3acce2..4bbbd81848 100644 --- a/board/timll/devkit8000/devkit8000.c +++ b/board/timll/devkit8000/devkit8000.c @@ -18,6 +18,7 @@ */ #include #include +#include #include #include #include diff --git a/board/toradex/common/tdx-common.c b/board/toradex/common/tdx-common.c index 6e12d279e8..d6d367161c 100644 --- a/board/toradex/common/tdx-common.c +++ b/board/toradex/common/tdx-common.c @@ -5,6 +5,7 @@ */ #include +#include #include #include diff --git a/cmd/elf.c b/cmd/elf.c index f874073280..038796498c 100644 --- a/cmd/elf.c +++ b/cmd/elf.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #ifdef CONFIG_X86 diff --git a/cmd/ethsw.c b/cmd/ethsw.c index b600965e8a..92a60b4515 100644 --- a/cmd/ethsw.c +++ b/cmd/ethsw.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 4cb25b8248..9838678262 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -341,6 +341,36 @@ ulong env_get_hex(const char *varname, ulong default_val) return value; } +void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr) +{ + char *end; + int i; + + for (i = 0; i < 6; ++i) { + enetaddr[i] = addr ? simple_strtoul(addr, &end, 16) : 0; + if (addr) + addr = (*end) ? end + 1 : end; + } +} + +int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr) +{ + eth_parse_enetaddr(env_get(name), enetaddr); + return is_valid_ethaddr(enetaddr); +} + +int eth_env_set_enetaddr(const char *name, const uint8_t *enetaddr) +{ + char buf[ARP_HLEN_ASCII + 1]; + + if (eth_env_get_enetaddr(name, (uint8_t *)buf)) + return -EEXIST; + + sprintf(buf, "%pM", enetaddr); + + return env_set(name, buf); +} + #ifndef CONFIG_SPL_BUILD static int do_env_set(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { diff --git a/drivers/net/cpsw-common.c b/drivers/net/cpsw-common.c index 0dc83ab820..7bd312a6c0 100644 --- a/drivers/net/cpsw-common.c +++ b/drivers/net/cpsw-common.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c index ff7ad91116..29af85ce0a 100644 --- a/drivers/net/fec_mxc.c +++ b/drivers/net/fec_mxc.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include diff --git a/drivers/net/fsl_mcdmafec.c b/drivers/net/fsl_mcdmafec.c index 2d89cea4a3..00d905c299 100644 --- a/drivers/net/fsl_mcdmafec.c +++ b/drivers/net/fsl_mcdmafec.c @@ -9,6 +9,7 @@ */ #include +#include #include #include #include diff --git a/drivers/net/mcffec.c b/drivers/net/mcffec.c index ebcbed941a..505a2d1bee 100644 --- a/drivers/net/mcffec.c +++ b/drivers/net/mcffec.c @@ -9,6 +9,7 @@ */ #include +#include #include #include diff --git a/drivers/net/ne2000_base.c b/drivers/net/ne2000_base.c index fb088e06a4..421aa20ea6 100644 --- a/drivers/net/ne2000_base.c +++ b/drivers/net/ne2000_base.c @@ -74,6 +74,7 @@ Add SNMP #include #include +#include #include #include #include diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index 6f48e93ab5..e3416f3391 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index a80486e91f..386505d42d 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include diff --git a/include/environment.h b/include/environment.h index 7986a24277..1b52353365 100644 --- a/include/environment.h +++ b/include/environment.h @@ -314,6 +314,10 @@ int env_load(void); */ int env_save(void); +void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr); +int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr); +int eth_env_set_enetaddr(const char *name, const uint8_t *enetaddr); + #endif /* DO_DEPS_ONLY */ #endif /* _ENVIRONMENT_H_ */ diff --git a/include/net.h b/include/net.h index 3101096e9a..3469811aa0 100644 --- a/include/net.h +++ b/include/net.h @@ -238,9 +238,6 @@ void eth_try_another(int first_restart); /* Change the device */ void eth_set_current(void); /* set nterface to ethcur var */ int eth_get_dev_index(void); /* get the device index */ -void eth_parse_enetaddr(const char *addr, uchar *enetaddr); -int eth_env_get_enetaddr(const char *name, uchar *enetaddr); -int eth_env_set_enetaddr(const char *name, const uchar *enetaddr); /** * eth_env_set_enetaddr_by_index() - set the MAC address environment variable diff --git a/net/eth_common.c b/net/eth_common.c index 66d0d22966..0af91a9642 100644 --- a/net/eth_common.c +++ b/net/eth_common.c @@ -8,40 +8,11 @@ #include #include +#include #include #include #include "eth_internal.h" -void eth_parse_enetaddr(const char *addr, uchar *enetaddr) -{ - char *end; - int i; - - for (i = 0; i < 6; ++i) { - enetaddr[i] = addr ? simple_strtoul(addr, &end, 16) : 0; - if (addr) - addr = (*end) ? end + 1 : end; - } -} - -int eth_env_get_enetaddr(const char *name, uchar *enetaddr) -{ - eth_parse_enetaddr(env_get(name), enetaddr); - return is_valid_ethaddr(enetaddr); -} - -int eth_env_set_enetaddr(const char *name, const uchar *enetaddr) -{ - char buf[ARP_HLEN_ASCII + 1]; - - if (eth_env_get_enetaddr(name, (uchar *)buf)) - return -EEXIST; - - sprintf(buf, "%pM", enetaddr); - - return env_set(name, buf); -} - int eth_env_get_enetaddr_by_index(const char *base_name, int index, uchar *enetaddr) {