diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-09-16 08:18:59 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-09-24 16:18:00 -0400 |
commit | 133b822638ff01eb1e32e1917b197c40ed095ddd (patch) | |
tree | 8b96f00426728f3c05ba05f387240f0279512a75 /net/mac80211/main.c | |
parent | 9e5e6c327defcef19dabad64335ee68bb55b2355 (diff) |
mac80211: make master iface not wireless
There's no need to register the master netdev with cfg80211,
in fact, this is quite dangerous and lead to having to add
checks for the master interface all over the config handlers.
This patch removes the "ieee80211_ptr" from the master iface
in favour of having a small netdev_priv() associated with
the master interface that stores the ieee80211_local pointer.
Because of this, a lot of code in the configuration handlers
can go away. To make this patch easier to verify I have also
removed a number of wiphy_priv() calls in favour of getting
the sdata first and then the local pointer from that.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/main.c')
-rw-r--r-- | net/mac80211/main.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index c307dba7ec03..7d2d5a041e26 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -106,7 +106,8 @@ static const struct header_ops ieee80211_header_ops = { | |||
106 | 106 | ||
107 | static int ieee80211_master_open(struct net_device *dev) | 107 | static int ieee80211_master_open(struct net_device *dev) |
108 | { | 108 | { |
109 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 109 | struct ieee80211_master_priv *mpriv = netdev_priv(dev); |
110 | struct ieee80211_local *local = mpriv->local; | ||
110 | struct ieee80211_sub_if_data *sdata; | 111 | struct ieee80211_sub_if_data *sdata; |
111 | int res = -EOPNOTSUPP; | 112 | int res = -EOPNOTSUPP; |
112 | 113 | ||
@@ -128,7 +129,8 @@ static int ieee80211_master_open(struct net_device *dev) | |||
128 | 129 | ||
129 | static int ieee80211_master_stop(struct net_device *dev) | 130 | static int ieee80211_master_stop(struct net_device *dev) |
130 | { | 131 | { |
131 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 132 | struct ieee80211_master_priv *mpriv = netdev_priv(dev); |
133 | struct ieee80211_local *local = mpriv->local; | ||
132 | struct ieee80211_sub_if_data *sdata; | 134 | struct ieee80211_sub_if_data *sdata; |
133 | 135 | ||
134 | /* we hold the RTNL here so can safely walk the list */ | 136 | /* we hold the RTNL here so can safely walk the list */ |
@@ -141,7 +143,8 @@ static int ieee80211_master_stop(struct net_device *dev) | |||
141 | 143 | ||
142 | static void ieee80211_master_set_multicast_list(struct net_device *dev) | 144 | static void ieee80211_master_set_multicast_list(struct net_device *dev) |
143 | { | 145 | { |
144 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 146 | struct ieee80211_master_priv *mpriv = netdev_priv(dev); |
147 | struct ieee80211_local *local = mpriv->local; | ||
145 | 148 | ||
146 | ieee80211_configure_filter(local); | 149 | ieee80211_configure_filter(local); |
147 | } | 150 | } |
@@ -787,7 +790,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
787 | int result; | 790 | int result; |
788 | enum ieee80211_band band; | 791 | enum ieee80211_band band; |
789 | struct net_device *mdev; | 792 | struct net_device *mdev; |
790 | struct wireless_dev *mwdev; | 793 | struct ieee80211_master_priv *mpriv; |
791 | 794 | ||
792 | /* | 795 | /* |
793 | * generic code guarantees at least one band, | 796 | * generic code guarantees at least one band, |
@@ -829,16 +832,14 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
829 | if (hw->queues < 4) | 832 | if (hw->queues < 4) |
830 | hw->ampdu_queues = 0; | 833 | hw->ampdu_queues = 0; |
831 | 834 | ||
832 | mdev = alloc_netdev_mq(sizeof(struct wireless_dev), | 835 | mdev = alloc_netdev_mq(sizeof(struct ieee80211_master_priv), |
833 | "wmaster%d", ether_setup, | 836 | "wmaster%d", ether_setup, |
834 | ieee80211_num_queues(hw)); | 837 | ieee80211_num_queues(hw)); |
835 | if (!mdev) | 838 | if (!mdev) |
836 | goto fail_mdev_alloc; | 839 | goto fail_mdev_alloc; |
837 | 840 | ||
838 | mwdev = netdev_priv(mdev); | 841 | mpriv = netdev_priv(mdev); |
839 | mdev->ieee80211_ptr = mwdev; | 842 | mpriv->local = local; |
840 | mwdev->wiphy = local->hw.wiphy; | ||
841 | |||
842 | local->mdev = mdev; | 843 | local->mdev = mdev; |
843 | 844 | ||
844 | ieee80211_rx_bss_list_init(local); | 845 | ieee80211_rx_bss_list_init(local); |