Bluetooth: make bluetooth 6lowpan as an option
authorAlexander Aring <alex.aring@gmail.com>
Tue, 4 Mar 2014 09:23:02 +0000 (10:23 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 11 Mar 2014 14:54:55 +0000 (07:54 -0700)
Currently you can have bluetooth 6lowpan without ipv6 enabled. This
doesn't make any sense. With this patch you can disable/enable bluetooth
6lowpan support at compile time.

The current bluetooth 6lowpan implementation doesn't check the return
value of 6lowpan function. Nevertheless I added -EOPNOTSUPP as return value
if 6lowpan bluetooth is disabled.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/6lowpan.h
net/bluetooth/Kconfig
net/bluetooth/Makefile

index 680eac808d74935b1d6c7c89c8294e8cf42a58e7..5d281f1eaf55d82117ab908928f2277df25f9714 100644 (file)
 #ifndef __6LOWPAN_H
 #define __6LOWPAN_H
 
+#include <linux/errno.h>
 #include <linux/skbuff.h>
 #include <net/bluetooth/l2cap.h>
 
+#if IS_ENABLED(CONFIG_BT_6LOWPAN)
 int bt_6lowpan_recv(struct l2cap_conn *conn, struct sk_buff *skb);
 int bt_6lowpan_add_conn(struct l2cap_conn *conn);
 int bt_6lowpan_del_conn(struct l2cap_conn *conn);
 int bt_6lowpan_init(void);
 void bt_6lowpan_cleanup(void);
+#else
+static int bt_6lowpan_recv(struct l2cap_conn *conn, struct sk_buff *skb)
+{
+       return -EOPNOTSUPP;
+}
+static int bt_6lowpan_add_conn(struct l2cap_conn *conn)
+{
+       return -EOPNOTSUPP;
+}
+int bt_6lowpan_del_conn(struct l2cap_conn *conn)
+{
+       return -EOPNOTSUPP;
+}
+static int bt_6lowpan_init(void)
+{
+       return -EOPNOTSUPP;
+}
+static void bt_6lowpan_cleanup(void) { }
+#endif
 
 #endif /* __6LOWPAN_H */
index 985b56070d2608c0e24965aa0c77d7b24498509a..10c752f18feb8142ce0fea84a2d4d520ab9a256c 100644 (file)
@@ -12,7 +12,6 @@ menuconfig BT
        select CRYPTO_AES
        select CRYPTO_ECB
        select CRYPTO_SHA256
-       select 6LOWPAN_IPHC
        help
          Bluetooth is low-cost, low-power, short-range wireless technology.
          It was designed as a replacement for cables and other short-range
@@ -40,6 +39,13 @@ menuconfig BT
          to Bluetooth kernel modules are provided in the BlueZ packages.  For
          more information, see <http://www.bluez.org/>.
 
+config BT_6LOWPAN
+       bool "Bluetooth 6LoWPAN support"
+       depends on BT && IPV6
+       select 6LOWPAN_IPHC
+       help
+         IPv6 compression over Bluetooth.
+
 source "net/bluetooth/rfcomm/Kconfig"
 
 source "net/bluetooth/bnep/Kconfig"
index 80cb215826e878b7f9bc306bd02f38e243bf1e4a..ca51246b1016f2496a53220256385f8072c5b360 100644 (file)
@@ -10,6 +10,7 @@ obj-$(CONFIG_BT_HIDP) += hidp/
 
 bluetooth-y := af_bluetooth.o hci_core.o hci_conn.o hci_event.o mgmt.o \
        hci_sock.o hci_sysfs.o l2cap_core.o l2cap_sock.o smp.o sco.o lib.o \
-       a2mp.o amp.o 6lowpan.o
+       a2mp.o amp.o
+bluetooth-$(CONFIG_BT_6LOWPAN) += 6lowpan.o
 
 subdir-ccflags-y += -D__CHECK_ENDIAN__
This page took 0.025723 seconds and 5 git commands to generate.