Re: [PATCH] wpa_supplicant: multi_ap: only enable 4addr mode if not already enabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



wt., 9 lut 2021 o 10:26 Janusz Dziedzic <janusz.dziedzic@xxxxxxxxx> napisał(a):
>
> pon., 8 lut 2021 o 18:30 Raphaël Mélotte <raphael.melotte@xxxxxxx> napisał(a):
> >
> > If 4addr mode is already enabled, the call to enable it a second time
> > may fail. If this happens when roaming, it leads to deauthentication.
> >
> > Signed-off-by: Raphaël Mélotte <raphael.melotte@xxxxxxx>
> > ---
> >  wpa_supplicant/events.c | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
> > index 199829bcf..7682dae76 100644
> > --- a/wpa_supplicant/events.c
> > +++ b/wpa_supplicant/events.c
> > @@ -2627,11 +2627,13 @@ static void multi_ap_set_4addr_mode(struct wpa_supplicant *wpa_s)
> >                 goto fail;
> >         }
> >
> > -       if (wpa_drv_set_4addr_mode(wpa_s, 1) < 0) {
> > -               wpa_printf(MSG_ERROR, "Failed to set 4addr mode");
> > -               goto fail;
> > +       if (wpa_s->enabled_4addr_mode == 0) {
> > +               if (wpa_drv_set_4addr_mode(wpa_s, 1) < 0) {
> > +                       wpa_printf(MSG_ERROR, "Failed to set 4addr mode");
> > +                       goto fail;
> > +               }
> > +               wpa_s->enabled_4addr_mode = 1;
> >         }
> > -       wpa_s->enabled_4addr_mode = 1;
> >         return;
> >
> Thanks for patch.
>
> Today set_4addr_mode(1) fail with EBUSY if netdev is already in the bridge.
> So, maybe we should fix it in cfg80211?
>
> janusz@t2:~$ sudo ifconfig wlp1s0 up
>
> janusz@t2:~$ sudo iw wlp1s0 set 4addr on
> janusz@t2:~$ sudo iw wlp1s0 set 4addr on
> janusz@t2:~$ sudo iw wlp1s0 set 4addr on
>
> janusz@t2:~$ sudo brctl addbr br0
> janusz@t2:~$ sudo brctl addif br0 wlp1s0
> janusz@t2:~$ sudo iw wlp1s0 set 4addr on
> command failed: Device or resource busy (-16)
>
> janusz@t2:~$ sudo iw wlp1s0 info
> Interface wlp1s0
> ifindex 3
> wdev 0x1
> addr 68:94:23:28:a7:25
> type managed
> wiphy 0
> txpower 16.00 dBm
> multicast TXQ:
> qsz-byt qsz-pkt flows drops marks overlmt hashcol tx-bytes tx-packets
> 0 0 0 0 0 0 0 0 0
> 4addr: on
>

Did fast patch (didn't check code deeply yet - just check set 4addr
when busy issuey, seems works correctly):

janusz@t1:~/work/linux$ git diff
diff --git a/net/wireless/util.c b/net/wireless/util.c
index b4acc805114b..fec068f48113 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -1027,6 +1027,7 @@ int cfg80211_change_iface(struct
cfg80211_registered_device *rdev,

        /* if it's part of a bridge, reject changing type to station/ibss */
        if (netif_is_bridge_port(dev) &&
+           (ntype != otype) &&
            (ntype == NL80211_IFTYPE_ADHOC ||
             ntype == NL80211_IFTYPE_STATION ||
             ntype == NL80211_IFTYPE_P2P_CLIENT))

@Johannes Berg - could you check if this will be correct?

For old kernels/cfg80211 maybe we should introduce
wpa_drv_get_4addr_mode() and set only if required?

BR
Janusz

_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux