Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/wpa/dist/src/drivers wpa: Don't set or remove I...



details:   https://anonhg.NetBSD.org/src/rev/88794418daf3
branches:  trunk
changeset: 968819:88794418daf3
user:      roy <roy%NetBSD.org@localhost>
date:      Wed Jan 29 11:45:54 2020 +0000

description:
wpa: Don't set or remove IFF_UP

Now that both hostapd and wpa_supplicant react to interface flag
changes, there is no need to set or remove IFF_UP.

It should be an administrative flag only.

diffstat:

 external/bsd/wpa/dist/src/drivers/driver_bsd.c |  46 ++++---------------------
 1 files changed, 8 insertions(+), 38 deletions(-)

diffs (121 lines):

diff -r cf66752989b8 -r 88794418daf3 external/bsd/wpa/dist/src/drivers/driver_bsd.c
--- a/external/bsd/wpa/dist/src/drivers/driver_bsd.c    Wed Jan 29 11:44:43 2020 +0000
+++ b/external/bsd/wpa/dist/src/drivers/driver_bsd.c    Wed Jan 29 11:45:54 2020 +0000
@@ -337,9 +337,8 @@
 }
 
 static int
-bsd_ctrl_iface(void *priv, int enable)
+bsd_get_iface_flags(struct bsd_driver_data *drv)
 {
-       struct bsd_driver_data *drv = priv;
        struct ifreq ifr;
 
        os_memset(&ifr, 0, sizeof(ifr));
@@ -351,24 +350,6 @@
                return -1;
        }
        drv->flags = ifr.ifr_flags;
-
-       if (enable) {
-               if (ifr.ifr_flags & IFF_UP)
-                       return 0;
-               ifr.ifr_flags |= IFF_UP;
-       } else {
-               if (!(ifr.ifr_flags & IFF_UP))
-                       return 0;
-               ifr.ifr_flags &= ~IFF_UP;
-       }
-
-       if (ioctl(drv->global->sock, SIOCSIFFLAGS, &ifr) < 0) {
-               wpa_printf(MSG_ERROR, "ioctl[SIOCSIFFLAGS]: %s",
-                          strerror(errno));
-               return -1;
-       }
-
-       drv->flags = ifr.ifr_flags;
        return 0;
 }
 
@@ -582,7 +563,7 @@
                           __func__);
                return -1;
        }
-       return bsd_ctrl_iface(priv, 1);
+       return 0;
 }
 
 static void
@@ -980,8 +961,7 @@
        if (l2_packet_get_own_addr(drv->sock_xmit, params->own_addr))
                goto bad;
 
-       /* mark down during setup */
-       if (bsd_ctrl_iface(drv, 0) < 0)
+       if (bsd_get_iface_flags(drv) < 0)
                goto bad;
 
        if (bsd_set_mediaopt(drv, IFM_OMASK, IFM_IEEE80211_HOSTAP) < 0) {
@@ -1006,8 +986,6 @@
 {
        struct bsd_driver_data *drv = priv;
 
-       if (drv->ifindex != 0)
-               bsd_ctrl_iface(drv, 0);
        if (drv->sock_xmit != NULL)
                l2_packet_deinit(drv->sock_xmit);
        os_free(drv);
@@ -1015,13 +993,6 @@
 
 
 static int
-bsd_commit(void *priv)
-{
-       return bsd_ctrl_iface(priv, 1);
-}
-
-
-static int
 bsd_set_sta_authorized(void *priv, const u8 *addr,
                       unsigned int total_flags, unsigned int flags_or,
                       unsigned int flags_and)
@@ -1274,8 +1245,11 @@
        }
 
        /* NB: interface must be marked UP to do a scan */
-       if (bsd_ctrl_iface(drv, 1) < 0)
+       if (!(drv->flags & IFF_UP)) {
+               wpa_printf(MSG_DEBUG, "%s: interface is not up, cannot scan",
+                          __func__);
                return -1;
+       }
 
 #ifdef IEEE80211_IOC_SCAN_MAX_SSID
        os_memset(&sr, 0, sizeof(sr));
@@ -1565,7 +1539,7 @@
                goto fail;
 
        /* Down interface during setup. */
-       if (bsd_ctrl_iface(drv, 0) < 0)
+       if (bsd_get_iface_flags(drv) < 0)
                goto fail;
 
        drv->opmode = get80211opmode(drv);
@@ -1586,9 +1560,6 @@
        if (drv->ifindex != 0 && !drv->if_removed) {
                wpa_driver_bsd_set_wpa(drv, 0);
 
-               /* NB: mark interface down */
-               bsd_ctrl_iface(drv, 0);
-
                wpa_driver_bsd_set_wpa_internal(drv, drv->prev_wpa,
                                                drv->prev_privacy);
 
@@ -1694,7 +1665,6 @@
        .sta_disassoc           = bsd_sta_disassoc,
        .sta_deauth             = bsd_sta_deauth,
        .sta_set_flags          = bsd_set_sta_authorized,
-       .commit                 = bsd_commit,
 #else /* HOSTAPD */
        .init2                  = wpa_driver_bsd_init,
        .deinit                 = wpa_driver_bsd_deinit,



Home | Main Index | Thread Index | Old Index