summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* tests: various refactoring in tools/test-networkmanager-service.pyth/cli-unit-testsThomas Haller2018-05-111-4/+2
|
* tests: refactor finding device in NetworkManager stubThomas Haller2018-05-111-55/+51
| | | | | | | | - add find_devices() and find_device_first() functions, to not re-implement iterating the device list. - for test functions, accept the device's "ident", instead of ifname. The "ident" must b unique, contrary to the "ifname".
* clients/tests: add python test script for nmcli testsThomas Haller2018-05-1136-76/+1514
| | | | | | | | | | | | | 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.
* build: let `make check` re-generate clients/common/settings-doc.h.in with ↵Thomas Haller2018-05-111-3/+7
| | | | | | | | | | | | | | | | | | | | | | | NM_TEST_REGENERATE=1 When building with --disable-introspection, we re-use the pre-generated clients/common/settings-doc.h.in file. When building with --enable-introspection, we generate clients/common/settings-doc.h, and let `make check` verify that the generated file is identical to what we would generate. The common case where the generated file differ, is when code changed, in this case, the developer is advised to update settings-doc.h.in. Interpret environment variable NM_TEST_REGENERATE=1 to do this automatically during `make check`. This will be useful, as there might be several tests that compare a generated file with a file from version control. NM_TEST_REGENERATE=1 will be the general way to re-generate all these files. $ NM_TEST_REGENERATE=1 make check
* tests: use libnm via pygobject in tools/test-networkmanager-service.pyThomas Haller2018-05-119-42/+285
| | | | | | | | | | | | | | | | | | | | | 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().
* build: set LD_LIBRARY_PATH and GI_TYPELIB_PATH variables in run-nm-test.shThomas Haller2018-05-113-4/+31
| | | | | | | | | | With autotools, we use libtool so that the right libraries are automatically found. Still, we won't find the right GI typelib. Add a mechanism so that when make/meson invokes the run-nm-test.sh runner, it passes the build-root directory. Also, try to autodetect when invoked manually.
* tests: minor code cleanup of nmtst_main_loop_run()Thomas Haller2018-05-111-12/+5
|
* shared: add NM_PID_T_INVAL macro for invalid PIDsThomas Haller2018-05-111-0/+2
|
* shared: add nm_auto_unref_gsource cleanup macroThomas Haller2018-05-111-0/+8
|
* Revert "build: qualify plugin dir name with a version string"Lubomir Rintel2018-05-114-32/+27
| | | | | | | This is broken -- looks for VPN plugins in a version-qualified path, which is wrong and break installed VPN plugins. This reverts commit 6384ad4ee16f31dd103f790bd193c4049d89a6fc.
* merge: branch 'lr/nmcli-colors'Lubomir Rintel2018-05-1073-559/+976
|\ | | | | | | https://github.com/NetworkManager/NetworkManager/pull/105
| * cli: allow setting the colors with terminal-colors.d(5)lr/nmcli-colorsLubomir Rintel2018-05-106-8/+545
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The present version of the specification is somewhat unclear at times, Unclear points were discussed with the maintainers [1] and probably some new version will address those. https://www.spinics.net/lists/util-linux-ng/msg15222.html Until then here's how the implementation copes with ambiguities (after the discussion with util-linux maintainers): 1.) It is unclear whether multiple .schem files should override each other or be merged. We use the overriding behavior -- take the highest priority one and ignore the rest. 2.) We assume "name.schem" is more specific than "@term.schem". 3.) We assume the "Color name" are to be used as aliases for the color sequences and translate them to ANSI escape sequences. 4.) The "Escape sequences" are of no use since the specification pretty much assumes an ANSI terminal and none of the sequences make any sense in ANSI color codes. We don't support them. accept that. 5.) We don't implement TERMINAL_COLORS_DEBUG because it's unspecified what should it do.
| * cli: use a palette to implement coloringLubomir Rintel2018-05-1011-272/+207
| | | | | | | | | | | | | | | | | | | | | | This basically replaces the (NMMetaTermColor, NMMetaTermFormat) combo with NMMetaColor that describes the colored element semantically as opposed to storing the raw attributes. A (currently static) paletted is used to translate the semantic color code to the actual ANSI controle sequence. This matches what terminal-colors.d(5) schemes use, making it convenient to implement customizable palettes.
| * cli: rework enabling and disabling colorsLubomir Rintel2018-05-107-66/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This actually makes very little difference at the moment, but will make things more confortable later on, when the logic of enabling/disabling coloring will involve terminal-colors.d(5). Instead of deciding whether to use colors lazily with use_colors(), it's done very early on nmcli initialization and a boolean use_colors field is stored in the NmcConfig instance instead of the raw tristate option of NmcColorOption type (which is now confined to nmcli.c). Wherever the NmcColorOption was used previously, the whole NmcConfig instance is passed around. That might seem pointless (since only the use_colors boolean is actually used at the moment), but will be utilized to pass around the actual color palette in future.
| * cli: drop --prompt-colorLubomir Rintel2018-05-105-70/+15
| | | | | | | | | | | | | | | | | | It's undocumented, useless, somewhat expensive in volume of code and probably just downright stupid. We'll get a more general way to set colors. Hacking in some code to keep this working wouldn't be too difficult, but it seems entirely pointless.
| * cli: use static initializer for NmCliLubomir Rintel2018-05-101-37/+31
| | | | | | | | | | It's perhaps but a small improvement here, but will make things a lot more convenient when the color palette will be added.
| * cli: drop a useless commentLubomir Rintel2018-05-101-1/+0
| | | | | | | | Thomas doesn't like it and who am I to argue with him.
| * cli: do not leave dangling pointers in a global structLubomir Rintel2018-05-101-1/+1
| | | | | | | | Makes Thomas content and happy..
| * all: use the elvis operator wherever possibleLubomir Rintel2018-05-1062-141/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * all: add and utilize nm_utils_is_separator()Lubomir Rintel2018-05-104-4/+10
|/ | | | | | | | | It is meant to be rather similar in nature to isblank() or g_ascii_isspace(). Sadly, isblank() is locale dependent while g_ascii_isspace() also considers vertical whitespace as a space. That's no good for configuration files that are strucutured into lines, which happens to be a pretty common case.
* device: start IP configuration when master carrier goes upBeniamino Galvani2018-05-091-6/+6
| | | | | | | | | | | | | | | | | If the master has no carrier in act_stage3_ip6_config_start(), we set IP state WAIT and wait until carrier goes up before starting IP configuration. However, in carrier_changed() if the device state is ACTIVATED we only call nm_device_update_dynamic_ip_setup(), which just restarts DHCP if it was already running. Let's also ensure that we start IP configuration if the IP state is WAIT. Fixes: b0f6baad90a3d8b571a56cc255ad49d9fa26d874 https://bugzilla.redhat.com/show_bug.cgi?id=1575944
* core-utils: don't load modules not ending with ".so"Lubomir Rintel2018-05-091-1/+1
| | | | This prevents attempts to load garbage from the module directory.
* merge: branch 'lr/version-dir'Lubomir Rintel2018-05-0917-41/+48
|\ | | | | | | https://github.com/NetworkManager/NetworkManager/pull/104
| * build: qualify plugin dir name with a version stringlr/version-dirLubomir Rintel2018-05-094-27/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes package updates more robust, avoiding in-place replaces of the plugins. Previously, if an upgrade transaction was terminated, NetworkManager library could end up being of a different version than the plugins. If the user was unfortunate enough to connect using a connection that required a plugin (say, Wi-Fi), he would be left without a network connection making it somewhat inconvenient to recover from the botched upgrade. This makes the whole situation a little bit less sad.
| * meson: distinguish arch specific and arch neutral lib dirLubomir Rintel2018-05-0914-15/+17
| | | | | | | | | | Plugins go to the arch specific place while conf.d/ and VPN/ are in lib/. Use the same naming as is used with autoconf.
| * meson: quote dist_version properlyLubomir Rintel2018-05-091-1/+1
|/
* session-monitor: avoid an assertion failure if there's no session monitorLubomir Rintel2018-05-091-1/+1
| | | | | | The constructor can bail out early, not setting monitor->sd.watch: (NetworkManager:373): GLib-CRITICAL **: 20:35:58.601: g_source_remove: assertion 'tag > 0' failed
* platform: fix adding direct route to gatewayBeniamino Galvani2018-05-071-0/+2
| | | | | | | | | | | | | Without ifindex, adding the direct route to gateway fails: platform: route-sync: failure to add IPv6 route: fd02::/64 via fd01::1 dev 1635 metric 101 mss 0 rt-src user: No route to host (113); try adding direct route to gateway fd01::1/128 via :: metric 101 mss 0 rt-src user platform: route: append IPv6 route: fd01::1/128 via :: metric 101 mss 0 rt-src user platform-linux: delayed-action: schedule wait-for-nl-response (seq 269, timeout in 0.199999195, response-type 0) platform-linux: delayed-action: handle wait-for-nl-response (any) platform-linux: netlink: recvmsg: new message NLMSG_ERROR, flags 0, seq 269 platform-linux: netlink: recvmsg: error message from kernel: No such device (19) for request 269 Fixes: c9f89cafdf588f443821ccff220283859ab26d1f
* build: add missing dependencies for building nmcliThomas Haller2018-05-051-0/+2
|
* libnm: export nm_connection_get_setting_tc_config()Beniamino Galvani2018-05-051-0/+1
| | | | Fixes: da13c7a1a4b91e95bbbe3014ecb6f36800c20dc8
* checkpoint: fix D-Bus operation to destroy checkpointThomas Haller2018-05-031-1/+1
| | | | | | | | | | When passing "/" to destroy all checkpoints, wrongly no checkpoint was destroyed. When passing a particular path that should be destroyed, wrongly all checkpoints were destroyed. Fixes: 79458a558bdf45a789df3024f84942f85eb15875
* build: add a missing dependencyLubomir Rintel2018-05-021-0/+2
| | | | | | | | | | | | | | | Parallel make failed for me: /usr/bin/xsltproc --output man/nm-settings-keyfile.xml ... ... man/nm-settings-keyfile.xsl libnm/nm-settings-keyfile-docs.xml man/nm-settings-keyfile.xsl:4: warning: failed to load external entity "man/common.ent" %entities; ^ man/nm-settings-keyfile.xsl:26: parser error : Entity 'NM_VERSION' not defined <refmiscinfo class="version">&NM_VERSION;</refmiscinfo> ^ cannot parse man/nm-settings-keyfile.xsl make[2]: *** [Makefile:18130: man/nm-settings-keyfile.xml] Error 4
* auth-manager: use the correct function to deallocate a GErrorLubomir Rintel2018-05-021-1/+1
| | | | This one ruins the party.
* build: fix missing dependency when building clients/tui/newt/libnmt-newt.aThomas Haller2018-05-021-0/+2
| | | | | We need to declare explicit dependencies, otherwise, the required header files may not yet be created when building nmtui helper library.
* libnm: add missing device includes to NetworkManager.hBeniamino Galvani2018-05-021-0/+2
|
* core: merge branch 'th/manager-activation-cleanup'Thomas Haller2018-05-016-80/+224
|\ | | | | | | https://github.com/NetworkManager/NetworkManager/pull/106
| * manager: search all existing active connections during ↵th/manager-activation-cleanupThomas Haller2018-04-301-7/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nm_manager_get_best_device_for_connection() In nm_manager_get_best_device_for_connection(), not only check whether the first found active-connection has a device. There might be multiple candidates, in which case iterate over them and figure out which one is the most suitable. Also, despite the found @ac has the same settings-connection, it does not mean that the connection is available on the device. Extend the check and only return compatible and ready devices. This can easily happen that the settings-connection was modified in the meantime and no longer is compatible with the device (despite currently being active on the device, but with the previous settings).
| * manager: disconnect all conflicting concurrent active connections in ↵Thomas Haller2018-04-301-5/+18
| | | | | | | | | | | | | | | | | | _internal_activate_device() It is possible, that there are multiple such conflicting connections. Maybe not now, but with connecition cardinality it will soon be. Find and disconnect them all.
| * core: rework nm_device_steal_connection()Thomas Haller2018-04-303-20/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nm_device_steal_connection() was a bit misleading. It only had one caller, and what _internal_activate_device() really wants it to deactivate all other active-connections for the same connection. Hence, it already performed a lookup for the active-connection that should be disconnected, only to then lookup the device, and tell it to steal the connection. Note, that if existing_ac happens to be neither the queued nor the currenct active connection, then previously it would have done nothing. It's unclear when that exactly can happen, however, we can avoid that question entirely. Instead of having steal-connection(), have a disconnect-active-connection(). If there is no matching device, it will just set the active-connection's state to DISCONNECTED. Which in turn does nothing, if the state is already DISCONNECTED.
| * core: don't consider deactivating active-connection when checking for ↵Thomas Haller2018-04-301-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | concurrent activations At various places we check whether we have an active-connection already. For example, when activating a new connection in _internal_activate_device(), we might want to "nm_device_steal_connection()" if the same profile is already active. However, the max-state argument was not accurate in several cases. For the purpose of finding concurrent activations, we don't care about active-connections that are already in state DEACTIVATING. Only those that are ACTIVATED or before.
| * manager: minor refactoring of active_connection_find_by_connection()Thomas Haller2018-04-301-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | active_connection_find_by_connection() (or how it was called previously) is a simpler wrapper around active_connection_find(), which accepts a NMConnection argument, that may or may not be a NMSettingsConnection. It always passed NM_ACTIVE_CONNECTION_STATE_DEACTIVATING as max_state, and I think that one of the two callers don't should do that. A later commit will change that. So, we also want to pass @max_state as argument to active_connection_find_by_connection(). At that point, make active_connection_find_by_connection() identical to active_connection_find(), with the only exception, that it accepts a NMConnection and does automatically do the right thing (either lookup by pointer equality or by uuid).
| * manager: extend helper function to find all matching active-connectionsThomas Haller2018-04-301-25/+61
| | | | | | | | | | | | ... instead of just the first. It's not used yet, and there is no change in behavior.
| * core: only abort conflicting activations for certain activation typesThomas Haller2018-04-301-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are various places where we do an internal activation (with an internal auth-subject). In several of these places, the ACTIVATION_REASON is USER_REQUEST. I think it is wrong to generally abort all internal activations, except AUTOCONNECT_SLAVES ones. I think, aborting an activation should be opt-in instead of opt-out. To me it seems, we want to abort the activation based on the activation reason. For now, opt-in to EXTERNAL, ASSUME and AUTOCONNECT only. If there are additional cases where we should abort activation, we should add yet another reason and not use USER_REQUEST.
| * core: add activation-reasons for external/assume connectionsThomas Haller2018-04-303-6/+14
| | | | | | | | | | | | | | | | | | Until now, we only really cared about whether a connection was activated with reason NM_ACTIVATION_REASON_AUTOCONNECT_SLAVES or not. Now however, we will care about whether a connection was activated via (genuine) autoconnect by NMPolicy, or external/assume by NMManager. Add a new reason to distinguish between them.
| * settings: avoid lookup in nm_settings_has_connection()Thomas Haller2018-04-301-10/+17
|/ | | | | | | | There is no need to perform a lookup by path. NMSettings is a singleton, it has the connection exactly iff the connection is linked. Also add an assertion to double-check that the results agree with the previous implementation.
* all: remove consecutive empty linesBeniamino Galvani2018-04-30189-364/+0
| | | | | | | Normalize coding style by removing consecutive empty lines from C sources and headers. https://github.com/NetworkManager/NetworkManager/pull/108
* manager: fix assertion in nm_manager_activate_connection()Beniamino Galvani2018-04-301-4/+6
| | | | | | | | | | nm_manager_activate_connection() should not require a device to be passed in for VPN connections because when the argument is NULL the actual device will be determined by _new_active_connection(). Fixes: 10753c36168a82cd658df8a7da800960fddd78ed https://bugzilla.redhat.com/show_bug.cgi?id=1570545 https://github.com/NetworkManager/NetworkManager/pull/109
* po: updated Russian (ru) translation (bgo #794738)Stas Solovey2018-04-271-207/+182
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=794738
* connectivity: merge branch 'th/connectivity-check-on-activated'Thomas Haller2018-04-271-34/+60
|\ | | | | | | https://github.com/NetworkManager/NetworkManager/pull/103
| * device/connectivity: refactor concheck_periodic_schedule_do()Thomas Haller2018-04-271-22/+32
| | | | | | | | | | | | | | | | | | | | | | | | Instead of passing the interval for the timeout, let concheck_periodic_schedule_do() figure it out on its own. It only depends on cur-interval and cur-basetime. Additionally, pass now_ns timestamp, because we already made decisions based on this particular timestamp. We don't want to re-evalutate the current time but ensure to use the same timestamp. There is no change in behavior, it just seems nicer this way.