Skip to content

Commit

Permalink
[posix] add Thread network default interface name configuration (open…
Browse files Browse the repository at this point in the history
…thread#9089) am: 2bbcc46 am: dc6ad09 am: 91b0854

Original change: https://android-review.googlesource.com/c/platform/external/openthread/+/2616630

Change-Id: I9390269e10c1787c1e6c00d258db22e38e10fa09
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
  • Loading branch information
zhanglongxia authored and android-build-merge-worker-robot committed Jun 6, 2023
2 parents 949e998 + 91b0854 commit 11d4556
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/posix/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ static bool ShouldEscape(char aChar)

Config ParseArg(int &aArgCount, char **&aArgVector)
{
Config config = {"wpan0"};
Config config = {OPENTHREAD_POSIX_CONFIG_THREAD_NETIF_DEFAULT_NAME};

optind = 1;

Expand Down
1 change: 1 addition & 0 deletions src/posix/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ static void ParseArg(int aArgCount, char *aArgVector[], PosixConfig *aConfig)
aConfig->mPlatformConfig.mPersistentInterface = false;
aConfig->mPlatformConfig.mSpeedUpFactor = 1;
aConfig->mLogLevel = OT_LOG_LEVEL_CRIT;
aConfig->mPlatformConfig.mInterfaceName = OPENTHREAD_POSIX_CONFIG_THREAD_NETIF_DEFAULT_NAME;
#ifdef __linux__
aConfig->mPlatformConfig.mRealTimeSignal = SIGRTMIN;
#endif
Expand Down
5 changes: 3 additions & 2 deletions src/posix/platform/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ typedef char(Filename)[sizeof(sockaddr_un::sun_path)];

void GetFilename(Filename &aFilename, const char *aPattern)
{
int rval;
int rval;
const char *netIfName = strlen(gNetifName) > 0 ? gNetifName : OPENTHREAD_POSIX_CONFIG_THREAD_NETIF_DEFAULT_NAME;

rval = snprintf(aFilename, sizeof(aFilename), aPattern, gNetifName);
rval = snprintf(aFilename, sizeof(aFilename), aPattern, netIfName);
if (rval < 0 && static_cast<size_t>(rval) >= sizeof(aFilename))
{
DieNow(OT_EXIT_INVALID_ARGUMENTS);
Expand Down
10 changes: 10 additions & 0 deletions src/posix/platform/openthread-posix-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,16 @@
#endif
#endif

/**
* @def OPENTHREAD_POSIX_CONFIG_THREAD_NETIF_DEFAULT_NAME
*
* Define the Thread default network interface name.
*
*/
#ifndef OPENTHREAD_POSIX_CONFIG_THREAD_NETIF_DEFAULT_NAME
#define OPENTHREAD_POSIX_CONFIG_THREAD_NETIF_DEFAULT_NAME "wpan0"
#endif

#ifdef __APPLE__

/**
Expand Down

0 comments on commit 11d4556

Please sign in to comment.