@@ -4859,6 +4859,128 @@ ZTEST(periph_loc_no_param_req, test_conn_update_periph_loc_disallowed_no_param_r
4859
4859
}
4860
4860
#endif
4861
4861
4862
+ /*
4863
+ * Central-initiated Connection Update procedure.
4864
+ * Peripheral receives invalid Connection Update parameters.
4865
+ *
4866
+ * +-----+ +-------+ +-----+
4867
+ * | UT | | LL_P | | LT |
4868
+ * +-----+ +-------+ +-----+
4869
+ * | | |
4870
+ * | | LL_CONNECTION_UPDATE_IND |
4871
+ * | |<--------------------------|
4872
+ * | | |
4873
+ * ~~~~~~~~~~~~~~~~~~ TERMINATE CONNECTION ~~~~~~~~~~~~~~~~~
4874
+ * | | |
4875
+ */
4876
+ ZTEST (periph_rem_invalid , test_conn_update_periph_rem_invalid_param )
4877
+ {
4878
+ uint16_t interval ;
4879
+
4880
+ /* Role */
4881
+ test_set_role (& conn , BT_HCI_ROLE_PERIPHERAL );
4882
+
4883
+ /* Connect */
4884
+ ull_cp_state_set (& conn , ULL_CP_CONNECTED );
4885
+
4886
+ /* Prepare */
4887
+ event_prepare (& conn );
4888
+
4889
+ /* Rx */
4890
+ interval = conn_update_ind .interval ;
4891
+ conn_update_ind .interval = 0U ;
4892
+ conn_update_ind .instant = event_counter (& conn ) + 6U ;
4893
+ lt_tx (LL_CONNECTION_UPDATE_IND , & conn , & conn_update_ind );
4894
+
4895
+ /* Done */
4896
+ event_done (& conn );
4897
+
4898
+ /* Termination 'triggered' */
4899
+ zassert_equal (conn .llcp_terminate .reason_final , BT_HCI_ERR_INVALID_LL_PARAM ,
4900
+ "Terminate reason %d" , conn .llcp_terminate .reason_final );
4901
+
4902
+ /* Clear termination flag for subsequent test cycle */
4903
+ conn .llcp_terminate .reason_final = 0 ;
4904
+
4905
+ /* Restore interval for other tests */
4906
+ conn_update_ind .interval = interval ;
4907
+ }
4908
+
4909
+ #if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ )
4910
+ /*
4911
+ * Peripheral-initiated Connection Parameters Request procedure.
4912
+ * Peripheral requests change in LE connection parameters, central’s Host accepts.
4913
+ * Peripheral receives invalid Connection Update parameters.
4914
+ *
4915
+ * +-----+ +-------+ +-----+
4916
+ * | UT | | LL_P | | LT |
4917
+ * +-----+ +-------+ +-----+
4918
+ * | | |
4919
+ * | LE Connection Update | |
4920
+ * |-------------------------->| |
4921
+ * | | LL_CONNECTION_PARAM_REQ |
4922
+ * | |-------------------------->|
4923
+ * | | |
4924
+ * | | LL_CONNECTION_UPDATE_IND |
4925
+ * | |<--------------------------|
4926
+ * | | |
4927
+ * ~~~~~~~~~~~~~~~~~~ TERMINATE CONNECTION ~~~~~~~~~~~~~~~~~
4928
+ * | | |
4929
+ */
4930
+ ZTEST (periph_rem_invalid , test_conn_param_req_periph_rem_invalid_param )
4931
+ {
4932
+ struct node_tx * tx ;
4933
+ uint16_t interval ;
4934
+ uint8_t err ;
4935
+
4936
+ /* Role */
4937
+ test_set_role (& conn , BT_HCI_ROLE_PERIPHERAL );
4938
+
4939
+ /* Connect */
4940
+ ull_cp_state_set (& conn , ULL_CP_CONNECTED );
4941
+
4942
+ /* Initiate a Connection Parameter Request Procedure */
4943
+ err = ull_cp_conn_update (& conn , INTVL_MIN , INTVL_MAX , LATENCY , TIMEOUT , NULL );
4944
+ zassert_equal (err , BT_HCI_ERR_SUCCESS );
4945
+
4946
+ /* Prepare */
4947
+ event_prepare (& conn );
4948
+ conn_param_req .reference_conn_event_count = event_counter (& conn );
4949
+
4950
+ /* Tx Queue should have one LL Control PDU */
4951
+ lt_rx (LL_CONNECTION_PARAM_REQ , & conn , & tx , & conn_param_req );
4952
+ lt_rx_q_is_empty (& conn );
4953
+
4954
+ /* Done */
4955
+ event_done (& conn );
4956
+
4957
+ /* Release Tx */
4958
+ ull_cp_release_tx (& conn , tx );
4959
+
4960
+ /* Prepare */
4961
+ event_prepare (& conn );
4962
+
4963
+ /* Rx */
4964
+ interval = conn_update_ind .interval ;
4965
+ conn_update_ind .interval = 0U ;
4966
+ conn_update_ind .instant = event_counter (& conn ) + 6U ;
4967
+ lt_tx (LL_CONNECTION_UPDATE_IND , & conn , & conn_update_ind );
4968
+
4969
+ /* Done */
4970
+ event_done (& conn );
4971
+
4972
+ /* Termination 'triggered' */
4973
+ zassert_equal (conn .llcp_terminate .reason_final , BT_HCI_ERR_INVALID_LL_PARAM ,
4974
+ "Terminate reason %d" , conn .llcp_terminate .reason_final );
4975
+
4976
+ /* Clear termination flag for subsequent test cycle */
4977
+ conn .llcp_terminate .reason_final = 0 ;
4978
+
4979
+ /* Restore interval for other tests */
4980
+ conn_update_ind .interval = interval ;
4981
+ }
4982
+ #endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
4983
+
4862
4984
#if defined(CONFIG_BT_CTLR_CONN_PARAM_REQ )
4863
4985
ZTEST_SUITE (central_loc , NULL , NULL , conn_update_setup , NULL , NULL );
4864
4986
ZTEST_SUITE (central_rem , NULL , NULL , conn_update_setup , NULL , NULL );
@@ -4870,3 +4992,5 @@ ZTEST_SUITE(central_rem_no_param_req, NULL, NULL, conn_update_setup, NULL, NULL)
4870
4992
ZTEST_SUITE (periph_loc_no_param_req , NULL , NULL , conn_update_setup , NULL , NULL );
4871
4993
ZTEST_SUITE (periph_rem_no_param_req , NULL , NULL , conn_update_setup , NULL , NULL );
4872
4994
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
4995
+
4996
+ ZTEST_SUITE (periph_rem_invalid , NULL , NULL , conn_update_setup , NULL , NULL );
0 commit comments