Commit graph

26105 commits

Author SHA1 Message Date
Beniamino Galvani
9064502834 platform: rework qdisc synchronization
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.
2020-05-28 17:25:22 +02:00
Beniamino Galvani
9a4578c8f9 platform: use ECHO flag for qdisc and filter requests
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
2020-05-28 17:25:22 +02:00
Beniamino Galvani
3957d40f54 initrd: don't generate new connections for rd.znet
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
2020-05-28 14:34:44 +02:00
Beniamino Galvani
eff0e0d123
device: add mechanism to call stage1 for external or assumed devices
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.
2020-05-27 15:49:02 +02:00
Thomas Haller
9cbab5d3e7
license: merge branch 'quozl:relicense-one-laptop-per-child'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/521
2020-05-27 12:42:38 +02:00
Thomas Haller
e0c220e7e9
libnm,ifcfg-rh: merge branch 'th/ifcfg-rh-ca-path'
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
2020-05-27 10:28:51 +02:00
Thomas Haller
4f21b14b90
libnm: update documentation for 802-1x ca-cert, ca-path and system-ca-certs 2020-05-27 10:28:26 +02:00
Thomas Haller
b6b6639c7c
ifcfg-rh: fix handling "802-1x.{phase2-,}ca-path" in ifcfg-rh settings plugin
https://bugzilla.redhat.com/show_bug.cgi?id=1840210
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/448
2020-05-27 10:26:07 +02:00
Thomas Haller
f8dcb3fc47
build: log system-ca-path configure setting in build scripts 2020-05-27 10:24:35 +02:00
Thomas Haller
56acdac152
license: add Bryan to RELICENSE.md
https://mail.gnome.org/archives/networkmanager-list/2020-May/msg00016.html
2020-05-27 09:52:42 +02:00
James Cameron
37843f9560 license: move One Laptop per Child in RELICENSE.md
With reference to
dd9156d55f/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>
2020-05-27 07:01:45 +10:00
Thomas Haller
82a468c9ad
keyfile: suppress bogus warning about [ethernet-s390-options] setting
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: cf9b8d3bad ('libnm/keyfile: implement ethernet.s390-options in keyfile')
2020-05-26 22:45:10 +02:00
Thomas Haller
5d5be6b3a3
mailmap: add Bryan to mailmap 2020-05-26 11:59:45 +02:00
Thomas Haller
dd9156d55f
license: add Marius to RELICENSE.md
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/390#note_509859
2020-05-25 15:05:52 +02:00
Thomas Haller
35fa604fbe
license: add Martin to RELICENSE.md
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/514#note_509563
2020-05-25 13:37:07 +02:00
Thomas Haller
650c550ab5
platform: don't use unsigned constants in _link_type_from_rtnl_type(), _link_type_from_devtype() 2020-05-24 12:16:04 +02:00
Matthias Schiffer
2b54202089
platform: fix crash in binary search for _link_type_from_rtnl_type(), _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: 19ad044359 ('platform: use binary search to lookup NMLinkType for rtnl_type')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/515
2020-05-24 12:15:40 +02:00
Thomas Haller
41d431e0f8
license: add Thomas to RELICENSE.md
https://mail.gnome.org/archives/networkmanager-list/2020-May/msg00015.html
2020-05-23 16:59:14 +02:00
Thomas Haller
e4ad30a011
license: add Florian to RELICENSE.md
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
2020-05-22 16:33:24 +02:00
Thomas Haller
b8d947333c
libnm,core: merge branch 'th/setting-option-and-ethtool'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/506
2020-05-22 15:58:22 +02:00
Thomas Haller
16c8555b24
libnm: check options in NMSettingEthtool.verify() in defined order
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.
2020-05-22 15:58:09 +02:00
Thomas Haller
280600f0be
libnm: remove redundant nm_setting_ethtool_*_coalesce() API
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().
2020-05-22 15:58:09 +02:00
Thomas Haller
482f9c574e
libnm: deprecated nm_setting_ethtool_*_feature() API
These are just aliases for the more general nm_setting_option_*() API.
2020-05-22 15:58:09 +02:00
Thomas Haller
0533ab3c79
all: avoid (soon to be) deprecated API instead of nm_setting_option*() 2020-05-22 15:58:09 +02:00
Thomas Haller
614f5f5a88
libnm: use nm_setting_option_*() API in NMSettingEthtool 2020-05-22 15:58:09 +02:00
Thomas Haller
49db9d8d78
libnm: add nm_setting_option_clear_by_name()
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.
2020-05-22 15:58:09 +02:00
Thomas Haller
1a56a2105c
libnm: add nm_setting_option_get_names()
More general purpose API for generic options of settings.
2020-05-22 15:58:09 +02:00
Thomas Haller
150af44e10
libnm: add nm_setting_option_get_uint32(), nm_setting_option_set_uint32()
More general purpose API for generic options of settings.
2020-05-22 15:58:09 +02:00
Thomas Haller
d0192b698e
libnm: add nm_setting_option_set(), nm_setting_option_get_boolean(), nm_setting_option_set_boolean()
More general purpose API for generic options of settings.
2020-05-22 15:58:08 +02:00
Thomas Haller
9655dff5cb
libnm: add API for setting gendata options to NMSetting (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.
2020-05-22 15:58:08 +02:00
Thomas Haller
618ae93b94
libnm: rename nm_setting_gendata_*() API to nm_setting_option_*()
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.
2020-05-22 15:58:08 +02:00
Thomas Haller
bfe05b48f2
libnm: drop unused internal API _nm_setting_gendata_reset_from_hash() and _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.
2020-05-22 15:58:08 +02:00
Thomas Haller
34fc68f20a
libnm: drop unused internal function nm_setting_gendata_get_all_values()
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.
2020-05-22 15:58:08 +02:00
Thomas Haller
20a2399aa9
libnm: verify that ethtool coalesce options "adaptive-[rt]x" are boolean
nm_setting_ethtool_set_coalesce() coerces the values to be either 0 or
1. Verification of NMSettingEthtool should ensure the same.
2020-05-22 15:58:08 +02:00
Thomas Haller
501554732c
libnm: avoid duplicate type checks in "nm-setting-ethtool.c"
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.
2020-05-22 15:58:08 +02:00
Thomas Haller
dcb4ed2cb1
ethtool: add and use _NM_ETHTOOL_ID_FEATURE_AS_IDX() macro 2020-05-22 15:58:08 +02:00
Thomas Haller
1f4b190934
platform: make states of NMEthtoolCoalesceState indexed by ethtool_id
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.
2020-05-22 15:58:08 +02:00
Thomas Haller
1f5f840818
device: in _ethtool_coalesce_set() only fetch current coalesce settings if needed
In the common case, the user doesn't set any coalesce options. Avoid always
fetching the current settings, unless they are actually needed.
2020-05-22 15:58:01 +02:00
Thomas Haller
94a603a1bc
platform/trivial: rename NMEthtoolCoalesceState variables to "coalesce"
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.
2020-05-22 15:58:01 +02:00
Thomas Haller
adcb935089
ifcfg-rh: avoid setting empty "-C/-K/-G" options for ethtool settings
If no options are set, we should not generate -C/-K/-G options
without parameter.
2020-05-22 15:58:01 +02:00
Thomas Haller
c48bfdf584
libnm: add NMUtilsPredicateStr typedef
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.
2020-05-22 15:58:01 +02:00
Thomas Haller
332cf1ad9d
license: add Rafael to RELICENSE.md
As confirmed via private email:

  From: Rafael Fontenelle <rafaelff(at)gnome.org>
  To:   Thomas Haller <thaller(at)redhat.com>
  Date: Fri, 22 May 2020 10:28:59 -0300
2020-05-22 15:54:43 +02:00
Thomas Haller
4cbb4a9dff
license: add Ikey to RELICENSE.md
As confirmed via private email:

  From: Ikey Doherty <ikey.doherty(at)lispysnake.com>
  To:   Thomas Haller <thaller(at)redhat.com>
  Date: Fri, 22 May 2020 14:43:18 +0100
2020-05-22 15:51:01 +02:00
Thomas Haller
9fd0867acb
license: add Yuri to RELICENSE.md
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/514#note_507841
2020-05-22 15:36:04 +02:00
Thomas Haller
7b9cb1f952
libnm: fix documentation for value argument of nm_client_dbus_call()
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/451
2020-05-22 08:51:21 +02:00
Thomas Haller
7774d837d7
license: add Alfonso to RELICENSE.md
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/390#note_502713
2020-05-20 21:25:40 +02:00
Thomas Haller
316719c5f7
license: add Canonical, Ltd. to RELICENSE.md
As discussed via email:

  From: Andrew Sinclair <andrew.sinclair(at)canonical.com>
  To:   Thomas Haller <thaller(at)redhat.com>
  Cc:   Legal(at)canonical.com <legal(at)canonical.com>, Loïc Minier <loic.minier(at)canonical.com>, Alfonso Sanchez-Beato <alfonso.sanchez-beato(at)canonical.com>
  Date: Wed, 20 May 2020 12:08:20 -0400
2020-05-20 21:17:05 +02:00
Thomas Haller
1373fd0a9b
license: fix obsolete line in RELICENSE.md 2020-05-20 21:16:41 +02:00
Thomas Haller
eb500fe077
license: add David to RELICENSE.md
https://mail.gnome.org/archives/networkmanager-list/2020-May/msg00014.html
2020-05-20 17:19:43 +02:00
Thomas Haller
6a464e3302
license: add Jan and Pengutronix to RELICENSE.md
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/390#note_504926
2020-05-20 11:43:00 +02:00