From nobody@FreeBSD.org  Fri Feb 19 14:30:26 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 92429106568B
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 19 Feb 2010 14:30:26 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 80B848FC1C
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 19 Feb 2010 14:30:26 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o1JEUQdJ074968
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 19 Feb 2010 14:30:26 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o1JEUQgr074967;
	Fri, 19 Feb 2010 14:30:26 GMT
	(envelope-from nobody)
Message-Id: <201002191430.o1JEUQgr074967@www.freebsd.org>
Date: Fri, 19 Feb 2010 14:30:26 GMT
From: Erik Fonnesbeck <efonnes@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: hostapd uses the MAC of the wireless interface, but should use the BSSID.
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         144109
>Category:       bin
>Synopsis:       hostapd(8) uses the MAC of the wireless interface, but should use the BSSID.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-wireless
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 19 14:40:00 UTC 2010
>Closed-Date:    
>Last-Modified:  Sun May  6 01:20:08 UTC 2012
>Originator:     Erik Fonnesbeck
>Release:        8.0
>Organization:
>Environment:
FreeBSD bsd.local 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Sat Nov 21 15:48:17 UTC 2009     root@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
If the MAC address of a wireless interface is set to something that does not match its BSSID, WPA does not work.  Another related bug is that if the wireless clone is named with the parent interface name at the start (for example, ath0_wlan0), WPA will not work if the MAC address of the parent does not match the BSSID of the clone.  They are both part of the same issue because it should be using the BSSID and not the MAC address.

This may also affect wpa_supplicant.
>How-To-Repeat:
Assign a different MAC address to a wireless clone interface and WPA does not work.

Or if you are naming the clones after the parent (ath0_wlan0, etc.):

If the parent's MAC address does not match the clone's BSSID, either from changing the parent's MAC or by having multiple clones created with the bssid option of ifconfig, WPA does not work.
>Fix:
In usr.sbin/wpa/l2_packet.c: eth_get, it needs to get the BSSID of the interface instead of its MAC.  hostapd appears to only read this information once, at startup.  WPA works correctly if the MAC address matched the BSSID when hostapd was started.  Changing it afterward seems to have no effect.

In the case of reading the MAC from the wrong interface, hostapd works if the parent's MAC matches the clone's BSSID, even if the clone's MAC does not match, showing that the clone's MAC does not need to match its BSSID for hostapd to function.

There is code for getting the BSSID in ifconfig's source code, though it is scattered a bit.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-wireless 
Responsible-Changed-By: eadler 
Responsible-Changed-When: Mon Apr 11 23:18:39 UTC 2011 
Responsible-Changed-Why:  
new wireless mailing list 

http://www.freebsd.org/cgi/query-pr.cgi?pr=144109 

From: Erik Fonnesbeck <efonnes@gmail.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/144109: hostapd(8) uses the MAC of the wireless interface,
 but should use the BSSID.
Date: Tue, 1 May 2012 02:30:23 -0600

 The file containing the code mentioned in the PR appears to have been
 moved to contrib/wpa/src/l2_packet/l2_packet_freebsd.c and does still
 use the code that causes hostapd to malfunction when the wireless MAC
 and BSSID are configured to not be the same as each other.

From: Erik Fonnesbeck <efonnes@gmail.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/144109: hostapd(8) uses the MAC of the wireless interface,
 but should use the BSSID.
Date: Sat, 5 May 2012 19:14:44 -0600

 --00248c6a66a6fc9c5f04bf53e0fd
 Content-Type: text/plain; charset=ISO-8859-1
 
 This patch I made a while ago gets the BSSID instead of the
 interface's ethernet MAC so that hostapd works even if the two do not
 match.  It is incomplete, however; because with this patch hostapd
 does not work if the interface was not up already when hostapd was
 started (it fails to acquire the BSSID).  If there is some way to get
 it without the interface being up, that would probably be better.  It
 must exist somewhere, because it is obviously already stored
 somewhere, but I just do not know how to get it.  If it is not
 possible, it could be necessary to bring up the interface a bit sooner
 in hostapd.
 
 --00248c6a66a6fc9c5f04bf53e0fd
 Content-Type: application/octet-stream; 
 	name="hostapd-eth_get-bssid-incomplete.patch"
 Content-Disposition: attachment; 
 	filename="hostapd-eth_get-bssid-incomplete.patch"
 Content-Transfer-Encoding: base64
 X-Attachment-Id: f_h1ve8srd0
 
 LS0tIHVzci5zYmluL3dwYS9sMl9wYWNrZXQuYy5vbGQJMjAxMC0xMi0wMSAxOToxNTo0Ni4wMDAw
 MDAwMDAgLTA3MDAKKysrIHVzci5zYmluL3dwYS9sMl9wYWNrZXQuYwkyMDEwLTEyLTAxIDE5OjIx
 OjI2LjAwMDAwMDAwMCAtMDcwMApAQCAtMjksNiArMjksNyBAQAogI2luY2x1ZGUgPG5ldC9yb3V0
 ZS5oPgogI2luY2x1ZGUgPG5ldGluZXQvaW4uaD4KICNpbmNsdWRlIDxhcnBhL2luZXQuaD4KKyNp
 bmNsdWRlICJuZXQ4MDIxMS9pZWVlODAyMTFfaW9jdGwuaCIKIAogI2luY2x1ZGUgPHN0ZGxpYi5o
 PgogI2luY2x1ZGUgPHN0ZGlvLmg+CkBAIC0yMjEsMzggKzIyMiwyNSBAQAogc3RhdGljIGludAog
 ZXRoX2dldChjb25zdCBjaGFyICpkZXZpY2UsIHU4IGVhW0VUSF9BTEVOXSkKIHsKLQlzdHJ1Y3Qg
 aWZfbXNnaGRyICppZm07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