From patchwork Mon Nov 26 06:02:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitkumar Karwar X-Patchwork-Id: 201629 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id D79EE2C0082 for ; Mon, 26 Nov 2012 17:02:29 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id E54F69C169; Mon, 26 Nov 2012 01:02:25 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XzTcXw2pj+Y6; Mon, 26 Nov 2012 01:02:25 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 9023D9C147; Mon, 26 Nov 2012 01:02:21 -0500 (EST) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id B55FE9C147 for ; Mon, 26 Nov 2012 01:02:19 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Am7m0UYpJSCu for ; Mon, 26 Nov 2012 01:02:16 -0500 (EST) Received: from na3sys009aog124.obsmtp.com (na3sys009aog124.obsmtp.com [74.125.149.151]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id BFF679C116 for ; Mon, 26 Nov 2012 01:02:15 -0500 (EST) Received: from sc-owa02.marvell.com ([199.233.58.137]) (using TLSv1) by na3sys009aob124.postini.com ([74.125.148.12]) with SMTP ID DSNKULMF3yubfwJCaZrWgzMRpWRE21qLnldp@postini.com; Sun, 25 Nov 2012 22:02:15 PST Received: from SC-VEXCH1.marvell.com ([10.93.76.137]) by sc-owa02.marvell.com ([10.93.76.22]) with mapi; Sun, 25 Nov 2012 22:02:07 -0800 From: Amitkumar Karwar To: "'hostap@lists.shmoo.com'" Date: Sun, 25 Nov 2012 22:02:05 -0800 Subject: WPS 2.0: Update authorized enrollee MAC address list correctly Thread-Topic: WPS 2.0: Update authorized enrollee MAC address list correctly Thread-Index: Ac3Lm5C8GYZ53z+UTiGgN7lenJZ+5Q== Message-ID: <5FF020A1CFFEEC49BD1E09530C4FF5950CC73D6BFA@SC-VEXCH1.marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Cc: Bing Zhao X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com It is observed that authorized enrollee MAC address list advertized in beacon and probe response sometimes contains both wildcard as well as specific station's MAC address. This patch makes sure that either of them will be present in the list. Signed-off-by: Amitkumar Karwar --- src/wps/wps_registrar.c | 24 +++++++++++++++++++++--- 1 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/wps/wps_registrar.c b/src/wps/wps_registrar.c index d8e0d6f..d376f8d 100644 --- a/src/wps/wps_registrar.c +++ b/src/wps/wps_registrar.c @@ -198,6 +198,8 @@ static void wps_registrar_add_authorized_mac(struct wps_registrar *reg, const u8 *addr) { int i; + u8 bcast[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + wpa_printf(MSG_DEBUG, "WPS: Add authorized MAC " MACSTR, MAC2STR(addr)); for (i = 0; i < WPS_MAX_AUTHORIZED_MACS; i++) @@ -206,9 +208,25 @@ static void wps_registrar_add_authorized_mac(struct wps_registrar *reg, "already in the list"); return; /* already in list */ } - for (i = WPS_MAX_AUTHORIZED_MACS - 1; i > 0; i--) - os_memcpy(reg->authorized_macs[i], reg->authorized_macs[i - 1], - ETH_ALEN); + + if (os_memcmp(addr, bcast, ETH_ALEN) == 0) { + /* + * Clear authorized MAC address list while adding wildcard MAC + */ + for (i = 0; i < WPS_MAX_AUTHORIZED_MACS; i++) + os_memset(reg->authorized_macs[0], 0x00, ETH_ALEN); + } else { + /* Remove wildcard MAC when valid MAC address is added */ + if (os_memcmp(reg->authorized_macs[0], bcast, ETH_ALEN) == 0) { + os_memset(reg->authorized_macs[0], 0x00, ETH_ALEN); + } else { + for (i = WPS_MAX_AUTHORIZED_MACS - 1; i > 0; i--) + os_memcpy(reg->authorized_macs[i], + reg->authorized_macs[i - 1], + ETH_ALEN); + } + + } os_memcpy(reg->authorized_macs[0], addr, ETH_ALEN); wpa_hexdump(MSG_DEBUG, "WPS: Authorized MACs", (u8 *) reg->authorized_macs, sizeof(reg->authorized_macs));