Bluetooth: controller: Fix slave sending reject_ext_ind

Fix slave implementation to initiate reject_ext_ind if peer
supports reject_ext_ind.

This fixes:
TP/SEC/SLA/BV-11-C [Slave Sending Reject_Ind_Ext]
conformance test in LL.TS.5.0.0.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2017-07-21 10:49:19 +02:00 committed by Johan Hedberg
commit b0f3944e90
2 changed files with 48 additions and 9 deletions

View file

@ -2105,6 +2105,9 @@ isr_rx_conn_pkt_ctrl(struct radio_pdu_node_rx *radio_pdu_node_rx,
/* AND the feature set to get Feature USED */
_radio.conn_curr->llcp_features &= feat_get(&req->features[0]);
/* features exchanged */
_radio.conn_curr->common.fex_valid = 1;
feature_rsp_send(_radio.conn_curr);
}
break;
@ -2118,6 +2121,9 @@ isr_rx_conn_pkt_ctrl(struct radio_pdu_node_rx *radio_pdu_node_rx,
/* AND the feature set to get Feature USED */
_radio.conn_curr->llcp_features &= feat_get(&rsp->features[0]);
/* features exchanged */
_radio.conn_curr->common.fex_valid = 1;
/* enqueue the feature resp */
*rx_enqueue = 1;
@ -5960,6 +5966,37 @@ static inline void event_ch_map_prep(struct connection *conn,
}
#if defined(CONFIG_BLUETOOTH_CONTROLLER_LE_ENC)
static inline void event_enc_reject_prep(struct connection *conn,
struct pdu_data *pdu)
{
if (conn->common.fex_valid &&
(conn->llcp_features & BIT(BT_LE_FEAT_BIT_EXT_REJ_IND))) {
struct pdu_data_llctrl_reject_ext_ind *p;
pdu->payload.llctrl.opcode =
PDU_DATA_LLCTRL_TYPE_REJECT_EXT_IND;
p = (void *)&pdu->payload.llctrl.ctrldata.reject_ext_ind;
p->reject_opcode = PDU_DATA_LLCTRL_TYPE_ENC_REQ;
p->error_code = conn->llcp.encryption.error_code;
pdu->len = sizeof(struct pdu_data_llctrl_reject_ext_ind);
} else {
struct pdu_data_llctrl_reject_ind *p;
pdu->payload.llctrl.opcode = PDU_DATA_LLCTRL_TYPE_REJECT_IND;
p = (void *)&pdu->payload.llctrl.ctrldata.reject_ind;
p->error_code = conn->llcp.encryption.error_code;
pdu->len = sizeof(struct pdu_data_llctrl_reject_ind);
}
pdu->len += offsetof(struct pdu_data_llctrl, ctrldata);
conn->llcp.encryption.error_code = 0;
}
static inline void event_enc_prep(struct connection *conn)
{
struct radio_pdu_node_tx *node_tx;
@ -6018,15 +6055,7 @@ static inline void event_enc_prep(struct connection *conn)
/* place the reject ind packet as next in tx queue */
if (conn->llcp.encryption.error_code) {
pdu_ctrl_tx->len =
offsetof(struct pdu_data_llctrl, ctrldata) +
sizeof(struct pdu_data_llctrl_reject_ind);
pdu_ctrl_tx->payload.llctrl.opcode =
PDU_DATA_LLCTRL_TYPE_REJECT_IND;
pdu_ctrl_tx->payload.llctrl.ctrldata.reject_ind.error_code =
conn->llcp.encryption.error_code;
conn->llcp.encryption.error_code = 0;
event_enc_reject_prep(conn, pdu_ctrl_tx);
}
/* place the start enc req packet as next in tx queue */
else {
@ -8444,6 +8473,7 @@ u32_t radio_adv_enable(u16_t interval, u8_t chan_map, u8_t filter_policy,
conn->role = 1;
conn->connect_expire = 6;
conn->common.fex_valid = 0;
conn->slave.latency_enabled = 0;
conn->slave.latency_cancel = 0;
conn->slave.window_widening_prepare_us = 0;
@ -8887,6 +8917,7 @@ u32_t radio_connect_enable(u8_t adv_addr_type, u8_t *adv_addr, u16_t interval,
conn->role = 0;
conn->connect_expire = 6;
conn->common.fex_valid = 0;
conn->master.terminate_ack = 0;
conn_interval_us =
(u32_t)_radio.scanner.conn_interval * 1250;

View file

@ -91,14 +91,22 @@ struct connection {
#endif /* CONFIG_BLUETOOTH_CONTROLLER_LE_PING */
union {
struct {
u8_t reserved:5;
u8_t fex_valid:1;
} common;
struct {
u8_t terminate_ack:1;
u8_t rfu:4;
u8_t fex_valid:1;
} master;
struct {
u8_t latency_enabled:1;
u8_t latency_cancel:1;
u8_t sca:3;
u8_t fex_valid:1;
u32_t window_widening_periodic_us;
u32_t window_widening_max_us;
u32_t window_widening_prepare_us;