-
Notifications
You must be signed in to change notification settings - Fork 406
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
Conversation
@sjanc PTAL |
a291abb
to
bb87755
Compare
There was a problem hiding this 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?
nimble/host/src/ble_gatts.c
Outdated
@@ -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; |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
bb87755
to
0b5aba2
Compare
0b5aba2
to
ccf0720
Compare
Add Reserved For Future use bits check(needed for PTS)