mirror of
https://github.com/espressif/openthread.git
synced 2026-08-02 09:07:47 +00:00
[api] check on prefix length when slaac is enabled (#5530)
This commit is contained in:
@@ -62,6 +62,10 @@ otError otBorderRouterAddOnMeshPrefix(otInstance *aInstance, const otBorderRoute
|
||||
// Thread 1.1 Specification 5.13.2 says
|
||||
// "A valid prefix MUST NOT allow both DHCPv6 and SLAAC for address configuration"
|
||||
VerifyOrExit(!aConfig->mDhcp || !aConfig->mSlaac, error = OT_ERROR_INVALID_ARGS);
|
||||
// RFC 4944 Section 6 says:
|
||||
// An IPv6 address prefix used for stateless autoconfiguration [RFC4862]
|
||||
// of an IEEE 802.15.4 interface MUST have a length of 64 bits.
|
||||
VerifyOrExit(!aConfig->mSlaac || aConfig->mPrefix.mLength == OT_IP6_PREFIX_BITSIZE, error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
error = instance.Get<NetworkData::Local>().AddOnMeshPrefix(*config);
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
|
||||
|
||||
@@ -249,7 +249,7 @@ wpan.verify_within(check_prefix4_removed_from_r1, WAIT_TIME)
|
||||
|
||||
r1.add_prefix(
|
||||
prefix4,
|
||||
48,
|
||||
64,
|
||||
priority="-1",
|
||||
stable=True,
|
||||
on_mesh=False,
|
||||
@@ -262,7 +262,7 @@ r1.add_prefix(
|
||||
verify_prefix(
|
||||
[r1],
|
||||
prefix4,
|
||||
48,
|
||||
64,
|
||||
priority="low",
|
||||
stable=True,
|
||||
on_mesh=False,
|
||||
|
||||
Reference in New Issue
Block a user