#include <linux/errno.h>
#include <linux/init.h>
#include <linux/string.h>
+#include <linux/etherdevice.h>
#include "nvram.h"
goto free;
}
+ if (strlen(mac_str) == 19 && mac_str[0] == '"' && mac_str[18] == '"') {
+ mac_str[18] = 0;
+ mac_str++;
+ }
+
t = sscanf(mac_str, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
&mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]);
- if (t != 6) {
+ if (t != ETH_ALEN)
+ t = sscanf(mac_str, "%02hhx-%02hhx-%02hhx-%02hhx-%02hhx-%02hhx",
+ &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]);
+
+ if (t != ETH_ALEN) {
ret = -EINVAL;
goto free;
}