cfg80211: move add/change interface monitor flags into params
authorJohannes Berg <johannes.berg@intel.com>
Wed, 12 Apr 2017 09:23:28 +0000 (11:23 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 13 Apr 2017 11:41:38 +0000 (13:41 +0200)
Instead passing both flags, which can be NULL, and vif_params,
which are never NULL, move the flags into the vif_params and
use BIT(0), which is invalid from userspace, to indicate that
the flags were changed.

While updating all drivers, fix a small bug in wil6210 where
it was setting the flags to 0 instead of leaving them unchanged.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
20 files changed:
drivers/net/wireless/ath/ath6kl/cfg80211.c
drivers/net/wireless/ath/wil6210/cfg80211.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h
drivers/net/wireless/intersil/orinoco/cfg.c
drivers/net/wireless/marvell/libertas/cfg.c
drivers/net/wireless/marvell/mwifiex/cfg80211.c
drivers/net/wireless/marvell/mwifiex/main.c
drivers/net/wireless/marvell/mwifiex/main.h
drivers/net/wireless/rndis_wlan.c
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
drivers/staging/wlan-ng/cfg80211.c
include/net/cfg80211.h
net/mac80211/cfg.c
net/wireless/core.h
net/wireless/nl80211.c
net/wireless/rdev-ops.h
net/wireless/util.c
net/wireless/wext-compat.c

index 363b30a549c2b69244e9dca3d0ac77ab4629a496..48dc66aac67d05755498d82cc6b82a9fab90d467 100644 (file)
@@ -1505,7 +1505,6 @@ static struct wireless_dev *ath6kl_cfg80211_add_iface(struct wiphy *wiphy,
                                                      const char *name,
                                                      unsigned char name_assign_type,
                                                      enum nl80211_iftype type,
-                                                     u32 *flags,
                                                      struct vif_params *params)
 {
        struct ath6kl *ar = wiphy_priv(wiphy);
@@ -1552,7 +1551,7 @@ static int ath6kl_cfg80211_del_iface(struct wiphy *wiphy,
 
 static int ath6kl_cfg80211_change_iface(struct wiphy *wiphy,
                                        struct net_device *ndev,
-                                       enum nl80211_iftype type, u32 *flags,
+                                       enum nl80211_iftype type,
                                        struct vif_params *params)
 {
        struct ath6kl_vif *vif = netdev_priv(ndev);
index 79d107018eac38deb4917b343a09ed76c0b39136..17fc152e33d96a2373ca83ea8ae5437082cef584 100644 (file)
@@ -255,7 +255,7 @@ static struct wireless_dev *
 wil_cfg80211_add_iface(struct wiphy *wiphy, const char *name,
                       unsigned char name_assign_type,
                       enum nl80211_iftype type,
-                      u32 *flags, struct vif_params *params)
+                      struct vif_params *params)
 {
        struct wil6210_priv *wil = wiphy_to_wil(wiphy);
        struct net_device *ndev = wil_to_ndev(wil);
@@ -306,7 +306,7 @@ static int wil_cfg80211_del_iface(struct wiphy *wiphy,
 
 static int wil_cfg80211_change_iface(struct wiphy *wiphy,
                                     struct net_device *ndev,
-                                    enum nl80211_iftype type, u32 *flags,
+                                    enum nl80211_iftype type,
                                     struct vif_params *params)
 {
        struct wil6210_priv *wil = wiphy_to_wil(wiphy);
@@ -333,11 +333,8 @@ static int wil_cfg80211_change_iface(struct wiphy *wiphy,
        case NL80211_IFTYPE_P2P_GO:
                break;
        case NL80211_IFTYPE_MONITOR:
-               if (flags)
-                       wil->monitor_flags = *flags;
-               else
-                       wil->monitor_flags = 0;
-
+               if (params->flags)
+                       wil->monitor_flags = params->flags;
                break;
        default:
                return -EOPNOTSUPP;
index 944b83cfc51978d06ccc82a9f23ce64472af3fc8..bd245a6c70d948ed865982b453e4c68e5ff2a761 100644 (file)
@@ -575,12 +575,11 @@ static int brcmf_cfg80211_request_ap_if(struct brcmf_if *ifp)
  *
  * @wiphy: wiphy device of new interface.
  * @name: name of the new interface.
- * @flags: not used.
  * @params: contains mac address for AP device.
  */
 static
 struct wireless_dev *brcmf_ap_add_vif(struct wiphy *wiphy, const char *name,
-                                     u32 *flags, struct vif_params *params)
+                                     struct vif_params *params)
 {
        struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
        struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
@@ -653,7 +652,6 @@ static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy,
                                                     const char *name,
                                                     unsigned char name_assign_type,
                                                     enum nl80211_iftype type,
-                                                    u32 *flags,
                                                     struct vif_params *params)
 {
        struct wireless_dev *wdev;
@@ -674,12 +672,12 @@ static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy,
        case NL80211_IFTYPE_MESH_POINT:
                return ERR_PTR(-EOPNOTSUPP);
        case NL80211_IFTYPE_AP:
-               wdev = brcmf_ap_add_vif(wiphy, name, flags, params);
+               wdev = brcmf_ap_add_vif(wiphy, name, params);
                break;
        case NL80211_IFTYPE_P2P_CLIENT:
        case NL80211_IFTYPE_P2P_GO:
        case NL80211_IFTYPE_P2P_DEVICE:
-               wdev = brcmf_p2p_add_vif(wiphy, name, name_assign_type, type, flags, params);
+               wdev = brcmf_p2p_add_vif(wiphy, name, name_assign_type, type, params);
                break;
        case NL80211_IFTYPE_UNSPECIFIED:
        default:
@@ -858,7 +856,7 @@ int brcmf_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev)
 
 static s32
 brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
-                        enum nl80211_iftype type, u32 *flags,
+                        enum nl80211_iftype type,
                         struct vif_params *params)
 {
        struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
@@ -6549,7 +6547,7 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
        if (err)
                goto default_conf_out;
        err = brcmf_cfg80211_change_iface(wdev->wiphy, ndev, wdev->iftype,
-                                         NULL, NULL);
+                                         NULL);
        if (err)
                goto default_conf_out;
 
index de19c7c92bc6c095b3b111abfc280fe228e588ac..208ae3535367b2659e9a38160015508a675dbdde 100644 (file)
@@ -2141,12 +2141,11 @@ fail:
  * @name: name of the new interface.
  * @name_assign_type: origin of the interface name
  * @type: nl80211 interface type.
- * @flags: not used.
  * @params: contains mac address for P2P device.
  */
 struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name,
                                       unsigned char name_assign_type,
-                                      enum nl80211_iftype type, u32 *flags,
+                                      enum nl80211_iftype type,
                                       struct vif_params *params)
 {
        struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
index 8ce9447533ef8fa519caab0f985949487346464d..0e8b34d2d85cb1b3dbc0ab9716e93c78628b132c 100644 (file)
@@ -150,7 +150,7 @@ s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced);
 void brcmf_p2p_detach(struct brcmf_p2p_info *p2p);
 struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name,
                                       unsigned char name_assign_type,
-                                      enum nl80211_iftype type, u32 *flags,
+                                      enum nl80211_iftype type,
                                       struct vif_params *params);
 int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev);
 int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg,
index 7aa47069af0a771725c8c158ac2c1cae35c484f9..b2d5ec8634b5d5ee6f4f8b5e7d509672b78dd328 100644 (file)
@@ -97,7 +97,7 @@ int orinoco_wiphy_register(struct wiphy *wiphy)
 }
 
 static int orinoco_change_vif(struct wiphy *wiphy, struct net_device *dev,
-                             enum nl80211_iftype type, u32 *flags,
+                             enum nl80211_iftype type,
                              struct vif_params *params)
 {
        struct orinoco_private *priv = wiphy_priv(wiphy);
index 3f97acb57e66f1d20fa73a13edbf78382ee3f38f..a0463fef79b016635b8cbd59978fe4c94b10a735 100644 (file)
@@ -1657,7 +1657,7 @@ static int lbs_cfg_get_station(struct wiphy *wiphy, struct net_device *dev,
  */
 
 static int lbs_change_intf(struct wiphy *wiphy, struct net_device *dev,
-       enum nl80211_iftype type, u32 *flags,
+       enum nl80211_iftype type,
               struct vif_params *params)
 {
        struct lbs_private *priv = wiphy_priv(wiphy);
index 1e3bd435a694534f4a450b32e8b0bd69702e5269..322adad0a65a68e43966e02101401e74bf26f074 100644 (file)
@@ -916,7 +916,7 @@ mwifiex_init_new_priv_params(struct mwifiex_private *priv,
 static int
 mwifiex_change_vif_to_p2p(struct net_device *dev,
                          enum nl80211_iftype curr_iftype,
-                         enum nl80211_iftype type, u32 *flags,
+                         enum nl80211_iftype type,
                          struct vif_params *params)
 {
        struct mwifiex_private *priv;
@@ -988,7 +988,7 @@ mwifiex_change_vif_to_p2p(struct net_device *dev,
 static int
 mwifiex_change_vif_to_sta_adhoc(struct net_device *dev,
                                enum nl80211_iftype curr_iftype,
-                               enum nl80211_iftype type, u32 *flags,
+                               enum nl80211_iftype type,
                                struct vif_params *params)
 {
        struct mwifiex_private *priv;
@@ -1047,7 +1047,7 @@ mwifiex_change_vif_to_sta_adhoc(struct net_device *dev,
 static int
 mwifiex_change_vif_to_ap(struct net_device *dev,
                         enum nl80211_iftype curr_iftype,
-                        enum nl80211_iftype type, u32 *flags,
+                        enum nl80211_iftype type,
                         struct vif_params *params)
 {
        struct mwifiex_private *priv;
@@ -1103,7 +1103,7 @@ mwifiex_change_vif_to_ap(struct net_device *dev,
 static int
 mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
                                     struct net_device *dev,
-                                    enum nl80211_iftype type, u32 *flags,
+                                    enum nl80211_iftype type,
                                     struct vif_params *params)
 {
        struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
@@ -1124,10 +1124,10 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
                case NL80211_IFTYPE_P2P_CLIENT:
                case NL80211_IFTYPE_P2P_GO:
                        return mwifiex_change_vif_to_p2p(dev, curr_iftype,
-                                                        type, flags, params);
+                                                        type, params);
                case NL80211_IFTYPE_AP:
                        return mwifiex_change_vif_to_ap(dev, curr_iftype, type,
-                                                       flags, params);
+                                                       params);
                case NL80211_IFTYPE_UNSPECIFIED:
                        mwifiex_dbg(priv->adapter, INFO,
                                    "%s: kept type as IBSS\n", dev->name);
@@ -1154,10 +1154,10 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
                case NL80211_IFTYPE_P2P_CLIENT:
                case NL80211_IFTYPE_P2P_GO:
                        return mwifiex_change_vif_to_p2p(dev, curr_iftype,
-                                                        type, flags, params);
+                                                        type, params);
                case NL80211_IFTYPE_AP:
                        return mwifiex_change_vif_to_ap(dev, curr_iftype, type,
-                                                       flags, params);
+                                                       params);
                case NL80211_IFTYPE_UNSPECIFIED:
                        mwifiex_dbg(priv->adapter, INFO,
                                    "%s: kept type as STA\n", dev->name);
@@ -1175,13 +1175,12 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
                case NL80211_IFTYPE_ADHOC:
                case NL80211_IFTYPE_STATION:
                        return mwifiex_change_vif_to_sta_adhoc(dev, curr_iftype,
-                                                              type, flags,
-                                                              params);
+                                                              type, params);
                        break;
                case NL80211_IFTYPE_P2P_CLIENT:
                case NL80211_IFTYPE_P2P_GO:
                        return mwifiex_change_vif_to_p2p(dev, curr_iftype,
-                                                        type, flags, params);
+                                                        type, params);
                case NL80211_IFTYPE_UNSPECIFIED:
                        mwifiex_dbg(priv->adapter, INFO,
                                    "%s: kept type as AP\n", dev->name);
@@ -1214,14 +1213,13 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
                        if (mwifiex_cfg80211_deinit_p2p(priv))
                                return -EFAULT;
                        return mwifiex_change_vif_to_sta_adhoc(dev, curr_iftype,
-                                                              type, flags,
-                                                              params);
+                                                              type, params);
                        break;
                case NL80211_IFTYPE_AP:
                        if (mwifiex_cfg80211_deinit_p2p(priv))
                                return -EFAULT;
                        return mwifiex_change_vif_to_ap(dev, curr_iftype, type,
-                                                       flags, params);
+                                                       params);
                case NL80211_IFTYPE_UNSPECIFIED:
                        mwifiex_dbg(priv->adapter, INFO,
                                    "%s: kept type as P2P\n", dev->name);
@@ -2822,7 +2820,6 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
                                              const char *name,
                                              unsigned char name_assign_type,
                                              enum nl80211_iftype type,
-                                             u32 *flags,
                                              struct vif_params *params)
 {
        struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy);
index 5ebca1d0cfc750969793c26ac5f37e858e897fc4..96b5fc5e53983cf8bf2681b9df0778eea84e137b 100644 (file)
@@ -593,7 +593,7 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context)
        rtnl_lock();
        /* Create station interface by default */
        wdev = mwifiex_add_virtual_intf(adapter->wiphy, "mlan%d", NET_NAME_ENUM,
-                                       NL80211_IFTYPE_STATION, NULL, NULL);
+                                       NL80211_IFTYPE_STATION, NULL);
        if (IS_ERR(wdev)) {
                mwifiex_dbg(adapter, ERROR,
                            "cannot create default STA interface\n");
@@ -603,7 +603,7 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context)
 
        if (driver_mode & MWIFIEX_DRIVER_MODE_UAP) {
                wdev = mwifiex_add_virtual_intf(adapter->wiphy, "uap%d", NET_NAME_ENUM,
-                                               NL80211_IFTYPE_AP, NULL, NULL);
+                                               NL80211_IFTYPE_AP, NULL);
                if (IS_ERR(wdev)) {
                        mwifiex_dbg(adapter, ERROR,
                                    "cannot create AP interface\n");
@@ -614,8 +614,7 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context)
 
        if (driver_mode & MWIFIEX_DRIVER_MODE_P2P) {
                wdev = mwifiex_add_virtual_intf(adapter->wiphy, "p2p%d", NET_NAME_ENUM,
-                                               NL80211_IFTYPE_P2P_CLIENT, NULL,
-                                               NULL);
+                                               NL80211_IFTYPE_P2P_CLIENT, NULL);
                if (IS_ERR(wdev)) {
                        mwifiex_dbg(adapter, ERROR,
                                    "cannot create p2p client interface\n");
index 5c8297207f339559461f43cee1dc9b0585a23042..bc19b0a3571fe4576a2bca1ad3cb1fdf83058f9c 100644 (file)
@@ -1529,7 +1529,6 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
                                              const char *name,
                                              unsigned char name_assign_type,
                                              enum nl80211_iftype type,
-                                             u32 *flags,
                                              struct vif_params *params);
 int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev);
 
