Merge pull request #77 from chenzhOS/master

oaf: fix function(mac_to_hex) cannot format mac string to mac hex.
This commit is contained in:
Derry 2021-01-26 09:43:41 +08:00 committed by GitHub
commit 95c95d3661
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -196,8 +196,8 @@ int is_user_match_enable(void){
return total_mac > 0;
}
int mac_to_hex(u8 *mac, u8 *mac_hex){
u8 mac_tmp[MAC_ADDR_LEN];
int ret = 0;
u32 mac_tmp[MAC_ADDR_LEN];
int ret = 0, i = 0;
ret = sscanf(mac, "%02x:%02x:%02x:%02x:%02x:%02x",
(unsigned int *)&mac_tmp[0],
(unsigned int *)&mac_tmp[1],
@ -207,7 +207,10 @@ int mac_to_hex(u8 *mac, u8 *mac_hex){
(unsigned int *)&mac_tmp[5]);
if (MAC_ADDR_LEN != ret)
return -1;
memcpy(mac_hex, mac_tmp, MAC_ADDR_LEN);
for (i = 0; i < MAC_ADDR_LEN; i++)
{
mac_hex[i] = mac_tmp[i];
}
return 0;
}
int af_set_mac_list(cJSON * data_obj)