summaryrefslogtreecommitdiff
path: root/libnm
Commit message (Collapse)AuthorAgeFilesLines
* doc: add units to nm_device_get_mtu()Thomas Haller2018-05-231-1/+1
|
* doc: add units to some libnm (and libnm-glib) function docsHarry Mallon2018-05-232-6/+6
| | | | https://mail.gnome.org/archives/networkmanager-list/2018-May/msg00027.html
* build: meson: add missing nm-autoptr.h to libnm headersBeniamino Galvani2018-05-111-0/+1
| | | | | | Fixes: ff8e56336574a168d427a993d666d9e038aacbaf https://bugzilla.gnome.org/show_bug.cgi?id=795965
* clients/tests: add python test script for nmcli testsThomas Haller2018-05-111-3/+9
| | | | | | | | | | | | | Add a test which runs nmcli against our stub NetworkManager service and compares the output. The output formats of nmcli are complicated and not easily understood. For example how --mode tabular|multiline interacts with selecting output-fields (--fields) and output modes ([default]|--terse|--pretty). Also, there are things like `nmcli connection show --order $FIELD_SPEC`. We need unit tests to ensure that we don't change the output accidentally.
* tests: use libnm via pygobject in tools/test-networkmanager-service.pyThomas Haller2018-05-113-5/+75
| | | | | | | | | | | | | | | | | | | | | tools/test-networkmanager-service.py is our NetworkManager stub server. NetworkManager uses libnm(-core) heavily, for example to decide whether a connection verifies (nm_connection_verify()) and for normalizing connections (nm_connection_normalize()). If the stub server wants to mimic NetworkManager, it also must use these function. Luckily, we already can do so, by loading libnm using python GObject introspection. We already correctly set GI_TYPELIB_PATH search path, so that the correct libnm is loaded -- provided that we build with introspection enabled. We still need to gracefully fail, if starting the stub server fails. That requries some extra effort. If the stub server notices that something is missing, it shall exit with status 77. That will cause the tests to g_test_skip().
* doc: fix GTK-Doc NMRoute linksHarry Mallon2018-05-111-1/+1
| | | | https://mail.gnome.org/archives/networkmanager-list/2018-May/msg00000.html
* all: use the elvis operator wherever possibleLubomir Rintel2018-05-104-6/+6
| | | | | | | | | | | | | | | | | | | | | Coccinelle: @@ expression a, b; @@ -a ? a : b +a ?: b Applied with: spatch --sp-file ternary.cocci --in-place --smpl-spacing --dir . With some manual adjustments on spots that Cocci didn't catch for reasons unknown. Thanks to the marvelous effort of the GNU compiler developer we can now spare a couple of bits that could be used for more important things, like this commit message. Standards commitees yet have to catch up.
* libnm: export nm_connection_get_setting_tc_config()Beniamino Galvani2018-05-051-0/+1
| | | | Fixes: da13c7a1a4b91e95bbbe3014ecb6f36800c20dc8
* libnm: add missing device includes to NetworkManager.hBeniamino Galvani2018-05-021-0/+2
|
* all: remove consecutive empty linesBeniamino Galvani2018-04-3015-20/+0
| | | | | | | Normalize coding style by removing consecutive empty lines from C sources and headers. https://github.com/NetworkManager/NetworkManager/pull/108
* shared: drop duplicate c-list.h headerBeniamino Galvani2018-04-182-2/+2
| | | | Use the one from the project just imported.
* all: add D-Bus property "Flags" for Settings.Connection interfaceThomas Haller2018-04-163-0/+43
| | | | | | | | | | | The D-Bus interface already has a boolean property "Unsaved". While that is nicer too look at (in the API), adding a new flag is very cumbersome, and also has more overhead. For example, it requires extending the D-Bus API, all the way down to libnm. Add a flags argument, that will allow to add future boolean flags easier.
* all: unify spelling of translators hint in source codeThomas Haller2018-04-131-1/+1
| | | | | | | | | Use the same form everywhere: "TRANSLATORS" instead of "Translators". The manual also seems to prefer the upper-case form [1]. $ sed 's/\<Translators\>: /TRANSLATORS: /g' $(git grep -l Translators) -i [1] https://www.gnu.org/software/gettext/manual/gettext.html
* build: meson: add prefix to test namesBeniamino Galvani2018-04-121-1/+1
| | | | | | There are multiple tests with the same in different directories; add a unique prefix to test names so that it is clear from the output which one is running.
* build: meson: enable all tests againBeniamino Galvani2018-04-121-4/+3
| | | | | | Some tests were disabled because they failed when run in parallel. Now that we use the wrapper script they succeed and can be enabled again.
* build: meson: use run-nm-test.sh to run testsBeniamino Galvani2018-04-121-1/+5
| | | | | Like autotools, use the wrapper script 'run-nm-test.sh' that starts a separate D-Bus session when needed.
* libnm: rework checkpoint APIThomas Haller2018-04-045-105/+104
| | | | | | | | | | | | | | | | | | | | | | The libnm API fir checkpoints was only introduced with 1.11. It is not yet stable, so there is still time to adjust it. Note that this changes API/ABI of the development branch. Changes: - we only add async variants of the checkpoint functions. I believe that synchronous D-Bus methods are fundamentally flawed, because they mess up the ordering of events. Rename the async functions by removing the "_async" suffix. This matches glib style, for which the async form is also not specially marked. - for function that refere to a particular checkpoint (rollback and destroy), accept the D-Bus path as string, instead of an NMCheckpoint instance. This form is more flexible, because it allows to use the function without having a NMCheckpoint instance at hand. On the other hand, if one has a NMCheckpoint instance, he can trivially obtain the path to make the call.
* checkpoint: allow resetting the rollback timeout via D-BusThomas Haller2018-04-045-0/+166
| | | | | | | | | | | | | | | | | | | | | | This allows to adjust the timeout of an existing checkpoint. The main usecase of checkpoints, is to have a fail-safe when configuring the network remotely. By allowing to reset the timeout, the user can perform a series of actions, and keep bumping the timeout. That way, the entire series is still guarded by the same checkpoint, but the user can start with short timeout, and re-adjust the timeout as he goes along. The libnm API only implements the async form (at least for now). Sync methods are fundamentally wrong with D-Bus, and it's probably not needed. Also, follow glib convenction, where the async form doesn't have the _async name suffix. Also, accept a D-Bus path as argument, not a NMCheckpoint instance. The libnm API should not be more restricted than the underlying D-Bus API. It would be cumbersome to require the user to lookup the NMCheckpoint instance first, especially since libnm doesn't provide an efficient or convenient lookup-by-path method. On the other hand, retrieving the path from a NMCheckpoint instance is always possible.
* checkpoint: generate GIR information for NMCheckpointCreateFlagsThomas Haller2018-04-041-0/+1
| | | | | | | Note that this changes API for checkpoint_create_async() in Python via GIR. Previously it would require an integer argument, now a flags argument. But this API is still unstable, it will be introduced with 1.12.
* libnm: fix crash creating checkpoint during find_checkpoint_info()Thomas Haller2018-04-041-10/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that the D-Bus signals in server are reordered, creating a checkpoint in libnm crashes: $ examples/python/gi/checkpoint.py create 4 #0 0x00007ffff6d011ee in __strcmp_sse2_unaligned () at /lib64/libc.so.6 #1 0x00007fffeb611c90 in find_checkpoint_info (manager=manager@entry=0x5555559e5110 [NMManager], path=0x7fffdc0092f0 "/org/freedesktop/NetworkManager/Checkpoint/6") at libnm/nm-manager.c:153 #2 0x00007fffeb611d8f in checkpoint_added (manager=0x5555559e5110 [NMManager], checkpoint=checkpoint@entry=0x555555a122d0 [NMCheckpoint]) at libnm/nm-manager.c:1194 #3 0x00007fffef7db929 in g_cclosure_marshal_VOID__OBJECTv (closure=0x5555559e4b30, return_value=<optimized out>, instance=<optimized out>, args=<optimized out>, marshal_data=<optimized out>, n_params=<optimized out>, param_types=0x5555559e2fc0) at gmarshal.c:2102 #4 0x00007fffef7d8976 in _g_closure_invoke_va (closure=0x5555559e4b30, return_value=0x0, instance=0x5555559e5110, args=0x7fffffffc1c8, n_params=1, param_types=0x5555559e2fc0) at gclosure.c:867 #5 0x00007fffef7f3ff4 in g_signal_emit_valist (instance=instance@entry=0x5555559e5110, signal_id=signal_id@entry=97, detail=0, var_args=var_args@entry=0x7fffffffc1c8) at gsignal.c:3300 #6 0x00007fffef7f4b48 in g_signal_emit_by_name (instance=instance@entry=0x5555559e5110, detailed_signal=detailed_signal@entry=0x7fffffffc310 "checkpoint-added") at gsignal.c:3487 #7 0x00007fffeb6156d1 in deferred_notify_cb (data=0x5555559e5110) at libnm/nm-object.c:219 #8 0x00007fffeb615ae7 in object_property_maybe_complete (self=0x5555559e5110 [NMManager]) at libnm/nm-object.c:555 #9 0x00007fffeb615e5d in object_created (obj=<optimized out>, path=<optimized out>, user_data=<optimized out>) at libnm/nm-object.c:576 #10 0x00007fffeb61648b in handle_object_array_property (pi=<optimized out>, value=0x7fffdc075070, property_name=0x7fffeb67f117 "checkpoints", self=0x5555559e5110 [NMManager]) at libnm/nm-object.c:671 #11 0x00007fffeb61648b in handle_property_changed (self=self@entry=0x5555559e5110 [NMManager], dbus_name=<optimized out>, value=<optimized out>) at libnm/nm-object.c:740 #12 0x00007fffeb6166e9 in properties_changed (proxy=<optimized out>, changed_properties=<optimized out>, invalidated_properties=<optimized out>, user_data=0x5555559e5110) at libnm/nm-object.c:772 ... That is, because NetworkManager now first emits signals that the checkpoint object was created, before answering the D-Bus request. That makes more sense, but leads to this crash. The ugliness of how libnm handles object visibility is considerable. libnm hides objects until they are fully initialized. So, when the async create-checkpoint operation returns, the object might not yet be ready to be exposed. We need to delay the result. It would be better if the API would simply return the created path.
* libnm: minor cleanup of nm_manager_get_device_by_path()Thomas Haller2018-04-041-5/+3
|
* libnm: don't use GTK-Doc comment in nm-autoptr.hBeniamino Galvani2018-03-281-2/+2
| | | | | | | | | It generates the following warning: libnm/nm-autoptr.h:25: Error: NM: identifier not found on the first line: * Note that you might use this header with older versions of libnm Fixes: ff8e56336574a168d427a993d666d9e038aacbaf
* libnm: add nm-autoptr.h headerThomas Haller2018-03-272-0/+87
| | | | | | | | | | | | | | | | | | | "nm-autoptr.h" is done in a way that allows you to copy the header in your source tree to support older versions of libnm, that didn't contain the header yet. For example, we might want to use it in network-manager-applet, but we don't want to bump the libnm dependency to 1.11.2+ only to get this functionality. Note that G_DEFINE_AUTOPTR_CLEANUP_FUNC() was added in glib 2.43.4, and requires compiler support for the cleanup attribute. The compiler support is taken as given, because we rely on it already. However, NetworkManager and network-manager-applet still don't depend on a glib version recent enough to provide these macros. To actually use them (*inside*) NetworkManager/network-manager-applet, we either would have to bump the glib minimal dependency, or reimplement g_autoptr in /shared/nm-utils/nm-glib.h compat header. https://bugzilla.gnome.org/show_bug.cgi?id=794294
* libnm: don't use deprecated tags for GOobject introspectionThomas Haller2018-03-262-10/+4
|\ | | | | | | | | https://bugzilla.gnome.org/show_bug.cgi?id=744250 https://bugzilla.gnome.org/show_bug.cgi?id=794658
| * libnm: don't use deprecated tags for GOobject introspectionJiří Klimeš2018-03-262-12/+4
| | | | | | | | | | | | | | | | | | | | Top level tags are deprecated in favour of identifier annotations. https://mail.gnome.org/archives/commits-list/2013-October/msg03220.html https://wiki.gnome.org/action/show/Projects/GObjectIntrospection/Annotations?action=show&redirect=GObjectIntrospection%2FAnnotations#Type_signature Signed-off-by: Jiří Klimeš <jklimes@redhat.com> https://bugzilla.gnome.org/show_bug.cgi?id=744250
* | gobject-introspection: made several fixes to the annotationsCorentin Noël2018-03-2612-40/+17
|/ | | | https://bugzilla.gnome.org/show_bug.cgi?id=794658
* Add calls to g_simple_async_result_set_check_cancellableBenjamin Berg2018-03-089-0/+82
| | | | | | | | | | | | | | If an operation is cancelled through the GCancellable, then the idiom is that the operation is always cancelled, even if it has finished successfully. To ensure this is the case, add calls to g_simple_async_result_set_check_cancellable everywhere. Without this, e.g. gnome-control-center will crash when switching away from the power panel quickly, as the NMClient creation finishes asynchronously and g-c-c assume that G_IO_ERROR_CANCELLED is returned to ensure it doesn't access the now invalid user_data parameter. https://bugzilla.gnome.org/show_bug.cgi?id=794088
* libnm/tests: fix compilation of test-generalThomas Haller2018-02-261-2/+2
| | | | | | | | | | | | | | ../libnm/tests/test-general.c: In function ‘test_fixup_vendor_string’: ../libnm/tests/test-general.c:70:3: error: initializer element is not constant T_DATA ("3Com", "3Com"), ^ ../libnm/tests/test-general.c:70:3: error: (near initialization for ‘data[0]’) ../libnm/tests/test-general.c: In function ‘test_fixup_product_string’: ../libnm/tests/test-general.c:365:3: error: initializer element is not constant T_DATA ("10/100BaseTX [RTL81xx]", "RTL81xx"), ... Fixes: 817fce917bb98c09977e8ca0cc87fc0612faeeb3
* libnm/tests: avoid compiler message about -fvar-tracking-assignments in ↵Thomas Haller2018-02-261-2081/+2117
| | | | | | | | | | | | test-general.c CC libnm/tests/libnm_tests_test_general-test-general.o libnm/tests/test-general.c: In function ‘test_fixup_product_string’: libnm/tests/test-general.c:328:1: note: variable tracking size limit exceeded with -fvar-tracking-assignments, retrying without test_fixup_product_string (void) ^~~~~~~~~~~~~~~~~~~~~~~~~ Fixes: 8e32d8fc230e593368ee7e5c85005c7b4281d88c
* libnm/device: use the type name for description if the product is emptylr/ugly-descriptionsLubomir Rintel2018-02-231-2/+5
| | | | | | It's very likely that the product said something that was filtered out by the fixup, such as "PCI Ethernet" or "Wi-Fi Adapter". Use a generic type name in place of it.
* libnm/device: (trivial) move some function upwardsLubomir Rintel2018-02-231-130/+130
|
* libnm/device: prefer FROM_DATABASE udev propertiesLubomir Rintel2018-02-231-7/+6
| | | | | | The database has a chance to fix up over garbage strings from the device properties and we're now known to be reasonably good at fixing up crap there.
* libnm/utils: drop part after a dash in product nameLubomir Rintel2018-02-232-0/+17
| | | | | | | It's always garbage. At this point we seem to reasonably handle all product names that come from hwdb.
* libnm/utils: extend the product fixup phrase listLubomir Rintel2018-02-234-41/+2070
| | | | | | The product names are generally of rather poor quality. The product name is no place to enumerate product capabilities, the bus it's attached on and similar nonsense.
* libnm/utils: ignore parts of vendor name after a slashLubomir Rintel2018-02-232-2/+17
| | | | | At this point the test suite also contains all network vendor names known to hwdb.
* libnm/utils: deal with the square brackets on producr/vendor fixupLubomir Rintel2018-02-232-5/+38
| | | | | | | | | If there's a [<string>] that survived the substitution, then the string is supposed to be a short form that is generally preferrable. That's great in theory, but actually it's rather often pure garbage for product names. Let's prefer it just for vendors and provide an option to drop it (will be useful for fixing up product names).
* libnm/utils: ignore stuff in parentheses for vendor/product fixupsLubomir Rintel2018-02-232-2/+19
| | | | It's always useless.
* libnm/utils: add more phrases to vendor fixup listLubomir Rintel2018-02-232-1/+174
| | | | Along with known correctly fixed up vendor names.
* libnm/utils: split out vendor fixupLubomir Rintel2018-02-234-74/+258
| | | | | | | | | | The hwdb generally contains the strings of rather poor quality, especially when it comes to sensibly presenting them to the user and they need various cleanups. While the following patches add fixups, this one splits out vendor fixups, because it turns out that a different set of fixups is needed than for products.
* libnm/vpn-plugin: avoid bad function pointer type castsLubomir Rintel2018-02-082-2/+18
| | | | | This makes GCC 8.0 unhappy and it is probably right about that -- it's more difficult to get things wrong when the function prototypes actually match.
* all: replace non-leading tabs with spacesThomas Haller2018-02-072-2/+2
| | | | | | We commonly only allow tabs at the beginning of a line, not afterwards. The reason for this style is so that the code looks formated right with tabstop=4 and tabstop=8.
* trivial: avoid XXX tag and replace by NOTE or FIXMEThomas Haller2018-01-231-2/+3
| | | | | | | | XXX was used to either raise attention (NOTE) or to indicate that this is ugly code that should be fixed (FIXME). The usage was inconsistent. Let's avoid XXX and use either NOTE or FIXME.
* libnm: fix empty statements that were supposed to return NULLPavel Šimerda2018-01-171-3/+3
| | | | Discovered thanks to `-Wunused-value` when building on openSUSE Leap 42.3.
* wifi: add support for FILSMasashi Honma2018-01-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The FILS(Fast Initial Link Setup) is a specification defined by IEEE 802.11ai to speed up roaming. This patch adds support of it. I have tested with these cases. +-----+-------------------------+----------------+ | STA | AP | | |FILS | key-mgmt | result | +-----+-------------------------+----------------+ | 1 | WPA-EAP | O | +-----+-------------------------+----------------+ | 1 | WPA-EAP-SHA256 | O | +-----+-------------------------+----------------+ | 1 | FILS-SHA256 | X | +-----+-------------------------+----------------+ | 1 | FILS-SHA384 | X | +-----+-------------------------+----------------+ | 1 | WPA-EAP WPA-EAP-SHA256 | O | | | FILS-SHA256 FILS-SHA384 | WPA-EAP-SHA256 | +-----+-------------------------+----------------+ | 2 | WPA-EAP | O | +-----+-------------------------+----------------+ | 2 | WPA-EAP-SHA256 | O | +-----+-------------------------+----------------+ | 2 | FILS-SHA256 | O | +-----+-------------------------+----------------+ | 2 | FILS-SHA384 | O | +-----+-------------------------+----------------+ | 2 | WPA-EAP WPA-EAP-SHA256 | O | | | FILS-SHA256 FILS-SHA384 | FILS-SHA384 | +-----+-------------------------+----------------+ | 3 | WPA-EAP | X | +-----+-------------------------+----------------+ | 3 | WPA-EAP-SHA256 | X | +-----+-------------------------+----------------+ | 3 | FILS-SHA256 | O | +-----+-------------------------+----------------+ | 3 | FILS-SHA384 | O | +-----+-------------------------+----------------+ | 3 | WPA-EAP WPA-EAP-SHA256 | O | | | FILS-SHA256 FILS-SHA384 | FILS-SHA384 | +-----+-------------------------+----------------+ Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
* libnm: add nm_vpn_service_plugin_shutdown() APIThomas Haller2018-01-163-33/+65
| | | | | | | | | Otherwise, the only way to disconnect the NMVpnServicePlugin instance is by completely unrefing it. However, often it is not so easy to ensure that nobody else is still keeping the instance alive, after the point where we no longer want to handle D-Bus requests. nm_vpn_service_plugin_shutdown() to the rescue.
* libnm: cleanup resource handling in NMVpnServicePlugin:init_sync()Thomas Haller2018-01-161-13/+6
|
* libnm/vpn: unexport and destroy D-Bus glue instance with NMVpnServicePluginThomas Haller2018-01-151-5/+11
| | | | | Otherwise, we might still be called back with D-Bus requests, after the NMVpnServicePlugin instance is already destroyed.
* build/meson: use variables for ldflags and linker-scriptThomas Haller2018-01-111-7/+6
|
* build/meson: remove unnecessary square bracketsThomas Haller2018-01-111-1/+1
|
* secret-agent: construct the dbus proxy for async agent with the correct bus nameLubomir Rintel2018-01-111-2/+2
| | | | | | | The asynchronous secret agent initialization doesn't work at all due to a rather silly typo. Oops. While at it, fix a whitespace error too.