mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-23 01:40:30 +00:00
MIPS: BCM47xx: Fix MAC address parsing.
Some devices like the Netgear WGT634u are using minuses between the blocks of the MAC address and other devices are using colons to separate them. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/2366/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
parent
41790fd51f
commit
9cbda726bb
@ -39,8 +39,16 @@ extern int nvram_getenv(char *name, char *val, size_t val_len);
|
||||
|
||||
static inline void nvram_parse_macaddr(char *buf, u8 *macaddr)
|
||||
{
|
||||
sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &macaddr[0], &macaddr[1],
|
||||
&macaddr[2], &macaddr[3], &macaddr[4], &macaddr[5]);
|
||||
if (strchr(buf, ':'))
|
||||
sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &macaddr[0],
|
||||
&macaddr[1], &macaddr[2], &macaddr[3], &macaddr[4],
|
||||
&macaddr[5]);
|
||||
else if (strchr(buf, '-'))
|
||||
sscanf(buf, "%hhx-%hhx-%hhx-%hhx-%hhx-%hhx", &macaddr[0],
|
||||
&macaddr[1], &macaddr[2], &macaddr[3], &macaddr[4],
|
||||
&macaddr[5]);
|
||||
else
|
||||
printk(KERN_WARNING "Can not parse mac address: %s\n", buf);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user