summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* dhcp: include conditionals from existing dhclient configurationbg/dhcp-conditionals-rh1758550Beniamino Galvani2019-10-072-12/+50
| | | | | | | | | | Since commit 159ff23268b1 ('dhcp/dhclient-utils: skip over dhclient.conf blocks') we skip blocks enclosed in lines containing '{' and '}' because NM should ignore 'lease', 'alias' and other declarations. However, conditional statements seem useful and should not be skipped. https://bugzilla.redhat.com/show_bug.cgi?id=1758550
* dispatcher: avoid "dirname" and "basename" calls in "10-ifcfg-rh-routes.sh" ↵Thomas Haller2019-10-041-9/+5
| | | | | | | | | | | | | script The script is run for every dispatcher event. Most of the events are not actually relevant, and we just need to determine that there is nothing to do and quit. Avoid calling "dirname" and "basename". The supported ifcfg-file has a very specific form. We can just check (and parse) it in one got regular expression in bash.
* dispatcher: move return-early checks in "10-ifcfg-rh-routes.sh" firstThomas Haller2019-10-041-18/+18
| | | | | | | A shell script is executed line-by-line. Note that for most dispatcher events, "10-ifcfg-rh-routes.sh" has nothing to do and will just quit. Move those checks earlier, to avoid bash executing the code that won't be needed most of the time.
* device: order assert before logging in concheck_cb()Thomas Haller2019-10-031-4/+4
|
* src/devices/nm-device.c: resolve possible null pointer dereferenceIlya Shipitsin2019-10-031-4/+4
| | | | | | | | found by cppcheck [src/devices/nm-device.c:3032] -> [src/devices/nm-device.c:3025]: (warning) Either the condition '!handle' is redundant or there is possible null pointer dereference: handle. https://github.com/NetworkManager/NetworkManager/pull/352
* libnm: merge branch 'th/libnm-deprecate-sync-api'Thomas Haller2019-10-0313-8/+295
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/296
| * libnm: deprecate nm_client_check_connectivity() in 1.22Thomas Haller2019-10-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous commit marks all synchronous libnm API as deprecated. In practice, the macro _NM_DEPRECATED_SYNC_METHOD expands to nothing, because there is no immediate urgency to force users to migrate. However nm_client_check_connectivity() is especially bad: it makes a synchronous call and then updates the content of the cache artificially. Usually, NMClient's cache of D-Bus objects is only updated by "PropertiesChanged" D-Bus signals. nm_client_check_connectivity() instead will act on the response to the "CheckConnectivity" D-Bus call -- a response that is picked out of order from the ordered sequence of messages -- and will update the cache instead of honoring the usual "PropertiesChanged" signal. I think such behavior is fundamentally broken. For a trivial property like NM_CLIENT_CONNECTIVITY such behavior is odd at best. Note how applying this approach to other functions (like nm_client_deactivate_connection(), which would affect a much larger state) would not be feasible. I also imagine it to be complicate to preserve this behavior when reworking libnm, as I plan to do. See also commit b799de281bc0 ('libnm: update property in the manager after connectivity check'), which introduced this behavior to "fix" bgo#784629.
| * libnm: deprecate synchronous/blocking API in libnmThomas Haller2019-10-0313-8/+294
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note that D-Bus is fundamentally asynchronous. Doing blocking calls on top of D-Bus is odd, especially for libnm's NMClient. That is because NMClient essentially is a client-side cache of the objects from the D-Bus interface. This cache should be filled exclusively by (asynchronous) D-Bus events (PropertiesChanged). So, making a blocking D-Bus call means to wait for a response and return it, while queuing all messages that are received in the meantime. Basically there are three ways how a synchronous API on NMClient could behave: 1) the call just calls g_dbus_connection_call_sync(). This means that libnm sends a D-Bus request via GDBusConnection, and blockingly waits for the response. All D-Bus messages that get received in the meantime are queued in the GMainContext that belongs to NMClient. That means, none of these D-Bus events are processed until we iterate the GMainContext after the call returns. The effect is, that NMClient (and all cached objects in there) are unaffected by the D-Bus request. Most of the synchronous API calls in libnm are of this kind. The problem is that the strict ordering of D-Bus events gets violated. For some API this is not an immediate problem. Take for example nm_device_wifi_request_scan(). The call merely blockingly tells NetworkManager to start scanning, but since NetworkManager's D-Bus API does not directly expose any state that tells whether we are currently scanning, this out of order processing of the D-Bus request is a small issue. The problem is more obvious for nm_client_networking_set_enabled(). After calling it, NM_CLIENT_NETWORKING_ENABLED is still unaffected and unchanged, because the PropertiesChanged signal from D-Bus is not yet processed. This means, while you make such a blocking call, NMClient's state does not change. But usually you perform the synchronous call to change some state. In this form, the blocking call is not useful, because NMClient only changes the state after iterating the GMainContext, and not after the blocking call returns. 2) like 1), but after making the blocking g_dbus_connection_call_sync(), update the NMClient cache artificially. This is what nm_manager_check_connectivity() does, to "fix" bgo#784629. This also has the problem of out-of-order events, but it kinda solves the problem of not changing the state during the blocking call. But it does so by hacking the state of the cache. I think this is really wrong because the state should only be updated from the ordered stream of D-Bus messages (PropertiesChanged signal and similar). When libnm decides to modify the state, there may be already D-Bus messages queued that affect this very state. 3) instead of calling g_dbus_connection_call_sync(), use the asynchronous g_dbus_connection_call(). If we would use a sepaate GMainContext for all D-Bus related calls, we could ensure that while we block for the response, we iterate that internal main context. This might be nice, because all events are processed in order and after the blocking call returns, the NMClient state is up to date. The are problems however: current blocking API does not do this, so it's a significant change in behavior. Also, it might be unexpected to the user that during the blocking call the entire content of NMClient's cache might change and all pointers to the cache might be invalidated. Also, of course NMClient would invoke signals for all the changes that happen. Another problem is that this would be more effort to implement and it involves a small performance overhead for all D-Bus related calls (because we have to serialize all events in an internal GMainContext first and then invoke them on the caller's context). Also, if the users wants this behavior, they could implement it themself by running libnm in their own GMainContext. Note that libnm might have bugs to make that really working, but that should be fixed instead of adding such synchrnous API behavior. Read also [1], for why blocking calls are wrong. [1] https://smcv.pseudorandom.co.uk/2008/11/nonblocking/ So, all possible behaviors for synchronous API have severe behavioural issues. Mark all this API as deprecated. Also, this serves the purpose of identifying blocking D-Bus calls in libnm. Note that "deprecated" here does not really mean that the API is going to be removed. We don't break API. The user may: - continue to use this API. It's deprecated, awkward and discouraged, but if it works, by all means use it. - use asynchronous API. That's the only sensible way to use D-Bus. If libnm lacks a certain asynchronous counterpart, it should be added. - use GDBusConnection directly. There really isn't anything wrong with D-Bus or GDBusConnection. This deprecated API is just a wrapper around g_dbus_connection_call_sync(). You may call it directly without feeling dirty. --- The only other remainging API is the synchronous GInitable call for NMClient. That is an entirely separate beast and not particularly wrong (from an API point of view). Note that synchronous API in NMSecretAgentOld, NMVpnPluginOld and NMVpnServicePlugin as not deprecated here. These types are not part of the D-Bus cache and while they have similar issues, it's less severe because they have less state.
* checkpatch,gitlab-ci: let checkpatch script compare against latest upstream ↵Thomas Haller2019-10-022-1/+7
| | | | | | | | | | | | | | | master When opening a merge request from a fork of NetworkManager, then the pipeline runs with the a checkout of the fork. That means, checkpatch would compare the branch against "master" (or "nm-x-y" stable branches) of the fork, instead of upstream. That doesn't seem too useful. Instead, also add upstream NetworkManager as git remote, fetch the branches, and use the branches from there as base for checkpatch. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/255
* cli: translate overview output of nmcliThomas Haller2019-10-021-5/+14
| | | | | | | | | | | Note the "to" in the output: $ LANG=de_DE.UTF-8 nmcli eth0: verbunden to Wired Connection 1 "Intel Ethernet" ... https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/246
* all: unify format of our Copyright source code commentsThomas Haller2019-10-02629-738/+738
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ```bash readarray -d '' FILES < <( git ls-files -z \ ':(exclude)po' \ ':(exclude)shared/c-rbtree' \ ':(exclude)shared/c-list' \ ':(exclude)shared/c-siphash' \ ':(exclude)shared/c-stdaux' \ ':(exclude)shared/n-acd' \ ':(exclude)shared/n-dhcp4' \ ':(exclude)src/systemd/src' \ ':(exclude)shared/systemd/src' \ ':(exclude)m4' \ ':(exclude)COPYING*' ) sed \ -e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) *[-–] *\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C1pyright#\5 - \7#\9/' \ -e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) *[,] *\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C2pyright#\5, \7#\9/' \ -e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C3pyright#\5#\7/' \ -e 's/^Copyright \(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/C4pyright#\1#\3/' \ -i \ "${FILES[@]}" echo ">>> untouched Copyright lines" git grep Copyright "${FILES[@]}" echo ">>> Copyright lines with unusual extra" git grep '\<C[0-9]pyright#' "${FILES[@]}" | grep -i reserved sed \ -e 's/\<C[0-9]pyright#\([^#]*\)#\(.*\)$/Copyright (C) \1 \2/' \ -i \ "${FILES[@]}" ``` https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/298
* bluetooth: don't set the ifindex after the device has been activatedLubomir Rintel2019-10-021-0/+3
| | | | | | | | | | | | | | | | The Bluetooth DUN device's NMModem would signal the reset of ifindex to zero when it's disconnected and the NMDeviceBt would accordingly update the bluetooth device's ip ifindex. This is not okay since commit ab4578302d69 ('device: refactor nm_device_set_ip_ifindex() and set_ip_iface()') which, although claiming to be a refactoring, made such use of nm_device_set_ip_ifindex() illegal. Resetting the ifindex is anyway not necessary, since it's taken care of _cleanup_generic_post(). Let's leave the ifindex alone once the device is activated, in a manner analogous to what NMDeviceModem. Fixes: ab4578302d69 ('device: refactor nm_device_set_ip_ifindex() and set_ip_iface()') Fixes: 78ca2a70c719 ('device: don't set invalid ip-iface'):
* contrib: add a Bluetooth DUN modem emulatorLubomir Rintel2019-10-021-0/+291
| | | | | | | Useful for quickly testing Bluetooth DUN support. Duplicates some modemu.pl logic, but hey... https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/297
* run-nm-test: fix using exec instead of running and exitingThomas Haller2019-10-021-2/+2
| | | | | | | | | | | | Otherwise, the script tries to run dbus-run-session -- exec ... which fails (because `exec` is a shell command, not a program). After the failure, the code falls through to run the test under valgrind. Fixes: 6a58c55ca44a ('run-nm-test: Just use exec instead of running and exiting')
* clients,libnm,tests: merge branch '3v1n0:gtask-initables' (part 1)Thomas Haller2019-10-024-118/+98
|\ | | | | | | | | | | Merge a subset of the patches from !263. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/263
| * libnm/secret-agent-old: steal pointer instead of taking additional referenceThomas Haller2019-10-021-2/+4
| |
| * libnm/trivial: fix whitespaceThomas Haller2019-10-021-3/+4
| |
| * secret-agent-old: Use GTask for Async initializingMarco Trevisan (Treviño)2019-10-021-65/+32
| | | | | | | | Cleanup the code removing the deprecated GSimpleAsyncResult
| * cli: Assert we don't require multiple commands during client initalizationMarco Trevisan (Treviño)2019-10-021-0/+2
| | | | | | | | | | | | | | If a new command was requested while a client was in the process of being created we were just requesting a new client. This was causing leak, so let's strongly ensure this is not the case.
| * cli: fix leaking error variable in command_done()Thomas Haller2019-10-021-1/+1
| |
| * cli: Use GTask to perform async requestsMarco Trevisan (Treviño)2019-10-021-44/+37
| |
| * test-client.py: Close pipes and print logs on timeout failuresMarco Trevisan (Treviño)2019-10-021-6/+20
| | | | | | | | | | | | | | | | If we failed on process wait, we didn't close the pipes and no clear output of what happened was exposed. So use a finally stanza to close the pipes and print stdout and stderr on failure.
| * run-nm-test: Just use exec instead of running and exitingMarco Trevisan (Treviño)2019-10-021-2/+1
| |
| * run-nm-test: Set NM_TEST_UNDER_VALGRIND accordinglyMarco Trevisan (Treviño)2019-10-021-0/+2
|/ | | | | When a test is going to be run under valgrind we set NM_TEST_UNDER_VALGRIND so that we can properly check whether this is happening.
* wifi: guess metered flag based on Network Cost information elementBeniamino Galvani2019-10-015-21/+58
| | | | | | | | | | | | Network Cost [1] is a vendor-specific information element defined by Microsoft and used to advertise the cost of Wi-Fi networks to clients. We can use it together with the ANDROID_METERED mechanism to automatically set the metered flag on the device. [1] https://docs.microsoft.com/en-us/windows-hardware/drivers/mobilebroadband/network-cost-information-element https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/200
* gitlab-ci: workaround unit test failure for iproute2 bug in "ubuntu:devel"Thomas Haller2019-10-011-1/+1
| | | | | | | | "ubuntu:devel" ships iproute2 version "5.2.0-1ubuntu1". This has a well known bug that prevents it from creating IP tunnels during the unit tests. We already workaround that on Debian. Add the same workaround to match the Ubuntu package.
* build/meson: merge branch 'inigomartinez:meson-update'Thomas Haller2019-10-0152-1110/+869
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/256
| * meson: Remove devices tests' meson build filesIñigo Martínez2019-10-017-45/+40
| | | | | | | | | | | | | | | | The devices tests' meson build files include only the build of a single executable file and its execution as a test unit. This has been moved to the devices' main meson build files so this files can be removed.
| * meson: Add missing "nm-bt-test" helper programIñigo Martínez2019-10-013-1/+13
| | | | | | | | | | | | | | | | In 878d4963e a new `nm-bt-test` helper program was added. However, although `autotools` build steps were included, meson build steps were not. This add meson's build steps.
| * meson: Make use of gnome.mkenums_simpleIñigo Martínez2019-10-012-6/+2
| | | | | | | | | | | | | | | | | | | | There are different enum files created that make use of different template files. However, `mkenums_simple` method allows the creation of the same enum files without the need of template files. The creation of the `nm-core-enum-types` and `nm-core-tests-enum-types` use now `mkenums_simple` so template files are now unnecessary.
| * meson: Rename variables related to pkg-config variablesIñigo Martínez2019-10-014-23/+23
| | | | | | | | | | | | | | | | | | | | | | | | Some variables belong to variables in their correspondent pkg-config file. These variables have been renamed to `dependency_variable` to reflect the dependency and variables from pkg-config files they are related to. Some of these has also been fixed to use paths relative to installation prefix.
| * meson: Improve the wwan test build fileIñigo Martínez2019-10-012-6/+9
| | | | | | | | | | | | | | | | The test unit name string is used in different place so it has been replaced by a variable. The `nm-service-providers.c` source file is appended by using a `files` generated object.
| * meson: Remove tests related to check_so_symbolsIñigo Martínez2019-10-019-81/+0
| | | | | | | | | | These tests are already working since 19a718bc1 so `FIXME` comments are not needed anymore.
| * meson: Improve api documentation build fileIñigo Martínez2019-10-011-22/+29
| | | | | | | | | | | | | | | | | | | | | | | | the `doc_module` variable has been removed. It was created because its used in the autotools build file but actually `nm_name` variable can be used easily. Different objects used in the documentation target have been grouped together. The content file `version.xml`, and different build files are now added properly.
| * meson: Improve libnm documentation build fileIñigo Martínez2019-10-011-17/+20
| | | | | | | | | | | | | | | | | | | | | | the `doc_module` variable has been removed. It was created because its used in the autotools build file but actually `libnm_name` variable can be used easily. Different objects used in the documentation target have been grouped together. The content file `version.xml` is now added properly.
| * meson: Improve Qt examplesIñigo Martínez2019-10-012-10/+8
| | | | | | | | | | | | | | | | Qt dependencies have been moved to the main build file where the rest of dependencies are located. This makes it easier to find them. The included directories has also reviewed and removed the unnecessary ones.
| * meson: Improve nmtui and libnmt-newt buildIñigo Martínez2019-10-012-16/+12
| | | | | | | | | | | | | | | | The dependencies used in the build of the `nmtui` executable and the `libnmt-newt` library have been reviewed. The compiler flags used in common by them has also been moved to a `common_c_flags` variable to avoid any confussion.
| * meson: Improve nmcli buildIñigo Martínez2019-10-011-7/+1
| | | | | | | | | | | | The dependencies used in the build of `nmcli` has been reviewed and removed the unnecessary ones. The used compiler flags has also been moved to one line.
| * meson: Improve the client common test build fileIñigo Martínez2019-10-011-22/+19
| | | | | | | | | | | | | | The build file in the `client` `common` directory has been improved by grouping the objects used in properties and by reviewing the dependencies used by tests built. Finally the indentation has also been fixed.
| * meson: Improve the client common build fileIñigo Martínez2019-10-011-22/+19
| | | | | | | | | | | | The build file in the `client` `common` directory has been improved by grouping the objects used in properties and by reviewing the dependencies used by libraries built in the file.
| * meson: Ease the use of the libnm-libnm-core-intern libraryIñigo Martínez2019-10-012-7/+9
| | | | | | | | | | The dependency for the `libnm-libnm-core-intern` library has been recovered to ease its use.
| * meson: Make one liner compiler flagIñigo Martínez2019-10-011-9/+3
| |
| * meson: Rename cflags variableIñigo Martínez2019-10-017-15/+15
| | | | | | | | | | | | | | | | | | | | | | The variable holding the compiler flags, `cflags`, has been renamed to `c_flags` to be consistent with the rest of build files. Different objects used in the `test-dispatcher-envp` target have been grouped together. The dependency over the `libnm` library has been removed as it is unnecessary.
| * meson: Improve dispatcher test build fileIñigo Martínez2019-10-011-14/+12
| | | | | | | | | | | | | | | | Different objects used in the `test-dispatcher-envp` target have been grouped together. The dependency over the `libnm` library has been removed as it is unnecessary.
| * meson: Avoid the creation of extra variablesIñigo Martínez2019-10-011-9/+5
| | | | | | | | | | | | | | | | | | | | Extra variables are used for sources of targets in the `dispatcher` build file. These have been moved to the `source` parameter because using them directly avoiding the creation of extra variablse doesn't hurt readibility. The compiler flags `cflags` variable has also been renamed to be consistent with the rest of build files.
| * meson: Remove extra new lineIñigo Martínez2019-10-011-1/+0
| |
| * meson: Avoid the creation of an extra variableIñigo Martínez2019-10-011-5/+1
| | | | | | | | | | | | | | An extra variable is used for sources of `libnm-settings-plugin-ifupdown` module. However, it only contains one source file and using it directly avoiding the creation of the extra variable doesn't hurt readibility.
| * meson: Remove unused variableIñigo Martínez2019-10-011-2/+0
| |
| * meson: Move network-config directory creation to main install fileIñigo Martínez2019-10-013-3/+6
| | | | | | | | | | | | | | | | | | The `ifcfg-rh` meson build file installs a new post install script to create the `network-config` directory. This has been moved to the main post install file so it's easier to find because all post install steps are together and it avoids and extra post install script execution.
| * meson: Improve ifcfg-rh plugin buildIñigo Martínez2019-10-011-3/+11
| | | | | | | | | | | | | | The file has been fixed to be consistent with the rest of the files. The data files to be installed have been grouped together. The sourc files has been listed vertically and the link target in `nm-settings-plugin-ifcfg-rh` does not use an array anymore.