Commit graph

30039 commits

Author SHA1 Message Date
Thomas Haller
ee1467fcdb
libnm/802-1x: check is-pkcs12 only for blob certificates in verify_tls()
If the certificate is not a blob, it makes no sense to call
nm_crypto_is_pkcs12_data().
2022-03-29 11:52:38 +02:00
Thomas Haller
d3a6b9e7cc
libnm/802-1x: move need_private_key_password() to need_secrets_tls()
When a static function only has one caller, it is often simpler to not
have the code in a separate function. Drop need_private_key_password()
and move it to need_secrets_tls().
2022-03-29 11:52:37 +02:00
Thomas Haller
bcb1ab9e1c
libnm/802-1x: don't use g_warning() in need_secrets_tls()
g_warning() for unexpected scheme is not right. Either, this should be an
assertion (and never be hit), or the library should be silent about conditions
that can happen regularly.
2022-03-29 11:52:37 +02:00
Thomas Haller
e4a7b671d6
libnm/802-1x: cleanup duplicate code paths in need_secrets_tls()
I think code is easier to understand, if the difference (between phase1
and phase2) is pushed to the bottom. Having one large "if(phase2){}else{}"
at the top makes it harder to compare the two branches and see where
they differ.
2022-03-29 11:52:37 +02:00
Thomas Haller
47f2c5e5db
libnm/802-1x: cleanup need_secrets_phase2() 2022-03-29 11:52:37 +02:00
Thomas Haller
a3aec9dc5c
libnm/802-1x: reuse verify_identity() in verify_ttls() implementation 2022-03-29 11:52:37 +02:00
Thomas Haller
d5ee67981c
libnm/802-1x: simplify verify_tls() for phase1 and phase2
The checks are duplicated and verbose. Combine them.
2022-03-29 11:52:33 +02:00
Beniamino Galvani
7d5a8d4f74 merge: branch 'bg/rfkill'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1157
https://bugzilla.redhat.com/show_bug.cgi?id=1996918
2022-03-29 09:37:36 +02:00
Beniamino Galvani
e51b4ca5fe cli: indicate missing radio hardware in "nmcli radio"
When no radio hardware is present in the system, "nmcli radio"
currently displays:

  WIFI-HW  WIFI     WWAN-HW  WWAN
  enabled  enabled  enabled  enabled

which is misleading. Use the new RadioFlags property to display
"missing" in the *-HW columns when there is no hardware for the
given radio technology.

https://bugzilla.redhat.com/show_bug.cgi?id=1996918
2022-03-29 09:34:07 +02:00
Beniamino Galvani
4a8a3847ad libnm: support radio flags 2022-03-29 09:34:07 +02:00
Beniamino Galvani
580ef03bee core: export radio flags
Introduce a RadioFlags property on the manager object. For now it
contains two bits WLAN_AVAILABLE, WWAN_AVAILABLE to indicate whether
any radio interface is present in the system. The presence of a radio
is detected by looking at devices and rfkill switches.

In future, any radio-related read-only boolean flag can be exposed via
this property, including the already existing WirelessHardwareEnabled
and WwanHardwareEnabled properties.
2022-03-29 09:34:07 +02:00
Beniamino Galvani
2343148da8 core: introduce "unavailable" rfkill state
Introduce a new "unavailable" rfkill state to indicate that no rfkill
hardware was found. Currently it is still handled as "unblocked".
2022-03-29 09:12:36 +02:00
Thomas Haller
2bdca1f5d6
libnm/keyfile: merge branch 'th/keyfile-cleanup'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1161
2022-03-28 18:31:41 +02:00
Thomas Haller
782f2fa8ef
keyfile: don't require verified profile in nm_keyfile_write()
Previously, only the daemon was writing keyfiles, and it ensures
that they are always valid.

As we now have this function as public API of libnm, we should drop this
restriction and write the profile the best we can. Granted, an invalid
profile may not be expressed in keyfile format, and the result is
undefined. But make the best of it.
2022-03-28 18:27:37 +02:00
Thomas Haller
b07bf1a8bb
keyfile: add write_handle_warn() helper 2022-03-28 18:27:37 +02:00
Thomas Haller
cec1269795
keyfile: rename handle_warn() to read_handle_warn()
We will also want to warn during write.
2022-03-28 18:27:36 +02:00
Thomas Haller
cfe594903e
keyfile: simplify code path in write_setting_value()
Avoid nested blocks. Check one condition after the other and handle it.
2022-03-28 18:27:36 +02:00
Thomas Haller
a0db72bf6d
keyfile: use nm_setting_8021x_scheme_vtable_by_setting_key() helper in cert_writer() 2022-03-28 18:27:36 +02:00
Thomas Haller
e965aa2536
libnm: add nm_setting_8021x_scheme_vtable_by_setting_key() helper
Add function to lookup the vtable by name. Implement a binary search.
2022-03-28 18:27:36 +02:00
Thomas Haller
22dcfb3a67
libnm: fix update of cached option names in nm_setting_option_set()
This is severe. We cache the list of names, and we must invalidate the
cache when the names change. Otherwise, out-of-bound access and crash.

