Hi Adrian,
The Concept of configuring, configured, unconfigured, which
is applicable for an (interface, address family ) pair, is a runtime
information , is that correct ? If Yes, then do we need to use ioctl calls
to store that info , with a new type of request code ?
Thanks,
Sayan Chaudhuri
On Fri, Mar 1, 2024 at 12:48 AM <pulkomandy@xxxxxxxxxxxxx> wrote:
21 février 2024 à 17:53 "sayan chaudhuri" <sayanchaudhuri758@xxxxxxxxx> a
écrit:
not a pair of configured(device name, address) is a blocker for the review
So, this line of code that stores only the configured device name and
request (https://review.haiku-os.org/c/haiku/+/7259?tab=comments) .
the below two lines
I am thinking of a solution like this
1. inside function NetServer::_ConfigureInterfacesFromSettings, we have
if (_ConfigureInterface(interface) == B_OK)(BNetworkDevice,BNetworkInterfaceAddress) and then add the configured
devicesSet.Add(device);
instead of this , may be we can have devicesSet type as a map of
device and address family pairs from the message
variable "interface" to devicesSet. I do not know / could not find ifany map class already exists in Haiku.
The NetServer.cpp code that you linked already has fDeviceMap that is
implemented using C++ standard std::map.
I think you can also use an std::map from standard C++ for your needs here.
2. Similarly inside NetServer::_ConfigureDevices, instead of checkingonly for the device
. if the pair is not present . then move on to auto_configure them0. Would
if (entry.GetName(name) != B_OK
|| entry.GetPath(&path) != B_OK
|| entry.GetStat(&stat) != B_OK
|| devicesAlreadyConfigured.HasString(path.Path()))
we can check for combination of device and address family being present
like to have community feedback on this approach .
The "devicesAlreadyConfigured" variable is currently a simple BStringList
(a list of strings containing just device names).
This will need some changes, both in the _ConfigureDevices function but
also in _ConfigureInterfacesFromSettings and _BringUpInterfaces, to make it
more explicit what is configured and what isn't. Maybe introduce a new
class to track the state of each device and each address family inside that
device, instead of the currently used string list.
I hope this helps,
--
Adrien / PulkoMandy.