This actually has another advantage: if we can use musl sources
in the kernel POSIX support, then we can drop some of the BSD
sources that are used only in the kernel and have a different
implementation in userland (e.g. strtod) and have just one
version for both.
These are BSD extensions, not POSIX functions. They were needed
in libroot by the previous versions of the ftw/nftw implementations,
but the musl versions do not need them, and so we can move them to
libbsd.
This is a minor ABI break, but hopefully whatever was using them
in libroot also links to libbsd. If not, that's an easy enough fix.
(These were only added to libroot in 2013.)
It crashes the firmware after 40 scans. The issue has been reported to
OpenBSD, until then we can leave this disabled. The consequence is that
the wifi network list will not refresh while already connected to a
network. But at least the connection remains online.
* Do not allocate an equally-sized buffer for all scan results,
but just alloca() a buffer for a single result, and copy this
back to userland at the end of each iteration.
* Check remaining space correctly with respect to IE data.
May fix incorrect scan results or userland memory corruptions
seen with the previous code. Also should be faster since it
does not need to allocate large kernel-side temporary buffers.
In the long run it may make more sense to have Haiku-style ioctls for
this purpose, but since we are currently coexisting with FreeBSD-style
ioctls, just add this as another FreeBSD-style ioctl for now (we already
have two custom ones anyway.)
This ioctl pretty much just consists of the same parameters we pass
to wpa_supplicant using the Haiku-specific constants already, with one
notable difference: the PSK must be in proper WPA format, i.e. already
hashed. Hence we will submit this ioctl, for now, from our own code in
our wpa_supplicant port.
WPS is not implemented in this commit, but it could be if someone actually
needs to connect to WPS networks for some reason...
Tested and verified as working along with the wpa_supplicant changes.
This file contains a set of constants and flags which are already passed
between applications, net_server, and wpa_supplicant to indicate network
security, connection modes, and a variety of other things.
As the OpenBSD net80211 stack does not need wpa_supplicant for WPA2/PSK,
it only makes sense that we would pass the same information we pass
to wpa_supplicant into the stack instead. Rather than expose yet another
set of constants and flags to userland besides the FreeBSD and these
Haiku native ones, just make it so this file can be included in the kernel,
and the constants thus used directly.
* Introduce IEEE80211_IOCTLS_ABBREVIATED to FreeBSD's ieee80211_ioctl.h,
so that the FreeBSD header can be included along with the OpenBSD
net80211 stack without triggering lots of errors, so we can use
these structs in openbsd_wlan ieee80211_haiku.cpp.
* Implement basic ieee80211req handling machinery. We aren't going
to handle anything but SIOCG80211 and SIOCS80211 in this method,
so we can simplify it a bit at the same time.
* Implement IEEE80211_IOC_SCAN_RESULTS to return scan results from
the OpenBSD WiFi stack in FreeBSD ioctl format.
This change adds two minor "features" (noted with #ifdefs) to the
OpenBSD net80211 stack: one to specify what node index to return
when returning known nodes (scan results), as this way we do not
have to allocate a huge buffer to store the scan results in before
sending them back to userland, but can instead get and convert
a single one at a time.
(We store the converted values in kernel mode all at once, though,
so this is not as efficient as it could be. More improvement possible.)
* Implement IEEE80211_IOC_BSSID and IEEE80211_IOC_SSID while we are at it.
This actually may make joining open networks possible, but I didn't
really test it. (They are used with SIOCG80211 to see what network
the device is currently connecting/connected to.)
Mostly a few #ifdefs for the dmamem API, if_alloc, probe, and attach hooks.
Basically the same changes in both drivers.
The firmware name map is not really needed anymore; the OpenBSD drivers
have unique firmware names and do not generally use ".ucode" extensions.
So just use the filenames as-is and drop the map.
The stack now compiles and links. Combining this with adaptations to
the driver gets things to the point where it runs scans, but we do
not yet implement ioctls so they can be returned to userland.
OpenBSD's and FreeBSD's kernel APIs are very similar, but there are
still some differences. Fortunately these are small enough that we
can take care of most of them with a header-only shim layer.
(The files and functions implemented by this commit were implemented
and tested against the modules and drivers imported and adapted in
the following commits. Some of this took quite a bit of time to get
right, especially where the APIs have diverged in very subtle ways.)
Most of these changes however add things that FreeBSD has (with a few
exceptions noted in comments) which the OpenBSD shim layer merely needs
to make use of.
(FreeBSD used to have support for IFF_NEEDSGIANT but removed it. The
support instated here is very similar to what FreeBSD used to have.)
* Have FindPanel::AttachedToWindow check to see if a MIME type is
already selected, before it sets MIME type to the default value.
* Fixes#14946.
Change-Id: Iab3b9058bbc3ef1f055475ed54a72d4032643632
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5357
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
IEEE 802.11 has its own maximum MTU which is smaller than PAGESIZE
but larger than the ETHERMTU default. So we now attempt to set this
as well. In doing so, refactor the set into a loop based off an array
of possible MTUs.
Before ca6a44c133, this function returned
whatever amount of the buffer it could and silently discarded the rest.
After that change and before this one, it would refuse to return anything,
which meant that as soon as we got one packet too large to handle,
we would never receive any more packets (and the errors displayed in
e.g. ifconfig would go up forever.)
Now, we discard too-large packets so RX will not stall completely
and still return E2BIG (so error counts will go up), but we also
print an error to syslog, so that precisely what has gone wrong
will be easily known.
"ticks" is the name of the global variable indicating time since
system start; "_ticks" is the local variable. The confusion between
the two caused every callout to be invoked as soon as it was instantiated.
I am pretty surprised this was not noticed before. I only discovered
it just now while working on the OpenBSD WiFi driver ports. Seems
it has been broken like this for multiple years...
In some circumstances, we can wind up iterating on requests
by recursing through this function once per "iteration" due to
how vfs_synchronous_io works. This can run out of stack, as
was seen in #9900 and potentially other tickets.
An initial attempt was made to fix the problem in hrev45906,
but it was quickly reverted because it seems to have broken
I/O for all devices that do not support the "IO" hook.
This solution is much simpler: the VFS layer already can handle
vnodes' IO hooks returning B_UNSUPPORTED and then falling back
to synchronous I/O just as if they had no IO hook at all.
This should hopefully cause iteration to occur without recursion.
Tested by booting off a USB drive (the usb_disk driver does not
support the IO hook, so all requests must be translated.)
May fix#9900.
Strange KDLs showed up on at least one system with this driver after
the enabling of jumbo frames, so it seems probable that was the cause.
Disable MTU changes to hopefully prevent this problem for now.
Should hopefully stop #17766.
Performs the increment of the view counter
after a delay of three seconds; otherwise
a number of "false views" can be stored as
people use keyboard navigation.
Relates to #16879
Change-Id: I6f3440e1e3132c832cd807e48105022d22df9abf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5356
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
this needed for dp aux before skylake, only for DP A (eDP).
should help with #17771
Change-Id: I4bdcca1fdc05294fb5b56c5c96164b6936a5881e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5355
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
* Use with --sysroot /path/to/sysroot; useful for CI
environments and cross-building.
Change-Id: I27a93a5d209cd5324591587e85fce9b47c18172d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5318
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
As the TODO comment noted, msg_iov has already been copied to the kernel
at this point (it is done in the syscall handler), so we do not need to
use the user memory access functions.
(I verified that the iovecs passed from userland are indeed copied to
the kernel, but I did not find anything that actually posts more than
a single iov, so this is not tested especially thoroughly.)
Create a utility function which performs all necessary checks,
allocates memory, and copies the structures, and then make use of it
in the three places in the kernel which did all this manually.
None of them were previously complete: the fd and socket code only
checked iov_base and not iov_len, while the port code did not check
anything at all.
Part of #14961.
We do not access these buffers directly here but pass them deeper
into the kernel, where they may be used in IO operations that do
not invoke user_* functions at all, so we have to validate them fully here.
Part of #14961.
It has more general use than just in the VM code; basically anything
which receives buffers from userland should be invoking this if it
does anything besides user_memcpy (which alreay does it.)
These were completely rewritten by me some years ago and contain nothing
from Hugo or Colin anymore.
Change-Id: I07f95b79c08f93b7630f73b6ff60634e3fc95599
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5353
Reviewed-by: waddlesplash <waddlesplash@gmail.com>