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
This commit is contained in:
Maksim Yevmenkin 2006-03-16 18:26:54 +00:00
parent a9e17e2e05
commit 35929e6013
3 changed files with 4 additions and 4 deletions

View File

@ -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) {

View File

@ -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. " \

View File

@ -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)",