l2cap.c (a536dfcc0cc0eb4d5bd5adb4f8c62edc50e38e9a) l2cap.c (da9b76deb1b84f3e066f2d7d22ad14357f918e37)
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

--- 1529 unchanged lines hidden (view full) ---

1538 channelStateVarClearFlag(channel, L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP);
1539 if (channel->state_var & L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_CONT) {
1540 flags = 1;
1541 } else {
1542 channelStateVarSetFlag(channel, L2CAP_CHANNEL_STATE_VAR_SENT_CONF_RSP);
1543 }
1544 if (channel->state_var & L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_INVALID){
1545 channelStateVarClearFlag(channel, L2CAP_CHANNEL_STATE_VAR_SENT_CONF_RSP);
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

--- 1529 unchanged lines hidden (view full) ---

1538 channelStateVarClearFlag(channel, L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP);
1539 if (channel->state_var & L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_CONT) {
1540 flags = 1;
1541 } else {
1542 channelStateVarSetFlag(channel, L2CAP_CHANNEL_STATE_VAR_SENT_CONF_RSP);
1543 }
1544 if (channel->state_var & L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_INVALID){
1545 channelStateVarClearFlag(channel, L2CAP_CHANNEL_STATE_VAR_SENT_CONF_RSP);
1546 l2cap_send_signaling_packet(channel->con_handle, CONFIGURE_RESPONSE, channel->remote_sig_id, channel->remote_cid, flags, L2CAP_CONF_RESULT_UNKNOWN_OPTIONS, 0, NULL);
1546 l2cap_send_signaling_packet(channel->con_handle, CONFIGURE_RESPONSE, channel->remote_sig_id, channel->remote_cid, flags, L2CAP_CONF_RESULT_UNKNOWN_OPTIONS, 1, &channel->unknown_option);
1547#ifdef ENABLE_L2CAP_ENHANCED_RETRANSMISSION_MODE
1548 } else if (channel->state_var & L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_REJECTED){
1549 channelStateVarClearFlag(channel, L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_REJECTED);
1550 channelStateVarClearFlag(channel, L2CAP_CHANNEL_STATE_VAR_SENT_CONF_RSP);
1551 uint16_t options_size = l2cap_setup_options_ertm_response(channel, config_options);
1552 l2cap_send_signaling_packet(channel->con_handle, CONFIGURE_RESPONSE, channel->remote_sig_id, channel->remote_cid, flags, L2CAP_CONF_RESULT_UNACCEPTABLE_PARAMETERS, options_size, &config_options);
1553 } else if (channel->state_var & L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_ERTM){
1554 channelStateVarClearFlag(channel, L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_ERTM);

--- 1179 unchanged lines hidden (view full) ---

2734 }
2735 }
2736 if (option_type == L2CAP_CONFIG_OPTION_TYPE_FRAME_CHECK_SEQUENCE && length == 1){
2737 use_fcs = command[pos];
2738 }
2739#endif
2740 // check for unknown options
2741 if ((option_hint == 0) && ((option_type < L2CAP_CONFIG_OPTION_TYPE_MAX_TRANSMISSION_UNIT) || (option_type > L2CAP_CONFIG_OPTION_TYPE_EXTENDED_WINDOW_SIZE))){
1547#ifdef ENABLE_L2CAP_ENHANCED_RETRANSMISSION_MODE
1548 } else if (channel->state_var & L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_REJECTED){
1549 channelStateVarClearFlag(channel, L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_REJECTED);
1550 channelStateVarClearFlag(channel, L2CAP_CHANNEL_STATE_VAR_SENT_CONF_RSP);
1551 uint16_t options_size = l2cap_setup_options_ertm_response(channel, config_options);
1552 l2cap_send_signaling_packet(channel->con_handle, CONFIGURE_RESPONSE, channel->remote_sig_id, channel->remote_cid, flags, L2CAP_CONF_RESULT_UNACCEPTABLE_PARAMETERS, options_size, &config_options);
1553 } else if (channel->state_var & L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_ERTM){
1554 channelStateVarClearFlag(channel, L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_ERTM);

--- 1179 unchanged lines hidden (view full) ---

2734 }
2735 }
2736 if (option_type == L2CAP_CONFIG_OPTION_TYPE_FRAME_CHECK_SEQUENCE && length == 1){
2737 use_fcs = command[pos];
2738 }
2739#endif
2740 // check for unknown options
2741 if ((option_hint == 0) && ((option_type < L2CAP_CONFIG_OPTION_TYPE_MAX_TRANSMISSION_UNIT) || (option_type > L2CAP_CONFIG_OPTION_TYPE_EXTENDED_WINDOW_SIZE))){
2742 log_info("l2cap cid %u, unknown options", channel->local_cid);
2742 log_info("l2cap cid %u, unknown option 0x%02x", channel->local_cid, option_type);
2743 channel->unknown_option = option_type;
2743 channelStateVarSetFlag(channel, L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_INVALID);
2744 }
2745 pos += length;
2746 }
2747
2748#ifdef ENABLE_L2CAP_ENHANCED_RETRANSMISSION_MODE
2749 // "FCS" has precedence over "No FCS"
2750 uint8_t update = channel->fcs_option || use_fcs;

--- 41 unchanged lines hidden (view full) ---

2792 break;
2793 default:
2794 break;
2795 }
2796 }
2797
2798 // check for unknown options
2799 if (option_hint == 0 && (option_type < L2CAP_CONFIG_OPTION_TYPE_MAX_TRANSMISSION_UNIT || option_type > L2CAP_CONFIG_OPTION_TYPE_EXTENDED_WINDOW_SIZE)){
2744 channelStateVarSetFlag(channel, L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_INVALID);
2745 }
2746 pos += length;
2747 }
2748
2749#ifdef ENABLE_L2CAP_ENHANCED_RETRANSMISSION_MODE
2750 // "FCS" has precedence over "No FCS"
2751 uint8_t update = channel->fcs_option || use_fcs;

--- 41 unchanged lines hidden (view full) ---

2793 break;
2794 default:
2795 break;
2796 }
2797 }
2798
2799 // check for unknown options
2800 if (option_hint == 0 && (option_type < L2CAP_CONFIG_OPTION_TYPE_MAX_TRANSMISSION_UNIT || option_type > L2CAP_CONFIG_OPTION_TYPE_EXTENDED_WINDOW_SIZE)){
2800 log_info("l2cap cid %u, unknown options", channel->local_cid);
2801 log_info("l2cap cid %u, unknown option 0x%02x", channel->local_cid, option_type);
2802 channel->unknown_option = option_type;
2801 channelStateVarSetFlag(channel, L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_INVALID);
2802 }
2803
2804 pos += length;
2805 }
2806#else
2807 UNUSED(channel); // ok: no code
2808 UNUSED(result); // ok: no code

--- 1486 unchanged lines hidden ---
2803 channelStateVarSetFlag(channel, L2CAP_CHANNEL_STATE_VAR_SEND_CONF_RSP_INVALID);
2804 }
2805
2806 pos += length;
2807 }
2808#else
2809 UNUSED(channel); // ok: no code
2810 UNUSED(result); // ok: no code

--- 1486 unchanged lines hidden ---