Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nimble/gatts: Add check for RFU bits #1660

Merged
merged 1 commit into from
Dec 22, 2023

Conversation

Roshan23699
Copy link
Contributor

Add Reserved For Future use bits check(needed for PTS)

@Roshan23699
Copy link
Contributor Author

@sjanc PTAL

@Roshan23699 Roshan23699 force-pushed the bugfix/rfu_check_on_csfs branch 2 times, most recently from a291abb to bb87755 Compare December 13, 2023 04:05
Copy link
Contributor

@sjanc sjanc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KKopyscinski could you have a look at ble_gatts_peer_cl_sup_feat_update usage?

there is something fishy with that code, firstly it probably shouldn't be in public gatt header, secondly, returned value is used at ATT code while it return BLE_HS codes

This should be cleaned up, maybe simply returning BLE_ATT_ERR_UNLIKELY and/or BLE_ATT_ERR_INSUFFICIENT_RES instead of BLE_HS would be enough?

@@ -1587,6 +1587,8 @@ ble_gatts_peer_cl_sup_feat_update(uint16_t conn_handle, struct os_mbuf *om)
int rc = 0;
int feat_idx = 0;
int i;
/* decimal(7) = binary(0000 0111) */
uint8_t rfu_mask = 7;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a define (preferably defined after BLE_SVC_GATT_CLI_SUP_FEAT_* defines)
eg

#define BLE_SVC_GATT_CLI_SUP_FEAT_MASK (BLE_SVC_GATT_CLI_SUP_FEAT_ROBUST_CATCHING_BIT | BLE_SVC_GATT_CLI_SUP_FEAT_EATT_BIT | BLE_SVC_GATT_CLI_SUP_FEAT_MULT_NTF_BIT)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This, macro I defined just below BLE_GATT_CHR_CLI_SUP_FEAT_SZ in ble_gatt_priv.h file.
I cannot define this in gatt service file(ble_svc_gatt.h) as the services are not accessible in src/host.

@@ -1618,10 +1620,15 @@ ble_gatts_peer_cl_sup_feat_update(uint16_t conn_handle, struct os_mbuf *om)
*/
if (conn->bhc_gatt_svr.peer_cl_sup_feat[feat_idx] >
om->om_data[i]) {
rc = BLE_HS_EINVAL;
rc = BLE_ATT_ERR_VALUE_NOT_ALLOWED;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this looks odd as now this function return either BLE_HS_ errors or BLE_ATT_ERR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning all att errors should work. Could you take a look again? I converted all the HS errors to ATT.

@Roshan23699 Roshan23699 force-pushed the bugfix/rfu_check_on_csfs branch from bb87755 to 0b5aba2 Compare December 20, 2023 09:13
@Roshan23699 Roshan23699 force-pushed the bugfix/rfu_check_on_csfs branch from 0b5aba2 to ccf0720 Compare December 22, 2023 06:15
@sjanc sjanc merged commit 64067f5 into apache:master Dec 22, 2023
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants