Commit Graph
100 Commits
Author SHA1 Message Date
Michael Lotz ec4d0e426d BMediaNode: Handle port read syscall interrupts by retrying.
The syscall might be interrupted, especially in signal heavy
applications. In that case we need to retry the read until the timeout
runs out. since the timeout is already absolute we don't need to adjust
anything.
2013-05-05 21:16:45 +02:00
Michael Lotz dff48661fd intel_extreme: Remove redundant cast of argument. 2013-05-05 18:27:01 +02:00
Michael Lotz f5d67f3f4d intel_gart: Fix build after argument type change. 2013-05-05 18:26:57 +02:00
Michael Lotz 8a43cad2ef BPlusTree: Fix fCurrentKey in backward TreeIterator traversal.
When reaching the next node the current key should be set to the next
valid index within that node (0 for forward and NumKeys() - 1 for
backward). This did not cause any harm as BFS uses forward traversal
only.
2013-05-02 23:26:05 +02:00
Michael Lotz 50ef2db4a8 BPlusTree: Fix GCC4 false positive of possible unintialized use. 2013-05-02 23:26:04 +02:00
Michael Lotz 1a5e87cc64 haiku_loader: Reuse BPlusTree implementation of the BFS add-on.
Instead of having an almost exact, albeit read only, duplicate of the
implementation.
2013-05-02 23:26:03 +02:00
Michael Lotz 6b65a838e0 BPlusTree: Style cleanup only, no functional change. 2013-05-02 23:26:02 +02:00
Michael Lotz a01dd96346 Return more than a single dirent at a time in bfs_read_dir().
Return as many dirents as fit into the provided buffer. The readdir()
implementation in libroot tries to get many dirents and caches them to
reduce the amount of syscalls and the associated overhead.

This reduces the syscall count dramatically for use cases where a lot
of directories are enumerated. A "git status" on a Haiku repository for
example goes from over 50k read dir syscalls down to just under 7k.
The performance gain is only around a moderate 5% in that use case
though.
2013-04-28 13:36:20 +02:00
Michael Lotz 91b4626a78 Check for and report an error on key buffer overrun.
This usually wasn't a problem as the key buffer is generally large
enough to hold a single value. Still on short buffers or very long
it could have silently overrun before.
2013-04-28 13:33:05 +02:00
Michael Lotz c4dbefe0b4 Fix build with tracing turned on. 2013-04-28 03:45:55 +02:00
Michael Lotz d057026dc4 Poll more frequently for the first explore.
This reduces needless waiting for the special case of the polled and
synchronous first explore.
2013-04-28 03:45:53 +02:00
Michael Lotz 22af7532d1 Reduce port reset recovery time from 250ms to 50ms.
The specs say the reset recovery time is 10ms only. The extra 40ms are
taken from the Linux hub driver.
2013-04-28 03:45:52 +02:00
Michael Lotz 827c7224a0 Implement debounce sequence according to USB 2.0 specs.
This replaces waiting a fixed time of 300ms for the device power to
stabilize. In the ideal case this reduces the boot time by 200ms per
connected device (including internal hubs).

This is very similar to what Linux implements and we use the same time
values. An interval of 25ms is used to check for connection state
changes, the stable time is at least 100ms as per the USB specs and the
whole process times out after 1.5 seconds.
2013-04-28 03:45:51 +02:00
Michael Lotz a064168869 Fix truncation of comparison value introduced in 848acd67.
Casting the difference of the two off_t values to size_t may truncate
the result. Doing so before the comparison will therefore break it.
Instead cast the size to off_t to get around the signed versus unsigned
integer expression comparison and then cast the result of the comparison
to size_t again. Should fix #9714.
2013-04-27 18:42:05 +02:00
Michael Lotz a9abcc37cd Rework initial auto joining and add big TODOs.
* If we have a configured network, then we always try to connect to it
  as soon as the interface has been brought up.
* If we don't have a configured network and are auto configuring, we
  use the AutoconfigLooper to also do initial auto joins.
* Before issuing auto joins we need to wait for scan results to come
  in, so we watch for corresponding messages.

