[HOSTAP]: set netdev type before registering AP interface
authorDaniel Drake <dsd@gentoo.org>
Wed, 26 Sep 2007 20:45:24 +0000 (21:45 +0100)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 10 Oct 2007 23:54:09 +0000 (16:54 -0700)
As detailed at https://bugs.gentoo.org/159646 hostap with hostapd confuses
udev by presenting 2 interfaces with the same MAC address. Also, at the time
of detection, the 'type' attribute is 1, identical to other hostap interfaces.

The AP interface is supposed to have type ARPHRD_IEEE80211 (801), but this is
not set until after registration.

Setting it before register_netdev() is called allows us to avoid this
confusion. We can do this by propogating the HOSTAP_INTERFACE type through
to hostap_setup_dev().

Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/wireless/hostap/hostap.h
drivers/net/wireless/hostap/hostap_hw.c
drivers/net/wireless/hostap/hostap_main.c

index 951df83702f9dfed6c8296f9c25e53d7b97f22cb..547ba84dc797a3155138b0a6e853957ff7d0509c 100644 (file)
@@ -34,7 +34,7 @@ extern const struct header_ops hostap_80211_ops;
 int hostap_80211_get_hdrlen(u16 fc);
 struct net_device_stats *hostap_get_stats(struct net_device *dev);
 void hostap_setup_dev(struct net_device *dev, local_info_t *local,
-                     int main_dev);
+                     int type);
 void hostap_set_multicast_list_queue(struct work_struct *work);
 int hostap_set_hostapd(local_info_t *local, int val, int rtnl_locked);
 int hostap_set_hostapd_sta(local_info_t *local, int val, int rtnl_locked);
index b20bb013d57ea79f3871cba185567b2eea4f550d..c592641e914e695d99aa1e408acae2501ca03496 100644 (file)
@@ -3257,7 +3257,7 @@ while (0)
 
        INIT_LIST_HEAD(&local->bss_list);
 
-       hostap_setup_dev(dev, local, 1);
+       hostap_setup_dev(dev, local, HOSTAP_INTERFACE_MASTER);
 
        dev->hard_start_xmit = hostap_master_start_xmit;
        dev->type = ARPHRD_IEEE80211;
index b75cf9205ce026902b2042b600c9d430b5ecdc3e..17c58e9bdad51178583f5d5844805e52f463415a 100644 (file)
@@ -73,7 +73,7 @@ struct net_device * hostap_add_interface(struct local_info *local,
        dev->mem_start = mdev->mem_start;
        dev->mem_end = mdev->mem_end;
 
-       hostap_setup_dev(dev, local, 0);
+       hostap_setup_dev(dev, local, type);
        dev->destructor = free_netdev;
 
        sprintf(dev->name, "%s%s", prefix, name);
@@ -857,7 +857,7 @@ const struct header_ops hostap_80211_ops = {
 EXPORT_SYMBOL(hostap_80211_ops);
 
 void hostap_setup_dev(struct net_device *dev, local_info_t *local,
-                     int main_dev)
+                     int type)
 {
        struct hostap_interface *iface;
 
@@ -877,15 +877,22 @@ void hostap_setup_dev(struct net_device *dev, local_info_t *local,
        dev->do_ioctl = hostap_ioctl;
        dev->open = prism2_open;
        dev->stop = prism2_close;
-       dev->hard_start_xmit = hostap_data_start_xmit;
        dev->set_mac_address = prism2_set_mac_address;
        dev->set_multicast_list = hostap_set_multicast_list;
        dev->change_mtu = prism2_change_mtu;
        dev->tx_timeout = prism2_tx_timeout;
        dev->watchdog_timeo = TX_TIMEOUT;
 
+       if (type == HOSTAP_INTERFACE_AP) {
+               dev->hard_start_xmit = hostap_mgmt_start_xmit;
+               dev->type = ARPHRD_IEEE80211;
+               dev->header_ops = &hostap_80211_ops;
+       } else {
+               dev->hard_start_xmit = hostap_data_start_xmit;
+       }
+
        dev->mtu = local->mtu;
-       if (!main_dev) {
+       if (type != HOSTAP_INTERFACE_MASTER) {
                /* use main radio device queue */
                dev->tx_queue_len = 0;
        }
@@ -910,10 +917,6 @@ static int hostap_enable_hostapd(local_info_t *local, int rtnl_locked)
        if (local->apdev == NULL)
                return -ENOMEM;
 
-       local->apdev->hard_start_xmit = hostap_mgmt_start_xmit;
-       local->apdev->type = ARPHRD_IEEE80211;
-       local->apdev->header_ops = &hostap_80211_ops;
-
        return 0;
 }