index 785334f7a5386e82c32cd6fe41dee6d36b37b969..3495386482be70bde6274c0f9d075d48bcb17e97 100644 (file)
@@ -479,7 +479,7 @@ struct rndis_wlan_private {
  */
 static int rndis_change_virtual_intf(struct wiphy *wiphy,
                                        struct net_device *dev,
-                                       enum nl80211_iftype type, u32 *flags,
+                                       enum nl80211_iftype type,
                                        struct vif_params *params);
 
 static int rndis_scan(struct wiphy *wiphy,
@@ -1857,7 +1857,7 @@ error:
  */
 static int rndis_change_virtual_intf(struct wiphy *wiphy,
                                        struct net_device *dev,
-                                       enum nl80211_iftype type, u32 *flags,
+                                       enum nl80211_iftype type,
                                        struct vif_params *params)
 {
        struct rndis_wlan_private *priv = wiphy_priv(wiphy);
index 7961d1c56847392c6d977e065cab76f435ea31de..2b4536318ca62b6bb464c2c16dcde34b6540e0c0 100644 (file)
@@ -1837,7 +1837,7 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
 }
 
 static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
-                              enum nl80211_iftype type, u32 *flags, struct vif_params *params)
+                              enum nl80211_iftype type, struct vif_params *params)
 {
        struct wilc_priv *priv;
        struct wilc_vif *vif;
@@ -2099,7 +2099,6 @@ static struct wireless_dev *add_virtual_intf(struct wiphy *wiphy,
                                             const char *name,
                                             unsigned char name_assign_type,
                                             enum nl80211_iftype type,
-                                            u32 *flags,
                                             struct vif_params *params)
 {
        struct wilc_vif *vif;
index 11870cb3f2548e28df9018918bda3a72e6f1e2be..cbb3388a97560e06c4cece688b66f9861d652a83 100644 (file)
@@ -100,7 +100,7 @@ static int prism2_domibset_pstr32(struct wlandevice *wlandev,
 /* The interface functions, called by the cfg80211 layer */
 static int prism2_change_virtual_intf(struct wiphy *wiphy,
                                      struct net_device *dev,
-                                     enum nl80211_iftype type, u32 *flags,
+                                     enum nl80211_iftype type,
                                      struct vif_params *params)
 {
        struct wlandevice *wlandev = dev->ml_priv;
index ba9348ee5327aef5c00722d2fe75255554c7a6af..89fa4995ddca31be12ba5048d4fad6b5e60434ea 100644 (file)
@@ -363,6 +363,8 @@ static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
 
 /**
  * struct vif_params - describes virtual interface parameters
+ * @flags: monitor interface flags, unchanged if 0, otherwise
+ *     %MONITOR_FLAG_CHANGED will be set
  * @use_4addr: use 4-address frames
  * @macaddr: address to use for this virtual interface.
  *     If this parameter is set to zero address the driver may
@@ -376,6 +378,7 @@ static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
  *     MU-MIMO packets going to the specified station; %NULL if not changed
  */
 struct vif_params {
+       u32 flags;
        int use_4addr;
        u8 macaddr[ETH_ALEN];
        const u8 *vht_mumimo_groups;
@@ -1214,6 +1217,7 @@ static inline int cfg80211_get_station(struct net_device *dev,
  * Monitor interface configuration flags. Note that these must be the bits
  * according to the nl80211 flags.
  *
+ * @MONITOR_FLAG_CHANGED: set if the flags were changed
  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
  * @MONITOR_FLAG_CONTROL: pass control frames
@@ -1222,6 +1226,7 @@ static inline int cfg80211_get_station(struct net_device *dev,
  * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
  */
 enum monitor_flags {
+       MONITOR_FLAG_CHANGED            = 1<<__NL80211_MNTR_FLAG_INVALID,
        MONITOR_FLAG_FCSFAIL            = 1<<NL80211_MNTR_FLAG_FCSFAIL,
        MONITOR_FLAG_PLCPFAIL           = 1<<NL80211_MNTR_FLAG_PLCPFAIL,
        MONITOR_FLAG_CONTROL            = 1<<NL80211_MNTR_FLAG_CONTROL,
@@ -2869,13 +2874,12 @@ struct cfg80211_ops {
                                                  const char *name,
                                                  unsigned char name_assign_type,
                                                  enum nl80211_iftype type,
-                                                 u32 *flags,
                                                  struct vif_params *params);
        int     (*del_virtual_intf)(struct wiphy *wiphy,
                                    struct wireless_dev *wdev);
        int     (*change_virtual_intf)(struct wiphy *wiphy,
                                       struct net_device *dev,
-                                      enum nl80211_iftype type, u32 *flags,
+                                      enum nl80211_iftype type,
                                       struct vif_params *params);
 
        int     (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
index e276b8cb24a4f07949e7f8c15b4ee7dddd8fd35b..5c16d23e28ddff0a0c3262dc2432a67112506961 100644 (file)
@@ -69,7 +69,6 @@ static struct wireless_dev *ieee80211_add_iface(struct wiphy *wiphy,
                                                const char *name,
                                                unsigned char name_assign_type,
                                                enum nl80211_iftype type,
-                                               u32 *flags,
                                                struct vif_params *params)
 {
        struct ieee80211_local *local = wiphy_priv(wiphy);
@@ -90,8 +89,7 @@ static struct wireless_dev *ieee80211_add_iface(struct wiphy *wiphy,
                        return NULL;
                }
 
-               if (flags)
-                       sdata->u.mntr.flags = *flags;
+               sdata->u.mntr.flags = params->flags;
        }
 
        return wdev;
@@ -106,7 +104,7 @@ static int ieee80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev)
 
 static int ieee80211_change_iface(struct wiphy *wiphy,
                                  struct net_device *dev,
-                                 enum nl80211_iftype type, u32 *flags,
+                                 enum nl80211_iftype type,
                                  struct vif_params *params)
 {
        struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
@@ -133,7 +131,7 @@ static int ieee80211_change_iface(struct wiphy *wiphy,
                if (err)
                        return err;
 
-               if (!flags)
+               if (!params->flags)
                        return 0;
 
                if (ieee80211_sdata_running(sdata)) {
@@ -149,11 +147,12 @@ static int ieee80211_change_iface(struct wiphy *wiphy,
                         *      cooked_mntrs, monitor and all fif_* counters
                         *      reconfigure hardware
                         */
-                       if ((*flags & mask) != (sdata->u.mntr.flags & mask))
+                       if ((params->flags & mask) !=
+                           (sdata->u.mntr.flags & mask))
                                return -EBUSY;
 
                        ieee80211_adjust_monitor_flags(sdata, -1);
-                       sdata->u.mntr.flags = *flags;
+                       sdata->u.mntr.flags = params->flags;
                        ieee80211_adjust_monitor_flags(sdata, 1);
 
                        ieee80211_configure_filter(local);
@@ -163,7 +162,7 @@ static int ieee80211_change_iface(struct wiphy *wiphy,
                         * and ieee80211_do_open take care of "everything"
                         * mentioned in the comment above.
                         */
-                       sdata->u.mntr.flags = *flags;
+                       sdata->u.mntr.flags = params->flags;
                }
        }
 
index d614efb417261879b2f0b1feac3ec8e7462e3dd0..5d27eca57d3b611b5c82edc283915d0842c4b7d5 100644 (file)
@@ -430,7 +430,7 @@ int __cfg80211_stop_sched_scan(struct cfg80211_registered_device *rdev,
 void cfg80211_upload_connect_keys(struct wireless_dev *wdev);
 int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
                          struct net_device *dev, enum nl80211_iftype ntype,
-                         u32 *flags, struct vif_params *params);
+                         struct vif_params *params);
 void cfg80211_process_rdev_events(struct cfg80211_registered_device *rdev);
 void cfg80211_process_wdev_events(struct wireless_dev *wdev);
 
index 5cdb0f9b016836a0299effae63b6c81aa1112554..a07a55eda55be0f23ee4f2ca95e256da22144498 100644 (file)
@@ -2726,6 +2726,8 @@ static int parse_monitor_flags(struct nlattr *nla, u32 *mntrflags)
                if (flags[flag])
                        *mntrflags |= (1<<flag);
 
+       *mntrflags |= MONITOR_FLAG_CHANGED;
+
        return 0;
 }
 
@@ -2762,7 +2764,6 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
        int err;
        enum nl80211_iftype otype, ntype;
        struct net_device *dev = info->user_ptr[1];
-       u32 _flags, *flags = NULL;
        bool change = false;
 
        memset(&params, 0, sizeof(params));
@@ -2809,14 +2810,17 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
                if (ntype != NL80211_IFTYPE_MONITOR)
                        return -EINVAL;
                err = parse_monitor_flags(info->attrs[NL80211_ATTR_MNTR_FLAGS],
-                                         &_flags);
+                                         &params.flags);
                if (err)
                        return err;
 
-               flags = &_flags;
                change = true;
        }
 
+       if (params.flags & MONITOR_FLAG_ACTIVE &&
+           !(rdev->wiphy.features & NL80211_FEATURE_ACTIVE_MONITOR))
+               return -EOPNOTSUPP;
+
        if (info->attrs[NL80211_ATTR_MU_MIMO_GROUP_DATA]) {
                const u8 *mumimo_groups;
                u32 cap_flag = NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER;
@@ -2847,12 +2851,8 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
                change = true;
        }
 
-       if (flags && (*flags & MONITOR_FLAG_ACTIVE) &&
-           !(rdev->wiphy.features & NL80211_FEATURE_ACTIVE_MONITOR))
-               return -EOPNOTSUPP;
-
        if (change)
-               err = cfg80211_change_iface(rdev, dev, ntype, flags, &params);
+               err = cfg80211_change_iface(rdev, dev, ntype, &params);
        else
                err = 0;
 
@@ -2870,7 +2870,6 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)
        struct sk_buff *msg;
        int err;
        enum nl80211_iftype type = NL80211_IFTYPE_UNSPECIFIED;
-       u32 flags;
 
        /* to avoid failing a new interface creation due to pending removal */
        cfg80211_destroy_ifaces(rdev);
@@ -2906,11 +2905,17 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)
                        return err;
        }
 
-       err = parse_monitor_flags(type == NL80211_IFTYPE_MONITOR ?
-                                 info->attrs[NL80211_ATTR_MNTR_FLAGS] : NULL,
-                                 &flags);
+       if (info->attrs[NL80211_ATTR_MNTR_FLAGS]) {
+               if (type != NL80211_IFTYPE_MONITOR)
+                       return -EINVAL;
+
+               err = parse_monitor_flags(info->attrs[NL80211_ATTR_MNTR_FLAGS],
+                                         &params.flags);
+               if (err)
+                       return err;
+       }
 
-       if (!err && (flags & MONITOR_FLAG_ACTIVE) &&
+       if (params.flags & MONITOR_FLAG_ACTIVE &&
            !(rdev->wiphy.features & NL80211_FEATURE_ACTIVE_MONITOR))
                return -EOPNOTSUPP;
 
@@ -2920,8 +2925,7 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)
 
        wdev = rdev_add_virtual_intf(rdev,
                                nla_data(info->attrs[NL80211_ATTR_IFNAME]),
-                               NET_NAME_USER, type, err ? NULL : &flags,
-                               &params);
+                               NET_NAME_USER, type, &params);
        if (WARN_ON(!wdev)) {
                nlmsg_free(msg);
                return -EPROTO;
index f2baf592109114cecbe4c21d3cc28a102c06ef57..e4a99989dd060fb696b27f9c9b057654fb1838de 100644 (file)
@@ -36,13 +36,13 @@ static inline void rdev_set_wakeup(struct cfg80211_registered_device *rdev,
 static inline struct wireless_dev
 *rdev_add_virtual_intf(struct cfg80211_registered_device *rdev, char *name,
                       unsigned char name_assign_type,
-                      enum nl80211_iftype type, u32 *flags,
+                      enum nl80211_iftype type,
                       struct vif_params *params)
 {
        struct wireless_dev *ret;
        trace_rdev_add_virtual_intf(&rdev->wiphy, name, type);
        ret = rdev->ops->add_virtual_intf(&rdev->wiphy, name, name_assign_type,
-                                         type, flags, params);
+                                         type, params);
        trace_rdev_return_wdev(&rdev->wiphy, ret);
        return ret;
 }
@@ -61,12 +61,11 @@ rdev_del_virtual_intf(struct cfg80211_registered_device *rdev,
 static inline int
 rdev_change_virtual_intf(struct cfg80211_registered_device *rdev,
                         struct net_device *dev, enum nl80211_iftype type,
-                        u32 *flags, struct vif_params *params)
+                        struct vif_params *params)
 {
        int ret;
        trace_rdev_change_virtual_intf(&rdev->wiphy, dev, type);
-       ret = rdev->ops->change_virtual_intf(&rdev->wiphy, dev, type, flags,
-                                            params);
+       ret = rdev->ops->change_virtual_intf(&rdev->wiphy, dev, type, params);
        trace_rdev_return_int(&rdev->wiphy, ret);
        return ret;
 }
index 8d6a0a7b1ca1ca39cb64f611958855beebb39224..88f3a11dbcd334495087c312ed81cc0eac0b85b9 100644 (file)
@@ -985,7 +985,7 @@ void cfg80211_process_rdev_events(struct cfg80211_registered_device *rdev)
 
 int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
                          struct net_device *dev, enum nl80211_iftype ntype,
-                         u32 *flags, struct vif_params *params)
+                         struct vif_params *params)
 {
        int err;
        enum nl80211_iftype otype = dev->ieee80211_ptr->iftype;
@@ -1043,7 +1043,7 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
                cfg80211_process_rdev_events(rdev);
        }
 
-       err = rdev_change_virtual_intf(rdev, dev, ntype, flags, params);
+       err = rdev_change_virtual_intf(rdev, dev, ntype, params);
 
        WARN_ON(!err && dev->ieee80211_ptr->iftype != ntype);
 
index a220156cf2175a459727fcf67e1291036dca21ae..5d4a02c7979b0d7478ff2b39f82e24bed97a6e78 100644 (file)
@@ -62,7 +62,7 @@ int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
 
        memset(&vifparams, 0, sizeof(vifparams));
 
-       return cfg80211_change_iface(rdev, dev, type, NULL, &vifparams);
+       return cfg80211_change_iface(rdev, dev, type, &vifparams);
 }
 EXPORT_WEXT_HANDLER(cfg80211_wext_siwmode);