diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 751b77d0e986ae918438b1e5c33f54c8ae75ef34..01110e9b3a6ac24bc9c0a54aa8399f303117fcaf 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -358,18 +358,6 @@ 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); diff --git a/include/environment.h b/include/environment.h index 77915f459e8a0acab93c9068fbf73e816b43152a..0de9d3fc600b868e07afce6af52a8881296127e6 100644 --- a/include/environment.h +++ b/include/environment.h @@ -325,8 +325,6 @@ int env_erase(void); */ void env_fix_drivers(void); -void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr); - #endif /* DO_DEPS_ONLY */ #endif /* _ENVIRONMENT_H_ */ diff --git a/include/net.h b/include/net.h index 0262175c81632d8648ccbd423b9e36f00e1404ab..a54d5eeac5fc95232089ac2f577ec0ffec667e23 100644 --- a/include/net.h +++ b/include/net.h @@ -875,4 +875,15 @@ int update_tftp(ulong addr, char *interface, char *devstring); /**********************************************************************/ +/** + * eth_parse_enetaddr() - Parse a MAC address + * + * Convert a string MAC address + * + * @addr: MAC address in aa:bb:cc:dd:ee:ff format, where each part is a 2-digit + * hex value + * @enetaddr: Place to put MAC address (6 bytes) + */ +void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr); + #endif /* __NET_H__ */ diff --git a/net/net.c b/net/net.c index 1a175c45973dc0f57d65a8698f27b7f0c21cafb2..f0a3996cd610e933c6017b924b507dda84014c03 100644 --- a/net/net.c +++ b/net/net.c @@ -1614,3 +1614,15 @@ ushort env_get_vlan(char *var) { return string_to_vlan(env_get(var)); } + +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; + } +}