Skip to content

Commit

Permalink
[dhcp6pd] add basic DHCPv6-PD support (#1917)
Browse files Browse the repository at this point in the history
This commit includes changes for build flags and feature flags.
  • Loading branch information
erjiaqing authored Jun 27, 2023
1 parent 19a8bf7 commit d5fdc0d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions etc/cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,10 @@ option(OTBR_PUBLISH_MESHCOP_BA_ID "Publish the MeshCoP mDNS 'id' TXT entry, enab
if (OTBR_PUBLISH_MESHCOP_BA_ID)
target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_PUBLISH_MESHCOP_BA_ID=1)
endif()

option(OTBR_DHCP6_PD "Prefix delegation support" OFF)
if (OTBR_DHCP6_PD)
target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_DHCP6_PD=1)
else()
target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_DHCP6_PD=0)
endif()
7 changes: 7 additions & 0 deletions src/ncp/ncp_openthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <string.h>

#include <openthread/backbone_router_ftd.h>
#include <openthread/border_routing.h>
#include <openthread/dataset.h>
#include <openthread/dnssd_server.h>
#include <openthread/logging.h>
Expand Down Expand Up @@ -243,6 +244,9 @@ void ControllerOpenThread::Init(void)
#if OTBR_ENABLE_DNS_UPSTREAM_QUERY
otDnssdUpstreamQuerySetEnabled(mInstance, /* aEnabled */ true);
#endif
#if OTBR_ENABLE_DHCP6_PD
otBorderRoutingDhcp6PdSetEnabled(mInstance, /* aEnabled */ true);
#endif
#endif // OTBR_ENABLE_FEATURE_FLAGS

mThreadHelper = std::unique_ptr<otbr::agent::ThreadHelper>(new otbr::agent::ThreadHelper(mInstance, this));
Expand Down Expand Up @@ -277,6 +281,9 @@ otError ControllerOpenThread::ApplyFeatureFlagList(const FeatureFlagList &aFeatu
#if OTBR_ENABLE_DNS_UPSTREAM_QUERY
otDnssdUpstreamQuerySetEnabled(mInstance, aFeatureFlagList.enable_dns_upstream_query());
#endif
#if OTBR_ENABLE_DHCP6_PD
otBorderRoutingDhcp6PdSetEnabled(mInstance, aFeatureFlagList.enable_dhcp6_pd());
#endif

return error;
}
Expand Down
1 change: 1 addition & 0 deletions src/proto/capabilities.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ message Capabilities {
// When some macro is deleted, the corresponding value should be marked as "reserved".
// It is suggested to assign a new field number to a macro when its scope has significantly changed.
optional bool nat64 = 1; // OTBR_ENABLE_NAT64
optional bool dhcp6_pd = 2; // OTBR_ENABLE_DHCP6_PD
}
2 changes: 2 additions & 0 deletions src/proto/feature_flag.proto
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,6 @@ message FeatureFlagList {
optional bool enable_trel = 4 [default = false];
// Whether to enable upstream DNS forwarding.
optional bool enable_dns_upstream_query = 5 [default = false];
// Whether to enable prefix delegation.
optional bool enable_dhcp6_pd = 6 [default = false];
}
1 change: 1 addition & 0 deletions third_party/openthread/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ set(OT_BORDER_AGENT_ID ON CACHE STRING "enable border agent ID" FORCE)
set(OT_BORDER_ROUTER ON CACHE STRING "enable border router feature" FORCE)
set(OT_BORDER_ROUTING ${OTBR_BORDER_ROUTING} CACHE STRING "enable border routing feature" FORCE)
set(OT_BORDER_ROUTING_COUNTERS ${OTBR_BORDER_ROUTING_COUNTERS} CACHE STRING "enable border routing counters feature" FORCE)
set(OT_BORDER_ROUTING_DHCP6_PD ${OTBR_DHCP6_PD} CACHE STRING "enable dhcpv6 pd support in border routing" FORCE)
set(OT_BUILD_EXECUTABLES OFF CACHE STRING "disable building executables" FORCE)
set(OT_BUILTIN_MBEDTLS_MANAGEMENT OFF CACHE STRING "diable mbedTLS management" FORCE)
set(OT_CHILD_SUPERVISION ON CACHE STRING "enable child supervision" FORCE)
Expand Down

0 comments on commit d5fdc0d

Please sign in to comment.