From c8fd0937e4ea79822aba3aa7439c0931e3192568 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Thu, 12 Aug 2021 15:20:57 +0200 Subject: [PATCH] replace custom hwaddr_aton_i() with mac_pton() Replace custom hwaddr_aton_i() with mac_pton() in core/ioctl_linux.c and remove the now unused function hwaddr_aton_i(). Link: https://lore.kernel.org/r/20210812132057.22579-1-straube.linux@gmail.com --- os_dep/linux/ioctl_linux.c | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/os_dep/linux/ioctl_linux.c b/os_dep/linux/ioctl_linux.c index b52d6db..ca7643d 100644 --- a/os_dep/linux/ioctl_linux.c +++ b/os_dep/linux/ioctl_linux.c @@ -69,33 +69,6 @@ static const char *const iw_operation_mode[] = { "Auto", "Ad-Hoc", "Managed", "Master", "Repeater", "Secondary", "Monitor" }; -/** - * hwaddr_aton - Convert ASCII string to MAC address - * @txt: MAC address as a string (e.g., "00:11:22:33:44:55") - * @addr: Buffer for the MAC address (ETH_ALEN = 6 bytes) - * Returns: 0 on success, -1 on failure (e.g., string not a MAC address) - */ -static int hwaddr_aton_i(const char *txt, u8 *addr) -{ - int i; - - for (i = 0; i < 6; i++) { - int a, b; - - a = hex2num_i(*txt++); - if (a < 0) - return -1; - b = hex2num_i(*txt++); - if (b < 0) - return -1; - *addr++ = (a << 4) | b; - if (i < 5 && *txt++ != ':') - return -1; - } - - return 0; -} - static void indicate_wx_custom_event(_adapter *padapter, char *msg) { u8 *buff; @@ -3757,8 +3730,7 @@ static int rtw_get_ap_info(struct net_device *dev, pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list); - /* if(hwaddr_aton_i(pdata->pointer, bssid)) */ - if (hwaddr_aton_i(data, bssid)) { + if (!mac_pton(data, bssid)) { RTW_INFO("Invalid BSSID '%s'.\n", (u8 *)data); _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); return -EINVAL;