summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bluetooth
diff options
context:
space:
mode:
authoremax <emax@FreeBSD.org>2006-03-16 18:26:54 +0000
committeremax <emax@FreeBSD.org>2006-03-16 18:26:54 +0000
commit21e354aa2a856fd116d03428c31d772e160e1a60 (patch)
treeac3814ab1981ea6aacd840ffe573e9c3997f2678 /usr.sbin/bluetooth
parent916ce663d77987cd78862e28e097abdfc7273adc (diff)
downloadFreeBSD-src-21e354aa2a856fd116d03428c31d772e160e1a60.zip
FreeBSD-src-21e354aa2a856fd116d03428c31d772e160e1a60.tar.gz
Properly convert L2CAP PSM values in sockaddr_l2cap to LE16 byte order.
Noticed by: Iain Hibbert < plunky at rya-online dot net > MFC after: 3 days
Diffstat (limited to 'usr.sbin/bluetooth')
-rw-r--r--usr.sbin/bluetooth/bthidd/client.c2
-rw-r--r--usr.sbin/bluetooth/bthidd/server.c4
-rw-r--r--usr.sbin/bluetooth/sdpd/server.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/bluetooth/bthidd/client.c b/usr.sbin/bluetooth/bthidd/client.c
index cc611bd..252248d 100644
--- a/usr.sbin/bluetooth/bthidd/client.c
+++ b/usr.sbin/bluetooth/bthidd/client.c
@@ -231,7 +231,7 @@ client_socket(bdaddr_p bdaddr, int psm)
}
memcpy(&l2addr.l2cap_bdaddr, bdaddr, sizeof(l2addr.l2cap_bdaddr));
- l2addr.l2cap_psm = psm;
+ l2addr.l2cap_psm = htole16(psm);
if (connect(s, (struct sockaddr *) &l2addr, sizeof(l2addr)) < 0 &&
errno != EINPROGRESS) {
diff --git a/usr.sbin/bluetooth/bthidd/server.c b/usr.sbin/bluetooth/bthidd/server.c
index ad2c828..2f20715 100644
--- a/usr.sbin/bluetooth/bthidd/server.c
+++ b/usr.sbin/bluetooth/bthidd/server.c
@@ -117,7 +117,7 @@ server_init(bthid_server_p srv)
l2addr.l2cap_len = sizeof(l2addr);
l2addr.l2cap_family = AF_BLUETOOTH;
memcpy(&l2addr.l2cap_bdaddr, &srv->bdaddr, sizeof(l2addr.l2cap_bdaddr));
- l2addr.l2cap_psm = 0x11;
+ l2addr.l2cap_psm = htole16(0x11);
if (bind(srv->ctrl, (struct sockaddr *) &l2addr, sizeof(l2addr)) < 0) {
syslog(LOG_ERR, "Could not bind control L2CAP socket. " \
@@ -151,7 +151,7 @@ server_init(bthid_server_p srv)
return (-1);
}
- l2addr.l2cap_psm = 0x13;
+ l2addr.l2cap_psm = htole16(0x13);
if (bind(srv->intr, (struct sockaddr *) &l2addr, sizeof(l2addr)) < 0) {
syslog(LOG_ERR, "Could not bind interrupt L2CAP socket. " \
diff --git a/usr.sbin/bluetooth/sdpd/server.c b/usr.sbin/bluetooth/sdpd/server.c
index d07b549..9528c62 100644
--- a/usr.sbin/bluetooth/sdpd/server.c
+++ b/usr.sbin/bluetooth/sdpd/server.c
@@ -136,7 +136,7 @@ server_init(server_p srv, char const *control)
l2.l2cap_len = sizeof(l2);
l2.l2cap_family = AF_BLUETOOTH;
memcpy(&l2.l2cap_bdaddr, NG_HCI_BDADDR_ANY, sizeof(l2.l2cap_bdaddr));
- l2.l2cap_psm = NG_L2CAP_PSM_SDP;
+ l2.l2cap_psm = htole16(NG_L2CAP_PSM_SDP);
if (bind(l2sock, (struct sockaddr *) &l2, sizeof(l2)) < 0) {
log_crit("Could not bind L2CAP socket. %s (%d)",
OpenPOWER on IntegriCloud