From patchwork Sat Oct 15 19:41:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Richter X-Patchwork-Id: 682592 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sxFGt5tNZz9s9x for ; Sun, 16 Oct 2016 06:42:14 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bvUqF-0001QO-VJ; Sat, 15 Oct 2016 19:41:59 +0000 Received: from gate.waldteufel.eu ([5.45.104.30] helo=parlor.waldteufel.eu) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bvUqC-0001KG-CS for hostap@lists.infradead.org; Sat, 15 Oct 2016 19:41:57 +0000 Received: from [IPv6:2003:e0:33c6:3e66:e0af:293d:1ffa:7a50] (p200300E033C63E66E0AF293D1FFA7A50.dip0.t-ipconnect.de [IPv6:2003:e0:33c6:3e66:e0af:293d:1ffa:7a50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by parlor.waldteufel.eu (Postfix) with ESMTPSA id D4BBD20673; Sat, 15 Oct 2016 21:41:28 +0200 (CEST) Subject: Re: [PATCH] wpa_supplicant: restore permanent mac on reassoc To: Jouni Malinen References: <1987bcb2-77cc-b595-825b-4b0537171bc6@waldteufel.eu> <20161011083338.GA3315@w1.fi> <7672e469-866c-df27-d291-0689ba1712f4@waldteufel.eu> <20161015190720.GB4763@w1.fi> From: Benjamin Richter Message-ID: Date: Sat, 15 Oct 2016 21:41:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161015190720.GB4763@w1.fi> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on parlor.waldteufel.eu X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161015_124156_686035_18AA5528 X-CRM114-Status: GOOD ( 14.09 ) X-Spam-Score: -3.3 (---) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-3.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -1.4 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hostap@lists.infradead.org Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org On 2016-10-15 21:07, Jouni Malinen wrote: > Wouldn't that break this for mac_addr == 1 and 2 cases by clearing > the random MAC address for reassociation to the same ESS cases when > the previously selected random MAC address should be maintained > instead? Yes. The revised patch below should fix both the error in the code and in the commit message. From f983d34ee161d4531c83e7613eeee5515fa04666 Mon Sep 17 00:00:00 2001 From: Benjamin Richter Date: Tue, 11 Oct 2016 05:57:38 +0200 Subject: [PATCH] wpa_supplicant: restore permanent mac on reassoc With mac_addr=0 and preassoc_mac_addr=1, the permanent MAC address should be restored for association. Previously this did not happen when reassociating to the same ESS. Signed-off-by: Benjamin Richter --- wpa_supplicant/wpa_supplicant.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index c939321..7fa58c6 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -1691,11 +1691,13 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, wmm_ac_save_tspecs(wpa_s); wpa_s->reassoc_same_bss = 1; } - } else if (rand_style > 0) { + } + + if (rand_style > 0 && !wpa_s->reassoc_same_ess) { if (wpas_update_random_addr(wpa_s, rand_style) < 0) return; wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid); - } else if (wpa_s->mac_addr_changed) { + } else if (rand_style == 0 && wpa_s->mac_addr_changed) { if (wpa_drv_set_mac_addr(wpa_s, NULL) < 0) { wpa_msg(wpa_s, MSG_INFO, "Could not restore permanent MAC address"); -- 2.10.0