summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* device: accept lease only after addresses are configuredBeniamino Galvani2019-09-181-2/+14
| | | | | | | | | | In the accept() callback, the nettools client creates a UDP socket with the received address as source, so the address must be already configured on the interface. Also, handle errors returned by nm_dhcp_client_accept(). Fixes: 401fee7c2040 ('dhcp: support notifying the client of the result of DAD')
* libnm: export reload flagsBeniamino Galvani2019-09-173-24/+5
| | | | | Flags to the manager Reload() method are stable API but not exposed in a public header. Export them.
* supplicant: add FT-SAE key-mgmt to verification listBeniamino Galvani2019-09-161-1/+1
| | | | | | | | FT-SAE is missing in the supplicant configuration verification list, causing an activation failure when using SAE and the supplicant supports FT. Fixes: d17a0a090555 ('supplicant: allow fast transition for WPA-PSK and WPA-EAP')
* dhcp: nettools: drop useless "options" GHashTable checksFrancesco Giudici2019-09-131-8/+5
|
* dhcp: nettools: add utf8 checking on the wpad optionFrancesco Giudici2019-09-132-3/+7
| | | | and assert values exported as dhcp options are utf8 compliant
* dhcp: nettools: drop the 'iface' parameter when no more usedFrancesco Giudici2019-09-131-25/+13
| | | | | | Drop it from the functions for extracting the dhcp options from the lease: it was just used for the logging, but now we log all the options once, at the end of the process.
* dhcp: nettools: drop plugin logging of the lease optionsFrancesco Giudici2019-09-131-38/+17
| | | | | as these are already logged in common dhcp-client code. Moreover, now the log level of the lease options will move from INFO to DEBUG.
* dhcp: internal: drop plugin logging of the lease optionsFrancesco Giudici2019-09-131-88/+20
| | | | as these are already logged in common dhcp-client code.
* dhcp: log the dhcp options got in the lease once for all pluginFrancesco Giudici2019-09-131-9/+11
| | | | | | | | | Each plugin logged the options: just do that on dhcp state change and do in common code. Log the options at INFO level for all the plugins. This partially reverts the effects on the internal plugin of the commit: 97ce488f5f50 ('dhcp/internal: decrease logging level when retrieving dhcp options')
* dhcp: nettools: retrieve and expose the private dhcp optionsFrancesco Giudici2019-09-131-0/+38
|
* dhcp: nettools: retrieve and expose the expiry timeFrancesco Giudici2019-09-131-8/+41
| | | | | also fix the lease time: it should be the time in seconds that the lease lasts
* wifi: allow reapply when the seen-bssids property changedBeniamino Galvani2019-09-132-0/+2
| | | | | | | | wifi.seen-bssid is a synthetic read-only property that lists all the bssids seen for that connection; it should be ignored during a reapply. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/243
* wwan/modem-broadband: add capability to look up default APN/username/passwordlr/gsm-default-apnLubomir Rintel2019-09-111-28/+107
| | | | | This allows the GSM connection to Just Work most of the time, as in: "nmcli d connect ttyUSB0".
* wwan/modem-broadband: get rid of g_assert*()Lubomir Rintel2019-09-111-10/+13
| | | | | Though there is no known way to reach these, it may well happen that this is going to prevent some hard crashes.
* wwan/tests: test service-providers.xml parserLubomir Rintel2019-09-114-1/+217
| | | | Just a handful of unit tests.
* wwan: add service-providers.xml parserLubomir Rintel2019-09-113-0/+485
| | | | This allows up to look up a default APN if the user doesn't pick one.
* wwan: remove an accidentally committed fileLubomir Rintel2019-09-111-0/+0
| | | | Fixes: 7a72c705acc2 ('initrd: add devicetree support')
* all: SPDX header conversionLubomir Rintel2019-09-10356-5014/+381
| | | | | $ find * -type f |xargs perl contrib/scripts/spdx.pl $ git rm contrib/scripts/spdx.pl
* initrd: add devicetree supportLubomir Rintel2019-09-1026-1/+580
| | | | | | | | | | | | This adds capability to hand over the network configuration from OpenFirmware (and potentially other boot loaders with openfirmware support such as U-Boot) to NetworkManager. It's done analogously to ACPI/iBFT. In fact, the same ip=ibft command line option is used, adding a more general ip=fw alias. This probably deserves some documentation, but I'm not adding any at this time. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/257
* platforn/linux: don't fall back to WEXT for OLPC Meshlr/olpc-meshLubomir Rintel2019-09-071-9/+1
| | | | nl80211 offers the same functionality sans the bugs.
* wifi/olpc-mesh: fix the stage2Lubomir Rintel2019-09-071-14/+33
| | | | | | | | | | | There's multiple things wrong there, but unnoticed because the error handling was entirely missing or nobody is using thie anymore. The Mesh ID needs to be set while the device is down. Also, the channel needs to be set last, because that's what triggers the connection attempt. For that the device needs to be up. Also, fix the error handling.
* wifi/olpc-mesh: drop assert(companion) from get_autoconnect_allowed()Lubomir Rintel2019-09-071-3/+3
| | | | | | The comment is wrong. Since 6eaded9071fb ('device: add get_autoconnect_allowed() virtual function'), get_autoconnect_allowed() is called before the device state is consulted.
* wifi: add OLPC Mesh support via nl80211Lubomir Rintel2019-09-071-0/+67
|
* dhcp: nettools: read/write lease filesFrancesco Giudici2019-09-051-2/+57
| | | | | | | | Use the same format of systemd-netword, so that we will be compatible with the leases created/read by the current "internal" plugin. Note that actually only the leased address is processed when reading a lease file, so no need to save more than the ip address when saving the lease.
* dhcp: dhclient: use the shared function to retrieve the lease file pathFrancesco Giudici2019-09-051-24/+2
| | | | ... but leave in place the custom checks dependant on the dhclient plugin
* dhcp: prefer nm_assert() to g_assert*()Francesco Giudici2019-09-053-3/+3
|
* dhcp: internal: use the shared function to retrieve the lease file pathFrancesco Giudici2019-09-051-35/+5
|
* dhcp: add a shared function to retrieve the dhcp lease fileFrancesco Giudici2019-09-052-1/+60
| | | | | | | | | | For each plugin we try to come up with a lease file constructed in the same way, i.e., plugin name + iface + connection duid. If the file isn't already there, for some plugins (dhclient) we do extra checks in order to allow to use lease files generated outside of NetworkManager. Let's allow to generate the common NetworkManager dhcp lease file name in a shared function, reporting to the caller if the file isn't already there, so that further plugin specific checks can be performed if needed.
* core: add audit log for the SaveHostname callBeniamino Galvani2019-09-052-12/+27
| | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/260
* core: add defines for common authentication-related error messagesBeniamino Galvani2019-09-055-22/+26
| | | | | | All D-Bus method call implementations use similar error messages when authenticating requests; add defines for them to ensure the same exact message is reused.
* core/tests: avoid deprecated g_main_run()/g_main_loop_unref() in testThomas Haller2019-09-031-3/+2
| | | | | | | | | These are deprecated. Also, they are nowadays implemented as macros that expand to #define g_main_run(loop) g_main_loop_run(loop) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_run) This can cause compilation failure (in some environments).
* manager: keep device if realize() failsBeniamino Galvani2019-09-031-1/+0
| | | | | | | | | system_create_virtual_device() first creates the device (unrealized) and then, if there a connection for the device with autoconnect=yes, creates the backing resources. If this last step fails the device should continue to exist, even if in an unrealized state. https://bugzilla.redhat.com/show_bug.cgi?id=1686634
* device: don't set nm-owned flag if realize() failsBeniamino Galvani2019-09-031-2/+5
| | | | | | The nm-owned flag indicates whether the device was created by NM. If the realization step fails, the device was not created and so nm-owned should not be updated.
* device: fix crash when master connection failsBeniamino Galvani2019-09-031-5/+5
| | | | | | | | | | | | When the master AC becomes ready, activate_stage1_device_prepare() is called in a idle handler. If the master AC fails in the meantime, it will change state to deactivating or deactivated. We must check for that condition before proceeding with slave activation. Note the the 'master_ready' flag of an AC is never cleared after it is set. Fixes: 5b677d5a3bed ('device: move check for master from nm_device_activate_schedule_stage2_device_config() to end of stage1') https://bugzilla.redhat.com/show_bug.cgi?id=1747998
* ipv6: disable kernel handling of RAs (accept_ra)Beniamino Galvani2019-08-302-25/+4
| | | | | | | | | | | | | | | | | | | | With accept_ra set to 1, kernel sends its own router solicitation messages and parses the advertisements. This duplicates what NM already does in userspace and has unwanted consequences like [1] and [2]. The only reason why accept_ra was re-enabled in the past was to apply RA parameters like ReachableTime and RetransTimer [3]; but now NM supports them and so accept_ra can be turned off again. Also, note that previously the option was set in addrconf6_start_with_link_ready(), and so this was done only when the method was 'auto'. Instead, now we clear it for all methods except 'ignore'. [1] https://mail.gnome.org/archives/networkmanager-list/2019-June/msg00027.html [2] https://bugzilla.redhat.com/show_bug.cgi?id=1734470 [3] https://bugzilla.redhat.com/show_bug.cgi?id=1068673
* ipv6: set neighbor parameters from RAsBeniamino Galvani2019-08-307-0/+103
| | | | | | | | | | | | | | | | | | | | | | | | IPv6 router advertisement messages contain the following parameters (RFC 4861): - Reachable time: 32-bit unsigned integer. The time, in milliseconds, that a node assumes a neighbor is reachable after having received a reachability confirmation. Used by the Neighbor Unreachability Detection algorithm. A value of zero means unspecified (by this router). - Retrans Timer: 32-bit unsigned integer. The time, in milliseconds, between retransmitted Neighbor Solicitation messages. Used by address resolution and the Neighbor Unreachability Detection algorithm. A value of zero means unspecified (by this router). Currently NM ignores them; however, since it leaves accept_ra=1, the kernel parses RAs and applies those parameters for us [1]. In the next commit kernel handling of RAs will be disabled, so let NM set those neighbor-related parameters. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/ipv6/ndisc.c?h=v5.2#n1353
* dhcp: fall back to 'internal' client for IPv6 when using 'nettools'Beniamino Galvani2019-08-291-13/+0
| | | | The 'nettools' client doesn't support IPv6, fall back to 'internal'.
* device: after stage1 call stage2 synchronouslyThomas Haller2019-08-281-1/+33
| | | | | We know we are ready and in a situation where we can handle state changes. Don't schedule stage2 in an idle handler, just invoke it directly.
* device: move check for master from ↵Thomas Haller2019-08-281-52/+39
| | | | | | | | | | | | | | | | | | | | | | nm_device_activate_schedule_stage2_device_config() to end of stage1 Note that by now no callers of nm_device_activate_schedule_stage2_device_config() are left. All previous callers now re-schedule stage1 instead of directly scheduling stage2. Note that if stage2 later also gets re-factored to re-enter itself instead of scheduling stage3 right away, the function will be used again. That means, we can move the check for the master where it belongs: as part (and at the end of) stage1. Also, slightly simplify the code. The handler master_ready_cb() no longer directly calls master_ready(). It's enough to always enter stage1 again. Also drop master_ready_handled. We don't need to remember that this condition was satsified. We can just check it always when we reach the place in activate_stage1_device_prepare().
* device: let devices call stage1 again after being ready to proceedThomas Haller2019-08-288-48/+99
| | | | | | | | | | | | | | | I am about to change the when stage1 gets postponed, then the way to proceed it is to schedule stage1 again (instead of scheduling stage2). The reason is that stage1 handling should be reentrant and we should keep entering it until there is no more reason to postpone it. If a subclass postpones stage1 and then later progresses it by directly scheduling stage2, then only the subclass is in control over postponing stage 2. Instead, anybody should be able to delay stage2 independently. That can only work if everybody signals readyness to proceed by scheduling stage1 again.
* device/wifi-p2p: inline and drop local function cleanup_p2p_connect_attempt()Thomas Haller2019-08-281-16/+9
| | | | It has only one caller. It's clearer to do the cleanup right there.
* device/team: don't remember connection while killing teamThomas Haller2019-08-281-22/+18
| | | | | We don't need this. The applied-connection is already remembered and suitable.
* device/team: various cleanupsThomas Haller2019-08-281-58/+72
|
* device: set failure reason when settings hardware address failsThomas Haller2019-08-282-2/+8
|
* device: let NMDevice set hardware address instead of act_stage1_prepare() ↵Thomas Haller2019-08-281-3/+1
| | | | | | | for NMDeviceEthernet There is a small change in the order of actions. Now we set the MAC address before calling link_negotiation_set(). That shouldn't make a difference.
* device: let NMDevice set hardware address instead of act_stage1_prepare()Thomas Haller2019-08-282-8/+2
|
* device: move redundant act_stage1_prepare() implementations to set hwaddr to ↵Thomas Haller2019-08-287-49/+17
| | | | | | NMDevice This is so common, that NMDevice can handle it for us.
* device: don't let subclasses call NMDevice's act_stage1_prepare()Thomas Haller2019-08-2819-109/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | NMDevice's act_stage1_prepare() now does nothing. Calling it is not useful and has no effect. In general, when a subclass overwrites a virtual function, it must be defined whether the subclass must, may or must-not call the parents implementation. Likewise, it must be clear when the parents implementation should be chained: first, as last, does it matter? In any case, that very much depends on how the parent is implemented and this can only be solved by documentation and common conventions. It's a forgiving approach to have a parents implementation do nothing, then the subclass may call it at any time (or not call it at all). This is especially useful if classes don't know their parent class well. But in NetworkManager code the relationship between classes are known at compile time, so every of these classes knows it derives directly from NMDevice. This forgingin approach was what NMDevice's act_stage1_prepare() was doing. However, it also adds lines of code resulting in a different kind of complexity. So, it's not clear that this forgiving approach is really better. Note that it also has a (tiny) runtime and code-size overhead. Change the expectation of how NMDevice's act_stage1_prepare() should be called: it is no longer implemented, and subclasses *MUST* not chain up.
* device: move SR-IOV initialization to activate_stage1_device_prepare()Thomas Haller2019-08-282-83/+149
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note that all subclasses of NMDevice that implement act_stage1_prepare(), call the parents implementation as very first thing. Previously, NMDevice's act_stage1_prepare() was setting up SR-IOV. But that is problemantic. Note that it may have returned NM_ACT_STAGE_RETURN_POSTPONE, in which case subclasses would just skip their action and return to the caller. Later, sriov_params_cb() would directly call nm_device_activate_schedule_stage2_device_config(), and thus act_stage1_prepare() was never executed for the subclass. That is wrong. First, I don't think it is good to let subclasses decide whether to call a parents implementation (and when). It just causes ambiguity. In the best case we do it always in the same order, in the worst case we call the parent at the wrong time or never. Instead, we want to initialize SR-IOV always and early in stage1, so we should just do it directly from activate_stage1_device_prepare(). Now NMDevice's act_stage1_prepare() does nothing. The bigger problem is that when a device wants to resume a stage that it previously postponed, that it would schedule the next stage! Instead, it should schedule the same stage again instead. That allows to postpone the completion of a stage for multiple reasons, and each call to a certain stage merely notifies that something changed and we need to check whether we can now complete the stage. For that to work, stages must become re-entrant. That means we need to remember whether an action that we care about needs to be started, is pending or already completed. Compare this to nm_device_activate_schedule_stage3_ip_config_start(), which checks whether firewall is configured. That is likewise the wrong approach. Callers that were in stage2 and postponed stage2, and later would schedule stage3 when they are ready. Then nm_device_activate_schedule_stage3_ip_config_start() would check whether firewall is also ready, and do nothing if that's not the case (relying that when the firewall code completes to call nm_device_activate_schedule_stage3_ip_config_start().
* device: refactor handling of scheduled activation tasks on idleThomas Haller2019-08-282-99/+79
| | | | | | | | | | | | | | - use a [2] array for IPv4/IPv6 variants and a IS_IPv4 variable, like we do for other places that have similar implementations for both address families. - drop ActivationHandleData and use the fields directly. Also drop activation_source_get_by_family(). - rename "act_handle*" field to "activation_source_*", to follow the naming of the related accessor functions. - downgrade the severity of some logging messages.