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

From: Renato Botelho <garga_at_FreeBSD.org>
Date: Fri, 23 Jun 2017 07:44:13 -0300
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_at_, 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)
>> _at__at_ -3519,6 +3519,10 _at__at_
>>  		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

Received on Fri Jun 23 2017 - 08:44:21 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:12 UTC