]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/bluetooth/bnep/core.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
[linux-2.6-omap-h63xx.git] / net / bluetooth / bnep / core.c
index 1f78c3e336d8cb460cfeb70ec5f7f053e20bddf7..12bba6207a8dca2719391bf1966072c9d3a107e3 100644 (file)
@@ -2,7 +2,7 @@
    BNEP implementation for Linux Bluetooth stack (BlueZ).
    Copyright (C) 2001-2002 Inventel Systemes
    Written 2001-2002 by
-       Clément Moreau <clement.moreau@inventel.fr>
+       Clément Moreau <clement.moreau@inventel.fr>
        David Libault  <david.libault@inventel.fr>
 
    Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com>
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- * $Id: core.c,v 1.20 2002/08/04 21:23:58 maxk Exp $
- */
-
 #include <linux/module.h>
 
 #include <linux/kernel.h>
 #define BT_DBG(D...)
 #endif
 
-#define VERSION "1.2"
+#define VERSION "1.3"
+
+static int compress_src = 1;
+static int compress_dst = 1;
 
 static LIST_HEAD(bnep_session_list);
 static DECLARE_RWSEM(bnep_session_sem);
@@ -135,7 +134,7 @@ static int bnep_ctrl_set_netfilter(struct bnep_session *s, __be16 *data, int len
        if (len < 2)
                return -EILSEQ;
 
-       n = ntohs(get_unaligned(data));
+       n = get_unaligned_be16(data);
        data++; len -= 2;
 
        if (len < n)
@@ -150,8 +149,8 @@ static int bnep_ctrl_set_netfilter(struct bnep_session *s, __be16 *data, int len
                int i;
 
                for (i = 0; i < n; i++) {
-                       f[i].start = ntohs(get_unaligned(data++));
-                       f[i].end   = ntohs(get_unaligned(data++));
+                       f[i].start = get_unaligned_be16(data++);
+                       f[i].end   = get_unaligned_be16(data++);
 
                        BT_DBG("proto filter start %d end %d",
                                f[i].start, f[i].end);
@@ -180,7 +179,7 @@ static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len)
        if (len < 2)
                return -EILSEQ;
 
-       n = ntohs(get_unaligned((__be16 *) data));
+       n = get_unaligned_be16(data);
        data += 2; len -= 2;
 
        if (len < n)
@@ -422,10 +421,10 @@ static inline int bnep_tx_frame(struct bnep_session *s, struct sk_buff *skb)
        iv[il++] = (struct kvec) { &type, 1 };
        len++;
 
-       if (!compare_ether_addr(eh->h_dest, s->eh.h_source))
+       if (compress_src && !compare_ether_addr(eh->h_dest, s->eh.h_source))
                type |= 0x01;
 
-       if (!compare_ether_addr(eh->h_source, s->eh.h_dest))
+       if (compress_dst && !compare_ether_addr(eh->h_source, s->eh.h_dest))
                type |= 0x02;
 
        if (type)
@@ -507,6 +506,11 @@ static int bnep_session(void *arg)
        /* Delete network device */
        unregister_netdev(dev);
 
+       /* Wakeup user-space polling for socket errors */
+       s->sock->sk->sk_err = EUNATCH;
+
+       wake_up_interruptible(s->sock->sk->sk_sleep);
+
        /* Release the socket */
        fput(s->sock->file);
 
@@ -726,6 +730,12 @@ static void __exit bnep_exit(void)
 module_init(bnep_init);
 module_exit(bnep_exit);
 
+module_param(compress_src, bool, 0644);
+MODULE_PARM_DESC(compress_src, "Compress sources headers");
+
+module_param(compress_dst, bool, 0644);
+MODULE_PARM_DESC(compress_dst, "Compress destination headers");
+
 MODULE_AUTHOR("David Libault <david.libault@inventel.fr>, Maxim Krasnyansky <maxk@qualcomm.com>");
 MODULE_DESCRIPTION("Bluetooth BNEP ver " VERSION);
 MODULE_VERSION(VERSION);