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

2017-06-23 Thread Adrian Chadd
Hi,

You can't change a wifi mac address /after the interface is up/. So if
that's happening with this RC script combination then we should kinda
fix that.


-adrian
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


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

2017-06-23 Thread Renato Botelho
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@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
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.10 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.10 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

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

2017-06-22 Thread M - Krasznai András
Good morning!

With em0 and iwn I have the same working configuration for failover between 
wireless interface and ethernet  adapter. I run FreeBSD-12. 

There was some change introduced with FreeBSD-11 in the syntax how to specify 
the mac address for the wireless interface (old - FreeBSD-10  working form: 
ifconfig_iwn0="ether ", the new is 
create_args_wlan0="wlanaddr ". The "new" mac address is 
identical with the ethernet adapter's mac address. 

best regards

András Krasznai


-Eredeti üzenet-
Feladó: owner-freebsd-curr...@freebsd.org 
[mailto:owner-freebsd-curr...@freebsd.org] Meghatalmazó Cy Schubert
Küldve: 2017. június 22. 7:40
Címzett: Sean Bruno
Másolatot kap: Renato Botelho; freebsd-current@freebsd.org
Tárgy: Re: Failover Mode Between Ethernet and Wireless Interfaces broken on >= 
11

In message <cbdb0928-1355-0d1e-7f9c-69fb5edde...@freebsd.org>, Sean Bruno write
s:
> This is an OpenPGP/MIME signed message (RFC 4880 and 3156) 
> --XuprkQPPD5E0VHaDeuAKBatHWCR01xNcA
> Content-Type: multipart/mixed; 
> boundary="fPqiMVoTg6hr4JdbiP1DBOlOppEsSDgjw";
>  protected-headers="v1"
> From: Sean Bruno <sbr...@freebsd.org>
> To: Renato Botelho <ga...@freebsd.org>, freebsd-current@freebsd.org
> Message-ID: <cbdb0928-1355-0d1e-7f9c-69fb5edde...@freebsd.org>
> Subject: Re: Failover Mode Between Ethernet and Wireless Interfaces 
> broken on  >= 11
> References: <1c1e5c6f-35e5-ca14-2e23-5e33d86a5...@freebsd.org>
> In-Reply-To: <1c1e5c6f-35e5-ca14-2e23-5e33d86a5...@freebsd.org>
> 
> --fPqiMVoTg6hr4JdbiP1DBOlOppEsSDgjw
> Content-Type: text/plain; charset=utf-8
> Content-Language: en-US
> Content-Transfer-Encoding: quoted-printable
> 
> 
> 
> On 06/21/17 11:48, Renato Botelho wrote:
> > I've already sent it to net, but I suspect this is the appropriate 
> > plac=
> e
> > to discuss this subject.
> >=20
> > 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 o=
> n
> > lagg(4) manpage) is outdated, based on FreeBSD 10.x.
> >=20
> > 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.
> >=20
> > My next attempt was to do the other way round and make lagg to use 
> >wlan=
> 0
> > mac address instead of em0's. but even doing this my wireless 
> > interface=
> 
> > ended up not working.
> >=20
> > After further investigation I noted that a simple command:
> >=20
> > # ifconfig wlan0 ether $wlan0_current_mac_address
> >=20
> > is enough to break it on 12-CURRENT.
> >=20
> > 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. I=
> s
> > it the expected behavior?
> >=20
> > Just as a PoC I've applied the following patch to if_setlladdr():
> >=20
> > Index: sys/net/if.c
> > 
> >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> >=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> 3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > --- 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) =3D=3D 0) {
> > +   ifa_free(ifa);
> > +   return (0);
> > +   }
> > switch (ifp->if_type) {
> > case IFT_ETHER:
> > case IFT_FDDI:
> >=20
> > And configured it to use wlan0 mac address on rc.conf:
> >=20
> > ifconfig_em0=3D"ether 60:67:20:c5:2d:48 up"
> > wlans_iwn0=3D"wlan0"
> > ifconfig_wlan0=3D"WPA"
> > cloned_interfaces=3D"lagg0"
> > ifconfig_lagg0=3D"up laggproto failover laggport em0 laggport wlan0 
> >DHC=
> P"
> >=20
> > and it's now working as expected.
> >=20
> > 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.
> >=20
> > Thoughts?
> >=20
> > [1]
> > 
> >https://www.freebsd.org/doc/handbook/network-aggregation.html#network
> >in=
> g-lagg-wired

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

2017-06-21 Thread Cy Schubert
In message <cbdb0928-1355-0d1e-7f9c-69fb5edde...@freebsd.org>, Sean Bruno 
write
s:
> This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
> --XuprkQPPD5E0VHaDeuAKBatHWCR01xNcA
> Content-Type: multipart/mixed; boundary="fPqiMVoTg6hr4JdbiP1DBOlOppEsSDgjw";
>  protected-headers="v1"
> From: Sean Bruno <sbr...@freebsd.org>
> To: Renato Botelho <ga...@freebsd.org>, freebsd-current@freebsd.org
> Message-ID: <cbdb0928-1355-0d1e-7f9c-69fb5edde...@freebsd.org>
> Subject: Re: Failover Mode Between Ethernet and Wireless Interfaces broken on
>  >= 11
> References: <1c1e5c6f-35e5-ca14-2e23-5e33d86a5...@freebsd.org>
> In-Reply-To: <1c1e5c6f-35e5-ca14-2e23-5e33d86a5...@freebsd.org>
> 
> --fPqiMVoTg6hr4JdbiP1DBOlOppEsSDgjw
> Content-Type: text/plain; charset=utf-8
> Content-Language: en-US
> Content-Transfer-Encoding: quoted-printable
> 
> 
> 
> On 06/21/17 11:48, Renato Botelho wrote:
> > I've already sent it to net, but I suspect this is the appropriate plac=
> e
> > to discuss this subject.
> >=20
> > 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 o=
> n
> > lagg(4) manpage) is outdated, based on FreeBSD 10.x.
> >=20
> > 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.
> >=20
> > My next attempt was to do the other way round and make lagg to use wlan=
> 0
> > mac address instead of em0's. but even doing this my wireless interface=
> 
> > ended up not working.
> >=20
> > After further investigation I noted that a simple command:
> >=20
> > # ifconfig wlan0 ether $wlan0_current_mac_address
> >=20
> > is enough to break it on 12-CURRENT.
> >=20
> > 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. I=
> s
> > it the expected behavior?
> >=20
> > Just as a PoC I've applied the following patch to if_setlladdr():
> >=20
> > Index: sys/net/if.c
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > --- 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) =3D=3D 0) {
> > +   ifa_free(ifa);
> > +   return (0);
> > +   }
> > switch (ifp->if_type) {
> > case IFT_ETHER:
> > case IFT_FDDI:
> >=20
> > And configured it to use wlan0 mac address on rc.conf:
> >=20
> > ifconfig_em0=3D"ether 60:67:20:c5:2d:48 up"
> > wlans_iwn0=3D"wlan0"
> > ifconfig_wlan0=3D"WPA"
> > cloned_interfaces=3D"lagg0"
> > ifconfig_lagg0=3D"up laggproto failover laggport em0 laggport wlan0 DHC=
> P"
> >=20
> > and it's now working as expected.
> >=20
> > 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.
> >=20
> > Thoughts?
> >=20
> > [1]
> > https://www.freebsd.org/doc/handbook/network-aggregation.html#networkin=
> g-lagg-wired-and-wireless
> >=20
> 
> 
> 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?

As a late comer to this thread, I don't have any issues either. I too have 
a bge interface and iwn set up as follows:

ifconfig_lagg0="laggproto failover laggport bge0 laggport wlan0 DHCP"


-- 
Cheers,
Cy Schubert <cy.schub...@cschubert.com>
FreeBSD UNIX:  <c...@freebsd.org>   Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


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

2017-06-21 Thread Sean Bruno


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?

sean



signature.asc
Description: OpenPGP digital signature


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

2017-06-21 Thread Renato Botelho
On 21/06/17 14:56, Guido Falsi wrote:
> On 06/21/17 19:48, Renato Botelho wrote:
>> I've already sent it to net, but I suspect this is the appropriate place
>> to discuss this subject.
> [...]
>>
>> 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.
> 
> Strange enough, this works for me. My laptop has a bge interface. Maybe
> that's relevant.
> 
> [...]
>>
>> 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.
> 
> I can confirm this is exactly what I've been doing for a while on my
> laptop. As noted before I did not need to patch the kernel to have this
> working.

Maybe bge is not affected by this bug, interesting. It would be good to
know which models are affected

> 
>>
>> 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?
> 
> I agree returning some error code would be nicer on users.
> 

In this case since some drivers are OK and others not, we cannot remove
the possibility of changing mac address from ifconfig for all wlan
interfaces.

I'm wondering if there is any side-effect to have only the change I made
applied, not sure if there are reasons to run filters and event_handler
when if_setlladdr() is called with the same address that is current set
on NIC.
-- 
Renato Botelho
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


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

2017-06-21 Thread Guido Falsi

On 06/21/17 19:48, Renato Botelho wrote:

I've already sent it to net, but I suspect this is the appropriate place
to discuss this subject.

[...]


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.


Strange enough, this works for me. My laptop has a bge interface. Maybe 
that's relevant.


[...]


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.


I can confirm this is exactly what I've been doing for a while on my 
laptop. As noted before I did not need to patch the kernel to have this 
working.




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?


I agree returning some error code would be nicer on users.

--
Guido Falsi 
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"