Commit Graph

19 Commits

Author SHA1 Message Date
Miao-chen Chou
32641ce15e monitor/rfcomm: Fix a potential memory access issue for compatibility with LLVM
This patch removes "packed" attribute from the definition of struct rfcomm_rpn
to prevent the access to an unaligned struct member in mmc_rpn(). This patch
also introduces a temp variable in mcc_pn() to prevent unaligned access without
touching the definition of struct rfcomm_pn, since struct rfcomm_pn is used as
a PDU.

error messages from LLVM build:

monitor/rfcomm.c:238:36: error: taking address of packed member 'pm' of class
or structure 'rfcomm_rpn' may result in an unaligned pointer value
[-Werror,-Waddress-of-packed-member]
        if (!l2cap_frame_get_le16(frame, &rpn.pm))
monitor/rfcomm.c:287:36: error: taking address of packed member 'mtu' of class
or structure 'rfcomm_pn' may result in an unaligned pointer value
[-Werror,-Waddress-of-packed-member]
        if (!l2cap_frame_get_le16(frame, &pn.mtu))

Currently there is no corresponding flag in GCC to generate the same error
messages. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51628.
2016-12-22 12:42:16 +02:00
Luiz Augusto von Dentz
d884d778d3 monitor/rfcomm: Fix left over packed struct 2016-12-20 11:52:00 +02:00
Luiz Augusto von Dentz
452024ba83 monitor/rfcomm: Remove packed attribute from structs
These structs do not represent the raw PDU format thus they don't need
to be the exact same size.
2016-12-16 14:10:11 +02:00
Andrzej Kaczmarek
3e8b659270 monitor/rfcomm: Fix names formatting 2015-11-16 09:59:16 +02:00
Marcel Holtmann
d9e800cbc9 monitor: Use local includes for libbluetooth headers 2015-02-12 21:52:00 +01:00
Gowtham Anandha Babu
e0150908f1 monitor/rfcomm: Add support for decoding Test command
RFCOMM: Unnumbered Info with Header Check (UIH)(0xef)
             Address: 0x01 cr 0 dlci 0x00
             Control: 0xef poll/final 0
             Length: 6
             FCS: 0xaa
             MCC Message type: Test Command RSP(0x08)
               Length: 4
               Test Data: 0x 5f 54 65 73
2014-12-19 10:59:30 -02:00
Gowtham Anandha Babu
804d14559e monitor/rfcomm: Fix byte ordering issue
The correct byte order for RFCOMM protocol is
little endian.
2014-12-05 17:13:34 +02:00
Andrei Emeltchenko
af7a575742 monitor: Fix RFCOMM parity type mask
Fix RFCOMM RPN parity type bit according to Spec. GSM 07.10 version
6.3.0. (PT1 - PT2 indicates the parity type).
2014-12-05 16:58:58 +02:00
Szymon Janc
680dadbc8f monitor/rfcomm: Fix incorrect byte swapping
Those were already converted to host order with l2cap_frame_get_be16.
2014-12-04 14:26:35 +01:00
Gowtham Anandha Babu
912a7a53fc monitor/rfcomm: Add support for NSC frame decoding
Changes made to decode NSC frame in RFCOMM for btmon.
Not able capture the output.
2014-12-04 12:27:41 +02:00
Gowtham Anandha Babu
90b017f247 monitor/rfcomm: Add support for PN frame decoding
Changes made to decode PN frame in RFCOMM for btmon.

      RFCOMM: Unnumbered Info with Header Check (UIH)(0xef)
         Address: 0x01 cr 0 dlci 0x00
         Control: 0xef poll/final 0
         Length: 10
         FCS: 0xaa
         MCC Message type: DLC Parameter Negotiation RSP(0x20)
           Length: 8
           dlci 32 frame_type 0 credit_flow 14 pri 39
           ack_timer 0 frame_size 666 max_retrans 0 credits 7
2014-12-04 12:27:41 +02:00
Gowtham Anandha Babu
f6d8fbe935 monitor/rfcomm: Add support for RLS frame decoding
Changes made to decode RLS frame in RFCOMM for btmon.

      RFCOMM: Unnumbered Info with Header Check (UIH)(0xef)
         Address: 0x03 cr 1 dlci 0x00
         Control: 0xef poll/final 0
         Length: 4
         FCS: 0x70
         MCC Message type: Remote Line Status CMD(0x14)
           Length: 2
           dlci 32 error: 5