For now auto joining is a one shot attempt as the infrastructure to
properly tell reasons for scans apart is not yet there.
2013-04-02 04:59:44 +02:00
Michael Lotz e484cc5098 Store the active flag if there is an initial link.
This ensures that we don't spuriously re-detect a link if we have a
race between starting to watch for link state changes and detecting the
initial link.
2013-04-02 03:16:06 +02:00
Michael Lotz 274b8be6c4 Don't try to auto-configure network interfaces with no link.
We already start watching for link state changes, so as soon as a link
is established the configuration will be triggered.
2013-04-02 02:57:14 +02:00
Michael Lotz 1b3dd41a35 Never join a network if not explicitly configured.
The scanning still occurs so that the network list is populated. But if
no SSID has been explicitly configured, we now always set the
IEEE80211_SCAN_NOJOIN flag that prevents automatically joining open
networks at the end of the scan.
2013-04-02 02:33:21 +02:00
Michael Lotz 6e77a76ef9 Use the SSID supplied in the MLME request not the desired SSID.
The wpa_supplicant (rightfully) supplies the SSID with this request.
However, with the code that is in place it gets ignored and the desired
SSID, as set by IEEE80211_IOC_SSID is used instead. This still works if
the wpa_supplicant is the only client in use and IEEE80211_IOC_SSID
is never used, as then the mlme.im_macaddr is used as the only
identifying element. If we used IEEE80211_IOC_SSID before though, for
example because we joined an open network from the net_server directly,
there will always be a mismatch between the desired SSID and the one
the wpa_supplicant tries to associate with using this MLME request.
No association is then possible. As there is no obvious reason why the
request supplied SSID shouldn't be used, we simply do so.
2013-04-02 01:18:09 +02:00
Michael Lotz 50944289c6 Use the wpa_supplicant to join open networks if it is running.
We need to make sure that the wpa_supplicant knows about our intention
even when joining an open network, as it otherwise might interfere.
Since leaving a network is not synchronous and the wpa_supplicant is
already running in that case anyway, this seems easier and more
reliable.

If the wpa_supplicant is not already running we still join ourselves.
2013-04-02 01:18:07 +02:00
Michael Lotz 0ef15eb6b9 Rename _ConfigureInterfaces() to *FromSettings().
This makes it more obvious what the function does.
2013-04-02 01:18:04 +02:00
Michael Lotz 2ac5770dc7 Don't automatically join a network if we already have a link.
The _ConfigureInterface() method is used as a backend for all
configuration tasks. That includes setting addresses manually or by
DHCP and changing flags, mtu or metric. Therefore we can't join
networks every time it is invoked. Instead we check for an existing
link first and only try to join if there is none yet.
2013-04-02 01:18:01 +02:00
Michael Lotz 8163a8e0ef Use a BMessenger to check for wpa_supplicant availabiltiy.
* Only launch it on join requests if it isn't yet valid anyway.
* Don't do any work on leave requests if it isn't running at all.
2013-04-02 01:17:58 +02:00
Michael Lotz 4e66f871e5 Launch the keystore_server on demand from BKeyStore.
This allows leaving the keystore_server closed as long as it isn't
used and still avoids having to launch it manually.
2013-04-02 01:15:29 +02:00
Michael Lotz 6de478363e Add BMessenger::SetTo() to reinitialize a BMessenger.
This allows to reuse BMessenger objects for different targets, or to
recheck validity after initial creation. With that one can use the same
BMessenger after launching an application that was previously not found
valid for example.
2013-03-31 20:16:04 +02:00
Michael Lotz 32057ce922 If a keyring is empty, store a no data flag instead of failing.
Any fully empty keyring (no keys and no applications) would fail to add
the empty flat buffer and thus prevent the whole keystore database from
being stored. This could easily happen when you used separate keyrings
but the master keyring was left unused for example.

Adding a flag that tells that there is no data allows us to distinguish
between a case where the stored data is missing due to a problem versus
an actually empty buffer.
2013-03-31 18:30:39 +02:00
Michael Lotz fa21184f24 Implement leaving networks on the net_server side.
We always try to reach the wpa_supplicant first. If it isn't running
we check if this might have been a network we've connected directly
and then just disassociate using an MLME disassociation request.
2013-03-31 03:22:21 +02:00
Michael Lotz 93c2c2aa6b Update wpa_supplicant to version 2.0 and bring in improvements.
* Updated to version 2.0 of vendor code.
* Reliability improvements in controlling the underlying devices.
* Implement leaving networks.
* Better timeout handling.
* Usability enhancements like cancel on escape, ok button being the
  default and the password field having focus on start.
