diff options
author | Aurelien Jarno <aurelien@aurel32.net> | 2019-11-11 13:00:07 +0100 |
---|---|---|
committer | Brian Gix <brian.gix@intel.com> | 2019-11-19 15:22:18 -0800 |
commit | 8a29b59d98b301df8331b4ca4dc9e150e67beee6 (patch) | |
tree | 8049bc5de938b333241b3a70e21608cd4f199c0f /mesh/mesh-config-json.c | |
parent | f5c178d1dcc977175a85a5cd0db9774376add08f (diff) | |
download | bluez-8a29b59d98b301df8331b4ca4dc9e150e67beee6.tar.gz |
mesh: fix node default TTL
There is a confusion between the node default TTL (section 4.2.7) and
the publish TTL (section 4.2.2.5):
- The node default TTL can only take values 0x00, and 0x02 to 0x7f. The
value 0xff is not prohibited.
- The publish TTL can take values 0x00 to 0x7f, as well as 0xff which
means use the node default TTL.
Currently the default node TTL is set to 0xff (DEFAULT_TTL), and
read_default_ttl() also allows such a value. This patch fixes that to
use 0x7f (TTL_MASK) as the default value instead.
Note that the code handling OP_CONFIG_DEFAULT_TTL_SET correctly use 0x7f
(TTL_MASK) for the upper allowed limit.
Diffstat (limited to 'mesh/mesh-config-json.c')
-rw-r--r-- | mesh/mesh-config-json.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mesh/mesh-config-json.c b/mesh/mesh-config-json.c index b2cff6824..5ca2961b0 100644 --- a/mesh/mesh-config-json.c +++ b/mesh/mesh-config-json.c @@ -358,7 +358,7 @@ static bool read_default_ttl(json_object *jobj, uint8_t *ttl) if (!val && errno == EINVAL) return false; - if (val < 0 || val == 1 || val > DEFAULT_TTL) + if (val < 0 || val == 1 || val > TTL_MASK) return false; *ttl = (uint8_t) val; |