github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/l2cap.txt (about) 1 # Copyright 2020 syzkaller project authors. All rights reserved. 2 # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. 3 4 include <net/bluetooth/bluetooth.h> 5 include <net/bluetooth/hci_sock.h> 6 include <net/bluetooth/l2cap.h> 7 8 # The following constants were removed from upstream in e7b02296fb40 ("Bluetooth: Remove BT_HS"). 9 # TODO: delete them together with the corresponding structs once they are removed from LTS kernels. 10 define L2CAP_CREATE_CHAN_REQ 0x0c 11 define L2CAP_CREATE_CHAN_RSP 0x0d 12 define L2CAP_MOVE_CHAN_REQ 0x0e 13 define L2CAP_MOVE_CHAN_RSP 0x0f 14 define L2CAP_MOVE_CHAN_CFM 0x10 15 define L2CAP_MOVE_CHAN_CFM_RSP 0x11 16 17 l2cap_hdr_un [ 18 l2cap_cid_signaling l2cap_hdr_t[L2CAP_CID_SIGNALING, array[l2cap_cid_signaling_un]] 19 l2cap_cid_le_signaling l2cap_hdr_t[L2CAP_CID_LE_SIGNALING, l2cap_cid_le_signaling_un] 20 ] [varlen] 21 22 l2cap_cid_signaling_un [ 23 l2cap_cmd_rej_unk l2cap_cmd_hdr_t[L2CAP_COMMAND_REJ, l2cap_cmd_rej_unk] 24 l2cap_conn_req l2cap_cmd_hdr_t[L2CAP_CONN_REQ, l2cap_conn_req] 25 l2cap_conn_rsp l2cap_cmd_hdr_t[L2CAP_CONN_RSP, l2cap_conn_rsp] 26 l2cap_conf_req l2cap_cmd_hdr_t[L2CAP_CONF_REQ, l2cap_conf_req] 27 l2cap_conf_rsp l2cap_cmd_hdr_t[L2CAP_CONF_RSP, l2cap_conf_rsp] 28 l2cap_create_chan_req l2cap_cmd_hdr_t[L2CAP_CREATE_CHAN_REQ, l2cap_create_chan_req] 29 l2cap_create_chan_rsp l2cap_cmd_hdr_t[L2CAP_CREATE_CHAN_RSP, l2cap_create_chan_rsp] 30 l2cap_disconn_req l2cap_cmd_hdr_t[L2CAP_DISCONN_REQ, l2cap_disconn_req] 31 l2cap_disconn_rsp l2cap_cmd_hdr_t[L2CAP_DISCONN_RSP, l2cap_disconn_rsp] 32 l2cap_info_req l2cap_cmd_hdr_t[L2CAP_INFO_REQ, l2cap_info_req] 33 l2cap_info_rsp l2cap_cmd_hdr_t[L2CAP_INFO_RSP, l2cap_info_rsp] 34 l2cap_move_chan_cfm l2cap_cmd_hdr_t[L2CAP_MOVE_CHAN_CFM, l2cap_move_chan_cfm] 35 l2cap_move_chan_cfm_rsp l2cap_cmd_hdr_t[L2CAP_MOVE_CHAN_CFM_RSP, l2cap_move_chan_cfm_rsp] 36 l2cap_move_chan_req l2cap_cmd_hdr_t[L2CAP_MOVE_CHAN_REQ, l2cap_move_chan_req] 37 l2cap_move_chan_rsp l2cap_cmd_hdr_t[L2CAP_MOVE_CHAN_RSP, l2cap_move_chan_rsp] 38 ] [varlen] 39 40 l2cap_cid_le_signaling_un [ 41 l2cap_cmd_rej_unk l2cap_cmd_hdr_t[L2CAP_COMMAND_REJ, l2cap_cmd_rej_unk] 42 l2cap_conn_param_update_req l2cap_cmd_hdr_t[L2CAP_CONN_PARAM_UPDATE_REQ, l2cap_conn_param_update_req] 43 l2cap_conn_param_update_rsp l2cap_cmd_hdr_t[L2CAP_CONN_PARAM_UPDATE_RSP, l2cap_conn_param_update_rsp] 44 l2cap_disconn_req l2cap_cmd_hdr_t[L2CAP_DISCONN_REQ, l2cap_disconn_req] 45 l2cap_disconn_rsp l2cap_cmd_hdr_t[L2CAP_DISCONN_RSP, l2cap_disconn_rsp] 46 l2cap_ecred_conn_req l2cap_cmd_hdr_t[L2CAP_ECRED_CONN_REQ, l2cap_ecred_conn_req] 47 l2cap_ecred_conn_rsp l2cap_cmd_hdr_t[L2CAP_ECRED_CONN_RSP, l2cap_ecred_conn_rsp] 48 l2cap_ecred_reconf_req l2cap_cmd_hdr_t[L2CAP_ECRED_RECONF_REQ, l2cap_ecred_reconf_req] 49 l2cap_ecred_reconf_rsp l2cap_cmd_hdr_t[L2CAP_ECRED_RECONF_RSP, l2cap_ecred_reconf_rsp] 50 l2cap_le_conn_req l2cap_cmd_hdr_t[L2CAP_LE_CONN_REQ, l2cap_le_conn_req] 51 l2cap_le_conn_rsp l2cap_cmd_hdr_t[L2CAP_LE_CONN_RSP, l2cap_le_conn_rsp] 52 l2cap_le_credits l2cap_cmd_hdr_t[L2CAP_LE_CREDITS, l2cap_le_credits] 53 ] [varlen] 54 55 type l2cap_hdr_t[CID, PAYLOAD] { 56 hdr l2cap_hdr[CID] 57 payload PAYLOAD 58 } [packed] 59 60 type l2cap_hdr[CID] { 61 len bytesize[l2cap_hdr_t:payload, int16] 62 cid const[CID, int16] 63 } [packed] 64 65 type l2cap_cmd_hdr_t[CODE, PAYLOAD] { 66 hdr l2cap_cmd_hdr[CODE] 67 payload PAYLOAD 68 } [packed] 69 70 type l2cap_cmd_hdr[CODE] { 71 code const[CODE, int8] 72 ident int8 73 len bytesize[l2cap_cmd_hdr_t:payload, int16] 74 } [packed] 75 76 l2cap_cmd_rej_unk { 77 reason int16 78 } [packed] 79 80 l2cap_conf_rfc { 81 mode flags[l2cap_rfc_mode, int8] 82 txwin_size int8 83 max_transmit int8 84 retrans_timeout int16 85 monitor_timeout int16 86 max_pdu_size int16 87 } [packed] 88 89 l2cap_rfc_mode = L2CAP_MODE_BASIC, L2CAP_MODE_RETRANS, L2CAP_MODE_FLOWCTL, L2CAP_MODE_ERTM, L2CAP_MODE_STREAMING 90 91 l2cap_conf_efs { 92 id int8 93 stype flags[l2cap_serv_type, int8] 94 msdu int16 95 sdu_itime int32 96 acc_lat int32 97 flush_to int32 98 } [packed] 99 100 l2cap_serv_type = L2CAP_SERV_NOTRAFIC, L2CAP_SERV_BESTEFFORT, L2CAP_SERV_GUARANTEED 101 102 type l2cap_conf_opt[TYPE, VAL] { 103 type const[TYPE, int8] 104 len bytesize[val, int8] 105 val VAL 106 } [packed] 107 108 l2cap_conf_opt_un [ 109 l2cap_conf_rfc l2cap_conf_opt[L2CAP_CONF_RFC, l2cap_conf_rfc] 110 l2cap_conf_efs l2cap_conf_opt[L2CAP_CONF_EFS, l2cap_conf_efs] 111 l2cap_conf_mtu l2cap_conf_opt[L2CAP_CONF_MTU, int16] 112 l2cap_conf_flushto l2cap_conf_opt[L2CAP_CONF_FLUSH_TO, int16] 113 l2cap_conf_fcs l2cap_conf_opt[L2CAP_CONF_FCS, flags[l2cap_fcs_type, int8]] 114 l2cap_conf_ews l2cap_conf_opt[L2CAP_CONF_EWS, int16] 115 ] [varlen] 116 117 l2cap_fcs_type = L2CAP_FCS_NONE, L2CAP_FCS_CRC16 118 119 l2cap_conf_req { 120 dcid int16 121 flags int16 122 data array[l2cap_conf_opt_un] 123 } [packed] 124 125 l2cap_conf_rsp { 126 scid int16 127 flags int16 128 result int16 129 data array[l2cap_conf_opt_un] 130 } [packed] 131 132 l2cap_conn_param_update_req { 133 min int16 134 max int16 135 latency int16 136 to_multiplier int16 137 } [packed] 138 139 l2cap_conn_param_update_rsp { 140 result int16 141 } [packed] 142 143 l2cap_conn_req { 144 psm int16 145 scid int16 146 } [packed] 147 148 l2cap_conn_rsp { 149 dcid int16 150 scid int16 151 result int16 152 status int16 153 } [packed] 154 155 l2cap_conninfo { 156 hci_handle int16 157 dev_class array[int8, 3] 158 } 159 160 l2cap_create_chan_req { 161 psm int16 162 scid int16 163 amp_id int8 164 } [packed] 165 166 l2cap_create_chan_rsp { 167 dcid int16 168 scid int16 169 result int16 170 status int16 171 } [packed] 172 173 l2cap_disconn_req { 174 dcid int16 175 scid int16 176 } [packed] 177 178 l2cap_disconn_rsp { 179 dcid int16 180 scid int16 181 } [packed] 182 183 l2cap_ecred_conn_req { 184 psm int16 185 mtu int16 186 mps int16 187 credits int16 188 scid array[int16] 189 } [packed] 190 191 l2cap_ecred_conn_rsp { 192 mtu int16 193 mps int16 194 credits int16 195 result int16 196 dcid array[int16] 197 } [packed] 198 199 l2cap_ecred_reconf_req { 200 mtu int16 201 mps int16 202 scid array[int16] 203 } [packed] 204 205 l2cap_ecred_reconf_rsp { 206 result int16 207 } [packed] 208 209 l2cap_info_req { 210 type int16 211 } [packed] 212 213 l2cap_info_rsp { 214 type int16 215 result int16 216 data array[int8] 217 } [packed] 218 219 l2cap_le_conn_req { 220 psm int16 221 scid int16 222 mtu int16 223 mps int16 224 credits int16 225 } [packed] 226 227 l2cap_le_conn_rsp { 228 dcid int16 229 mtu int16 230 mps int16 231 credits int16 232 result int16 233 } [packed] 234 235 l2cap_le_credits { 236 cid int16 237 credits int16 238 } [packed] 239 240 l2cap_move_chan_cfm { 241 icid int16 242 result int16 243 } [packed] 244 245 l2cap_move_chan_cfm_rsp { 246 icid int16 247 } [packed] 248 249 l2cap_move_chan_req { 250 icid int16 251 dest_amp_id int8 252 } [packed] 253 254 l2cap_move_chan_rsp { 255 icid int16 256 result int16 257 } [packed] 258 259 l2cap_options { 260 omtu int16 261 imtu int16 262 flush_to int16 263 mode int8 264 fcs int8 265 max_tx int8 266 txwin_size int16 267 }