* Storing of the password using BKeyStore.
2013-03-31 03:01:08 +02:00
Michael Lotz f848907875 Implement storing persistent network configurations.
The API to add persistent networks was added back in r42807 and
r42816 but storing them was still missing.
2013-03-31 00:43:32 +01:00
Michael Lotz a3a541eebd Make a copy of the network config message and store that one.
Using the original message and storing that into the settings resulted
in a not yet fully understood deadlock. Presumably related to missing
and/or stray replies.
2013-03-30 20:17:39 +01:00
Michael Lotz 4e186e6a31 Add IEEE80211_IOC_HAIKU_COMPAT_WLAN_{UP|DOWN} compat requests.
They can be supplied as request type codes to SIOCS80211 are added to
allow overcoming a difference between how Haiku and FreeBSD handle
network drivers.

In FreeBSD a device can be set into the down state but is still fully
configurable using the ioctl interface. The Haiku network stack on the
other hand opens and closes the driver on the transition form up to
down and vice versa. This difference can become problematic with ported
software that depends on the original behaviour.

Therefore IEEE80211_IOC_HAIKU_COMPAT_WLAN_{UP|DOWN} provide a way to
achieve the behaviour of setting and clearing IFF_UP without opening
or closing the driver itself.

The wpa_supplicant will use this in its BSD driver instead of actually
setting the interface down and then failing all other ioctls.
2013-03-29 23:58:48 +01:00
Michael Lotz 18004d3ac0 Avoid trying to set the media to Ethernet for WLAN devices.
It didn't really harm, but would always try to find a corresponding
media, fail and print an error.
2013-03-29 23:58:47 +01:00
Michael Lotz 066ca38aea Include the actual error message in usb_disk debug output. 2013-03-23 21:42:24 +01:00
Michael Lotz c5469c3939 Add missing check for unlocked state. 2013-03-05 11:05:02 -05:00
Michael Lotz d3b8b801a8 Fix missing write of the keystore database on app removal. 2013-03-05 11:05:00 -05:00
Michael Lotz ae542b141d Add setting/removal of keyring unlock keys to the cli app. 2013-03-05 11:04:59 -05:00
Michael Lotz 4a0460a9bc Add generic unlock key setting and removal.
* Replace {Set|Remove}MasterKey() by generic {Set|Remove}UnlockKey()
  that works on a keyring.
* Implement {Set|Remove}MasterUnlockKey() on top of that.
* Rename the commands and constants accrodingly.
* Implement setting and removing keyring unlock keys.
2013-03-05 11:04:57 -05:00
Michael Lotz a82011ff96 Introduce keyring unlock key concept.
* Rename fKeyMessage to fUnlockKey and the KeyMessage() getter to
  UnlockKey().
* Keep track of whether the keyring has an unlock key set.
* Store and restore that info separately.
* En- and decryption will depend on unlock key presence later.
* Add functions to set and remove an unlock key and query for it.
2013-03-05 11:04:56 -05:00
Michael Lotz bec02d0c2f Store each keyring in a message under a common keyrings field.
* Each keyring is now stored in a proper message which allows it to
  contain additional meta data along side the flat data.
* Adding all keyring messages under a common field also allows to add
  meta data to the keystore, as the keyrings don't use up random field
  names anymore.
* Treat the master keyring as any other keyring and just add it to the
  list. This allows to write/read the keystore database without special
  casing the master keyring.
