summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/l2cap_core.c
diff options
context:
space:
mode:
authorAndrei Emeltchenko2011-10-11 12:37:48 +0200
committerGustavo F. Padovan2011-10-13 21:45:10 +0200
commit793c2f1cb9d722231290daf1744e6c5b7269f445 (patch)
treeb46ea72bcadbce72fd76241f852bdc2d358a4c4a /net/bluetooth/l2cap_core.c
parentBluetooth: EWS: rewrite L2CAP ERTM txseq calculation (diff)
downloadkernel-qcow2-linux-793c2f1cb9d722231290daf1744e6c5b7269f445.tar.gz
kernel-qcow2-linux-793c2f1cb9d722231290daf1744e6c5b7269f445.tar.xz
kernel-qcow2-linux-793c2f1cb9d722231290daf1744e6c5b7269f445.zip
Bluetooth: EWS: rewrite check frame type function
Check frame function uses now information about control field type. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/l2cap_core.c')
-rw-r--r--net/bluetooth/l2cap_core.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 1c367d6af995..9262a00bce55 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -578,7 +578,8 @@ static inline void l2cap_send_sframe(struct l2cap_chan *chan, u16 control)
BT_DBG("chan %p, control 0x%2.2x", chan, control);
count = min_t(unsigned int, conn->mtu, hlen);
- control |= L2CAP_CTRL_FRAME_TYPE;
+
+ control |= __set_sframe(chan);
if (test_and_clear_bit(CONN_SEND_FBIT, &chan->conn_state))
control |= L2CAP_CTRL_FINAL;
@@ -3707,7 +3708,7 @@ static int l2cap_ertm_data_rcv(struct sock *sk, struct sk_buff *skb)
if (l2cap_check_fcs(chan, skb))
goto drop;
- if (__is_sar_start(chan, control) && __is_iframe(control))
+ if (__is_sar_start(chan, control) && !__is_sframe(chan, control))
len -= 2;
if (chan->fcs == L2CAP_FCS_CRC16)
@@ -3734,7 +3735,7 @@ static int l2cap_ertm_data_rcv(struct sock *sk, struct sk_buff *skb)
goto drop;
}
- if (__is_iframe(control)) {
+ if (!__is_sframe(chan, control)) {
if (len < 0) {
l2cap_send_disconn_req(chan->conn, chan, ECONNRESET);
goto drop;
@@ -3817,7 +3818,7 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk
if (chan->fcs == L2CAP_FCS_CRC16)
len -= 2;
- if (len > chan->mps || len < 0 || __is_sframe(control))
+ if (len > chan->mps || len < 0 || __is_sframe(chan, control))
goto drop;
tx_seq = __get_txseq(chan, control);