aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakanori Watanabe <takawata@FreeBSD.org>2015-04-07 16:48:23 +0000
committerTakanori Watanabe <takawata@FreeBSD.org>2015-04-07 16:48:23 +0000
commit8d6f425ddd8021ae2257ba9682f8844254ecdde1 (patch)
tree3407105e73d99b25919959b8ea59bc192c2c9f36
parent212236608c8e01c8e4c65053539714d897e1482b (diff)
downloadsrc-8d6f425ddd8021ae2257ba9682f8844254ecdde1.tar.gz
src-8d6f425ddd8021ae2257ba9682f8844254ecdde1.zip
Check l2cap socket initialisation and define L2CAP_SOCKET_CHECKED
This will fix build.
Notes
Notes: svn path=/head/; revision=281210
-rw-r--r--lib/libbluetooth/bluetooth.c2
-rw-r--r--lib/libbluetooth/dev.c1
-rw-r--r--lib/libbluetooth/hci.c1
-rw-r--r--lib/libsdp/search.c1
-rw-r--r--lib/libsdp/service.c1
-rw-r--r--lib/libsdp/session.c5
-rw-r--r--lib/libsdp/util.c1
-rw-r--r--usr.bin/bluetooth/bthost/bthost.c1
-rw-r--r--usr.bin/bluetooth/btsockstat/btsockstat.c1
-rw-r--r--usr.bin/bluetooth/rfcomm_sppd/rfcomm_sdp.c2
-rw-r--r--usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c1
-rw-r--r--usr.sbin/bluetooth/bthidcontrol/bthidcontrol.c1
-rw-r--r--usr.sbin/bluetooth/bthidcontrol/hid.c1
-rw-r--r--usr.sbin/bluetooth/bthidcontrol/sdp.c1
-rw-r--r--usr.sbin/bluetooth/bthidd/bthidd.c1
-rw-r--r--usr.sbin/bluetooth/bthidd/client.c5
-rw-r--r--usr.sbin/bluetooth/bthidd/hid.c1
-rw-r--r--usr.sbin/bluetooth/bthidd/kbd.c1
-rw-r--r--usr.sbin/bluetooth/bthidd/lexer.l2
-rw-r--r--usr.sbin/bluetooth/bthidd/parser.y1
-rw-r--r--usr.sbin/bluetooth/bthidd/server.c5
-rw-r--r--usr.sbin/bluetooth/bthidd/session.c1
-rw-r--r--usr.sbin/bluetooth/btpand/bnep.c1
-rw-r--r--usr.sbin/bluetooth/btpand/btpand.c1
-rw-r--r--usr.sbin/bluetooth/btpand/channel.c2
-rw-r--r--usr.sbin/bluetooth/btpand/client.c4
-rw-r--r--usr.sbin/bluetooth/btpand/event.c1
-rw-r--r--usr.sbin/bluetooth/btpand/packet.c1
-rw-r--r--usr.sbin/bluetooth/btpand/sdp.c1
-rw-r--r--usr.sbin/bluetooth/btpand/server.c4
-rw-r--r--usr.sbin/bluetooth/btpand/tap.c1
-rw-r--r--usr.sbin/bluetooth/hccontrol/hccontrol.c1
-rw-r--r--usr.sbin/bluetooth/hccontrol/host_controller_baseband.c1
-rw-r--r--usr.sbin/bluetooth/hccontrol/info.c1
-rw-r--r--usr.sbin/bluetooth/hccontrol/link_control.c1
-rw-r--r--usr.sbin/bluetooth/hccontrol/link_policy.c1
-rw-r--r--usr.sbin/bluetooth/hccontrol/node.c1
-rw-r--r--usr.sbin/bluetooth/hccontrol/util.c1
-rw-r--r--usr.sbin/bluetooth/hcsecd/hcsecd.c1
-rw-r--r--usr.sbin/bluetooth/hcsecd/parser.y1
-rw-r--r--usr.sbin/bluetooth/l2control/l2cap.c1
-rw-r--r--usr.sbin/bluetooth/l2control/l2control.c1
-rw-r--r--usr.sbin/bluetooth/l2ping/l2ping.c1
-rw-r--r--usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c2
-rw-r--r--usr.sbin/bluetooth/sdpcontrol/sdpcontrol.c1
-rw-r--r--usr.sbin/bluetooth/sdpcontrol/search.c1
-rw-r--r--usr.sbin/bluetooth/sdpd/bgd.c2
-rw-r--r--usr.sbin/bluetooth/sdpd/dun.c1
-rw-r--r--usr.sbin/bluetooth/sdpd/ftrn.c1
-rw-r--r--usr.sbin/bluetooth/sdpd/gn.c1
-rw-r--r--usr.sbin/bluetooth/sdpd/irmc.c1
-rw-r--r--usr.sbin/bluetooth/sdpd/irmc_command.c1
-rw-r--r--usr.sbin/bluetooth/sdpd/lan.c1
-rw-r--r--usr.sbin/bluetooth/sdpd/main.c1
-rw-r--r--usr.sbin/bluetooth/sdpd/nap.c1
-rw-r--r--usr.sbin/bluetooth/sdpd/opush.c1
-rw-r--r--usr.sbin/bluetooth/sdpd/panu.c1
-rw-r--r--usr.sbin/bluetooth/sdpd/profile.c1
-rw-r--r--usr.sbin/bluetooth/sdpd/provider.c1
-rw-r--r--usr.sbin/bluetooth/sdpd/sar.c1
-rw-r--r--usr.sbin/bluetooth/sdpd/scr.c1
-rw-r--r--usr.sbin/bluetooth/sdpd/sd.c1
-rw-r--r--usr.sbin/bluetooth/sdpd/server.c1
-rw-r--r--usr.sbin/bluetooth/sdpd/sp.c1
-rw-r--r--usr.sbin/bluetooth/sdpd/srr.c1
-rw-r--r--usr.sbin/bluetooth/sdpd/ssar.c1
-rw-r--r--usr.sbin/bluetooth/sdpd/ssr.c1
-rw-r--r--usr.sbin/bluetooth/sdpd/sur.c1
-rw-r--r--usr.sbin/bluetooth/sdpd/uuid.c2
69 files changed, 84 insertions, 10 deletions
diff --git a/lib/libbluetooth/bluetooth.c b/lib/libbluetooth/bluetooth.c
index 23b7df0da970..bbcf0071cfe0 100644
--- a/lib/libbluetooth/bluetooth.c
+++ b/lib/libbluetooth/bluetooth.c
@@ -30,7 +30,7 @@
* $Id: bluetooth.c,v 1.3 2003/05/20 23:04:30 max Exp $
* $FreeBSD$
*/
-
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/libbluetooth/dev.c b/lib/libbluetooth/dev.c
index 1f9e745dd46a..a6295dd2b1f0 100644
--- a/lib/libbluetooth/dev.c
+++ b/lib/libbluetooth/dev.c
@@ -30,6 +30,7 @@
* $FreeBSD$
*/
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <stdio.h>
#include <string.h>
diff --git a/lib/libbluetooth/hci.c b/lib/libbluetooth/hci.c
index 1ae6ff963d7b..651c0dda1fe7 100644
--- a/lib/libbluetooth/hci.c
+++ b/lib/libbluetooth/hci.c
@@ -31,6 +31,7 @@
*/
#include <assert.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <inttypes.h>
#include <stdio.h>
diff --git a/lib/libsdp/search.c b/lib/libsdp/search.c
index 868fbe562ffe..fa2a92d05a61 100644
--- a/lib/libsdp/search.c
+++ b/lib/libsdp/search.c
@@ -32,6 +32,7 @@
#include <sys/uio.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <errno.h>
#include <stdio.h>
diff --git a/lib/libsdp/service.c b/lib/libsdp/service.c
index 2667966c7822..53c8909bb2f3 100644
--- a/lib/libsdp/service.c
+++ b/lib/libsdp/service.c
@@ -32,6 +32,7 @@
#include <sys/uio.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <errno.h>
#include <string.h>
diff --git a/lib/libsdp/session.c b/lib/libsdp/session.c
index a31f3278dc0f..a74ce5fea359 100644
--- a/lib/libsdp/session.c
+++ b/lib/libsdp/session.c
@@ -28,7 +28,7 @@
* $Id: session.c,v 1.2 2003/09/04 22:12:13 max Exp $
* $FreeBSD$
*/
-
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <errno.h>
#include <stdlib.h>
@@ -62,6 +62,9 @@ sdp_open(bdaddr_t const *l, bdaddr_t const *r)
sa.l2cap_len = sizeof(sa);
sa.l2cap_family = AF_BLUETOOTH;
sa.l2cap_psm = 0;
+ sa.l2cap_cid = 0;
+ sa.l2cap_bdaddr_type = BDADDR_BREDR;
+
memcpy(&sa.l2cap_bdaddr, l, sizeof(sa.l2cap_bdaddr));
if (bind(ss->s, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
ss->error = errno;
diff --git a/lib/libsdp/util.c b/lib/libsdp/util.c
index b996bd22160d..5ef4a1dfd376 100644
--- a/lib/libsdp/util.c
+++ b/lib/libsdp/util.c
@@ -30,6 +30,7 @@
*/
#include <netinet/in.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <stdio.h>
#include <sdp.h>
diff --git a/usr.bin/bluetooth/bthost/bthost.c b/usr.bin/bluetooth/bthost/bthost.c
index 2dd56359fbaf..69ce3f57f018 100644
--- a/usr.bin/bluetooth/bthost/bthost.c
+++ b/usr.bin/bluetooth/bthost/bthost.c
@@ -29,6 +29,7 @@
* $FreeBSD$
*/
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/usr.bin/bluetooth/btsockstat/btsockstat.c b/usr.bin/bluetooth/btsockstat/btsockstat.c
index a9c93542cfb8..aa85286ee9d1 100644
--- a/usr.bin/bluetooth/btsockstat/btsockstat.c
+++ b/usr.bin/bluetooth/btsockstat/btsockstat.c
@@ -39,6 +39,7 @@
#include <net/if.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <err.h>
#include <fcntl.h>
diff --git a/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sdp.c b/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sdp.c
index 587307153333..239597dc755d 100644
--- a/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sdp.c
+++ b/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sdp.c
@@ -28,7 +28,7 @@
* $Id: rfcomm_sdp.c,v 1.1 2003/09/07 18:15:55 max Exp $
* $FreeBSD$
*/
-
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <errno.h>
#include <sdp.h>
diff --git a/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c b/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c
index ab6e1a77e8c7..309bab93ac21 100644
--- a/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c
+++ b/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c
@@ -33,6 +33,7 @@
#include <sys/stat.h>
#include <sys/types.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <ctype.h>
#include <err.h>
diff --git a/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.c b/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.c
index 900bda5d559b..0f795dd5b159 100644
--- a/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.c
+++ b/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.c
@@ -31,6 +31,7 @@
#include <sys/queue.h>
#include <assert.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <err.h>
#include <errno.h>
diff --git a/usr.sbin/bluetooth/bthidcontrol/hid.c b/usr.sbin/bluetooth/bthidcontrol/hid.c
index 9fb6220da5a8..e43ef6a1101e 100644
--- a/usr.sbin/bluetooth/bthidcontrol/hid.c
+++ b/usr.sbin/bluetooth/bthidcontrol/hid.c
@@ -30,6 +30,7 @@
*/
#include <sys/queue.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbhid.h>
diff --git a/usr.sbin/bluetooth/bthidcontrol/sdp.c b/usr.sbin/bluetooth/bthidcontrol/sdp.c
index a0b4534e4cad..3beabc14be77 100644
--- a/usr.sbin/bluetooth/bthidcontrol/sdp.c
+++ b/usr.sbin/bluetooth/bthidcontrol/sdp.c
@@ -30,6 +30,7 @@
*/
#include <sys/queue.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbhid.h>
diff --git a/usr.sbin/bluetooth/bthidd/bthidd.c b/usr.sbin/bluetooth/bthidd/bthidd.c
index b93fd3dd6df4..7e988fced0ba 100644
--- a/usr.sbin/bluetooth/bthidd/bthidd.c
+++ b/usr.sbin/bluetooth/bthidd/bthidd.c
@@ -34,6 +34,7 @@
#include <sys/time.h>
#include <sys/queue.h>
#include <assert.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <err.h>
#include <errno.h>
diff --git a/usr.sbin/bluetooth/bthidd/client.c b/usr.sbin/bluetooth/bthidd/client.c
index 59f0d19a1ce8..5f01133d20c2 100644
--- a/usr.sbin/bluetooth/bthidd/client.c
+++ b/usr.sbin/bluetooth/bthidd/client.c
@@ -33,6 +33,7 @@
#include <sys/queue.h>
#include <assert.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <errno.h>
#include <fcntl.h>
@@ -236,7 +237,9 @@ client_socket(bdaddr_p bdaddr, uint16_t psm)
l2addr.l2cap_family = AF_BLUETOOTH;
memset(&l2addr.l2cap_bdaddr, 0, sizeof(l2addr.l2cap_bdaddr));
l2addr.l2cap_psm = 0;
-
+ l2addr.l2cap_bdaddr_type = BDADDR_BREDR;
+ l2addr.l2cap_cid = 0;
+
if (bind(s, (struct sockaddr *) &l2addr, sizeof(l2addr)) < 0) {
close(s);
return (-1);
diff --git a/usr.sbin/bluetooth/bthidd/hid.c b/usr.sbin/bluetooth/bthidd/hid.c
index 0a5ebffe4109..69a6fdcc4d28 100644
--- a/usr.sbin/bluetooth/bthidd/hid.c
+++ b/usr.sbin/bluetooth/bthidd/hid.c
@@ -35,6 +35,7 @@
#include <sys/mouse.h>
#include <sys/queue.h>
#include <assert.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbhid.h>
diff --git a/usr.sbin/bluetooth/bthidd/kbd.c b/usr.sbin/bluetooth/bthidd/kbd.c
index 20b627847a02..e570b80863f7 100644
--- a/usr.sbin/bluetooth/bthidd/kbd.c
+++ b/usr.sbin/bluetooth/bthidd/kbd.c
@@ -37,6 +37,7 @@
#include <sys/queue.h>
#include <sys/wait.h>
#include <assert.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbhid.h>
diff --git a/usr.sbin/bluetooth/bthidd/lexer.l b/usr.sbin/bluetooth/bthidd/lexer.l
index b9f62a1e7ca2..6d913eede778 100644
--- a/usr.sbin/bluetooth/bthidd/lexer.l
+++ b/usr.sbin/bluetooth/bthidd/lexer.l
@@ -31,7 +31,7 @@
* $Id: lexer.l,v 1.3 2006/09/07 21:06:53 max Exp $
* $FreeBSD$
*/
-
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <stdlib.h>
#include "parser.h"
diff --git a/usr.sbin/bluetooth/bthidd/parser.y b/usr.sbin/bluetooth/bthidd/parser.y
index 50468f4e03a8..dbb27632680c 100644
--- a/usr.sbin/bluetooth/bthidd/parser.y
+++ b/usr.sbin/bluetooth/bthidd/parser.y
@@ -33,6 +33,7 @@
*/
#include <sys/queue.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbhid.h>
diff --git a/usr.sbin/bluetooth/bthidd/server.c b/usr.sbin/bluetooth/bthidd/server.c
index d76bd62664eb..26aeb4a961a1 100644
--- a/usr.sbin/bluetooth/bthidd/server.c
+++ b/usr.sbin/bluetooth/bthidd/server.c
@@ -33,6 +33,7 @@
#include <sys/queue.h>
#include <assert.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <dev/vkbd/vkbd_var.h>
#include <errno.h>
@@ -90,7 +91,9 @@ server_init(bthid_server_p srv)
l2addr.l2cap_family = AF_BLUETOOTH;
memcpy(&l2addr.l2cap_bdaddr, &srv->bdaddr, sizeof(l2addr.l2cap_bdaddr));
l2addr.l2cap_psm = htole16(0x11);
-
+ l2addr.l2cap_bdaddr_type = BDADDR_BREDR;
+ l2addr.l2cap_cid = 0;
+
if (bind(srv->ctrl, (struct sockaddr *) &l2addr, sizeof(l2addr)) < 0) {
syslog(LOG_ERR, "Could not bind control L2CAP socket. " \
"%s (%d)", strerror(errno), errno);
diff --git a/usr.sbin/bluetooth/bthidd/session.c b/usr.sbin/bluetooth/bthidd/session.c
index b9f331bf7e7f..260cb8654d72 100644
--- a/usr.sbin/bluetooth/bthidd/session.c
+++ b/usr.sbin/bluetooth/bthidd/session.c
@@ -33,6 +33,7 @@
#include <sys/queue.h>
#include <assert.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <errno.h>
#include <fcntl.h>
diff --git a/usr.sbin/bluetooth/btpand/bnep.c b/usr.sbin/bluetooth/btpand/bnep.c
index 200a72301183..4065b1ba8e0c 100644
--- a/usr.sbin/bluetooth/btpand/bnep.c
+++ b/usr.sbin/bluetooth/btpand/bnep.c
@@ -31,6 +31,7 @@
__RCSID("$NetBSD: bnep.c,v 1.1 2008/08/17 13:20:57 plunky Exp $");
#include <sys/uio.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <sdp.h>
#include <stdarg.h>
diff --git a/usr.sbin/bluetooth/btpand/btpand.c b/usr.sbin/bluetooth/btpand/btpand.c
index 938744448bea..243fcf5292b9 100644
--- a/usr.sbin/bluetooth/btpand/btpand.c
+++ b/usr.sbin/bluetooth/btpand/btpand.c
@@ -33,6 +33,7 @@ __RCSID("$NetBSD: btpand.c,v 1.1 2008/08/17 13:20:57 plunky Exp $");
#include <sys/wait.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <err.h>
#include <fcntl.h>
diff --git a/usr.sbin/bluetooth/btpand/channel.c b/usr.sbin/bluetooth/btpand/channel.c
index b4eb4ab49c8f..32f248718e3a 100644
--- a/usr.sbin/bluetooth/btpand/channel.c
+++ b/usr.sbin/bluetooth/btpand/channel.c
@@ -35,7 +35,7 @@ __RCSID("$NetBSD: channel.c,v 1.1 2008/08/17 13:20:57 plunky Exp $");
#include <libutil.h>
#include <unistd.h>
-
+#define L2CAP_SOCKET_CHECKED
#include "btpand.h"
static struct chlist channel_list;
diff --git a/usr.sbin/bluetooth/btpand/client.c b/usr.sbin/bluetooth/btpand/client.c
index 2cc908996584..f88dc6ee5098 100644
--- a/usr.sbin/bluetooth/btpand/client.c
+++ b/usr.sbin/bluetooth/btpand/client.c
@@ -30,6 +30,7 @@
#include <sys/cdefs.h>
__RCSID("$NetBSD: client.c,v 1.2 2008/12/06 20:01:14 plunky Exp $");
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <errno.h>
#include <sdp.h>
@@ -65,6 +66,9 @@ client_init(void)
memset(&sa, 0, sizeof(sa));
sa.l2cap_family = AF_BLUETOOTH;
sa.l2cap_len = sizeof(sa);
+ sa.l2cap_bdaddr_type = BDADDR_BREDR;
+ sa.l2cap_cid = 0;
+
bdaddr_copy(&sa.l2cap_bdaddr, &local_bdaddr);
if (bind(fd, (struct sockaddr *)&sa, sizeof(sa)) == -1) {
log_err("Could not bind client socket: %m");
diff --git a/usr.sbin/bluetooth/btpand/event.c b/usr.sbin/bluetooth/btpand/event.c
index 159f90c862d4..ac51f57d1480 100644
--- a/usr.sbin/bluetooth/btpand/event.c
+++ b/usr.sbin/bluetooth/btpand/event.c
@@ -45,6 +45,7 @@
#include <syslog.h>
#include "event.h"
+#define L2CAP_SOCKET_CHECKED
#include "btpand.h"
#define __event_link(ev) \
diff --git a/usr.sbin/bluetooth/btpand/packet.c b/usr.sbin/bluetooth/btpand/packet.c
index e42e5c5b3045..21a563c754e3 100644
--- a/usr.sbin/bluetooth/btpand/packet.c
+++ b/usr.sbin/bluetooth/btpand/packet.c
@@ -30,6 +30,7 @@
#include <sys/cdefs.h>
__RCSID("$NetBSD: packet.c,v 1.1 2008/08/17 13:20:57 plunky Exp $");
+#define L2CAP_SOCKET_CHECKED
#include "btpand.h"
packet_t *
diff --git a/usr.sbin/bluetooth/btpand/sdp.c b/usr.sbin/bluetooth/btpand/sdp.c
index e5aec1c6bbba..3cad3f8fbefa 100644
--- a/usr.sbin/bluetooth/btpand/sdp.c
+++ b/usr.sbin/bluetooth/btpand/sdp.c
@@ -32,6 +32,7 @@ __RCSID("$NetBSD: sdp.c,v 1.2 2008/12/06 20:01:14 plunky Exp $");
#include <string.h>
+#define L2CAP_SOCKET_CHECKED
#include "sdp.h"
/*
diff --git a/usr.sbin/bluetooth/btpand/server.c b/usr.sbin/bluetooth/btpand/server.c
index b24d416ff196..b72b0322b0f3 100644
--- a/usr.sbin/bluetooth/btpand/server.c
+++ b/usr.sbin/bluetooth/btpand/server.c
@@ -32,6 +32,7 @@ __RCSID("$NetBSD: server.c,v 1.2 2009/01/24 17:29:28 plunky Exp $");
#include <sys/ioctl.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <inttypes.h>
#include <errno.h>
@@ -103,6 +104,9 @@ server_open(void)
sa.l2cap_family = AF_BLUETOOTH;
sa.l2cap_len = sizeof(sa);
sa.l2cap_psm = htole16(l2cap_psm);
+ sa.l2cap_bdaddr_type = BDADDR_BREDR;
+ sa.l2cap_cid = 0;
+
bdaddr_copy(&sa.l2cap_bdaddr, &local_bdaddr);
if (bind(server_fd, (struct sockaddr *)&sa, sizeof(sa)) == -1) {
log_err("Could not bind server socket: %m");
diff --git a/usr.sbin/bluetooth/btpand/tap.c b/usr.sbin/bluetooth/btpand/tap.c
index c96563338ea2..644bf02366fa 100644
--- a/usr.sbin/bluetooth/btpand/tap.c
+++ b/usr.sbin/bluetooth/btpand/tap.c
@@ -43,6 +43,7 @@ __RCSID("$NetBSD: tap.c,v 1.1 2008/08/17 13:20:57 plunky Exp $");
#include <stdio.h>
#include <unistd.h>
+#define L2CAP_SOCKET_CHECKED
#include "btpand.h"
static bool tap_send(channel_t *, packet_t *);
diff --git a/usr.sbin/bluetooth/hccontrol/hccontrol.c b/usr.sbin/bluetooth/hccontrol/hccontrol.c
index 089869b3cf03..9c60ae8b3149 100644
--- a/usr.sbin/bluetooth/hccontrol/hccontrol.c
+++ b/usr.sbin/bluetooth/hccontrol/hccontrol.c
@@ -29,6 +29,7 @@
* $FreeBSD$
*/
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <sys/ioctl.h>
#include <sys/sysctl.h>
diff --git a/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c b/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c
index aae5dd1457ed..213b017c4346 100644
--- a/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c
+++ b/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c
@@ -29,6 +29,7 @@
* $FreeBSD$
*/
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <errno.h>
#include <stdio.h>
diff --git a/usr.sbin/bluetooth/hccontrol/info.c b/usr.sbin/bluetooth/hccontrol/info.c
index d7bad36bb8de..ee9d1a164328 100644
--- a/usr.sbin/bluetooth/hccontrol/info.c
+++ b/usr.sbin/bluetooth/hccontrol/info.c
@@ -29,6 +29,7 @@
* $FreeBSD$
*/
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <errno.h>
#include <stdio.h>
diff --git a/usr.sbin/bluetooth/hccontrol/link_control.c b/usr.sbin/bluetooth/hccontrol/link_control.c
index 536520a71298..a55426c088a8 100644
--- a/usr.sbin/bluetooth/hccontrol/link_control.c
+++ b/usr.sbin/bluetooth/hccontrol/link_control.c
@@ -29,6 +29,7 @@
* $FreeBSD$
*/
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <errno.h>
#include <stdio.h>
diff --git a/usr.sbin/bluetooth/hccontrol/link_policy.c b/usr.sbin/bluetooth/hccontrol/link_policy.c
index 67b32d5a0d61..8142b2365f10 100644
--- a/usr.sbin/bluetooth/hccontrol/link_policy.c
+++ b/usr.sbin/bluetooth/hccontrol/link_policy.c
@@ -29,6 +29,7 @@
* $FreeBSD$
*/
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <errno.h>
#include <stdio.h>
diff --git a/usr.sbin/bluetooth/hccontrol/node.c b/usr.sbin/bluetooth/hccontrol/node.c
index ede2153b6ced..fb6fd199376b 100644
--- a/usr.sbin/bluetooth/hccontrol/node.c
+++ b/usr.sbin/bluetooth/hccontrol/node.c
@@ -30,6 +30,7 @@
*/
#include <sys/ioctl.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <errno.h>
#include <netgraph/ng_message.h>
diff --git a/usr.sbin/bluetooth/hccontrol/util.c b/usr.sbin/bluetooth/hccontrol/util.c
index 4bb5000c087a..13e8cb09073c 100644
--- a/usr.sbin/bluetooth/hccontrol/util.c
+++ b/usr.sbin/bluetooth/hccontrol/util.c
@@ -30,6 +30,7 @@
*/
#include <sys/param.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <stdio.h>
#include <string.h>
diff --git a/usr.sbin/bluetooth/hcsecd/hcsecd.c b/usr.sbin/bluetooth/hcsecd/hcsecd.c
index 72f9c8cb8fdf..15b5ca45138e 100644
--- a/usr.sbin/bluetooth/hcsecd/hcsecd.c
+++ b/usr.sbin/bluetooth/hcsecd/hcsecd.c
@@ -30,6 +30,7 @@
*/
#include <sys/queue.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <err.h>
#include <errno.h>
diff --git a/usr.sbin/bluetooth/hcsecd/parser.y b/usr.sbin/bluetooth/hcsecd/parser.y
index ec91c484cae2..cfaeb022b89e 100644
--- a/usr.sbin/bluetooth/hcsecd/parser.y
+++ b/usr.sbin/bluetooth/hcsecd/parser.y
@@ -32,6 +32,7 @@
#include <sys/fcntl.h>
#include <sys/queue.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <errno.h>
#include <limits.h>
diff --git a/usr.sbin/bluetooth/l2control/l2cap.c b/usr.sbin/bluetooth/l2control/l2cap.c
index c23106c3db3f..44009ef2ef40 100644
--- a/usr.sbin/bluetooth/l2control/l2cap.c
+++ b/usr.sbin/bluetooth/l2control/l2cap.c
@@ -30,6 +30,7 @@
*/
#include <sys/ioctl.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <errno.h>
#include <stdio.h>
diff --git a/usr.sbin/bluetooth/l2control/l2control.c b/usr.sbin/bluetooth/l2control/l2control.c
index fdbf2f5b841d..87ec2371a360 100644
--- a/usr.sbin/bluetooth/l2control/l2control.c
+++ b/usr.sbin/bluetooth/l2control/l2control.c
@@ -30,6 +30,7 @@
*/
#include <assert.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <err.h>
#include <errno.h>
diff --git a/usr.sbin/bluetooth/l2ping/l2ping.c b/usr.sbin/bluetooth/l2ping/l2ping.c
index 4baa3540d14b..92e7a0aa777b 100644
--- a/usr.sbin/bluetooth/l2ping/l2ping.c
+++ b/usr.sbin/bluetooth/l2ping/l2ping.c
@@ -34,6 +34,7 @@
#include <arpa/inet.h>
#include <netinet/in.h>
#include <assert.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <err.h>
#include <errno.h>
diff --git a/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c b/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c
index 956dc4d83839..e970fb030be1 100644
--- a/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c
+++ b/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c
@@ -30,7 +30,7 @@
* $Id: rfcomm_pppd.c,v 1.5 2003/09/07 18:32:11 max Exp $
* $FreeBSD$
*/
-
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <ctype.h>
#include <err.h>
diff --git a/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.c b/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.c
index fca2015c9c02..65ee3d0f9234 100644
--- a/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.c
+++ b/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.c
@@ -30,6 +30,7 @@
*/
#include <assert.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <err.h>
#include <errno.h>
diff --git a/usr.sbin/bluetooth/sdpcontrol/search.c b/usr.sbin/bluetooth/sdpcontrol/search.c
index e7d824436aa4..acc8c167ed6e 100644
--- a/usr.sbin/bluetooth/sdpcontrol/search.c
+++ b/usr.sbin/bluetooth/sdpcontrol/search.c
@@ -30,6 +30,7 @@
*/
#include <netinet/in.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <ctype.h>
#include <sdp.h>
diff --git a/usr.sbin/bluetooth/sdpd/bgd.c b/usr.sbin/bluetooth/sdpd/bgd.c
index 70dda891072f..2c4e4d9698b5 100644
--- a/usr.sbin/bluetooth/sdpd/bgd.c
+++ b/usr.sbin/bluetooth/sdpd/bgd.c
@@ -28,7 +28,7 @@
* $Id: bgd.c,v 1.4 2004/01/13 01:54:39 max Exp $
* $FreeBSD$
*/
-
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <sdp.h>
#include <string.h>
diff --git a/usr.sbin/bluetooth/sdpd/dun.c b/usr.sbin/bluetooth/sdpd/dun.c
index e7aeb78d679e..1496285a68c2 100644
--- a/usr.sbin/bluetooth/sdpd/dun.c
+++ b/usr.sbin/bluetooth/sdpd/dun.c
@@ -30,6 +30,7 @@
*/
#include <sys/queue.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <sdp.h>
#include <string.h>
diff --git a/usr.sbin/bluetooth/sdpd/ftrn.c b/usr.sbin/bluetooth/sdpd/ftrn.c
index bcebfc79807f..bc1095eada3d 100644
--- a/usr.sbin/bluetooth/sdpd/ftrn.c
+++ b/usr.sbin/bluetooth/sdpd/ftrn.c
@@ -30,6 +30,7 @@
*/
#include <sys/queue.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <sdp.h>
#include <string.h>
diff --git a/usr.sbin/bluetooth/sdpd/gn.c b/usr.sbin/bluetooth/sdpd/gn.c
index d35c0eea5fda..c2bea4811350 100644
--- a/usr.sbin/bluetooth/sdpd/gn.c
+++ b/usr.sbin/bluetooth/sdpd/gn.c
@@ -32,6 +32,7 @@
*/
#include <sys/queue.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <sdp.h>
#include <string.h>
diff --git a/usr.sbin/bluetooth/sdpd/irmc.c b/usr.sbin/bluetooth/sdpd/irmc.c
index d28a1205be67..2b8f31746966 100644
--- a/usr.sbin/bluetooth/sdpd/irmc.c
+++ b/usr.sbin/bluetooth/sdpd/irmc.c
@@ -30,6 +30,7 @@
*/
#include <sys/queue.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <sdp.h>
#include <string.h>
diff --git a/usr.sbin/bluetooth/sdpd/irmc_command.c b/usr.sbin/bluetooth/sdpd/irmc_command.c
index 10dafe0b1ed2..a55e1337985d 100644
--- a/usr.sbin/bluetooth/sdpd/irmc_command.c
+++ b/usr.sbin/bluetooth/sdpd/irmc_command.c
@@ -30,6 +30,7 @@
*/
#include <sys/queue.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <sdp.h>
#include <string.h>
diff --git a/usr.sbin/bluetooth/sdpd/lan.c b/usr.sbin/bluetooth/sdpd/lan.c
index 2425a89db5a2..3ed2b1243c4f 100644
--- a/usr.sbin/bluetooth/sdpd/lan.c
+++ b/usr.sbin/bluetooth/sdpd/lan.c
@@ -31,6 +31,7 @@
#include <arpa/inet.h>
#include <sys/queue.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <sdp.h>
#include <stdio.h>
diff --git a/usr.sbin/bluetooth/sdpd/main.c b/usr.sbin/bluetooth/sdpd/main.c
index 1df3bf0d5887..a287b9b70fd4 100644
--- a/usr.sbin/bluetooth/sdpd/main.c
+++ b/usr.sbin/bluetooth/sdpd/main.c
@@ -30,6 +30,7 @@
*/
#include <sys/select.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <errno.h>
#include <grp.h>
diff --git a/usr.sbin/bluetooth/sdpd/nap.c b/usr.sbin/bluetooth/sdpd/nap.c
index 5a857d8e91ad..c034ee68909b 100644
--- a/usr.sbin/bluetooth/sdpd/nap.c
+++ b/usr.sbin/bluetooth/sdpd/nap.c
@@ -32,6 +32,7 @@
*/
#include <sys/queue.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <sdp.h>
#include <string.h>
diff --git a/usr.sbin/bluetooth/sdpd/opush.c b/usr.sbin/bluetooth/sdpd/opush.c
index 36359daa98ef..bcdfda2733be 100644
--- a/usr.sbin/bluetooth/sdpd/opush.c
+++ b/usr.sbin/bluetooth/sdpd/opush.c
@@ -30,6 +30,7 @@
*/
#include <sys/queue.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <sdp.h>
#include <string.h>
diff --git a/usr.sbin/bluetooth/sdpd/panu.c b/usr.sbin/bluetooth/sdpd/panu.c
index e00f6503c924..5b2773e44e4a 100644
--- a/usr.sbin/bluetooth/sdpd/panu.c
+++ b/usr.sbin/bluetooth/sdpd/panu.c
@@ -32,6 +32,7 @@
*/
#include <sys/queue.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <sdp.h>
#include <string.h>
diff --git a/usr.sbin/bluetooth/sdpd/profile.c b/usr.sbin/bluetooth/sdpd/profile.c
index f3dfaa7652a3..5c25d037378e 100644
--- a/usr.sbin/bluetooth/sdpd/profile.c
+++ b/usr.sbin/bluetooth/sdpd/profile.c
@@ -32,6 +32,7 @@
*/
#include <sys/queue.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <sdp.h>
#include <string.h>
diff --git a/usr.sbin/bluetooth/sdpd/provider.c b/usr.sbin/bluetooth/sdpd/provider.c
index b0f5347018f8..0243305b0d9f 100644
--- a/usr.sbin/bluetooth/sdpd/provider.c
+++ b/usr.sbin/bluetooth/sdpd/provider.c
@@ -30,6 +30,7 @@
*/
#include <sys/queue.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <string.h>
#include <stdlib.h>
diff --git a/usr.sbin/bluetooth/sdpd/sar.c b/usr.sbin/bluetooth/sdpd/sar.c
index 4fc25d92b118..705f7161eaad 100644
--- a/usr.sbin/bluetooth/sdpd/sar.c
+++ b/usr.sbin/bluetooth/sdpd/sar.c
@@ -34,6 +34,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <assert.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <errno.h>
#include <sdp.h>
diff --git a/usr.sbin/bluetooth/sdpd/scr.c b/usr.sbin/bluetooth/sdpd/scr.c
index d0c9ec5f29d6..1df72d1df5da 100644
--- a/usr.sbin/bluetooth/sdpd/scr.c
+++ b/usr.sbin/bluetooth/sdpd/scr.c
@@ -30,6 +30,7 @@
*/
#include <sys/queue.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <errno.h>
#include <sdp.h>
diff --git a/usr.sbin/bluetooth/sdpd/sd.c b/usr.sbin/bluetooth/sdpd/sd.c
index 1743ea7dc406..c5397ce084da 100644
--- a/usr.sbin/bluetooth/sdpd/sd.c
+++ b/usr.sbin/bluetooth/sdpd/sd.c
@@ -30,6 +30,7 @@
*/
#include <sys/queue.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <sdp.h>
#include <string.h>
diff --git a/usr.sbin/bluetooth/sdpd/server.c b/usr.sbin/bluetooth/sdpd/server.c
index 4ef153b1661f..abd181574f00 100644
--- a/usr.sbin/bluetooth/sdpd/server.c
+++ b/usr.sbin/bluetooth/sdpd/server.c
@@ -38,6 +38,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <assert.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <errno.h>
#include <pwd.h>
diff --git a/usr.sbin/bluetooth/sdpd/sp.c b/usr.sbin/bluetooth/sdpd/sp.c
index 31a9585a25e1..48edc77fe7fb 100644
--- a/usr.sbin/bluetooth/sdpd/sp.c
+++ b/usr.sbin/bluetooth/sdpd/sp.c
@@ -30,6 +30,7 @@
*/
#include <sys/queue.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <sdp.h>
#include <string.h>
diff --git a/usr.sbin/bluetooth/sdpd/srr.c b/usr.sbin/bluetooth/sdpd/srr.c
index fd636d56d446..60f48ca439b9 100644
--- a/usr.sbin/bluetooth/sdpd/srr.c
+++ b/usr.sbin/bluetooth/sdpd/srr.c
@@ -34,6 +34,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <assert.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <errno.h>
#include <sdp.h>
diff --git a/usr.sbin/bluetooth/sdpd/ssar.c b/usr.sbin/bluetooth/sdpd/ssar.c
index eac92351c824..5e52e80e4c7b 100644
--- a/usr.sbin/bluetooth/sdpd/ssar.c
+++ b/usr.sbin/bluetooth/sdpd/ssar.c
@@ -30,6 +30,7 @@
*/
#include <sys/queue.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <sdp.h>
#include <string.h>
diff --git a/usr.sbin/bluetooth/sdpd/ssr.c b/usr.sbin/bluetooth/sdpd/ssr.c
index ac27548575cc..785c8cac3755 100644
--- a/usr.sbin/bluetooth/sdpd/ssr.c
+++ b/usr.sbin/bluetooth/sdpd/ssr.c
@@ -34,6 +34,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <assert.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <errno.h>
#include <sdp.h>
diff --git a/usr.sbin/bluetooth/sdpd/sur.c b/usr.sbin/bluetooth/sdpd/sur.c
index 143eaf3dbec9..581b593f3001 100644
--- a/usr.sbin/bluetooth/sdpd/sur.c
+++ b/usr.sbin/bluetooth/sdpd/sur.c
@@ -30,6 +30,7 @@
*/
#include <sys/queue.h>
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <errno.h>
#include <sdp.h>
diff --git a/usr.sbin/bluetooth/sdpd/uuid.c b/usr.sbin/bluetooth/sdpd/uuid.c
index 1989bc5e797d..dff8d2c66b93 100644
--- a/usr.sbin/bluetooth/sdpd/uuid.c
+++ b/usr.sbin/bluetooth/sdpd/uuid.c
@@ -28,7 +28,7 @@
* $Id: uuid.c,v 1.1 2004/12/09 18:20:26 max Exp $
* $FreeBSD$
*/
-
+#define L2CAP_SOCKET_CHECKED
#include <bluetooth.h>
#include <sdp.h>
#include <uuid.h>