2013-03-05 11:04:54 -05:00
Michael Lotz d4d6d12393 Don't require a key when creating a new keyring.
There will be key setting/removal functions so the step of adding the
keyring and setting a key on it can be done individually.
2013-03-05 11:04:53 -05:00
Michael Lotz 8775bd129d Remove old TODO as we don't support multiple instances for now.
As there aren't any more generic meta data containers inside BKey,
there's no real way to distinguish different instances with the same
identifiers. This may be added later, for example the same index system
as used in BMessage could apply.
2013-03-05 11:04:51 -05:00
Michael Lotz 112af58652 Focus the password field in the key request dialog. 2013-03-05 11:04:50 -05:00
Michael Lotz a59169de6f Add the access string to the app access request dialog.
This way the user can see what operation the application tries to do.
2013-03-05 11:04:48 -05:00
Michael Lotz cbdd5aff17 Restyle the app access request dialog to make it less horrible. 2013-03-05 11:04:47 -05:00
Michael Lotz ee83472042 Accumulate the app access flags instead of replacing them.
Before, each permanently granted access flag would overwrite the
previously granted flag, causing the dialog to come up whenever the
operation was changed.
2013-03-05 11:04:45 -05:00
Michael Lotz a2f279870c Add strings that explain an access operation.
May be used in the app access request dialog later on to show what
privilege is actually requested.
2013-03-05 11:04:44 -05:00
Michael Lotz 0e4f2804b5 Remove the leftover checkbox in the key request dialog. 2013-03-05 11:04:42 -05:00
Michael Lotz 7306e9e4d5 Add an explanatory message to the key request dialog. 2013-03-05 11:04:41 -05:00
Michael Lotz f1f719c433 Make the keyring label and name StringViews. 2013-03-05 11:04:39 -05:00
Michael Lotz 7b437e50eb Reflect "access" -> "unlock" change in key request dialog. 2013-03-05 11:04:38 -05:00
Michael Lotz 82b425a59f Reword the label from "Always Allow" to "Allow Always". 2013-03-05 11:04:36 -05:00
Michael Lotz 03a84249b5 Add app enumeration and removal to the keystore cli tool. 2013-03-05 11:04:35 -05:00
Michael Lotz f8ccc32326 Remove the API part of the concept of apps per key.
The application access concept is on the keyring level only for now.
Generally it probably would get pretty complicated and therefore harder
to use when application access needs to be granted on a per key basis.
2013-03-05 11:04:33 -05:00
Michael Lotz a5a5f4ca70 Rename "default" to "master" keyring as that's what it is.
Also add a well defined name ("Master") for the master keyring so it is
easier to understand what this keyring does instead of displaying an
empty string.
2013-03-05 11:04:32 -05:00
Michael Lotz c8ae843f3d Rename keyring "access/revoke" to "unlock/lock".
The unlock/lock concept just seems easier to grasp and is used in
various similar tools as well.
2013-03-05 11:04:30 -05:00
Michael Lotz f17ddab827 Initialize the BKey to default values and set fCreationTime.
* Using Unset() initializes the BKey to default values.
* Also set fCreationTime to 0 for now. It is still unused but needs to
  have a stable value for the exact matches when comparing keys.
2013-03-05 11:04:29 -05:00
Michael Lotz b31a707a95 Implement the application enumeration and removal commands. 2013-03-05 11:04:27 -05:00
Michael Lotz 67a4644454 Allow for all entries of an application to be removed. 2013-03-05 11:04:26 -05:00
Michael Lotz 0778e1477d Add application iteration method. 2013-03-05 11:04:24 -05:00
Michael Lotz cfa8131526 Resolve/validate the calling application, request if needed.
The application is resolved and then looked up in the keyring. If the
keyring doesn't provide a matching entry, an application access request
is triggered. The mechanism doesn't yet do any actual checksums, but
has provisions for differentiating between new and changed/updated
applications.
2013-03-05 11:04:23 -05:00
Michael Lotz f32874e611 Add an application access request dialog. 2013-03-05 11:04:21 -05:00
Michael Lotz 76df966ee6 Add a preliminary way to resolve the calling application.
This will have to be reworked though, as by using the roster only
BApplications can be resolved, as plain cli apps aren't registered with
the registrar.
2013-03-05 11:04:20 -05:00
Michael Lotz aef629f200 Only clear the keystore database when prepartion worked. 2013-03-05 11:04:19 -05:00
Michael Lotz d389650a7a Add application info handling into the Keyring class. 2013-03-05 11:04:17 -05:00
Michael Lotz 6ef5917d45 Only write and encrypt the flat buffer when modified. 2013-03-05 11:04:16 -05:00
Michael Lotz 1b3bb46aed Restructure how keyrings are stored/restored.
* Pass them through a flat buffer that can later be encrypted and
  decrypted in a central place.
