History log of /haiku/src/kits/network/libnetapi/NetworkDevice.cpp
Revision Date Author Comments
# 15ff8d64 29-Mar-2023 Augustin Cavalier <waddlesplash@gmail.com>

BNetworkDevice: Remove GetNextNetwork.

As far as I can tell, it has no consumers whatsoever outside the tree.
(wpa_supplicant did not even use it.) So, remove it altogether.

If that turns out to be mistaken, we can reinstate it temporarily
as a private class function or ABI-only symbol.


# b94de4c9 27-Oct-2022 Augustin Cavalier <waddlesplash@gmail.com>

BNetworkDevice: Restore old buffer size.

May help with #18020.


# b2c77ad2 25-Oct-2022 Augustin Cavalier <waddlesplash@gmail.com>

Network: Add a BNetworkDevice::GetNetworks() method and use it in the GUI.

The GetNextNetwork() method is really inefficient: it fetches all the
networks at once from the kernel every single time and then winds
up returning only one of them. In parts of the GUI that iterate over
all networks more than once per refresh (sometimes within a loop, even!)
this was often a noticeable lag on the GUI, especially with OpenBSD
drivers which have extra overhead to do struct translation in the
ioctl handler.

Now, we have a way to fetch all scan results at once and just iterate
over them as many times as we need, and this is what NetworkStatus
and Network preferences now do, saving lots of time and effort.


# 44fa45df 13-Jun-2022 Augustin Cavalier <waddlesplash@gmail.com>

net/if: Drop ifmediareq and just use the regular ifreq for SIOCGIFMEDIA.

This was introduced into the main API in 2010 (d72ede75fb252c24c8a5fcc39395f9ae1c202322),
but was actually only fully used for the past month (c2a9a890f3ac7795602d11c0edaa20ac2db48202)
when SIOCGIFMEDIA was supported for all *BSD drivers and not just WiFi.
Most userland consumers of this structure did not use it correctly,
as was the case in #17770, and only worked because in the fallback case
the network stack just treated it as if it were an ifreq.

Nothing actually used the ifm_count/ifm_ulist (though tentative APIs
were exposed for it) as noted by previous commits; and the fact that
Haiku's IFM_* declarations are so spartan makes most of the returned
values unintelligible to userland without using FreeBSD compat headers.

If, in the future, we decide to implement ifmedia listing and selection
properly, that should likely be done with separate ioctls instead of
having multi-function ones like this.

This is technically an ABI break, but in practice it should not matter:
ifmediareq::ifm_current aligns with ifreq::ifr_media, so the things
that used this structure like our in-tree code did will continue to work.
Until this past May, the only other field that was usually set was
ifm_active, but in the absence of setting ifm_status all non-Haiku
consumers should ignore it completely.

The only consumer of this ioctl that I know of out of the tree,
wpa_supplicant, still works after these changes.


# fce7f3a7 09-Dec-2020 X512 <danger_mail@list.ru>

integrate AutoDeleter's into pointers

Change-Id: I6c3925a7aec4d0647c76c2a03aad7b08985d7166
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3490
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 043b00fb 13-Sep-2018 Augustin Cavalier <waddlesplash@gmail.com>

BNetworkDevice: Fix memory leaks and address comments.

Thanks Axel and Jerome for the reviews!

Change-Id: I4f116c540cf59ba74b79d9d2f95ed40edc9c4174
Reviewed-on: https://review.haiku-os.org/557
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 4e5aaaa7 12-Sep-2018 Augustin Cavalier <waddlesplash@gmail.com>

BNetworkDevice: Implement Scan().

This depends on the previous commit to return the correct error code
from ioctl().

If there are no VAPs running (which is the case after a forced disconnect
from an access point), scans will fail. In that case, we call
IEEE80211_IOC_HAIKU_COMPAT_WLAN_UP, which will restart a VAP, and then
initiate the scan.

Change-Id: I732aefe67e386dbb0ed3d232ed9deda678132601
Reviewed-on: https://review.haiku-os.org/551
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 0dc3ab4f 01-Aug-2018 Augustin Cavalier <waddlesplash@gmail.com>

libnetapi: Do not use the freebsd11_network headers globally.

Since they were being Use'd at global scope, the FreeBSD versions
of a number of POSIX headers were being used instead of the POSIX ones,
which breaks the build on non-x86 as these headers presently do not work
elsewhere.

Instead, just include the base directory, and then include the compat
headers manually in the one place that actually requires them.
Also fix all the other files that expected errno.h and others to
be included implicitly, which they now are not.