Fixes: d0192b698e ('libnm: add nm_setting_option_set(), nm_setting_option_get_boolean(), nm_setting_option_set_boolean()')
Fixes: 150af44e10 ('libnm: add nm_setting_option_get_uint32(), nm_setting_option_set_uint32()')
2022-03-28 18:27:35 +02:00
Thomas Haller
681926ad43
glib-aux: make nm_gobject_notify_together_full() macro more robust
If __VA_ARGS__ contains odd arguments, it's not clear that N_ARG() gives
the same as the array initialization. Add a static assert that the
numbers agree to catch wrong usage of the macro.

For example:

    nm_gobject_notify_together(setting, a, b, );
2022-03-28 18:27:35 +02:00
Thomas Haller
321b59e84b
docs: add "sandboxing.md" 2022-03-28 18:04:18 +02:00
Lubomir Rintel
aba3401df0 cli: remove one more g_assert()
I pushed accidentally pushed commit 9702310f25 ('clients: bulk removal
of g_assert*() statements') earlier than I intended, without addressing
one more case introduced by preceding merge. Fix it now.

Fixes: 9702310f25 ('clients: bulk removal of g_assert*() statements')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1166
2022-03-28 15:04:07 +02:00
Lubomir Rintel
8dbe6fa0d5 merge: branch 'lr/conn-migrate'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1146
https://bugzilla.redhat.com/show_bug.cgi?id=2059608
2022-03-28 15:00:45 +02:00
Lubomir Rintel
1aa9c80b9b cli: add "connection migrate" subcommand
This is used to move a connection to a different settings plugin.
2022-03-28 14:59:30 +02:00
Lubomir Rintel
9702310f25 clients: bulk removal of g_assert*() statements
Assertions should be done in tests. If we detect an unexpected situation
at runtime, we shall fail more gracefully than crashing right away.
2022-03-28 13:51:44 +02:00
Lubomir Rintel
c7ab380a5c cli: fix handling of erroneous connections in "delete"
If we can't find a connection for any reason other than that it doesn't
exist, we should error out immediately and consistently, regardless of
whether we already encountered a non-existent connection.
2022-03-28 13:29:28 +02:00
Lubomir Rintel
e39e5d9372 cli: fix up help string for "delete"
Make it obvious that we can delete more connections in one go.
2022-03-28 13:29:28 +02:00
Lubomir Rintel
82d16789a5 settings-connection: add a "plugin" argument to Update2()
This will allow migrating a connection. If specified, the connection will
be confined to a particular settings plugin when written back. If the
plugin differs from the existing one, it will be removed from the old one.
2022-03-28 13:29:28 +02:00
Lubomir Rintel
f4f165f945 settings: add "plugin" argument to AddAndActivate2()
This will confine a newly added connection to a particular settings
plugin.
2022-03-28 13:29:28 +02:00
Nathan Follens
18b4ea7468
po: update Dutch (nl) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1163
2022-03-28 12:43:48 +02:00
Daisuke Matsuda
fc2fab99b2
platform: add log detail for ENODEV at do_delete_object()
Deactivation of a NIC invokes deletion of qdisc. An ENODEV error can
be generated on deactivation of a virtual NIC when the kernel driver
has already deleted the device along with the qdisc.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1165
2022-03-28 10:52:01 +02:00
Thomas Haller
979dbd6d0d
libnm: merge branch 'BryanJacobs:main'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1164
2022-03-28 10:46:00 +02:00
Thomas Haller
b1b1ee8cc4
libnm/tests: test that nm_vpn_service_plugin_read_vpn_details() does not consume "QUIT" command 2022-03-28 10:40:00 +02:00
Thomas Haller
6235815248
libnm: handle NUL characters in nm_vpn_service_plugin_read_vpn_details() and fix test
We expect to read NUL terminated strings. Upon NUL, we should do
something. Treat it as a line break.

Fixes: 8ae9cf4698 ('Revert "libnm: buffer reads in nm_vpn_service_plugin_read_vpn_details()"')
2022-03-28 10:36:05 +02:00
Bryan Jacobs
8ae9cf4698
Revert "libnm: buffer reads in nm_vpn_service_plugin_read_vpn_details()"
This partially reverts commit 4a9fcb0fc3, which replaced one-byte
reads with buffered ones in the VPN service plugin.

Unfortunately the buffering means that commands coming after the magic
"DONE" string were being pulled into the buffer. Secrets agents expect
a "QUIT" to come after the "DONE", and since with buffering "QUIT" was
in the buffer, this led to a twenty-second delay on every VPN
connection using a secrets manager.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1164

Fixes: 4a9fcb0fc3 ('libnm: buffer reads in nm_vpn_service_plugin_read_vpn_details()')
2022-03-28 09:39:13 +02:00
Lubomir Rintel
bdcc85de76 release: bump version to 1.37.3 (development) 2022-03-24 21:36:26 +01:00
Lubomir Rintel
79e8f9f258 NEWS: update 2022-03-24 21:33:39 +01:00
Lubomir Rintel
e17f8526dd merge: branch 'lr/dbus-api'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1154
2022-03-22 14:49:19 +01:00
Lubomir Rintel
2df493c00d introspection: fix punctuation and capitalization
Sentences start with a capital letter and end with a period, even if
they are really really short.
2022-03-22 14:48:45 +01:00
Lubomir Rintel
d1e73f0ece introspection: unbreak a couple of docstrings
A couple of argument documentation strings were long enough to be broken
up to span over multiple lines. gdbus-codegen, on the other hand, was
of differing opinion and promptly punished the offense by garbling the
resulting docbook.

Merge the string into single lines.
2022-03-22 14:48:45 +01:00
Lubomir Rintel
87d16e7020 introspection: unbreak o.fd.NM.Device.WifiP2p StartFind() docstring
This one attempts to document an option dictionary in a manner that has
been deemed criminal by the high court of gdbus-codegen.

Beat it back into shape.
2022-03-22 14:48:45 +01:00
Lubomir Rintel
fe9ef5e151 introspection: unbreak o.fd.NM.Settings AddConnection2() docstring
There has been a lot wrong with this one. Aside from the messy
capitalization, it broke the argument documentation into multiple lines,
baffling gdbus-codegen, which, in turn, generated garbage documentation.

Overhaul it.
2022-03-22 14:48:45 +01:00
Lubomir Rintel
b5715b82b6 introspection: unbreak o.fd.NM.Settings.Connection Update2() docstring
There has been a lot wrong with this one. Aside from the messy
capitalization, it broke the argument documentation into multiple lines,
baffling gdbus-codegen, which, in turn, generated garbage documentation.

Overhaul it.
2022-03-22 14:48:43 +01:00
Lubomir Rintel
1358831d03 introspection: use @since
gdbus-codegen provides a way to specify a version number on various
elements. Use it to instead of a plain text paragraph.
2022-03-22 14:47:33 +01:00
Christian Eggers
f6ec6ef364
core: create GMainLoop after daemonizing
The GMainLoop instance (and the default GMainContext singleton) is not
required for trivial operations like --print-config, --version or
--help). If running as SysV daemon, the event file descriptor is
unnecessarily dup'ed from the parent to the child process.