* Remove the data argument from the constructor as keyrings are
  now reading their data on their own.
* Prepare for additional application info storage in the keyring.
2013-03-05 11:04:14 -05:00
Michael Lotz 97b3abf162 Add access flags to fine tune application access.
Not sure if these will actually be used, as they might just be a little
overkill and not easily usable.
2013-03-05 11:04:13 -05:00
Michael Lotz a5a2a2754e Make the keystore cli app a BApplication.
We need the app to be registered so that the app info can be retrieved.
2013-03-05 11:04:11 -05:00
Michael Lotz 64ca113fe0 Add keyring specific versions of the *Application() methods. 2013-03-05 11:04:10 -05:00
Michael Lotz 51ab46a83c Remove the purpose argument from all GetKey() variants.
The type is relevant and required as it determines the type of the
handed in key. The purpose however isn't actually needed and rather
inconvenient to get by depending on the situation.
2013-03-05 11:04:08 -05:00
Michael Lotz 90013c82e8 Let the KeyRequestWindow return a flattened BPasswordKey.
Also provide the keyring string separately instead of abusing the
output key message.
2013-03-05 11:04:07 -05:00
Michael Lotz f16fef70be Implement adding/removing keyrings from/to master. 2013-03-05 11:04:05 -05:00
Michael Lotz 1dd765c92c Store the key message from access/creation.
* Allow creating a Keyring with a key message.
* Store the key message when accessing.
* Add a few missing consts.
2013-03-05 11:04:04 -05:00
Michael Lotz 94f897deea Make Flatten/Unflatten public and remove IsRegistered().
The BKey doesn't know anything about the keyring concept, so the
registered info isn't really useful. May be re-added later with
keyring info as well.
2013-03-05 11:04:02 -05:00
Michael Lotz 6fb7a4569b Add commands for adding/removig keyrings from/to the master.
Also adds missing revoke usage string.
2013-03-05 11:04:01 -05:00
Michael Lotz 40516a14f9 Add the keystore_server and the keystore command to the image. 2013-03-05 11:03:59 -05:00
Michael Lotz f17ed51165 Add access revokation to the keystore command line util. 2013-03-05 11:00:06 -05:00
Michael Lotz ac9b28f058 Implement basic keyring access logic and key request dialog.
* The keyring needs to be made accessible before allowing any
  operation.
* Before executing commands the keyring is made accessible if
  possible (the command is aborted as needed).
* Accessing a keyring opens up a preliminary key request dialog.
* If the default keyring is accessible and a keyring key for the
  requested keyring is found, that key will be used to automatically
  make the requested keyring accessible.
2013-03-05 11:00:04 -05:00
Michael Lotz 5d4a0da455 Remove unneeded master access revoke command.
Revoking master access currently simply means to revoke access
to the default keyring.
2013-03-05 11:00:03 -05:00
Michael Lotz f3f13a2fc9 Make the keystore_server a background app. 2013-03-05 11:00:01 -05:00
Michael Lotz 687164ffa9 Flesh out the keystore command line tool.
* Implement adding/removing passwords and keyrings.
* Implement enumerating passwords and keyrings.
* Implement preliminary accessibility status check for keyrings.
2013-03-05 11:00:00 -05:00
Michael Lotz 95eee1a363 Make the keystore_server keyring aware.
* Move the *Key() functions into a Keyring class.
* Retrieve and select the right keyring for various commands.
* Implement adding/removing/enumerating keyrings.
* Rework the keystore database read/write to work with keyrings.
* Sync BKeyStore::IsKeyringAccessible() with the changed message.
* Remove leftover template code from registrar.
2013-03-05 10:59:58 -05:00
Michael Lotz d962e21058 Add B_KEY_PURPOSE_KEYRING for keyring keys. 2013-03-05 10:59:57 -05:00
Michael Lotz 0dfaf59dbb Implement basic storage and lookup functions.
* Add reading/writing a yet unprotected flat BMessage as the storage
  backend for the keys.
