From 949a1ff7cc91f8404c1a60e3f4dca52b6708970e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 19 Dec 2018 17:40:14 +0100 Subject: [PATCH] net_server: Documented suggested interface behavior * Also simplified updating the interface message with SetString(). Change-Id: I29635cba5ddde693f6b7b97b8bd01769b02919d5 Reviewed-on: https://review.haiku-os.org/788 Reviewed-by: waddlesplash --- src/servers/net/NetServer.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/servers/net/NetServer.cpp b/src/servers/net/NetServer.cpp index 323fe3bd74..c86180fbf4 100644 --- a/src/servers/net/NetServer.cpp +++ b/src/servers/net/NetServer.cpp @@ -666,6 +666,14 @@ NetServer::_ConfigureDevice(const char* device) } +/*! \brief Traverses the device tree starting from \a startPath, and configures + everything that has not yet been configured via settings before. + + \param suggestedInterface Contains the configuration of an interface that + does not have any hardware left. It is used to configure the first + unconfigured device. This allows to move a Haiku configuration around + without losing the network configuration. +*/ void NetServer::_ConfigureDevices(const char* startPath, BStringList& devicesAlreadyConfigured, BMessage* suggestedInterface) @@ -683,8 +691,7 @@ NetServer::_ConfigureDevices(const char* startPath, if (S_ISBLK(stat.st_mode) || S_ISCHR(stat.st_mode)) { if (suggestedInterface != NULL - && suggestedInterface->RemoveName("device") == B_OK - && suggestedInterface->AddString("device", path.Path()) == B_OK + && suggestedInterface->SetString("device", path.Path()) == B_OK && _ConfigureInterface(*suggestedInterface) == B_OK) suggestedInterface = NULL; else if (!devicesAlreadyConfigured.HasString(path.Path()))