summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* logging: make nm-logging.c independent of other core componentsth/move-to-sharedThomas Haller2018-10-173-3/+4
| | | | | "nm-logging.c" now no longer depends on anything particularly special from NM core.
* shared/tests: add test for "shared/nm-utils"Thomas Haller2018-10-175-0/+144
| | | | | | | | | "shared/nm-utils" is a loose collection of utility functions. There is a certain aim that they can be used independently. However, they also rely on each other. Add a test that we can build a minimal shared library with these tools, independent of libnm-core.
* shared: move nm_utils_get_monotonic_timestamp*() to shared/nm-utils.Thomas Haller2018-10-178-219/+283
| | | | | | | | | This is independent functionality that only depends on linux API and glib. Note how "nm-logging" uses this for getting the timestamps. This makes "nm-logging.c" itself dependen on "src/nm-core-utils.c", for little reason.
* core: move logging of monotonic-timestamp to "nm-logging.c"Thomas Haller2018-10-173-11/+26
| | | | This makes monotonic-timestamp handling independent of "nm-logging.c".
* build/meson: don't rebuild c-siphash.c but link against static libraryThomas Haller2018-10-171-2/+0
|
* checkpatch: complain about Emacs file variables in source codeThomas Haller2018-10-171-0/+1
|
* release: update NEWSThomas Haller2018-10-171-0/+27
|
* cli: merge branch 'th/cli-fix-serial-properties'Thomas Haller2018-10-178-2067/+2899
|\ | | | | | | https://github.com/NetworkManager/NetworkManager/pull/233
| * cli/tests: add test for adding and displaying gsm/serial settingsThomas Haller2018-10-173-1997/+2737
| |
| * tests: support UInt64 type in test-networkmanager-service.pyThomas Haller2018-10-171-3/+6
| | | | | | | | and also accept "gsm" connection-type. Both will be used next.
| * cli: minor cleanup of _set_fcn_gobject_enum()Thomas Haller2018-10-171-5/+6
| | | | | | | | No need to check again the gtype_class. We did it above already.
| * cli: fix setting "serial.parity" enumThomas Haller2018-10-171-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The meta data type descriptor must set .get_gtype only for GObject properties which are of type int or uint. That is, when the enum type cannot be automatically detected. However, NM_SETTING_SERIAL_PARITY is a g_param_spec_enum() of type NM_TYPE_SETTING_SERIAL_PARITY, so setting the get_gtype() hook is wrong and leads to a crash $ /bin/nmcli connection add type gsm autoconnect no con-name t ifname '*' apn xyz serial.parity 5 (process:11086): libnmc-CRITICAL **: 15:04:35.180: file clients/common/nm-meta-setting-desc.c: line 1283 (_set_fcn_gobject_enum): should not be reached Segmentation fault (core dumped) That is because the enum property setter does: »···if ( has_gtype »··· && NM_IN_SET (gtype_prop, »··· G_TYPE_INT, »··· G_TYPE_UINT) »··· && G_TYPE_IS_CLASSED (gtype) »··· && (gtype_class = g_type_class_ref (gtype)) »··· && ( (is_flags = G_IS_FLAGS_CLASS (gtype_class)) »··· || G_IS_ENUM_CLASS (gtype_class))) { »···»···/* valid */ meaning, it only allows "has_gtype" if the native "gtype_prop" is G_TYPE_INT or G_TYPE_UINT. Fixes: 9a68123827a8c4fe1eeaaf003d365429441d97e9
| * cli: fix handling uint64 connection property "serial.send-delay"Thomas Haller2018-10-172-60/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libnm currently has only one GObject property of type uint64: "serial.send-delay". However, it's broken because uint64 handling is not implemented. $ nmcli connection add type gsm autoconnect no con-name t ifname '*' apn 'xyz' serial.baud 5 Connection 't' (4c929f17-9fda-41d6-8f90-897f6d46b078) successfully added. $ nmcli connection show t ... ipv6.dhcp-duid: -- ipv6.dhcp-send-hostname: yes ipv6.dhcp-hostname: -- ipv6.token: -- (process:14016): libnmc-CRITICAL **: 14:08:32.591: file clients/common/nm-meta-setting-desc.c: line 811 (_get_fcn_gobject_int): should not be reached serial.baud: 5 serial.bits: 8 serial.parity: none serial.stopbits: 1 serial.send-delay: -- gsm.number: *99# ... $ nmcli connection add type gsm autoconnect no con-name t ifname '*' apn 'xyz' serial.baud 5 serial.send-delay 100 (process:14852): libnmc-CRITICAL **: 14:12:24.259: file clients/common/nm-meta-setting-desc.c: line 1131 (_set_fcn_gobject_int): should not be reached Segmentation fault (core dumped) Fixes: b6d9bdcee86fc6d52b2aa1bc8a0dcfa64bec86e8
| * shared: add _nm_utils_ascii_str_to_uint64() helperThomas Haller2018-10-172-1/+46
|/
* core: merge branch 'th/device-availability'Thomas Haller2018-10-173-19/+99
|\ | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1639254
| * core: ignore unmanaged devices for explicit activation request depending on ↵Thomas Haller2018-10-171-2/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | multi-connect When a device is unmanaged, an explicit activation request can still activate it. In particular, that is the case for $ nmcli connection up "$PROFILE" ifname "$DEVICE" It is also the case, for plain $ nmcli connection up "$PROFILE" where NetworkManager searches for a suitable device -- depending on multi-connect setting of the profile. The idea is, that a profile with "multi-connect=single" is expected to sufficently and uniquely match a device, based on matching properties like "connection.interface-name". In that case, an explicit activation request from the user shows the intent to manage the device. Note that it's hard to understand whether the profile really uniquely selects a particular device. For example, if the profile doesn't specify "connection.interface-name", it might still uniquely identify an ethernet device, if you only have one such device. On the other hand, with "connection.multi-connect" other than "single", it is very much expected that the profile does not strictly match one device. Change the behavior here for multi-connect profiles. This allows the user to block individual devices from activation via $ nmcli device set "$DEVICE" managed not A subsequent $ nmcli connection up "$MULTI_PROFILE" will not consider "$DEVICE" as suitable candidate for activation. Likewise, in the future we may want to add a $ nmcli connection up --all "$MULTI_PROFILE" command, to activate the profile on all suitable device. In that case again, unmanaged devices probably also should be skipped for multi-connect profiles. https://bugzilla.redhat.com/show_bug.cgi?id=1639254
| * device: add and use overrule-unmanaged flag for ↵Thomas Haller2018-10-172-8/+15
| | | | | | | | | | | | | | | | | | | | | | | | nm_device_check_connection_available() This flag is more granular in whether to consider the connection available or not. We probably should never check for the combined flag NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST directly, but always explicitly for the relevant parts. Also, improve the error message, to indicate whether the device is strictly unmanaged or whether it could be overruled.
| * device: cleanup checking device avilability for ignoring carrierThomas Haller2018-10-171-7/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The flags NMDeviceCheckConAvailableFlags and NMDeviceCheckDevAvailableFlags both control whether a device appears available (either, available in general, or related to a particular profile). Also, both flag types strictly increase availability. Meaning: more flags, more available. There is some overlap between the flags, however they still have their own distinct parts. Improve the mapping from NMDeviceCheckConAvailableFlags to NMDeviceCheckDevAvailableFlags, by picking exactly the flags that are relevant.
| * core/trivial: add code comment for NMDeviceCheckDevAvailableFlags and ↵Thomas Haller2018-10-171-0/+17
| | | | | | | | NMDeviceCheckConAvailableFlags
| * core/trivial: add code comment for nm_manager_get_best_device_for_connection()Thomas Haller2018-10-171-2/+12
| |
| * core: fix checking multi-connect flag in ↵Thomas Haller2018-10-171-1/+4
|/ | | | | | | | nm_manager_get_best_device_for_connection() We should not check @sett_conn, but @connection. Fixes: 09719bc479b63c8e5fef3950e980b263aca7eff5
* core: merge branch 'th/no-gasyncresult'Thomas Haller2018-10-1725-469/+590
|\ | | | | | | https://github.com/NetworkManager/NetworkManager/pull/227
| * modem: cleanup nm_modem_deactivate_async()Thomas Haller2018-10-174-96/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - fix stopping ppp-manager. Previously, we would take a reference to priv->ppp_manager to cancel it later. However, deactivate_cleanup() is called first, which already issues nm_ppp_manager_stop(). Thereby, not using a callback and not waiting for the operation to complete. - get rid of this "step" state machine. There are litterally two steps that need to be performed asynchornously. Instead chain the calls. - it is now obviously visible, that the async callback never completes synchronously upon being called (provided that all async operations that it calls themself have this behavior -- which they should).
| * ppp: make ppp-manager cancellable via GCancellableThomas Haller2018-10-178-43/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously nm_ppp_manager_stop() would return a handle which makes it easy to cancel the operation. However, sometimes, we may want to cancel an operation based on an GCancellable. So, extend nm_ppp_manager_stop() to hook it with a cancellable. Essentially, move the code from nm-modem.c to nm-ppp-manager-call.c, where it belongs and where the functionality gets available to every component.
| * modem: don't use GAsyncResult pattern for disconnecting modemThomas Haller2018-10-179-208/+188
| | | | | | | | | | | | | | | | | | We should not use GAsyncResult. At least, not for internal API. It's more cumbersome then helpful, in my opinion. It requires this awkward async_finish() pattern. Instead, let the caller pass a suitable callback of the right type.
| * bluez: make connect operation (partially) cancellable and drop GAsyncResult ↵Thomas Haller2018-10-175-115/+155
| | | | | | | | | | | | | | | | | | | | | | | | pattern All operations must be cancellable in a timely manner, otherwise, the objects hang during shutdown. Also, get rid of the GAsyncResult pattern. It is more cumbersome than helpful. There are still several issues, marked by FIXME comments.
| * shared: add nm_utils_invoke_on_idle() helperThomas Haller2018-10-172-0/+76
| |
| * libnm-core: expose internal _nm_dbus_typecheck_response() helperThomas Haller2018-10-172-26/+72
|/
* core: improve selection of device when activating profile on any deviceThomas Haller2018-10-171-4/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With $ nmcli connection up "$PROFILE" ifname "$DEVICE" it's clear that the user means the particular device. That also is taken as a indication to make $DEVICE as managed, in case it was unmanaged before. So, this command implies a previous $ nmcli device set $DEVICE managed yes On the other hand, if the user just issues $ nmcli connection up "$PROFILE" without a particular device, then we should prefer devices which are marked as managed instead of unmanaged once. Likewise, we should consider the device's state when selecting a device. This means, when activating a profile which is activatable on multiple devices, it will now prefer devices which are not already active. The exception to this is that if the profile itself is already active (and multi-connect "single"), then it will prefer to re-activate the profile on the same device. This was done previously already. What's new is that if the the profile is not multi-connect "single", the said exception no longer applies, and we prefer to activate the profile on a hitherto unactivated device. https://bugzilla.redhat.com/show_bug.cgi?id=1639254 https://github.com/NetworkManager/NetworkManager/pull/232
* po: update from Red Hat translatorsLubomir Rintel2018-10-169-17945/+20876
| | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1608323 (cherry picked from commit d7d085a88d6207c8362834adf407e807e9a89b68)
* dhcp: merge branch 'bg/dhcp-failed-rh1625901'Beniamino Galvani2018-10-153-50/+51
|\ | | | | | | https://github.com/NetworkManager/NetworkManager/pull/217
| * dhcp: don't start grace period if the client is not runningBeniamino Galvani2018-10-151-33/+31
| | | | | | | | We shouldn't start a grace period when the client is not running.
| * dhcp: introduce terminated dhcp-stateBeniamino Galvani2018-10-153-14/+12
| | | | | | | | | | | | | | | | When the client terminates, we really don't care if it exited cleanly, with an error or killed by a signal. We expect the client to never exit and so all these situations are equally bad for us. Introduce a new TERMINATED state instead of reusing existing FAIL or DONE states, which are set when receiving particular events from the client.
| * dhcp: reset @was_active on cleanupBeniamino Galvani2018-10-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | The @was_active flag indicates that we started DHCP on an assumed connection. The idea is that if DHCP succeeded before, any failure must be treated like a renewal failure (and so it should start a grace period) rather than a failure in getting an initial lease (which fails the IP method). When we clean up the DHCP instance, the flag must be reset to FALSE, otherwise it will be potentially considered for other connections.
| * dhcp: log whether the client was activeBeniamino Galvani2018-10-151-4/+6
| | | | | | | | It is useful to understand why the grace period was started.
| * dhcp6: fix handling of failure eventsBeniamino Galvani2018-10-151-7/+8
|/ | | | | | The effect of a DHCPv6 failure should depend only on current IP state. This in the analogous of commit bd63d39252ea ("dhcp: fix handling of failure events") for IPv6.
* ndisc: merge branch 'th/ndisc-addr-lifetime'Thomas Haller2018-10-137-88/+163
|\ | | | | | | | | | | | | https://github.com/NetworkManager/NetworkManager/pull/228 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/57 https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1796622
| * ndisc: don't update dad_counter for addresses in router configThomas Haller2018-10-131-3/+1
| | | | | | | | | | | | | | | | I am not sure, we ever call complete_address() for router-configurations. Maybe not, so the dad-counter is never incremented and does not matter either. If we however do, then we certainly want to preserve the DAD counter when the address is already tracked.
| * ndisc: fix updating address lifetime on Router Announcement according to RFC4862Thomas Haller2018-10-135-14/+64
| | | | | | | | | | | | | | | | | | | | This is a denial-of-service protection, where a malicious router advertisement can expire the addresses. See-also: https://github.com/systemd/systemd/commit/6554550f35a7976f9110aff94743d3576d5f02dd See-also: https://tools.ietf.org/search/rfc4862#section-5.5.3 https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1796622
| * ndisc: handle integer overflows better for lifetime handlingThomas Haller2018-10-132-59/+56
| | | | | | | | | | | | | | | | | | | | | | we use get_expiry() to compare two lifetimes. Note, that previously, it would correctly truncate the calculated expiry at G_MAXINT32-1. However, that means, that two different lifetimes that both lie more than 68 years in the future would compare equal. Fix that, but extending the range to int64, so that no overflow can happen.
| * ndisc: minor refactoring loop in nm_ndisc_add_address()Thomas Haller2018-10-131-11/+18
| | | | | | | | | | No change in behavior. Just don't do so much work inside the deeper nesting of the loop.
| * ndisc: only generate address interface identifer after checking existing prefixThomas Haller2018-10-132-22/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RFC4862 5.5.3, points d) and e) make it clear, that the list of addresses should be compared based on the prefix. d) If the prefix advertised is not equal to the prefix of an address configured by stateless autoconfiguration already in the list of addresses associated with the interface (where "equal" means the two prefix lengths are the same and the first prefix- length bits of the prefixes are identical), and if the Valid Lifetime is not 0, form an address (and add it to the list) by combining the advertised prefix with an interface identifier of the link as follows: That means, we should not initialize the interface identifier first (via complete_address()) and then search for the full address. See-also: https://tools.ietf.org/search/rfc4862#section-5.5.3
| * ndisc: ensure we skip unspecified IPv6 address in ndisc_set_router_config()Thomas Haller2018-10-131-1/+2
| | | | | | | | | | Later, nm_ndisc_add_address() asserts that the address is not an unspecified address. Skip it, just to be sure.
| * ndisc: ignore addresses with preferred lifetime larger than lifetimeThomas Haller2018-10-132-4/+5
|/ | | | | | | | | | | Previously, we would coerce the value so that preferred is the same as lifetime. However, RFC4862 5.5.3.c) says: c) If the preferred lifetime is greater than the valid lifetime, silently ignore the Prefix Information option. A node MAY wish to log a system management error in this case. See-also: https://tools.ietf.org/search/rfc4862#section-5.5.3
* all: remove \n endings from log callsLubomir Rintel2018-10-127-40/+40
| | | | | | The extra newlines look bad when logging to the console. https://github.com/NetworkManager/NetworkManager/pull/223
* devices/olpc: don't assert we're waiting for companion on device_added_cb()Lubomir Rintel2018-10-121-1/+1
| | | | | | | | | | | | | We're hooking the signal on construction, but we only queue a pending action on reaching UNAVAILABLE state. The signal could fire in between: <info> [1539282167.9666] manager: (msh0): new 802.11 OLPC Mesh device (/org/freedesktop/NetworkManager/Devices/4) <info> [1539282168.1440] manager: (wlan0): new 802.11 WiFi device (/org/freedesktop/NetworkManager/Devices/5) <info> [1539282168.1831] device (msh0): found companion WiFi device wlan0 <warn> [1539282168.2110] device (msh0): remove_pending_action (1): 'waiting-for-companion' not pending file src/devices/nm-device.c: line 13966 (<dropped>): should not be reached https://github.com/NetworkManager/NetworkManager/pull/229
* systemd: don't make NetworkManager D-Bus activatableMichael Biebl2018-10-125-28/+7
| | | | | | | | | | | | | | | | | If the NetworkManager daemon has been stopped manually we don't want it to be autostarted by a client request. [lkundrak@v3.sk: The auto-activation is probably more surprising than useful. Services that need NetworkManager API should depend on NetworkManager service directly. I have no idea what purpose does the D-Bus service file serve nowadays, but it looks rather hacky (really, activating /bin/false) and the comment in it suggests that the autoactivating behavior was not intended anyway. Debian has been shipping this for quite some time and no complains have been heard.] https://github.com/NetworkManager/NetworkManager/pull/230
* wwan: don't assume DNS info is always available for IPv6Thomas Haller2018-10-121-1/+1
| | | | | See also "5df024f57a wwan: don't assume DNS info is always available" which does the same for IPv4.
* cli: check we have an active connection before showing hintbg/fix-hint-assertionBeniamino Galvani2018-10-111-0/+3
| | | | | | | | | | | | | | If the activation fails even before the active connection instance is created, we get the following: $ nmcli connection up vpn1 libnm-CRITICAL **: nm_active_connection_get_connection: assertion 'NM_IS_ACTIVE_CONNECTION (connection)' failed nmcli-CRITICAL **: active_connection_hint: assertion 'connection' failed Error: Connection activation failed: Not authorized to control networking. Check that we have an active connection before showing the hint. Fixes: bc6c042d5461028a2fac53ffcdb36837e596a1a5
* wifi/iwd: merge branch 'balrog-kun/iwd-ap-adhoc'Thomas Haller2018-10-113-279/+714
|\ | | | | | | https://github.com/NetworkManager/NetworkManager/pull/221