* Factor out the identifier based lookup logic into _FindKey() and use
  that from _AddKey() to detect duplicates.
* Add _FindKey() variant that does the lookup based on given type and
  purpose constraints.
2013-03-05 10:59:55 -05:00
Michael Lotz 37ac7cb2de Update the cookie from the reply message. 2013-03-05 10:59:53 -05:00
Michael Lotz 05480477ff Add a simple command line tool to interact with the keystore.
The app is yet almost empty but will gradually grow to include
enumeration and possibly modification functions for the keystore.
2013-03-05 10:59:52 -05:00
Michael Lotz c494c06109 Add B*Key::PrintToStream() method for debugging convenience. 2013-03-05 10:59:51 -05:00
Michael Lotz 8d9bc9e0ee Add a skeleton keystore_server.
It will handle the BKeyStore messages but is yet relatively empty. It
only returns an error to two messages right now.
2013-03-05 10:59:49 -05:00
Michael Lotz 005a15bbcd Move keystore message constants and use a messenger.
* The keystore backend will (at least for the time being) reside in a
  separate server. This one can be reached via normal messaging, so use
  a BMessenger for sending key messages.
* Move the message constants from RegistrarDefs.h into a new
  KeyStoreDefs.h that also contains the server signature.
* Update the message constants to reflect the new situation.
2013-03-05 10:59:47 -05:00
Michael Lotz 1c3996496b Implement all KeyStore methods except for password generation.
* Add all relevant message constants.
* Implement the messaging to send/retrieve key info.
* Implement _Flatten/_Unflatten for sending flat BKey objects.
* Remove application list from BKey, the key can't only differ by
  allowed applications as the identifiers would still collide, so the
  comparison isn't needed to uniquely identify the key. The applications
  can be enumerated via the BKeyStore instead.
2013-03-05 10:59:46 -05:00
Michael Lotz b73982892d Rename [Un]Register* functions to Add/Remove*. 2013-03-05 10:59:44 -05:00
Michael Lotz dc1acef865 Flesh out the API and implement stubs.
* Modified the API greatly to be based on BKey* instead of BPassword*.
* Added BKeyPurpose and used it instead of BKeyType. It is supposed to
  indicate the purpose of a key so that an app can look up keys on a
  more granular level. The BKeyType on the other hand actually
  identifies the type (i.e. subclass of BKey) so an app knows how to
  handle a given key or may only enumerate/use keys it is compatible
  with.
* Made everything based on a raw data buffer for now, only BPasswordKey
  is implemented yet which stores the (0 terminated) string into that
  data buffer.
* Removed the additional data BMessage as I don't yet see where it fits
  in. While I could imagine adding meta data to a key may be nice it
  might be an interoperability concern when keys are shared by
  different apps.
* Moved the app functions to the keystore as per the TODO, but not sure
  how to actually implement them.
2013-03-05 10:59:43 -05:00
Michael Lotz 3b3884d9ee KeyStore and Key interface/stubs draft per Axel Dörfler.
A draft API and (mostly) stubs to back it up. Initial import of yet
unmodified sources.
2013-03-05 10:59:41 -05:00
Michael Lotz 760de9b200 Tiny code style cleanup. 2012-12-04 23:38:11 +01:00
Michael Lotz 85db228177 Style cleanup only. 2012-12-04 23:38:10 +01:00
Michael Lotz 1ed5f66cd4 Add missing function end macro. 2012-12-04 23:38:09 +01:00
Michael Lotz 2b5d52a174 Whitespace cleanup only. 2012-12-04 23:38:09 +01:00
Michael Lotz f0422c6f9f Only set the physical address if the entry is mapped.
Otherwise, even when the address was 0, we would possibly set the
physical address to != 0 as we always applied the page offset.
2012-12-04 23:38:08 +01:00
Michael Lotz 926d1024d0 Fix wrong address mask (page directory vs. page table). 2012-12-04 23:38:07 +01:00
Michael Lotz fd6e3a11e2 Use the existing ARM MMU definitions and remove duplicates. 2012-12-04 23:38:06 +01:00