This should fix the PowerPC and (part of the) ARM builds.


# 31023893 15-Mar-2016 Julian Harnath <julian.harnath@rwth-aachen.de>

Network Kit: add BNetworkDevice::Control

* Allows to do an arbitrary ioctl on the network device

* For ifreq and ieee80211req requests


# d5dd8637 11-Feb-2015 Axel Dörfler <axeld@pinc-software.de>

BNetworkDevice.GetHardwareAddress() was broken.

* Copy&paste error, apparently.


# 754bbf48 26-Nov-2013 Jérôme Duval <jerome.duval@gmail.com>

libnetapi: second pass of style cleanup

* remarks from Axel


# 7d7b9632 09-Oct-2011 Michael Lotz <mmlr@mlotz.ch>

* Remove the BNetworkDevice::AddPersistentNetwork() again and instead introduce
BNetworkRoster::{Count|GetNext|Add|Remove}PersistentNetwork() as it fits
better (thanks Philippe for the heads up).
* Implement the backend for these functions in the net_server and also move
conversion of the wireless_network based format into the settings based format
there.
* Implement removal of a network from the settings and make adding a new network
with the same name replace the old one instead of just adding multiple ones.
Might need to change this in the future depending on how we want to handle
multiple networks with the same name (i.e. distinguish based on BSSID or
similar).
* Fix apparent oversight that caused configured networks _not_ to be used in the
auto join attempt.
* Remove auto joining open networks. I've been bitten by that more than once now
because we happen to have an open network in the neighbourhood that I now
accidentally used to transfer quite a bit of (unencrypted) stuff before
noticing... In the future, one will instead have to explicitly join an open
network once and store that config. Note that the driver will actually still
auto-associate with open networks due to how things are set up currently.
Note also that the auto join will fire join requests whenever there's a
disassociation event, so you might see spurious join dialogs when the
wpa_supplicant actually just re-establishes the connection.
* Make join requests async again. Instead of waiting for a synchronous reply of
the wpa_supplicant we instead return success when the request has been sent.
While the API call might still be made synchronous again in the future, the
net_server should really not block on an external application. In the case of
the wpa_supplicant we would otherwise deadlock when using the new
*PersistentNetwork() API after a successful join, and in other cases we might
just unacceptably delay other calls.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42816 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a1b98367 07-Oct-2011 Michael Lotz <mmlr@mlotz.ch>

Add a way to add persistent (configured) wireless_networks that will eventually
be stored by the backend in the net_server. I put it in BNetworkDevice because
that is where network enumeration is done as well, but I'm not sure that it fits
there particularly well.
Since BNetworkDevice::GetNetwork() directly interfaces with the driver and gets
the networks from scan results, such persistent networks don't yet show up in
those enumerations.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42807 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0a8ad865 09-Dec-2010 Axel Dörfler <axeld@pinc-software.de>

* Implemented operator<() for AF_LINK addresses as well; now NetworkStatus
actually marks the currently associated network.
* Removed unused code from NetworkDevice.cpp - doesn't look like we're going
to use it anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39793 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c4165266 09-Dec-2010 Axel Dörfler <axeld@pinc-software.de>

* Parse the additional information elements the station sends in order to
retrieve the WLAN cipher/key configuration. Might not work perfectly yet; so
far I've only seen WPA2, and WPA networks.
* Have wlan_test show this extra info.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39792 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 440d0e61 08-Dec-2010 Axel Dörfler <axeld@pinc-software.de>

* Pretty much completed BNetworkDevice. The only parts missing are GetMediaAt(),
and parsing the extra station data to retrieve the authentication details.
Comments welcome.
* NetworkStatus should now mark the currently associated network (if any).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39774 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1d8e6ee8 30-Nov-2010 Axel Dörfler <axeld@pinc-software.de>

* Untested work-in-progress. Actually cannot work because of missing
functionality in BNetworkAddress.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39687 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2bd61a6f 23-Nov-2010 Axel Dörfler <axeld@pinc-software.de>

* Added Index() method, was not even declared yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39593 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 223cae9f 10-Nov-2010 Axel Dörfler <axeld@pinc-software.de>

* Implemented IsEthernet(), and IsWireless() temporarily, but this will do
for some drivers at least.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39393 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1d56eab0 25-Oct-2010 Axel Dörfler <axeld@pinc-software.de>

* Work in progress network API changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39147 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d5dd8637bb701f1bda37b7b9e4b63e6615481629 11-Feb-2015 Axel Dörfler <axeld@pinc-software.de>

