From b240f0ad50b9138fa1a9e5c4022cc0c989769005 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 20 Nov 2019 21:02:49 +0100 Subject: [PATCH] net_server: Fixed overwriting wrong interface config * When the "interfaces" file contains a configuration for a missing device, the first interface found would be overwritten, irregardless of its status. * Now, _ConfigureDevices() properly honours the "devicesAlreadyConfigured" list. * This fixes bug #14908. --- src/servers/net/NetServer.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/servers/net/NetServer.cpp b/src/servers/net/NetServer.cpp index bd32a69730..6e5eb82160 100644 --- a/src/servers/net/NetServer.cpp +++ b/src/servers/net/NetServer.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2006-2018, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2019, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -731,7 +731,8 @@ NetServer::_ConfigureDevices(const char* startPath, BPath path; if (entry.GetName(name) != B_OK || entry.GetPath(&path) != B_OK - || entry.GetStat(&stat) != B_OK) + || entry.GetStat(&stat) != B_OK + || devicesAlreadyConfigured.HasString(path.Path())) continue; if (S_ISBLK(stat.st_mode) || S_ISCHR(stat.st_mode)) { @@ -739,7 +740,7 @@ NetServer::_ConfigureDevices(const char* startPath, && suggestedInterface->SetString("device", path.Path()) == B_OK && _ConfigureInterface(*suggestedInterface) == B_OK) suggestedInterface = NULL; - else if (!devicesAlreadyConfigured.HasString(path.Path())) + else _ConfigureDevice(path.Path()); } else if (entry.IsDirectory()) { _ConfigureDevices(path.Path(), devicesAlreadyConfigured,