cfg80211: unify sending NL80211_CMD_NEW_INTERFACE
authorJohannes Berg <johannes.berg@intel.com>
Mon, 1 Oct 2018 12:18:31 +0000 (14:18 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 2 Oct 2018 07:58:57 +0000 (09:58 +0200)
There isn't really any need for us to be sending this from
two different places - move cfg80211_init_wdev() later and
send the notification from there, removing it from the non-
netdev case.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/core.c
net/wireless/nl80211.c

index ba6363db1f31c02b6580b82c794c2003bc7af42a..5bd01058b9e6af605f42d7328ba46a652dc827da 100644 (file)
@@ -1186,6 +1186,8 @@ void cfg80211_init_wdev(struct cfg80211_registered_device *rdev,
                wdev->identifier = ++rdev->wdev_id;
        list_add_rcu(&wdev->list, &rdev->wiphy.wdev_list);
        rdev->devlist_generation++;
+
+       nl80211_notify_iface(rdev, wdev, NL80211_CMD_NEW_INTERFACE);
 }
 
 static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
@@ -1213,7 +1215,6 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
                 * called within code protected by it when interfaces
                 * are added with nl80211.
                 */
-               cfg80211_init_wdev(rdev, wdev);
                /* can only change netns with wiphy */
                dev->features |= NETIF_F_NETNS_LOCAL;
 
@@ -1242,7 +1243,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
 
                INIT_WORK(&wdev->disconnect_wk, cfg80211_autodisconnect_wk);
 
-               nl80211_notify_iface(rdev, wdev, NL80211_CMD_NEW_INTERFACE);
+               cfg80211_init_wdev(rdev, wdev);
                break;
        case NETDEV_GOING_DOWN:
                cfg80211_leave(rdev, wdev);
index 35ee15c26027387ebd2177df587cb42706d72675..b0a5ce8dbb5c144a66db6e460561ccb443f62676 100644 (file)
@@ -3295,15 +3295,6 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)
                return -ENOBUFS;
        }
 
-       /*
-        * For wdevs which have no associated netdev object (e.g. of type
-        * NL80211_IFTYPE_P2P_DEVICE), emit the NEW_INTERFACE event here.
-        * For all other types, the event will be generated from the
-        * netdev notifier
-        */
-       if (!wdev->netdev)
-               nl80211_notify_iface(rdev, wdev, NL80211_CMD_NEW_INTERFACE);
-
        return genlmsg_reply(msg, info);
 }