[Bluetooth] Add parameters to control BNEP header compression
authorMarcel Holtmann <marcel@holtmann.org>
Thu, 7 Aug 2008 20:26:54 +0000 (22:26 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 7 Aug 2008 20:26:54 +0000 (22:26 +0200)
The Bluetooth qualification for PAN demands testing with BNEP header
compression disabled. This is actually pretty stupid and the Linux
implementation outsmarts the test system since it compresses whenever
possible. So to pass qualification two need parameters have been added
to control the compression of source and destination headers.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/bnep/core.c

index 021172c..12bba62 100644 (file)
 #define BT_DBG(D...)
 #endif
 
 #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);
 
 static LIST_HEAD(bnep_session_list);
 static DECLARE_RWSEM(bnep_session_sem);
@@ -418,10 +421,10 @@ static inline int bnep_tx_frame(struct bnep_session *s, struct sk_buff *skb)
        iv[il++] = (struct kvec) { &type, 1 };
        len++;
 
        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;
 
                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)
                type |= 0x02;
 
        if (type)
@@ -727,6 +730,12 @@ static void __exit bnep_exit(void)
 module_init(bnep_init);
 module_exit(bnep_exit);
 
 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);
 MODULE_AUTHOR("David Libault <david.libault@inventel.fr>, Maxim Krasnyansky <maxk@qualcomm.com>");
 MODULE_DESCRIPTION("Bluetooth BNEP ver " VERSION);
 MODULE_VERSION(VERSION);