summaryrefslogtreecommitdiff
path: root/src/nm-checkpoint.c
Commit message (Collapse)AuthorAgeFilesLines
* settings: unify settings-update API (rename and merge)Thomas Haller2017-12-051-6/+6
|
* settings: unify settings-update API (nm_settings_connection_commit_changes())Thomas Haller2017-12-051-0/+2
|
* checkpoint: don't bypass settings-connection commit code on rollbackThomas Haller2017-12-051-3/+1
| | | | | | | | commit involves more then just replacing the setting and writing them out. What? Dunno. It's complex. But let's not bypass the commit-changes function. That one is supposed to get it right.
* core: track NMActiveConnection in manager with CListThomas Haller2017-11-271-6/+4
| | | | | | | | | | Using CList, we embed the list element in NMActiveConnection struct itself. That means for example, that you couldn't track a NMActiveConnection more then once. But we anyway never want that. The advantage is, that removing an active connection from the list is O(1), and we safe additional GSlice allocations for each node element.
* core: merge nm_settings_get_connections_sorted() with ↵Thomas Haller2017-11-271-1/+3
| | | | nm_settings_get_connections_clone()
* all: use nm_direct_hash() instead of g_direct_hash()Thomas Haller2017-11-161-1/+1
| | | | | | We also do this for libnm, where it causes visible changes in behavior. But if somebody would rely on the hashing implementation for hash tables, it would be seriously flawed.
* all: don't use g_direct_equal() for hash table equality functionThomas Haller2017-11-161-1/+1
| | | | | | | | | | GHashTable optimizes a NULL equality function to use direct pointer comparison. That saves the overhead of calling g_direct_equal(). This is also documented behavior for g_hash_table_new(). While at it, also don't pass g_direct_hash() but use the default of %NULL. The behavior is the same, but consistently don't use g_direct_hash().
* settings: extend commit_changes() to update the settings after writingThomas Haller2017-10-251-0/+1
| | | | | | | | | | | | | | | | | | | During write, it can regularly happen that the connection gets modified. For example, keyfile never writes blobs as-is, it always writes the blob to an external file, and replaces the certificate property with a path. Other reasons could be just bugs, where the reader and writer are not doing a proper round trip (these cases should be fixed). Refactor commit_changes(), to return the re-read connection to the settings-connection class, and handle replacing the settings there. Also, prepare for another change. Sometimes we first call replace_settings() followed by commit_changes(). It would be better to instead call commit_changes() first, and only on success proceed with replace_settings(). Hence, commit_changes() gets a new argument new_connection, that can be used to write another connection to disk.
* settings: get rid of callback arguments for nm_settings_connection_delete()Thomas Haller2017-10-251-1/+1
|
* settings: get rid of callback arguments for ↵Thomas Haller2017-10-251-1/+0
| | | | | | | nm_settings_connection_commit_changes() No need to return an error result via a callback function. Just return the plain error.
* core,clients: use our own string hashing function nm_str_hash()Thomas Haller2017-10-181-1/+1
| | | | | | | | | | | | | | | | | | | | Replace the usage of g_str_hash() with our own nm_str_hash(). GLib's g_str_hash() uses djb2 hashing function, just like we do at the moment. The only difference is, that we use a diffrent seed value. Note, that we initialize the hash seed with random data (by calling getrandom() or reading /dev/urandom). That is a change compared to before. This change of the hashing function and accessing the random pool might be undesired for libnm/libnm-core. Hence, the change is not done there as it possibly changes behavior for public API. Maybe we should do that later though. At this point, there isn't much of a change. This patch becomes interesting, if we decide to use a different hashing algorithm.
* checkpoint: better restore device managed state on rollbackBeniamino Galvani2017-08-281-6/+18
| | | | | | Manage a device again if it was managed before the checkpoint. https://bugzilla.redhat.com/show_bug.cgi?id=1464904
* checkpoint: disconnect device before reactivation during rollbackBeniamino Galvani2017-07-051-0/+11
| | | | | | | | | | Since commit 0922a177385b ("manager: avoid that auto-activations preempt user activations") the manager doesn't allow a internal activation to disconnect the same connection already active on the device. Thus, during a rollback we must ensure that the device is deactivated before. Fixes: 0922a177385be188b9c9c8ad39c1068533f5a4b3
* logging: log device and connection along with the messageLubomir Rintel2017-03-241-1/+1
|
* core: add activation-type property to active-connectionThomas Haller2017-03-161-0/+1
| | | | | It is still unused, but will be useful to mark a connection whether it is a full activation or assumed.
* checkpoint: reactivate/update connections only if necessary on rollbackBeniamino Galvani2017-03-061-37/+102
| | | | | | | | On rollback, before updating the settings-connection check if it actually changed. Also, only reactivate the connection if it was deactivated or if the settings/applied connection changed. https://bugzilla.redhat.com/show_bug.cgi?id=1427187
* checkpoint: drop a redundant assignmentLubomir Rintel2017-02-161-1/+1
|
* core: refactor nm_settings_get_connections_sorted() to return array instead ↵Thomas Haller2017-02-101-5/+5
| | | | | | | | | | | | | | | | | | | of GSList We call these functions a lot. A GSList is just the wrong tool for the job. Refactor the code to use instead a sorted array everywhere. This means, we malloc() one array for all connections instead slice-allocate a GSList item for each. Also, sorting an array is faster then sorting a GSList. Technically, the GSList implementation had the same big-O runtime complexity, but using an array is still faster. That is, sorting an array and a GSList is both O(n*log(n)). Actually, nm_settings_get_connections_sorted() used g_slist_insert_sorted() instead of g_slist_sort(). That results in O(n^2). That could have been fixed to have O(n*log(n)), but instead refactor the code to use an array.
* exported-object: use NM_EXPORT_PATH_NUMBERED() macroThomas Haller2017-01-031-1/+1
|
* all: rename the introspection data to use the interface paths in namesLubomir Rintel2016-11-231-1/+1
| | | | | | | | This makes it easier to install the files with proper names. Also, it makes the makefile rules slightly simpler. Lastly, the documentation is now generated into docs/api, which makes it possible to get rid of the awkward relative file names in docbook.
* build: don't add subdirectories to include search path but require qualified ↵Thomas Haller2016-11-211-3/+3
| | | | | | | | | | | | | | | include Keep the include paths clean and separate. We use directories to group source files together. That makes sense (I guess), but then we should use this grouping also when including files. Thus require to #include files with their path relative to "src/". Also, we build various artifacts from the "src/" tree. Instead of having individual CFLAGS for each artifact in Makefile.am, the CFLAGS should be unified. Previously, the CFLAGS for each artifact differ and are inconsistent in which paths they add to the search path. Fix the inconsistency by just don't add the paths at all.
* checkpoint: introduce new flags to better restore previous stateBeniamino Galvani2016-10-241-1/+55
| | | | | | | | | | | | | | | When a global checkpoint is created (one with empty device list) we save the status of all devices to restore it later. After the checkpoint new interfaces and connections may appear and they can significantly influence the overall networking status, but we don't consider them at the moment. Introduce a new flag DELETE_NEW_CONNECTIONS to delete any connection added after the checkpoint and similarly a DISCONNECT_NEW_DEVICES to ensure that the connection active on newly appeared devices doesn't disrupt network connectivity. https://bugzilla.redhat.com/show_bug.cgi?id=1378393
* core: refactor private data in "src"Thomas Haller2016-10-041-58/+65
| | | | | | | | | | | | | | | | - use _NM_GET_PRIVATE() and _NM_GET_PRIVATE_PTR() everywhere. - reorder statements, to have GObject related functions (init, dispose, constructed) at the bottom of each file and in a consistent order w.r.t. each other. - unify whitespaces in signal and properties declarations. - use NM_GOBJECT_PROPERTIES_DEFINE() and _notify() - drop unused signal slots in class structures - drop unused header files for device factories
* checkpoint: restore both applied and settings connectionsBeniamino Galvani2016-09-261-11/+21
|
* checkpoint: consider all devices when an empty list is passedBeniamino Galvani2016-09-261-26/+0
| | | | | | | | | First, consider all devices and not only realized and managed ones when an empty list is passed. Also, move the list evaluation to the checkpoint manager, since the check for device conflicts is done there. Fixes: 3e09aed2a09fab11f66b8228e48dc8f732c65cce
* checkpoint: use UUID instead of path to match connectionsBeniamino Galvani2016-09-261-5/+5
| | | | | The path can change, while the UUID should univocally identify the connection.
* checkpoint: better handle unmanaged and unrealized devicesBeniamino Galvani2016-09-261-26/+45
| | | | | | In order to better restore the previous system state, allow the inclusion of unmanaged devices in a checkpoint and try to revert to the old state taking also the realized/managed state into account.
* core: allow passing an applied connection to nm_act_request_new()Beniamino Galvani2016-09-261-0/+1
| | | | | This is useful for the checkpoint/restore functionality to revert both the applied and the settings connections.
* core: use _NM_GET_PRIVATE() macrosThomas Haller2016-09-081-13/+2
|
* checkpoint: add create, rollback and destroy D-Bus APIBeniamino Galvani2016-08-171-0/+433
Co-authored-by: Thomas Haller <thaller@redhat.com>