From a4ddc932a3f648762cdaa8e92086d1dfba83d2fe Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Sun, 13 Jul 2014 19:43:54 +0000 Subject: ar71xx: allow ath79_nvram_parse_mac_addr parsing mac with quotes Signed-off-by: Jon Suphammer Patchwork: http://patchwork.openwrt.org/patch/5838/ [juhosg: - fix coding style, - check the first and the last character of the MAC string instead of using the strchr() function] Signed-off-by: Gabor Juhos git-svn-id: svn://svn.openwrt.org/openwrt/trunk@41622 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/files/arch/mips/ath79/nvram.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'target/linux/ar71xx/files/arch') diff --git a/target/linux/ar71xx/files/arch/mips/ath79/nvram.c b/target/linux/ar71xx/files/arch/mips/ath79/nvram.c index 43911b8ac1..e55af5abe2 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/nvram.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/nvram.c @@ -59,6 +59,11 @@ int ath79_nvram_parse_mac_addr(const char *nvram, unsigned nvram_len, 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]); -- cgit v1.2.3