l2cap.c (b45b7749fd0a3efec18073ae84f893078d0216d0) | l2cap.c (d7387af38d88a0c8d4e85f60f1b0906d02cd738a) |
---|---|
1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 2346 unchanged lines hidden (view full) --- 2355 if (channel->con_handle != handle) continue; 2356 2357 gap_security_level_t required_level = channel->required_security_level; 2358 2359 log_info("channel %p, cid %04x - state %u: actual %u >= required %u?", channel, channel->local_cid, channel->state, actual_level, required_level); 2360 2361 switch (channel->state){ 2362 case L2CAP_STATE_WAIT_INCOMING_SECURITY_LEVEL_UPDATE: | 1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 2346 unchanged lines hidden (view full) --- 2355 if (channel->con_handle != handle) continue; 2356 2357 gap_security_level_t required_level = channel->required_security_level; 2358 2359 log_info("channel %p, cid %04x - state %u: actual %u >= required %u?", channel, channel->local_cid, channel->state, actual_level, required_level); 2360 2361 switch (channel->state){ 2362 case L2CAP_STATE_WAIT_INCOMING_SECURITY_LEVEL_UPDATE: |
2363 if ((actual_level >= required_level) && 2364 ((gap_get_secure_connections_only_mode() == false) || gap_secure_connection(channel->con_handle))){ | 2363 if (actual_level >= required_level){ |
2365#ifdef ENABLE_L2CAP_ENHANCED_RETRANSMISSION_MODE 2366 // we need to know if ERTM is supported before sending a config response 2367 hci_connection_t * connection = hci_connection_for_handle(channel->con_handle); 2368 if (connection->l2cap_state.information_state != L2CAP_INFORMATION_STATE_DONE){ 2369 connection->l2cap_state.information_state = L2CAP_INFORMATION_STATE_W2_SEND_EXTENDED_FEATURE_REQUEST; 2370 channel->state = L2CAP_STATE_WAIT_INCOMING_EXTENDED_FEATURES; 2371 break; 2372 } --- 223 unchanged lines hidden (view full) --- 2596 && (psm != PSM_SDP) 2597 && (gap_encryption_key_size(handle) == 0) 2598 && (gap_bonded(handle) == false)){ 2599 hci_disconnect_security_block(handle); 2600 return; 2601 } 2602 2603 // alloc structure | 2364#ifdef ENABLE_L2CAP_ENHANCED_RETRANSMISSION_MODE 2365 // we need to know if ERTM is supported before sending a config response 2366 hci_connection_t * connection = hci_connection_for_handle(channel->con_handle); 2367 if (connection->l2cap_state.information_state != L2CAP_INFORMATION_STATE_DONE){ 2368 connection->l2cap_state.information_state = L2CAP_INFORMATION_STATE_W2_SEND_EXTENDED_FEATURE_REQUEST; 2369 channel->state = L2CAP_STATE_WAIT_INCOMING_EXTENDED_FEATURES; 2370 break; 2371 } --- 223 unchanged lines hidden (view full) --- 2595 && (psm != PSM_SDP) 2596 && (gap_encryption_key_size(handle) == 0) 2597 && (gap_bonded(handle) == false)){ 2598 hci_disconnect_security_block(handle); 2599 return; 2600 } 2601 2602 // alloc structure |
2604 // log_info("l2cap_handle_connection_request register channel"); | 2603 gap_security_level_t required_level = service->required_security_level; 2604 if (gap_get_secure_connections_only_mode() && (required_level != LEVEL_0)){ 2605 required_level = LEVEL_4; 2606 } |
2605 l2cap_channel_t * channel = l2cap_create_channel_entry(service->packet_handler, L2CAP_CHANNEL_TYPE_CLASSIC, hci_connection->address, BD_ADDR_TYPE_ACL, | 2607 l2cap_channel_t * channel = l2cap_create_channel_entry(service->packet_handler, L2CAP_CHANNEL_TYPE_CLASSIC, hci_connection->address, BD_ADDR_TYPE_ACL, |
2606 psm, service->mtu, service->required_security_level); | 2608 psm, service->mtu, required_level); |
2607 if (!channel){ 2608 // 0x0004 No resources available 2609 l2cap_register_signaling_response(handle, CONNECTION_REQUEST, sig_id, source_cid, 0x0004); 2610 return; 2611 } 2612 2613 channel->con_handle = handle; 2614 channel->remote_cid = source_cid; --- 1694 unchanged lines hidden --- | 2609 if (!channel){ 2610 // 0x0004 No resources available 2611 l2cap_register_signaling_response(handle, CONNECTION_REQUEST, sig_id, source_cid, 0x0004); 2612 return; 2613 } 2614 2615 channel->con_handle = handle; 2616 channel->remote_cid = source_cid; --- 1694 unchanged lines hidden --- |