BNetworkDevice.GetHardwareAddress() was broken.

* Copy&paste error, apparently.


# 754bbf4866278ecd2da2c517560bc90c67a3a6f5 26-Nov-2013 Jérôme Duval <jerome.duval@gmail.com>

libnetapi: second pass of style cleanup

* remarks from Axel


# 7d7b9632250246bc3a60ae5c343f79c0236a9f02 09-Oct-2011 Michael Lotz <mmlr@mlotz.ch>

* Remove the BNetworkDevice::AddPersistentNetwork() again and instead introduce
BNetworkRoster::{Count|GetNext|Add|Remove}PersistentNetwork() as it fits
better (thanks Philippe for the heads up).
* Implement the backend for these functions in the net_server and also move
conversion of the wireless_network based format into the settings based format
there.
* Implement removal of a network from the settings and make adding a new network
with the same name replace the old one instead of just adding multiple ones.
Might need to change this in the future depending on how we want to handle
multiple networks with the same name (i.e. distinguish based on BSSID or
similar).
* Fix apparent oversight that caused configured networks _not_ to be used in the
auto join attempt.
* Remove auto joining open networks. I've been bitten by that more than once now
because we happen to have an open network in the neighbourhood that I now
accidentally used to transfer quite a bit of (unencrypted) stuff before
noticing... In the future, one will instead have to explicitly join an open
network once and store that config. Note that the driver will actually still
auto-associate with open networks due to how things are set up currently.
Note also that the auto join will fire join requests whenever there's a
disassociation event, so you might see spurious join dialogs when the
wpa_supplicant actually just re-establishes the connection.
* Make join requests async again. Instead of waiting for a synchronous reply of
the wpa_supplicant we instead return success when the request has been sent.
While the API call might still be made synchronous again in the future, the
net_server should really not block on an external application. In the case of
the wpa_supplicant we would otherwise deadlock when using the new
*PersistentNetwork() API after a successful join, and in other cases we might
just unacceptably delay other calls.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42816 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a1b98367ae834c4bb2027a0a7b8e9384af0f89d3 07-Oct-2011 Michael Lotz <mmlr@mlotz.ch>

Add a way to add persistent (configured) wireless_networks that will eventually
be stored by the backend in the net_server. I put it in BNetworkDevice because
that is where network enumeration is done as well, but I'm not sure that it fits
there particularly well.
Since BNetworkDevice::GetNetwork() directly interfaces with the driver and gets
the networks from scan results, such persistent networks don't yet show up in
those enumerations.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42807 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0a8ad865de1af8292591f980c130a376ff6eb219 09-Dec-2010 Axel Dörfler <axeld@pinc-software.de>

* Implemented operator<() for AF_LINK addresses as well; now NetworkStatus
actually marks the currently associated network.
* Removed unused code from NetworkDevice.cpp - doesn't look like we're going
to use it anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39793 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c416526666f8e147086d96906a5f9b79ee2dcb96 09-Dec-2010 Axel Dörfler <axeld@pinc-software.de>

* Parse the additional information elements the station sends in order to
retrieve the WLAN cipher/key configuration. Might not work perfectly yet; so
far I've only seen WPA2, and WPA networks.
* Have wlan_test show this extra info.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39792 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 440d0e61e812dd49268aa75e9fee369e4df4db0d 08-Dec-2010 Axel Dörfler <axeld@pinc-software.de>

* Pretty much completed BNetworkDevice. The only parts missing are GetMediaAt(),
and parsing the extra station data to retrieve the authentication details.
Comments welcome.
* NetworkStatus should now mark the currently associated network (if any).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39774 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1d8e6ee862d36468a620df521b8b0ea37f9e32c1 30-Nov-2010 Axel Dörfler <axeld@pinc-software.de>

* Untested work-in-progress. Actually cannot work because of missing
functionality in BNetworkAddress.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39687 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2bd61a6f333f0af2627d9c7e60cac6323ddb0474 23-Nov-2010 Axel Dörfler <axeld@pinc-software.de>

* Added Index() method, was not even declared yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39593 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 223cae9fe6bae99b3fb03efa0f42a9987f30eaca 10-Nov-2010 Axel Dörfler <axeld@pinc-software.de>

* Implemented IsEthernet(), and IsWireless() temporarily, but this will do
for some drivers at least.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39393 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1d56eab029dbd3266af0d791bba61dbd85e9020d 25-Oct-2010 Axel Dörfler <axeld@pinc-software.de>

* Work in progress network API changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39147 a95241bf-73f2-0310-859d-f6bbb57e9c96