Bluetooth: Mesh: Take advantage of BT_MESH_TTL_MAX macro
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
a2a46e66e1
commit
e70f6dfc88
1 changed files with 6 additions and 6 deletions
|
@ -716,7 +716,7 @@ static void default_ttl_set(struct bt_mesh_model *model,
|
||||||
|
|
||||||
if (!cfg) {
|
if (!cfg) {
|
||||||
BT_WARN("No Configuration Server context available");
|
BT_WARN("No Configuration Server context available");
|
||||||
} else if (buf->data[0] <= 0x7f && buf->data[0] != 0x01) {
|
} else if (buf->data[0] <= BT_MESH_TTL_MAX && buf->data[0] != 0x01) {
|
||||||
cfg->default_ttl = buf->data[0];
|
cfg->default_ttl = buf->data[0];
|
||||||
} else {
|
} else {
|
||||||
BT_WARN("Prohibited Default TTL value 0x%02x", buf->data[0]);
|
BT_WARN("Prohibited Default TTL value 0x%02x", buf->data[0]);
|
||||||
|
@ -1008,7 +1008,7 @@ static void mod_pub_set(struct bt_mesh_model *model,
|
||||||
pub_app_idx &= BIT_MASK(12);
|
pub_app_idx &= BIT_MASK(12);
|
||||||
|
|
||||||
pub_ttl = net_buf_simple_pull_u8(buf);
|
pub_ttl = net_buf_simple_pull_u8(buf);
|
||||||
if (pub_ttl > 0x7f && pub_ttl != BT_MESH_TTL_DEFAULT) {
|
if (pub_ttl > BT_MESH_TTL_MAX && pub_ttl != BT_MESH_TTL_DEFAULT) {
|
||||||
BT_ERR("Invalid TTL value 0x%02x", pub_ttl);
|
BT_ERR("Invalid TTL value 0x%02x", pub_ttl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1114,7 +1114,7 @@ static void mod_pub_va_set(struct bt_mesh_model *model,
|
||||||
cred_flag = ((pub_app_idx >> 12) & BIT_MASK(1));
|
cred_flag = ((pub_app_idx >> 12) & BIT_MASK(1));
|
||||||
pub_app_idx &= BIT_MASK(12);
|
pub_app_idx &= BIT_MASK(12);
|
||||||
pub_ttl = net_buf_simple_pull_u8(buf);
|
pub_ttl = net_buf_simple_pull_u8(buf);
|
||||||
if (pub_ttl > 0x7f && pub_ttl != BT_MESH_TTL_DEFAULT) {
|
if (pub_ttl > BT_MESH_TTL_MAX && pub_ttl != BT_MESH_TTL_DEFAULT) {
|
||||||
BT_ERR("Invalid TTL value 0x%02x", pub_ttl);
|
BT_ERR("Invalid TTL value 0x%02x", pub_ttl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2733,7 +2733,7 @@ static void heartbeat_pub_set(struct bt_mesh_model *model,
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (param->ttl > 0x7f && param->ttl != BT_MESH_TTL_DEFAULT) {
|
if (param->ttl > BT_MESH_TTL_MAX && param->ttl != BT_MESH_TTL_DEFAULT) {
|
||||||
BT_ERR("Invalid TTL value 0x%02x", param->ttl);
|
BT_ERR("Invalid TTL value 0x%02x", param->ttl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2882,7 +2882,7 @@ static void heartbeat_sub_set(struct bt_mesh_model *model,
|
||||||
} else {
|
} else {
|
||||||
cfg->hb_sub.src = sub_src;
|
cfg->hb_sub.src = sub_src;
|
||||||
cfg->hb_sub.dst = sub_dst;
|
cfg->hb_sub.dst = sub_dst;
|
||||||
cfg->hb_sub.min_hops = 0x7f;
|
cfg->hb_sub.min_hops = BT_MESH_TTL_MAX;
|
||||||
cfg->hb_sub.max_hops = 0;
|
cfg->hb_sub.max_hops = 0;
|
||||||
cfg->hb_sub.count = 0;
|
cfg->hb_sub.count = 0;
|
||||||
period_ms = hb_pwr2(sub_period, 1) * 1000;
|
period_ms = hb_pwr2(sub_period, 1) * 1000;
|
||||||
|
@ -2997,7 +2997,7 @@ static bool conf_is_valid(struct bt_mesh_cfg *cfg)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cfg->default_ttl > 0x7f) {
|
if (cfg->default_ttl > BT_MESH_TTL_MAX) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue