diff mbox series

[BlueZ] mesh: Fix encoding of Config Key Refresh Phase Status

Message ID 20200811193709.27341-1-michal.lowas-rzechonek@silvair.com (mailing list archive)
State Accepted
Headers show
Series [BlueZ] mesh: Fix encoding of Config Key Refresh Phase Status | expand

Commit Message

Michał Lowas-Rzechonek Aug. 11, 2020, 7:37 p.m. UTC
Config Key Refresh Phase Status is 4 octets long (see Mesh Profile
v1.0.1, section 4.3.2.60): 1 octet for status, 2 octets for net key
index, 1 octet for the phase.
---
 mesh/cfgmod-server.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Brian Gix Aug. 12, 2020, 4:28 p.m. UTC | #1
Applied

On Tue, 2020-08-11 at 21:37 +0200, Michał Lowas-Rzechonek wrote:
> Config Key Refresh Phase Status is 4 octets long (see Mesh Profile
> v1.0.1, section 4.3.2.60): 1 octet for status, 2 octets for net key
> index, 1 octet for the phase.
> ---
>  mesh/cfgmod-server.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/mesh/cfgmod-server.c b/mesh/cfgmod-server.c
> index 9da981700..90ebdf046 100644
> --- a/mesh/cfgmod-server.c
> +++ b/mesh/cfgmod-server.c
> @@ -447,11 +447,11 @@ static uint16_t cfg_key_refresh_phase(struct mesh_node *node,
>  
>  done:
>  	msg[n] = status;
> -	l_put_le16(idx, msg + n);
> -	msg[n + 2] = (status != MESH_STATUS_SUCCESS) ?
> +	l_put_le16(idx, &msg[n + 1]);
> +	msg[n + 3] = (status != MESH_STATUS_SUCCESS) ?
>  						KEY_REFRESH_PHASE_NONE : phase;
>  
> -	return n + 3;
> +	return n + 4;
>  }
>  
>  static uint8_t uint32_to_log(uint32_t value)
diff mbox series

Patch

diff --git a/mesh/cfgmod-server.c b/mesh/cfgmod-server.c
index 9da981700..90ebdf046 100644
--- a/mesh/cfgmod-server.c
+++ b/mesh/cfgmod-server.c
@@ -447,11 +447,11 @@  static uint16_t cfg_key_refresh_phase(struct mesh_node *node,
 
 done:
 	msg[n] = status;
-	l_put_le16(idx, msg + n);
-	msg[n + 2] = (status != MESH_STATUS_SUCCESS) ?
+	l_put_le16(idx, &msg[n + 1]);
+	msg[n + 3] = (status != MESH_STATUS_SUCCESS) ?
 						KEY_REFRESH_PHASE_NONE : phase;
 
-	return n + 3;
+	return n + 4;
 }
 
 static uint8_t uint32_to_log(uint32_t value)