Failover Mode Between Ethernet and Wireless Interfaces broken on >= 11

Renato Botelho garga at FreeBSD.org
Fri Jun 23 10:44:21 UTC 2017


On 21/06/17 16:26, Sean Bruno wrote:
> 
> 
> On 06/21/17 11:48, Renato Botelho wrote:
>> I've already sent it to net, but I suspect this is the appropriate place
>> to discuss this subject.
>>
>> Last night I was configuring a new laptop and decided to give it [1] a
>> try. I figured out this section of handbook (similar instructions are on
>> lagg(4) manpage) is outdated, based on FreeBSD 10.x.
>>
>> Then I modified a bit the commands and tried to get it configured on
>> 12-CURRENT, without success. I spoke with adrian@, who told me this
>> setup doesn't work on FreeBSD > 10, because on newer versions Wireless
>> interfaces mac address cannot be changed.
>>
>> My next attempt was to do the other way round and make lagg to use wlan0
>> mac address instead of em0's. but even doing this my wireless interface
>> ended up not working.
>>
>> After further investigation I noted that a simple command:
>>
>> # ifconfig wlan0 ether $wlan0_current_mac_address
>>
>> is enough to break it on 12-CURRENT.
>>
>> I've checked if_setlladdr() source code and noted it always replace the
>> mac address, even if the same is already configured on the interface. Is
>> it the expected behavior?
>>
>> Just as a PoC I've applied the following patch to if_setlladdr():
>>
>> Index: sys/net/if.c
>> ===================================================================
>> --- sys/net/if.c	(revision 320097)
>> +++ sys/net/if.c	(working copy)
>> @@ -3519,6 +3519,10 @@
>>  		ifa_free(ifa);
>>  		return (EINVAL);
>>  	}
>> +	if (memcmp(lladdr, LLADDR(sdl), len) == 0) {
>> +		ifa_free(ifa);
>> +		return (0);
>> +	}
>>  	switch (ifp->if_type) {
>>  	case IFT_ETHER:
>>  	case IFT_FDDI:
>>
>> And configured it to use wlan0 mac address on rc.conf:
>>
>> ifconfig_em0="ether 60:67:20:c5:2d:48 up"
>> wlans_iwn0="wlan0"
>> ifconfig_wlan0="WPA"
>> cloned_interfaces="lagg0"
>> ifconfig_lagg0="up laggproto failover laggport em0 laggport wlan0 DHCP"
>>
>> and it's now working as expected.
>>
>> Other than that, I believe if wlan interfaces cannot have their mac
>> address changed, ifconfig should return an error when user attempts to
>> do it, and if_setlladdr() should do the same.
>>
>> Thoughts?
>>
>> [1]
>> https://www.freebsd.org/doc/handbook/network-aggregation.html#networking-lagg-wired-and-wireless
>>
> 
> 
> Maybe this is a "iflib" problem.  em(4) and igb(4) are pretty different
> now in head.  Can you shove it into bugzilla with a test case
> (copy/paste your email) and tag me on it?

em0 is working as expected, the main problem is on iwn, which in my case is:

iwn0 at pci0:3:0:0:	class=0x028000 card=0x13118086 chip=0x00858086 rev=0x34
hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Centrino Advanced-N 6205 [Taylor Peak]'
    class      = network

After investigate a bit more I noted wpa_supplicant is exiting when I
change wlan0 mac address, and because of that my interface is
disconnected. If I start wpa_supplicant again it back to work.

# ifconfig wlan0 | grep status:
	status: associated

# ifconfig wlan0 ether 60:67:20:c5:2d:49

# ifconfig wlan0 | grep status:
	status: no carrier

# /etc/rc.d/wpa_supplicant restart wlan0
wpa_supplicant not running? (check /var/run/wpa_supplicant/wlan0.pid).
Starting wpa_supplicant.

# ifconfig wlan0 | grep status:
	status: associated

It happens every time, even if I call ifconfig using the same mac
address already configured. In this case, that patch I submitted on
first email prevent the error to happen.

Attached you can see wpa_supplicant log, my understanding is the
relevant line is:

1498213478.949506: ioctl[SIOCS80211, op=20, val=0, arg_len=7]: Can't
assign requested address

-- 
Renato Botelho
-------------- next part --------------
1498213478.949265: wlan0: Event DISASSOC (1) received
1498213478.949291: wlan0: Disassociation notification
1498213478.949308: wlan0: CTRL-EVENT-DISCONNECTED bssid=56:d9:e7:75:3f:b6 reason=0
1498213478.949321: wlan0: Auto connect enabled: try to reconnect (wps=0/0 wpa_state=9)
1498213478.949335: wlan0: Setting scan request: 0.100000 sec
1498213478.949367: Added BSSID 56:d9:e7:75:3f:b6 into blacklist
1498213478.949383: wlan0: Blacklist count 1 --> request scan in 100 ms
1498213478.949395: wlan0: Ignore new scan request for 0.100000 sec since an earlier request is scheduled to trigger sooner
1498213478.949408: wlan0: WPA: Clear old PMK and PTK
1498213478.949416: wlan0: Disconnect event - remove keys
1498213478.949422: bsd_set_key: alg=0 addr=0x0 key_idx=0 set_tx=0 seq_len=0 key_len=0
1498213478.949433: bsd_del_key: key_idx=0
1498213478.949462: bsd_set_key: alg=0 addr=0x0 key_idx=1 set_tx=0 seq_len=0 key_len=0
1498213478.949470: bsd_del_key: key_idx=1
1498213478.949479: bsd_set_key: alg=0 addr=0x8007340f0 key_idx=0 set_tx=0 seq_len=0 key_len=0
1498213478.949485: bsd_del_key: addr=56:d9:e7:75:3f:b6
1498213478.949506: ioctl[SIOCS80211, op=20, val=0, arg_len=7]: Can't assign requested address
1498213478.949521: wlan0: State: COMPLETED -> DISCONNECTED
1498213478.949529: EAPOL: External notification - portEnabled=0
1498213478.949535: EAPOL: SUPP_PAE entering state DISCONNECTED
1498213478.949542: EAPOL: Supplicant port status: Unauthorized
1498213478.949547: EAPOL: SUPP_BE entering state INITIALIZE
1498213478.949555: EAPOL: External notification - portValid=0
1498213478.949560: EAPOL: External notification - EAP success=0
1498213478.949579: RTM_IFINFO: Interface 'wlan0' DOWN
1498213478.949598: wlan0: Event INTERFACE_STATUS (5) received
1498213478.949610: wlan0: Configured interface was removed
1498213478.949619: wlan0: State: DISCONNECTED -> DISCONNECTED
1498213478.949624: EAPOL: External notification - portEnabled=0
1498213478.949629: EAPOL: External notification - portValid=0
1498213478.949639: wlan0: State: DISCONNECTED -> INTERFACE_DISABLED
1498213478.949923: wlan0: Removing interface wlan0
1498213478.949949: wlan0: Request to deauthenticate - bssid=00:00:00:00:00:00 pending_bssid=00:00:00:00:00:00 reason=3 state=INTERFACE_DISABLED
1498213478.949957: wpa_driver_bsd_set_countermeasures: enabled=0
1498213478.951772: wlan0: WPA: Clear old PMK and PTK
1498213478.951801: Removed BSSID 56:d9:e7:75:3f:b6 from blacklist (clear)
1498213478.951830: wlan0: BSS: Remove id 0 BSSID 46:d9:e7:75:3f:b6 SSID 'Angband' due to wpa_bss_flush
1498213478.951857: wlan0: BSS: Remove id 1 BSSID 6a:02:71:72:5f:04 SSID 'Desktop_F7A41341' due to wpa_bss_flush
1498213478.951878: wlan0: BSS: Remove id 2 BSSID 56:d9:e7:75:3f:b6 SSID 'MORDOR' due to wpa_bss_flush
1498213478.951915: wlan0: BSS: Remove id 3 BSSID c4:6e:1f:69:a1:56 SSID 'Valfenda' due to wpa_bss_flush
1498213478.951940: wlan0: BSS: Remove id 4 BSSID 6a:02:71:59:ce:f7 SSID 'Desktop_F3A48318' due to wpa_bss_flush
1498213478.951960: wlan0: Cancelling scan request
1498213478.951972: wlan0: Cancelling authentication timeout
1498213478.951989: Remove interface wlan0 from radio
1498213478.951997: Remove radio
1498213478.952004: wpa_driver_bsd_set_wpa: enabled=0
1498213478.952011: wpa_driver_bsd_set_wpa_internal: wpa=0 privacy=0
1498213478.952018: bsd_set_opt_ie: set WPA+RSN ie (len 0)
1498213478.996885: wpa_driver_bsd_set_wpa_internal: wpa=0 privacy=0
1498213478.996912: bsd_set_opt_ie: set WPA+RSN ie (len 0)
1498213478.996968: wlan0: CTRL-EVENT-TERMINATING
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20170623/601a2d01/attachment.sig>


More information about the freebsd-current mailing list