Endian issues:

hci_event.c:
 - Convert memo->response.clock_offset to host-endian.

hci_ioctl.c:
 - printf format tweak (size_t)

hci_link.c:
 - Convert memo->response.clock_offset from host-endian.
 - Tweak a DIAGNOSTIC message.

l2cap_signal.c:
 - In l2cap_recv_config_req(), rp->scid is little-endian so make sure
   we convert from host-endian.

	from scw@
This commit is contained in:
plunky 2006-09-11 22:12:39 +00:00
parent 00d762682c
commit 264c79359e
4 changed files with 17 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: hci_event.c,v 1.1 2006/06/19 15:44:45 gdamore Exp $ */
/* $NetBSD: hci_event.c,v 1.2 2006/09/11 22:12:39 plunky Exp $ */
/*-
* Copyright (c) 2005 Iain Hibbert.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hci_event.c,v 1.1 2006/06/19 15:44:45 gdamore Exp $");
__KERNEL_RCSID(0, "$NetBSD: hci_event.c,v 1.2 2006/09/11 22:12:39 plunky Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -422,6 +422,9 @@ hci_event_inquiry_result(struct hci_unit *unit, struct mbuf *m)
m_copydata(m, 0, sizeof(hci_inquiry_response),
(caddr_t)&memo->response);
m_adj(m, sizeof(hci_inquiry_response));
memo->response.clock_offset =
le16toh(memo->response.clock_offset);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: hci_ioctl.c,v 1.3 2006/08/27 11:41:58 plunky Exp $ */
/* $NetBSD: hci_ioctl.c,v 1.4 2006/09/11 22:12:39 plunky Exp $ */
/*-
* Copyright (c) 2005 Iain Hibbert.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hci_ioctl.c,v 1.3 2006/08/27 11:41:58 plunky Exp $");
__KERNEL_RCSID(0, "$NetBSD: hci_ioctl.c,v 1.4 2006/09/11 22:12:39 plunky Exp $");
#include <sys/param.h>
#include <sys/domain.h>
@ -107,11 +107,11 @@ hci_dump(void)
BDADDR(chan->lc_raddr.bt_bdaddr));
LIST_FOREACH(dlc, &rs->rs_dlcs, rd_next) {
printf("+DLC channel=%d, dlci=%d, "
"state=%d, flags=0x%4.4x, rxcred=%d, rxsize=%d, "
"state=%d, flags=0x%4.4x, rxcred=%d, rxsize=%ld, "
"txcred=%d, pending=%d, txqlen=%d\n",
dlc->rd_raddr.bt_channel, dlc->rd_dlci,
dlc->rd_state, dlc->rd_flags,
dlc->rd_rxcred, dlc->rd_rxsize,
dlc->rd_rxcred, (unsigned long)dlc->rd_rxsize,
dlc->rd_txcred, dlc->rd_pending,
(dlc->rd_txbuf ? dlc->rd_txbuf->m_pkthdr.len : 0));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: hci_link.c,v 1.4 2006/09/11 22:08:38 plunky Exp $ */
/* $NetBSD: hci_link.c,v 1.5 2006/09/11 22:12:39 plunky Exp $ */
/*-
* Copyright (c) 2005 Iain Hibbert.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hci_link.c,v 1.4 2006/09/11 22:08:38 plunky Exp $");
__KERNEL_RCSID(0, "$NetBSD: hci_link.c,v 1.5 2006/09/11 22:12:39 plunky Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -98,7 +98,7 @@ hci_acl_open(struct hci_unit *unit, bdaddr_t *bdaddr)
if (memo != NULL) {
cp.page_scan_rep_mode = memo->response.page_scan_rep_mode;
cp.page_scan_mode = memo->response.page_scan_mode;
cp.clock_offset = memo->response.clock_offset;
cp.clock_offset = htole16(memo->response.clock_offset);
}
if (unit->hci_link_policy & HCI_LINK_POLICY_ENABLE_ROLE_SWITCH)
@ -261,7 +261,8 @@ hci_acl_recv(struct mbuf *m, struct hci_unit *unit)
}
if (m->m_pkthdr.len != le16toh(hdr.length)) {
printf("%s: bad ACL packet length\n", unit->hci_devname);
printf("%s: bad ACL packet length (%d != %d)\n",
unit->hci_devname, m->m_pkthdr.len, le16toh(hdr.length));
goto bad;
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: l2cap_signal.c,v 1.1 2006/06/19 15:44:45 gdamore Exp $ */
/* $NetBSD: l2cap_signal.c,v 1.2 2006/09/11 22:12:39 plunky Exp $ */
/*-
* Copyright (c) 2005 Iain Hibbert.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: l2cap_signal.c,v 1.1 2006/06/19 15:44:45 gdamore Exp $");
__KERNEL_RCSID(0, "$NetBSD: l2cap_signal.c,v 1.2 2006/09/11 22:12:39 plunky Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -412,7 +412,7 @@ l2cap_recv_config_req(struct mbuf *m, struct hci_link *link)
/* ready our response packet */
rp = (l2cap_cfg_rsp_cp *)buf;
rp->scid = chan->lc_rcid;
rp->scid = htole16(chan->lc_rcid);
rp->flags = 0; /* "No Continuation" */
rp->result = L2CAP_SUCCESS;
len = sizeof(*rp);