aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2014-03-04 04:23:02 -0500
committerMarcel Holtmann <marcel@holtmann.org>2014-03-11 10:54:55 -0400
commit97550887973d04e344f5ccee392d7650d01f8f69 (patch)
treeda75e61a559df920add47dce114d2270c1d2dbb7
parent53ac6ab612456a13bf0f6bad89c1503616e4de3b (diff)
Bluetooth: make bluetooth 6lowpan as an option
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>
-rw-r--r--net/bluetooth/6lowpan.h21
-rw-r--r--net/bluetooth/Kconfig8
-rw-r--r--net/bluetooth/Makefile3
3 files changed, 30 insertions, 2 deletions
diff --git a/net/bluetooth/6lowpan.h b/net/bluetooth/6lowpan.h
index 680eac808d74..5d281f1eaf55 100644
--- a/net/bluetooth/6lowpan.h
+++ b/net/bluetooth/6lowpan.h
@@ -14,13 +14,34 @@
14#ifndef __6LOWPAN_H 14#ifndef __6LOWPAN_H
15#define __6LOWPAN_H 15#define __6LOWPAN_H
16 16
17#include <linux/errno.h>
17#include <linux/skbuff.h> 18#include <linux/skbuff.h>
18#include <net/bluetooth/l2cap.h> 19#include <net/bluetooth/l2cap.h>
19 20
21#if IS_ENABLED(CONFIG_BT_6LOWPAN)
20int bt_6lowpan_recv(struct l2cap_conn *conn, struct sk_buff *skb); 22int bt_6lowpan_recv(struct l2cap_conn *conn, struct sk_buff *skb);
21int bt_6lowpan_add_conn(struct l2cap_conn *conn); 23int bt_6lowpan_add_conn(struct l2cap_conn *conn);
22int bt_6lowpan_del_conn(struct l2cap_conn *conn); 24int bt_6lowpan_del_conn(struct l2cap_conn *conn);
23int bt_6lowpan_init(void); 25int bt_6lowpan_init(void);
24void bt_6lowpan_cleanup(void); 26void bt_6lowpan_cleanup(void);
27#else
28static int bt_6lowpan_recv(struct l2cap_conn *conn, struct sk_buff *skb)
29{
30 return -EOPNOTSUPP;
31}
32static int bt_6lowpan_add_conn(struct l2cap_conn *conn)
33{
34 return -EOPNOTSUPP;
35}
36int bt_6lowpan_del_conn(struct l2cap_conn *conn)
37{
38 return -EOPNOTSUPP;
39}
40static int bt_6lowpan_init(void)
41{
42 return -EOPNOTSUPP;
43}
44static void bt_6lowpan_cleanup(void) { }
45#endif
25 46
26#endif /* __6LOWPAN_H */ 47#endif /* __6LOWPAN_H */
diff --git a/net/bluetooth/Kconfig b/net/bluetooth/Kconfig
index 985b56070d26..10c752f18feb 100644
--- a/net/bluetooth/Kconfig
+++ b/net/bluetooth/Kconfig
@@ -12,7 +12,6 @@ menuconfig BT
12 select CRYPTO_AES 12 select CRYPTO_AES
13 select CRYPTO_ECB 13 select CRYPTO_ECB
14 select CRYPTO_SHA256 14 select CRYPTO_SHA256
15 select 6LOWPAN_IPHC
16 help 15 help
17 Bluetooth is low-cost, low-power, short-range wireless technology. 16 Bluetooth is low-cost, low-power, short-range wireless technology.
18 It was designed as a replacement for cables and other short-range 17 It was designed as a replacement for cables and other short-range
@@ -40,6 +39,13 @@ menuconfig BT
40 to Bluetooth kernel modules are provided in the BlueZ packages. For 39 to Bluetooth kernel modules are provided in the BlueZ packages. For
41 more information, see <http://www.bluez.org/>. 40 more information, see <http://www.bluez.org/>.
42 41
42config BT_6LOWPAN
43 bool "Bluetooth 6LoWPAN support"
44 depends on BT && IPV6
45 select 6LOWPAN_IPHC
46 help
47 IPv6 compression over Bluetooth.
48
43source "net/bluetooth/rfcomm/Kconfig" 49source "net/bluetooth/rfcomm/Kconfig"
44 50
45source "net/bluetooth/bnep/Kconfig" 51source "net/bluetooth/bnep/Kconfig"
diff --git a/net/bluetooth/Makefile b/net/bluetooth/Makefile
index 80cb215826e8..ca51246b1016 100644
--- a/net/bluetooth/Makefile
+++ b/net/bluetooth/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_BT_HIDP) += hidp/
10 10
11bluetooth-y := af_bluetooth.o hci_core.o hci_conn.o hci_event.o mgmt.o \ 11bluetooth-y := af_bluetooth.o hci_core.o hci_conn.o hci_event.o mgmt.o \
12 hci_sock.o hci_sysfs.o l2cap_core.o l2cap_sock.o smp.o sco.o lib.o \ 12 hci_sock.o hci_sysfs.o l2cap_core.o l2cap_sock.o smp.o sco.o lib.o \
13 a2mp.o amp.o 6lowpan.o 13 a2mp.o amp.o
14bluetooth-$(CONFIG_BT_6LOWPAN) += 6lowpan.o
14 15
15subdir-ccflags-y += -D__CHECK_ENDIAN__ 16subdir-ccflags-y += -D__CHECK_ENDIAN__