Commit 24bc10ca authored by Marcel Holtmann's avatar Marcel Holtmann Committed by Johan Hedberg

Bluetooth: Access RFCOMM session addresses through L2CAP channel

The L2CAP socket structure does not contain the address information
anymore. They need to be accessed through the L2CAP channel.
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent 4f1654e0
...@@ -641,13 +641,13 @@ static struct rfcomm_session *rfcomm_session_get(bdaddr_t *src, bdaddr_t *dst) ...@@ -641,13 +641,13 @@ static struct rfcomm_session *rfcomm_session_get(bdaddr_t *src, bdaddr_t *dst)
{ {
struct rfcomm_session *s; struct rfcomm_session *s;
struct list_head *p, *n; struct list_head *p, *n;
struct bt_sock *sk; struct l2cap_chan *chan;
list_for_each_safe(p, n, &session_list) { list_for_each_safe(p, n, &session_list) {
s = list_entry(p, struct rfcomm_session, list); s = list_entry(p, struct rfcomm_session, list);
sk = bt_sk(s->sock->sk); chan = l2cap_pi(s->sock->sk)->chan;
if ((!bacmp(src, BDADDR_ANY) || !bacmp(&sk->src, src)) && if ((!bacmp(src, BDADDR_ANY) || !bacmp(&chan->src, src)) &&
!bacmp(&sk->dst, dst)) !bacmp(&chan->dst, dst))
return s; return s;
} }
return NULL; return NULL;
...@@ -732,11 +732,11 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, ...@@ -732,11 +732,11 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src,
void rfcomm_session_getaddr(struct rfcomm_session *s, bdaddr_t *src, bdaddr_t *dst) void rfcomm_session_getaddr(struct rfcomm_session *s, bdaddr_t *src, bdaddr_t *dst)
{ {
struct sock *sk = s->sock->sk; struct l2cap_chan *chan = l2cap_pi(s->sock->sk)->chan;
if (src) if (src)
bacpy(src, &bt_sk(sk)->src); bacpy(src, &chan->src);
if (dst) if (dst)
bacpy(dst, &bt_sk(sk)->dst); bacpy(dst, &chan->dst);
} }
/* ---- RFCOMM frame sending ---- */ /* ---- RFCOMM frame sending ---- */
...@@ -2112,12 +2112,11 @@ static int rfcomm_dlc_debugfs_show(struct seq_file *f, void *x) ...@@ -2112,12 +2112,11 @@ static int rfcomm_dlc_debugfs_show(struct seq_file *f, void *x)
rfcomm_lock(); rfcomm_lock();
list_for_each_entry(s, &session_list, list) { list_for_each_entry(s, &session_list, list) {
struct l2cap_chan *chan = l2cap_pi(s->sock->sk)->chan;
struct rfcomm_dlc *d; struct rfcomm_dlc *d;
list_for_each_entry(d, &s->dlcs, list) { list_for_each_entry(d, &s->dlcs, list) {
struct sock *sk = s->sock->sk;
seq_printf(f, "%pMR %pMR %ld %d %d %d %d\n", seq_printf(f, "%pMR %pMR %ld %d %d %d %d\n",
&bt_sk(sk)->src, &bt_sk(sk)->dst, &chan->src, &chan->dst,
d->state, d->dlci, d->mtu, d->state, d->dlci, d->mtu,
d->rx_credits, d->tx_credits); d->rx_credits, d->tx_credits);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment