Skip to content

Commit 6eb1e65

Browse files
LuDudanashif
authored andcommitted
net: openthread: Fix the handling of address state changes
This commit ensures that the state of the address can be changed from the Deprecated state to the Preferred state. Additionally, an issue with improper memory comparison size for the mesh local prefix has been fixed. Signed-off-by: Łukasz Duda <[email protected]>
1 parent dde46a9 commit 6eb1e65

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

subsys/net/l2/openthread/openthread_utils.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static bool is_mesh_local(struct openthread_context *context,
3232
const otMeshLocalPrefix *ml_prefix =
3333
otThreadGetMeshLocalPrefix(context->instance);
3434

35-
return (memcmp(address, ml_prefix->m8, sizeof(ml_prefix)) == 0);
35+
return (memcmp(address, ml_prefix->m8, sizeof(ml_prefix->m8)) == 0);
3636
}
3737

3838
int pkt_list_add(struct openthread_context *context, struct net_pkt *pkt)
@@ -156,9 +156,8 @@ void add_ipv6_addr_to_zephyr(struct openthread_context *context)
156156
context, address->mAddress.mFields.m8);
157157

158158
/* Mark address as deprecated if it is not preferred. */
159-
if (!address->mPreferred) {
160-
if_addr->addr_state = NET_ADDR_DEPRECATED;
161-
}
159+
if_addr->addr_state =
160+
address->mPreferred ? NET_ADDR_PREFERRED : NET_ADDR_DEPRECATED;
162161
}
163162
}
164163

0 commit comments

Comments
 (0)