aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx/files/arch/mips/ath79/nvram.c
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2014-07-13 19:43:54 +0000
committerGabor Juhos <juhosg@openwrt.org>2014-07-13 19:43:54 +0000
commita46c7d055c9fd8dfc9c2465b5611a4ff2618c625 (patch)
tree1eeb68cdf28fef49b6bfc245daf5d0de0a43e8e5 /target/linux/ar71xx/files/arch/mips/ath79/nvram.c
parenta749d8163f8ee180ec42142b784db3871a57f073 (diff)
downloadupstream-a46c7d055c9fd8dfc9c2465b5611a4ff2618c625.tar.gz
upstream-a46c7d055c9fd8dfc9c2465b5611a4ff2618c625.tar.bz2
upstream-a46c7d055c9fd8dfc9c2465b5611a4ff2618c625.zip
ar71xx: allow ath79_nvram_parse_mac_addr parsing mac with quotes
Signed-off-by: Jon Suphammer <jon@suphammer.net> 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 <juhosg@openwrt.org> SVN-Revision: 41622
Diffstat (limited to 'target/linux/ar71xx/files/arch/mips/ath79/nvram.c')
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/nvram.c5
1 files changed, 5 insertions, 0 deletions
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]);