diff options
author | Andrei Emeltchenko <andrei.emeltchenko@intel.com> | 2012-05-29 06:59:17 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-06-04 23:34:14 -0400 |
commit | 97e8e89d2d8185b7644c9941636d3682eedc517b (patch) | |
tree | b9db250da912d6185c03f2a93145ef9f69d4c32a /net/bluetooth | |
parent | 416fa7527d6bf658e5517ea36d2de9270be2c11e (diff) |
Bluetooth: A2MP: Manage incoming connections
Handle incoming A2MP connection by creating AMP manager and
processing A2MP messages.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/a2mp.c | 16 | ||||
-rw-r--r-- | net/bluetooth/l2cap_core.c | 19 |
2 files changed, 31 insertions, 4 deletions
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c index f1ec1b1d308f..e08ca2ac31aa 100644 --- a/net/bluetooth/a2mp.c +++ b/net/bluetooth/a2mp.c | |||
@@ -569,3 +569,19 @@ static struct amp_mgr *amp_mgr_create(struct l2cap_conn *conn) | |||
569 | 569 | ||
570 | return mgr; | 570 | return mgr; |
571 | } | 571 | } |
572 | |||
573 | struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn, | ||
574 | struct sk_buff *skb) | ||
575 | { | ||
576 | struct amp_mgr *mgr; | ||
577 | |||
578 | mgr = amp_mgr_create(conn); | ||
579 | if (!mgr) { | ||
580 | BT_ERR("Could not create AMP manager"); | ||
581 | return NULL; | ||
582 | } | ||
583 | |||
584 | BT_DBG("mgr: %p chan %p", mgr, mgr->a2mp_chan); | ||
585 | |||
586 | return mgr->a2mp_chan; | ||
587 | } | ||
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index fc572795497a..3daac2c6b7b4 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <net/bluetooth/hci_core.h> | 37 | #include <net/bluetooth/hci_core.h> |
38 | #include <net/bluetooth/l2cap.h> | 38 | #include <net/bluetooth/l2cap.h> |
39 | #include <net/bluetooth/smp.h> | 39 | #include <net/bluetooth/smp.h> |
40 | #include <net/bluetooth/a2mp.h> | ||
40 | 41 | ||
41 | bool disable_ertm; | 42 | bool disable_ertm; |
42 | 43 | ||
@@ -5132,10 +5133,20 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk | |||
5132 | 5133 | ||
5133 | chan = l2cap_get_chan_by_scid(conn, cid); | 5134 | chan = l2cap_get_chan_by_scid(conn, cid); |
5134 | if (!chan) { | 5135 | if (!chan) { |
5135 | BT_DBG("unknown cid 0x%4.4x", cid); | 5136 | if (cid == L2CAP_CID_A2MP) { |
5136 | /* Drop packet and return */ | 5137 | chan = a2mp_channel_create(conn, skb); |
5137 | kfree_skb(skb); | 5138 | if (!chan) { |
5138 | return 0; | 5139 | kfree_skb(skb); |
5140 | return 0; | ||
5141 | } | ||
5142 | |||
5143 | l2cap_chan_lock(chan); | ||
5144 | } else { | ||
5145 | BT_DBG("unknown cid 0x%4.4x", cid); | ||
5146 | /* Drop packet and return */ | ||
5147 | kfree_skb(skb); | ||
5148 | return 0; | ||
5149 | } | ||
5139 | } | 5150 | } |
5140 | 5151 | ||
5141 | BT_DBG("chan %p, len %d", chan, skb->len); | 5152 | BT_DBG("chan %p, len %d", chan, skb->len); |