wireless: correctly report signal value for IEEE80211_HW_SIGNAL_UNSPEC
[safe/jmp/linux-2.6] / net / llc / llc_core.c
index 9ccff12..ff4c0ab 100644 (file)
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/init.h>
+#include <net/net_namespace.h>
 #include <net/llc.h>
 
 LIST_HEAD(llc_sap_list);
 DEFINE_RWLOCK(llc_sap_list_lock);
 
-unsigned char llc_station_mac_sa[ETH_ALEN];
-
 /**
  *     llc_sap_alloc - allocates and initializes sap.
  *
@@ -33,12 +32,11 @@ unsigned char llc_station_mac_sa[ETH_ALEN];
  */
 static struct llc_sap *llc_sap_alloc(void)
 {
-       struct llc_sap *sap = kmalloc(sizeof(*sap), GFP_ATOMIC);
+       struct llc_sap *sap = kzalloc(sizeof(*sap), GFP_ATOMIC);
 
        if (sap) {
-               memset(sap, 0, sizeof(*sap));
+               /* sap->laddr.mac - leave as a null, it's filled by bind */
                sap->state = LLC_SAP_STATE_ACTIVE;
-               memcpy(sap->laddr.mac, llc_station_mac_sa, ETH_ALEN);
                rwlock_init(&sap->sk_list.lock);
                atomic_set(&sap->refcnt, 1);
        }
@@ -69,7 +67,7 @@ static void llc_del_sap(struct llc_sap *sap)
        write_unlock_bh(&llc_sap_list_lock);
 }
 
-struct llc_sap *__llc_sap_find(unsigned char sap_value)
+static struct llc_sap *__llc_sap_find(unsigned char sap_value)
 {
        struct llc_sap* sap;
 
@@ -127,7 +125,6 @@ struct llc_sap *llc_sap_open(unsigned char lsap,
                goto out;
        sap->laddr.lsap = lsap;
        sap->rcv_func   = func;
-       llc_sap_hold(sap);
        llc_add_sap(sap);
 out:
        write_unlock_bh(&llc_sap_list_lock);
@@ -150,22 +147,24 @@ void llc_sap_close(struct llc_sap *sap)
        kfree(sap);
 }
 
-static struct packet_type llc_packet_type = {
-       .type = __constant_htons(ETH_P_802_2),
+static struct packet_type llc_packet_type __read_mostly = {
+       .type = cpu_to_be16(ETH_P_802_2),
        .func = llc_rcv,
 };
 
-static struct packet_type llc_tr_packet_type = {
-       .type = __constant_htons(ETH_P_TR_802_2),
+static struct packet_type llc_tr_packet_type __read_mostly = {
+       .type = cpu_to_be16(ETH_P_TR_802_2),
        .func = llc_rcv,
 };
 
 static int __init llc_init(void)
 {
-       if (dev_base->next)
-               memcpy(llc_station_mac_sa, dev_base->next->dev_addr, ETH_ALEN);
-       else
-               memset(llc_station_mac_sa, 0, ETH_ALEN);
+       struct net_device *dev;
+
+       dev = first_net_device(&init_net);
+       if (dev != NULL)
+               dev = next_net_device(dev);
+
        dev_add_pack(&llc_packet_type);
        dev_add_pack(&llc_tr_packet_type);
        return 0;
@@ -180,7 +179,6 @@ static void __exit llc_exit(void)
 module_init(llc_init);
 module_exit(llc_exit);
 
-EXPORT_SYMBOL(llc_station_mac_sa);
 EXPORT_SYMBOL(llc_sap_list);
 EXPORT_SYMBOL(llc_sap_list_lock);
 EXPORT_SYMBOL(llc_sap_find);