2014-12-04 12:27:41 +02:00
Gowtham Anandha Babu
75c1eab025 monitor/rfcomm: Add support for RPN frame decoding
Changes made to decode RPN frame in RFCOMM for btmon.

      RFCOMM: Unnumbered Info with Header Check (UIH)(0xef)
         Address: 0x03 cr 1 dlci 0x00
         Control: 0xef poll/final 0
         Length: 10
         FCS: 0x70
         MCC Message type: Remote Port Negotiation Command CMD(0x24)
           Length: 8
           dlci 32
           br 3 db 2 sb 0 p 0 pt 0 xi 0 xo 0
           rtri 0 rtro 0 rtci 0 rtco 0 xon 17 xoff 19
           pm 0x3f7f
2014-12-04 12:27:41 +02:00
Gowtham Anandha Babu
1765fdda2d monitor/rfcomm.c: Add support for MSC frame decoding
Changes made to decode MSC frame in RFCOMM for btmon.

      RFCOMM: Unnumbered Info with Header Check (UIH)(0xef)
         Address: 0x01 cr 0 dlci 0x00
         Control: 0xef poll/final 0
         Length: 4
         FCS: 0xaa
         MCC Message type: Modem Status Command CMD(0x38)
           Length: 2
           dlci 32
           fc 0 rtc 1 rtr 1 ic 0 dv 1
2014-12-04 12:27:41 +02:00
Szymon Janc
477d9c540b monitor/rfcomm: Fix not printing userdata in UIH frame with credits
> ACL Data RX: Handle 7 flags 0x02 dlen 19              [hci0] 8.723738
      Channel: 65 len 15 [PSM 3 mode 0] {chan 1}
      RFCOMM: Unnumbered Info with Header Check (UIH)(0xef)
         Address: 0x09 cr 0 dlci 0x02
         Control: 0xff poll/final 1
         Length: 10
         FCS: 0x5c
         Credits: 1
        41 54 2b 43 49 4e 44 3d 3f 0d 5c               AT+CIND=?.\
2014-11-17 14:58:13 +02:00
Gowtham Anandha Babu
bbee1ad5c7 monitor/rfcomm: Add support for mcc frame decoding
Changes made to decode MCC frame in RFCOMM for btmon.

      RFCOMM: Unnumbered Info with Header Check (UIH)(0xef)
         Address: 0x01 cr 0 dlci 0x00
         Control: 0xef poll/final 0
         Length: 10
         FCS: 0xaa
         MCC Message type: DLC Parameter Negotiation RSP(0x20)
           Length: 8
        20 e0 27 00 9a 02 00 07 aa                        .'......
2014-11-10 11:01:44 +02:00
Gowtham Anandha Babu
4ebdfcce8c monitor/rfcomm: Add support for UIH frame decoding
Changes made to decode UIH frame in btmon.

In below UIH frame, MCC frame is present, so no credits field is printed.

      RFCOMM: Unnumbered Info with Header Check (UIH)(0xef)
         Address: 0x01 cr 0 dlci 0x00
         Control: 0xef poll/final 0
         Length: 10
         FCS: 0xaa
        81 11 20 e0 27 00 9a 02 00 07 aa                 .. .'......

In this UIH frame, no MCC frame, so credits field is printed.

      RFCOMM: Unnumbered Info with Header Check (UIH)(0xef)
         Address: 0x81 cr 0 dlci 0x20
         Control: 0xff poll/final 1
         Length: 0
         FCS: 0x1e
         Credits : 33
2014-11-10 11:01:44 +02:00
Gowtham Anandha Babu
2f371db645 monitor/rfcomm: Add support for printing RFCOMM hdr
Changes made to decode RFCOMM hdr and print the same.

      RFCOMM: Unnumbered Info with Header Check (UIH)(0xef)
         Address: 0x01 cr 0 dlci 0x00
         Control: 0xef poll/final 0
         Length: 10
         FCS: 0xaa
        81 11 20 e0 27 00 9a 02 00 07 aa                 .. .'......
2014-11-10 11:01:44 +02:00
Gowtham Anandha Babu
3d92c0289c monitor/rfcomm: Add RFCOMM support to btmon
Changes made to add initial code to support RFCOMM frame in btmon

btmon logs:

      RFCOMM: Set Async Balance Mode (SABM) (0x2f)
        01 1c                                            ..

      RFCOMM: Unnumbered Ack (UA)(0x63)
        01 d7                                            ..

      RFCOMM: Unnumbered Info with Header Check (UIH)(0xef)
        15 81 11 20 e0 27 00 9a 02 00 07 aa              ... .'......

      RFCOMM: Disconnect (DISC)(0x43)
        01 fd
2014-11-10 11:01:44 +02:00