Signed-off-by: Christian Eggers <ceggers@arri.de>

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1160
2022-03-22 13:43:41 +01:00
Yuri Chornoivan
866a28e585
po: update Ukrainian (uk) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1159
2022-03-21 18:13:22 +01:00
Thomas Haller
bd2fc2bf8a
gitlab-ci,po,doc: merge branch 'th/build-misc'
buil://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1152
2022-03-21 17:23:02 +01:00
Thomas Haller
20f43d968f
po: unify "Language" header field in po files
`msgfmt -vc` warns:

  po/be@latin.po:2: warning: header field 'Language' still has the initial default value

Check all files and update the Language manually.

The documentation ([1]) says that either "ll", "ll_CC" or "ll_CC@variant"
is valid. Update accordingly.

[1] https://www.gnu.org/software/gettext/manual/html_node/Header-Entry.html
2022-03-21 17:19:49 +01:00
Thomas Haller
e8b309e4ef
po: update "Project-Id-Version" for po files
`msgfmt -vc` warns:

  po/as.po:9: warning: header field 'Project-Id-Version' still has the initial default value

Update them all:

  $ git grep -l Project-Id-Version | xargs sed 's/^"Project-Id-Version: \(.*\)\\n"$/"Project-Id-Version: NetworkManager\\n"/' -i

The documentation ([1]) says:

  Project-Id-Version
    This is the name and version of the package. Fill it in if it has not already
    been filled in by xgettext.

but don't add the "version". We have these files in git on the devel branch,
so whenever we branch a new release, the version would change. Just say
"NetworkManager".

[1] https://www.gnu.org/software/gettext/manual/html_node/Header-Entry.html
2022-03-21 17:19:47 +01:00