summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* device: reset original autoneg/speed/duplex setting on deactivateth/ethtool-reset-autonegThomas Haller2020-05-281-1/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The autoneg/speed ethtool settings are important. If they are wrong, the device might not get any carrier. Having no carrier means that you may be unable to activate a profile (because depending on configuration, carrier is required to activate a profile). Since activating profiles are the means to configure the link settings in NetworkManager, and activating a profile can be hampered by wrong link settings, it's important to reset the "correct" settings, when deactivating a profile. "Correct" in this case means to restore the settings that were present before NM changed the settings. Presumably, these are the right once. Beyond that, in the future it might make sense to support configuring the default link settings per device. So that NM will always restore a defined, configured, working state. The problem is that per-device settings currently are only available via NetworkManager.conf, which is rather inflexible. Also, when you restart NetworkManager service, it leaves the interface up but forgets the previous setting. That possibly could be fixed by persisting the previous link state in /run. However, it's not implemented yet. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/ ## 356 https://bugzilla.redhat.com/show_bug.cgi?id=1807171
* device: inline nm_platform_ethtool_init_ring() functionThomas Haller2020-05-283-49/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | nm_platform_ethtool_init_ring() only has one caller. It's simpler to drop the function and implement it at the only place where it is needed. Maybe there could be a place for a function to initialize NMEthtoolRingState, one option after the other. However, at the moment there is only one user, so don't implement it. This fixes various minor issues: - the function had a NMPlatform argument, although the argument is not used. Thus function merely operates on a NMEthtoolRingState instance and shouldn't have a nm_platform_*() name. - nm_platform_ethtool_init_ring() returned a boolean, but all code paths (except assertion failures) returned success. - as the function returned an error status, the caller was compelled to handle an error that could never happen. - the option was specified by name, although we already have a more efficient way to express the option: the NMEthtoolID. Also, the caller already needed to resolve the name to the NMEthtoolID, so there was no need to again lookup the ID by name.
* device: only ready existing ethtool ring settings if neededThomas Haller2020-05-281-55/+35
| | | | | | | | | | | | | | | | | | | | Imagine you have a veth device. That device supports certain offload features (like "ethtool.feature-rx-checksum") but doesn't support any ring options. Even trying to read the current ring settings will fail. If you try to activate that profile, NMDevice previously would always try to fetch the ring options and log a warning and extra debugging messages: <trace> [1590511552.3943] ethtool[31]: ETHTOOL_GRINGPARAM, v: failed: Operation not supported <trace> [1590511552.3944] ethtool[31]: get-ring: failure getting ring settings <warn> [1590511552.3944] device (v): ethtool: failure getting ring settings (cannot read) It does so, although you didn't specify any ring settings and there was no need to fetch the ring settings to begin with. Avoid this extra logging by only fetching the ring option when they are actually required.
* ifcfg-rh: merge branch 'th/ifcfg-rh-802-1x-pin'Thomas Haller2020-05-289-9/+31
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/520
| * ifcfg-rh: support persisting 802-1x.pin and pin-flags propertyThomas Haller2020-05-289-5/+27
| |
| * libnm,ifcfg-rh: fix documentation for IEEE_8021X_SYSTEM_CA_CERTS in `man ↵Thomas Haller2020-05-281-2/+2
| | | | | | | | | | | | nm-settings-ifcfg-rh` Fixes: 2a4fb75d3b03 ('ifcfg: add support for "802-1x.system-ca-certs" setting')
| * libnm,ifcfg-rh: fix documentation for IEEE_8021X_PASSWORD_RAW_FLAGS in `man ↵Thomas Haller2020-05-281-2/+2
|/ | | | | | nm-settings-ifcfg-rh` Fixes: a83ab252ee58 ('ifcfg-rh: add support for 802-1x.password-raw property')
* tc: merge branch 'bg/qdisc-sync-rh1815875'Beniamino Galvani2020-05-2810-12/+215
|\ | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1815875 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/516
| * platform: add tc testsBeniamino Galvani2020-05-287-0/+162
| |
| * platform: rework qdisc synchronizationBeniamino Galvani2020-05-282-10/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rework qdisc synchronization. The previous implementation added all known qdiscs and removed unneeded ones from platform; this had some problems: - kernel doesn't allow to add (with exclusive flag) a qdisc if one with the same parent already exists; - if we use the replace flag instead of add, then it becomes possible to add a new qdisc with the same parent of an existing one. However if the existing qdisc is of the same kind, kernel will try to to change() it, which fails for some qdiscs (e.g. sfq). - kernel doesn't allow to delete a qdisc with handle of zero because that is the default qdisc and can only be replaced; Fix that.
| * platform: use ECHO flag for qdisc and filter requestsBeniamino Galvani2020-05-283-2/+5
|/ | | | | | | | | By default the kernel sends back events notification to all other process except the one that requested the change, unless the ECHO flag is used. See [1], [2]. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/sched/sch_api.c?h=v5.6#n979 [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/core/rtnetlink.c?h=v5.6#n706
* initrd: don't generate new connections for rd.znetBeniamino Galvani2020-05-282-4/+30
| | | | | | | | The rd.znet specifies the s390 parameters of an existing connection. If no matching connection exists, we should not create a new one. https://bugzilla.redhat.com/show_bug.cgi?id=1840287
* device: add mechanism to call stage1 for external or assumed devicesBeniamino Galvani2020-05-272-11/+16
| | | | | | Usually stage1 is skipped for external or assumed devices. Add a mechanism to call stage1 for all devices, similarly to what was already done for stage2.
* license: merge branch 'quozl:relicense-one-laptop-per-child'Thomas Haller2020-05-271-1/+1
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/521
| * license: move One Laptop per Child in RELICENSE.mdJames Cameron2020-05-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | With reference to https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/dd9156d55f530b0112920f732cb14fe9a1a06090/RELICENSE.md#which-code One Laptop per Child has a Copyright (C) 2009 on two files licensed as GPL-2.0+; src/devices/wifi/nm-device-olpc-mesh.c and src/devices/wifi/nm-device-olpc-mesh.h One Laptop per Child agrees to relicensing these files and any other GPL-2.0+ code in Network Manager as LGPL-2.1+ Signed-off-by: James Cameron <quozl@laptop.org>
* | libnm,ifcfg-rh: merge branch 'th/ifcfg-rh-ca-path'Thomas Haller2020-05-278-21/+56
|\ \ | | | | | | | | | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1840210 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/448 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/518
| * | libnm: update documentation for 802-1x ca-cert, ca-path and system-ca-certsThomas Haller2020-05-272-20/+38
| | |
| * | ifcfg-rh: fix handling "802-1x.{phase2-,}ca-path" in ifcfg-rh settings pluginThomas Haller2020-05-274-1/+16
| | | | | | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1840210 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/448
| * | build: log system-ca-path configure setting in build scriptsThomas Haller2020-05-272-0/+2
|/ /
* | license: add Bryan to RELICENSE.mdThomas Haller2020-05-271-0/+1
| | | | | | | | https://mail.gnome.org/archives/networkmanager-list/2020-May/msg00016.html
* | keyfile: suppress bogus warning about [ethernet-s390-options] settingThomas Haller2020-05-261-1/+2
| | | | | | | | | | | | | | | | | | | | S390 options are stored in a separate [ethernet-s390-options] section. This group must not be interpreted as a NMSetting name, otherwise we log a bogus warning: <warn> [1590523563.7757] keyfile: ethernet-s390-options: invalid setting name 'ethernet-s390-options' Fixes: cf9b8d3badfd ('libnm/keyfile: implement ethernet.s390-options in keyfile')
* | mailmap: add Bryan to mailmapThomas Haller2020-05-261-2/+3
|/
* license: add Marius to RELICENSE.mdThomas Haller2020-05-251-0/+1
| | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/390#note_509859
* license: add Martin to RELICENSE.mdThomas Haller2020-05-251-0/+1
| | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/514#note_509563
* platform: don't use unsigned constants in _link_type_from_rtnl_type(), ↵Thomas Haller2020-05-241-6/+6
| | | | _link_type_from_devtype()
* platform: fix crash in binary search for _link_type_from_rtnl_type(), ↵Matthias Schiffer2020-05-241-6/+6
| | | | | | | | | | | | | | | _link_type_from_devtype() When searching an element that is lower than the first list element (for example RTNL type "batadv"), imax will be -1 after the last iteration. Use int instead of unsigned to make the termination condition imin > imax work in this case. This fixes NetworkManager crashing due to an out-of-bounds array access whenever interfaces of such types exist. Fixes: 19ad044359c4 ('platform: use binary search to lookup NMLinkType for rtnl_type') https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/515
* license: add Thomas to RELICENSE.mdThomas Haller2020-05-231-0/+1
| | | | https://mail.gnome.org/archives/networkmanager-list/2020-May/msg00015.html
* license: add Florian to RELICENSE.mdThomas Haller2020-05-221-0/+1
| | | | | | | | As confirmed via private email: From: Florian Echtler <floe(at)butterbrot.org> To: Thomas Haller <thaller(at)redhat.com> Date: Fri, 22 May 2020 16:17:52 +0200
* libnm,core: merge branch 'th/setting-option-and-ethtool'Thomas Haller2020-05-2221-962/+743
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/506
| * libnm: check options in NMSettingEthtool.verify() in defined orderThomas Haller2020-05-221-9/+10
| | | | | | | | | | | | | | | | Iterating the hash gives the entries in undefined order. That means, when validation would fail for more than one option, then the error message arbitrarily points out one or the other. Instead, process the entries in a defined order.
| * libnm: remove redundant nm_setting_ethtool_*_coalesce() APIThomas Haller2020-05-223-251/+0
| | | | | | | | | | | | | | | | Note that nm_setting_ethtool_set_coalesce() used to coerce "coalesce-adaptive-[rt]x" values to 0 or 1. The alternative API doesn't do that. But so does nm_setting_option_set() not tell you whether the value you set is valid. That is not the options of the setters, for that we have verify().
| * libnm: deprecated nm_setting_ethtool_*_feature() APIThomas Haller2020-05-222-4/+16
| | | | | | | | These are just aliases for the more general nm_setting_option_*() API.
| * all: avoid (soon to be) deprecated API instead of nm_setting_option*()Thomas Haller2020-05-224-174/+175
| |
| * libnm: use nm_setting_option_*() API in NMSettingEthtoolThomas Haller2020-05-221-43/+18
| |
| * libnm: add nm_setting_option_clear_by_name()Thomas Haller2020-05-225-29/+44
| | | | | | | | | | | | | | | | | | | | | | | | More general purpose API for generic options of settings. The predicate function is also nicely usable via bindings. One question is about the form of the predicate. In this case, it is convenient to pass nm_ethtool_optname_is_coalesce(). On the other hand, it's not very flexible as it does not accept a user data argument. Use NMUtilsPredicateStr here, which is not flexible but convenient for where it's used.
| * libnm: add nm_setting_option_get_names()Thomas Haller2020-05-224-11/+11
| | | | | | | | More general purpose API for generic options of settings.
| * libnm: add nm_setting_option_get_uint32(), nm_setting_option_set_uint32()Thomas Haller2020-05-225-53/+91
| | | | | | | | More general purpose API for generic options of settings.
| * libnm: add nm_setting_option_set(), nm_setting_option_get_boolean(), ↵Thomas Haller2020-05-223-0/+157
| | | | | | | | | | | | nm_setting_option_set_boolean() More general purpose API for generic options of settings.
| * libnm: add API for setting gendata options to NMSetting ↵Thomas Haller2020-05-225-18/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (nm_setting_option_get()) NMSettingEthtool is implemented using "gendata", meaning a hash of GVariant. This is different from most other settings that have properties implemented as GObject properties. There are two reasons for this approach: - The setting is transferred via D-Bus as "a{sv}" dictionary. By unpacking the dictionary into GObject properties, the setting cannot handle unknown properties. To be forward compatible (and due to sloppy programming), unknown dictionary keys are silently ignored when parsing a NMSetting. That is error prone and also prevents settings to be treated loss-less. Instead, we should at first accept all values from the dictionary. Only in a second step, nm_connection_verify() rejects invalid settings with an error reason. This way, the user can create a NMSetting, but in a separate step handle if the setting doesn't verify. "gendata" solves this by tracking the full GVariant dictionary. This is still not entirely lossless, because multiple keys are combined. This is for example interesting if an libnm client fetches a connection from a newer NetworkManager version. Now the user can modify the properties that she knows about, while leaving all unknown properties (from newer versions) in place. - the approach aims to reduce the necessary boiler plate to create GObject properties. Adding a new property should require less new code. This approach was always be intended to be suitable for all settings, not only NMSettingEthtool. We should not once again try to add API like nm_setting_ethtool_set_feature(), nm_setting_ethtool_set_coalesce(), etc. Note that the option name already fully encodes whether it is a feature, a coalesce option, or whatever. We should not have "nm_setting_set_$SUB_GROUP (setting, $ONE_NAME_FROM_GROUP)" API, but simply "nm_setting_option_set (setting, $OPTION)" accessors. Also, when parsing a NMSettingEthtool from a GVariant, then a feature option can be any kind of variant. Only nm_setting_verify() rejects variants of the wrong type. As such, nm_setting_option_set*() also doesn't validate whether the variant type matches the option. Of course, if you set a value of wrong type, verify() will reject the setting. Add new general purpose API for this and expose it for NMSetting.
| * libnm: rename nm_setting_gendata_*() API to nm_setting_option_*()Thomas Haller2020-05-225-58/+58
| | | | | | | | | | | | | | | | | | | | | | We are going to expose some of this API in libnm. The name "gendata" (for "generic data") is not very suited. Instead, call the public API nm_setting_option_*(). This also brings no naming conflict, because currently no API exists with such naming. Rename the internal API, so that it matches the API that we are going to expose next.
| * libnm: drop unused internal API _nm_setting_gendata_reset_from_hash() and ↵Thomas Haller2020-05-222-71/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | _nm_setting_gendata_to_gvalue() This was intended for when the gendata hash should be converted to/from a GValue/GHashTable. This would have been used, if we also would have added a GObject property that exposes the hash. But that was never done (at least not for NMSettingEthtool and not yet). This code is not used. If you ever need it, revert the patch or implement it anew.
| * libnm: drop unused internal function nm_setting_gendata_get_all_values()Thomas Haller2020-05-222-29/+0
| | | | | | | | | | | | | | | | | | | | This function is not used nor does it seem useful. Either you only need the names (nm_setting_gendata_get_all_names()) or you need the names and values together (_nm_setting_gendata_get_all()). Getting the values without knowing the corresponding name makes little sense. If you need it, call _nm_setting_gendata_get_all() instead.
| * libnm: verify that ethtool coalesce options "adaptive-[rt]x" are booleanThomas Haller2020-05-221-0/+13
| | | | | | | | | | nm_setting_ethtool_set_coalesce() coerces the values to be either 0 or 1. Verification of NMSettingEthtool should ensure the same.
| * libnm: avoid duplicate type checks in "nm-setting-ethtool.c"Thomas Haller2020-05-221-35/+43
| | | | | | | | | | | | | | | | Don't duplicate the code that maps the option to the variant type. Also, only resolve the name to NMEthtoolID once. Multiple calls to nm_ethtool_optname_is_*() unnecessarily need to convert the string to the ethtool id multiple times.
| * ethtool: add and use _NM_ETHTOOL_ID_FEATURE_AS_IDX() macroThomas Haller2020-05-224-13/+14
| |
| * platform: make states of NMEthtoolCoalesceState indexed by ethtool_idThomas Haller2020-05-226-160/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We already have NMEthtoolID to handle coalesce options in a way that is convenient programmatically. That is, we can iterate over all valid coalesce options (it's just an integer) and use that in a more generic way. If NMEthtoolCoalesceState names all fields explicitly, we need explicit code that names each coalesce option. Especially since NMEthtoolCoalesceState is an internal and intermediate data structure, this is cumbersome and unnecessary. Thereby it also fixes the issue that nm_platform_ethtool_init_coalesce() has a NMPlatform argument without actually needing it. nm_platform_ethtool_init_coalesce() does not operate on a NMPlatform instance, and should not have the appearance of being a method of NMPlatform.
| * device: in _ethtool_coalesce_set() only fetch current coalesce settings if ↵Thomas Haller2020-05-223-70/+43
| | | | | | | | | | | | | | needed In the common case, the user doesn't set any coalesce options. Avoid always fetching the current settings, unless they are actually needed.
| * platform/trivial: rename NMEthtoolCoalesceState variables to "coalesce"Thomas Haller2020-05-221-47/+47
| | | | | | | | | | | | All other users name a similar variable "coalesce" (or "coalesce_new", "coalesce_old"). Rename the variables, to don't use different names for similar uses.
| * ifcfg-rh: avoid setting empty "-C/-K/-G" options for ethtool settingsThomas Haller2020-05-222-35/+43
| | | | | | | | | | If no options are set, we should not generate -C/-K/-G options without parameter.
| * libnm: add NMUtilsPredicateStr typedefThomas Haller2020-05-222-0/+17
|/ | | | | | This will be used for nm_setting_option_clear_by_name(), to filter based on a name. But it is a general purpose typedef for a predicate, not tied to NMSetting or option.