Commit graph

34212 commits

Author SHA1 Message Date
Thomas Haller
24a714d12e cli: merge branch 'th/cli-device-wifi-list-rework'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/443
2020-03-19 10:47:56 +01:00
Thomas Haller
db396cea9d cli: rework do_device_wifi_list() to scan and print Wi-Fi list
Drop the special casing of not scanning. Now do_device_wifi_list()
always handles the scan list in a callback.

Also fix the error code for scanning for a certain "bssid", which
previously was not set if scanning was not performed:

  $ nmcli device wifi list --rescan no bssid bogus
  Success
2020-03-19 10:46:58 +01:00
Thomas Haller
81d12f020a cli: use nm_utils_hwaddr_matches() for matching BSSID in wifi_print_aps()
We have a proper implementation for comparing MAC addresses. Don't
reimplement it differently.
2020-03-19 10:40:13 +01:00
Antonio Cardace
17082a868e gitlab-ci: use ruby:2.7 for triage pipeline
This fixes the pipeline as 'gem' will be installed by default in the
container image.

Also fix wording and run gitlab-triage in debug mode to get more output.
2020-03-18 17:40:59 +01:00
Antonio Cardace
968e7898e6 gitlab-ci: add scheduled pipeline to triage inactive issues and MRs 2020-03-18 16:25:55 +01:00
Thomas Haller
a6574b7124 n-dhcp4: fallback to CLOCK_MONOTONIC for timerfd (resync with upstream)
The upstream merge request [1] was solved differently from
commit f49ce41214 ('client: fallback to CLOCK_MONOTONIC for timerfd').

Resync with upstream.

[1] https://github.com/nettools/n-dhcp4/pull/13
[2] a0bb7c69a1
2020-03-18 16:10:49 +01:00
Thomas Haller
6c837a366b supplicant: combine multiple log lines about supported supplicant features
For many purposes, the supplicant features are not very interesting (as
they are also mostly static for a certain release/distribution). Combine
the multiple logging lines into one.

Also, sort the NMSupplCapType enum values consistently with the order
in which we log them.

Also, rename the logging output for features to match the enum name.
E.g. "FAST" instead of "EAP-FAST".

Now:

  > supplicant: supported features: AP+ PMF+ FILS- P2P+ FT+ SHA384+ MESH+ FAST+ WFD+
2020-03-18 09:52:16 +01:00
Beniamino Galvani
8fe2046f08 core: avoid unbound recursion in IPv6 connection sharing
When a device gets a prefix delegation, we call
nm_device_use_ip6_subnet() for all other devices that have IPv6
sharing enabled, which changes the current IPv6 configuration and
notifies NMPolicy. When updating the DNS configuration in NMPolicy, we
should notify all devices except the one that triggered the change.

https://bugzilla.redhat.com/show_bug.cgi?id=1488030
2020-03-17 21:42:42 +01:00
Thomas Haller
1a387f9ef9 license: add Soapux to RELICENSE.md
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/397#note_438764
2020-03-17 16:26:57 +01:00
Thomas Haller
fe1005f876 license: fix Dan's email address in RELICENSE.md
The email address should match the commit's authors and
what we track in .mailmap file. Adjust the email address
for Dan.
2020-03-17 15:10:59 +01:00
Thomas Haller
2ae81250c4 license: add Christian to RELICENSE.md
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/397#note_438590
2020-03-17 14:47:40 +01:00
Thomas Haller
b2a0738765 man: improve manual page for nm-online
https://bugzilla.redhat.com/show_bug.cgi?id=1706646
2020-03-17 13:33:51 +01:00
Thomas Haller
32d79f6c6e license: add Jan to RELICENSE.md
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/397#note_438497
2020-03-17 13:01:29 +01:00
Thomas Haller
f34510988f license: add Corentin to RELICENSE.md
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/397#note_438328
2020-03-17 11:36:30 +01:00
Thomas Haller
13f9a742b4 license: add Javier to RELICENSE.md
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/397#note_438327
2020-03-17 11:27:51 +01:00
Thomas Haller
b97bf184a1 license: add Jan to RELICENSE.md
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/397#note_438290
2020-03-17 09:30:04 +01:00
Thomas Haller
9a2a8feb41 license: add Benjamin to RELICENSE.md
https://mail.gnome.org/archives/networkmanager-list/2020-March/msg00023.html
2020-03-17 09:27:56 +01:00
Thomas Haller
cd21e5fdff device: merge branch 'th/act-stage2-re-entrant'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/427
2020-03-17 08:16:52 +01:00
Thomas Haller
7af61e2aa0 device: make device stage2 reentrant for NMDeviceBridge 2020-03-17 08:13:22 +01:00
Thomas Haller
ea3912b70b device: make device stage2 reentrant for NMDeviceAdsl
Configuration stages like act_stage2_config() can postpone progressing
to the next stage. Currently, when the condition that we wait for gets
satisfied, the code schedules the next stage from there.

I think that is wrong, because when we postpone from act_stage2_config(),
follow up steps of stage2 get skipped. Thus, when we are ready to progress,
the class should enter stage 2 again.

This requires that stage2 becomes reentrant and that the code reenters the
same stage.
2020-03-17 08:13:22 +01:00
Thomas Haller
99cb791813 device: allow scheduling nm_device_activate_schedule_stage2_device_config() right away
We usually want to schedule stage2 when we just completed with the previous
stage (or, if we are currently in stage2, and want to re-enter it).

In those cases, the conditions are often right to just proceed right away.
No need to schedule the stage on an idle handler. Allow to invoke stage2
right away.
2020-03-17 08:13:22 +01:00
Thomas Haller
3d78740398 device: allow scheduling nm_device_activate_schedule_stage1_prepare() right away
There was only API to schedule the stage on an idle handler.

Sometimes, we are just in the right situation to schedule the stage
right away. It should be possibly to avoid going through the extra hop.

For now, none of the caller makes use of this. So, there isn't any
actual change in behavior. But by adding this possibility, we may do
use in the future.
2020-03-17 08:13:22 +01:00
Thomas Haller
5979972e20 device/wifi: don't postpone act_stage2_config() for iwd when nothing to wait 2020-03-17 08:13:22 +01:00
Thomas Haller
aa991916dc device: various code cleanups in devices
Mostly just cleanups, there should be no significant change in behavior.
2020-03-17 08:09:32 +01:00
Thomas Haller
607a22b900 libnm-core: minor cleanup checks in "nm-setting-adsl.c"'s verify() 2020-03-17 08:02:54 +01:00
Thomas Haller
d3e5eab734 shared: add nm_g_variant_is_of_type() helper 2020-03-17 08:02:54 +01:00
Thomas Haller
c3bfd57c69 cli: merge branch 'th/cli-device-wifi-cleanup'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/435
2020-03-16 13:44:38 +01:00
Thomas Haller
3d2b982fb7 cli: fix out of bounds access in _print_fill()
cols_len might be larger than header_row->len. That is when
the cols has entries that are not leaf entries (which currently
I think is never the case).

Fix it to use the right variable for the length of the row.
2020-03-16 13:44:12 +01:00
Thomas Haller
5bef7d7453 cli: minor cleanup dropping unnecessary local variables 2020-03-16 13:44:12 +01:00
Thomas Haller
3cc99c9f8c cli: return typed PrintDataCol array from _output_selection_parse()
It makes debugging and understanding the code slightly simpler, if we
have a pointer of correct type, instead of returning a GArray. We don't
need the GArray at this point anymore.
2020-03-16 13:44:09 +01:00
Thomas Haller
a01355ba64 cli: add get_type argument to ap_wpa_rsn_flags_to_string() for optional i18n
Will be used later.
2020-03-16 13:40:51 +01:00
Thomas Haller
49dacaa34e cli: use slice allocator in do_device_wifi_list() and designated initializers for data 2020-03-16 13:40:51 +01:00
Thomas Haller
30cf1885d4 cli: cleanup selecting Wi-Fi device for nmcli device wifi list
Refactor the selection of the Wi-Fi device by name. Avoid
find_wifi_device_by_iface() to lookup by name. We already
have a sorted list of candidate devices. The ifname is just
an additional filter to exclude devices. So, we shouldn't
use find_wifi_device_by_iface(), but instead check our prepared
list of devices, whether it contains matching candidates.
2020-03-16 13:40:51 +01:00
Thomas Haller
e0e39a7452 cli: take reference in sort_access_points() for "clients/cli/devices.c"
It's not really necessary, but it feels slightly more correct. The only
reason not to take a reference is to safe the overhead of increasing and
decreasing the reference counter. But that doesn't matter for nmcli
at this point (and is tiny anyway). Let the API make sure that the instances
are kept alive.
2020-03-16 13:40:51 +01:00
Thomas Haller
ca4b530742 cli: use NM_CMP*() macros for compare_aps() in "clients/cli/devices.c"
The compare pattern seems simple, but seems error prone and subtle.
NM_CMP*() avoids that.

For example, nm_access_point_get_strength() returns an uint8_t.
C will promote those values to "int" before doing the subtraction.
Likewise, nm_access_point_get_frequency() returns a uint32_t. This
gets promoted to unsigned int when doing the subtraction. Afterwards,
that is converted to a signed int.
So both cases were in fact correct. But such things are not obvious.

Also, as fallback sort by D-Bus path. While that is not semantically
useful, we should use a defined sort order.
2020-03-16 13:40:51 +01:00
Thomas Haller
652de3b8d2 cli: use nm_utils_bin2hexstr_full() in ssid_to_hex()
We already have an implementation for converting a binary
array to hex. And, it doesn't require a GString for constructing
the output that has an known length.
2020-03-16 13:40:51 +01:00
Thomas Haller
b7e171c1f7 libnm: fix nm_vpn_plugin_info_list_find_service_type()
Of course, having no list does not mean we cannot resolve the service-type.
That is, because we also have a hard-coded list of known VPNs.

Fixes: 67c00353d3 ('libnm: reuse _list_find_by_service() for searching NMVpnPluginInfo')
2020-03-15 09:16:19 +01:00
Thomas Haller
6b07b40c46 libnm: hide NMVpnPluginInfo structs from public API
The NMVpnPluginInfo class is not intended to be subclassed. An API that
allows to be subclassed needs to be designed in a certain manner for
that to be useful. NMVpnPluginInfo does not want to support that.

Only because a user technically could do that (as the structs were
in the public headers), it does not make it supported. Not everything
that is possible in C is guaranteed to work.

Also, of course there exist no users in practice that would rely on this.
So, hide the structs.

Also, this allows to embed the private data in the GObject struct
itself, which is useful for debugging and for performance.
2020-03-14 18:04:05 +01:00
Thomas Haller
67c00353d3 libnm: reuse _list_find_by_service() for searching NMVpnPluginInfo 2020-03-14 17:52:08 +01:00
Thomas Haller
2b814f4e87 libnm: let nm_vpn_plugin_info_new_search_file() call full list-load
list-load does some special handling, for example, it will avoid adding
duplicates. As such, two plugin infos cannot have the same name or
same service type.

nm_vpn_plugin_info_new_search_file() did not implement this, it merely
loaded each directory after the other, sort the plugin infos, and
returned the first match.

That might mean, with unusual (duplicate) name files,
nm_vpn_plugin_info_new_search_file() might return a value
that would not otherwise be returned by
nm_vpn_plugin_info_list_load().

Let nm_vpn_plugin_info_new_search_file() call list-load, so that
the search result is always consistent.

The downside of this is that previously, if the searched plugin was
already found in /usr/lib, we would skip loading /etc. But
that is a minor optimization, in any case nm_vpn_plugin_info_new_search_file()
scales with the number of .name files on disk, which is expected to be small.
2020-03-14 17:26:28 +01:00
Antonio Cardace
1a76141e66 nm-device: merge branch 'ac/nm-device-hwaddr'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/430
2020-03-13 10:23:13 +01:00
Antonio Cardace
067a3d6c08 nm-device: expose via D-Bus the 'hw-address' property
Drop device-specific 'hw-address' GObject properties which are now
redundant.

https://bugzilla.redhat.com/show_bug.cgi?id=1786937
2020-03-13 10:22:21 +01:00
Antonio Cardace
cbb45aaf90 libnm: cleanup 'NML_DBUS_META_IFACE_INIT_PROP' macro 2020-03-13 10:22:21 +01:00
Atul Anand
219ee9a9e8 license: add Atul to RELICENSE.md
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/436
2020-03-12 18:16:10 +01:00
Thomas Haller
f714ae7626 supplicant: merge branch 'th/supplicant'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/426
2020-03-12 10:32:31 +01:00
Thomas Haller
ef5c109562 wifi: track access point via hash table for supplicant D-Bus path
Let's not do linear search. Use a hash table to find the AP by D-Bus
path.
2020-03-12 10:16:22 +01:00
Thomas Haller
4cfed38135 wifi: expose NMRefString for nm_wifi_ap_get_supplicant_path()
We internally track the string as NMRefString. Expose it, so that
users can directly use the reference counted string.
2020-03-12 10:16:22 +01:00
Thomas Haller
b83f07916a supplicant: large rework of wpa_supplicant handling
Avoid GDBusProxy, instead use GDBusConnection directly. I very much
prefer this because that way we have explicit control over what happens
on D-Bus. With GDBusProxy this is hidden under another layer of complex
code. The hardest part when using a D-Bus interface is to manage the
state via an asynchronous medium. GDBusProxy contains state about the
D-Bus interface and duplicate the state that we track. This makes it hard
to reason about things.

Rework creation of NMSupplicantInterface. Previously, a NMSupplicantInterface
had multiple initialization states. In particular, the first state would not
yet tie the interface to a certain D-Bus object path. Instead, NMSupplicantInterface
would try and retry to create the D-Bus object.
Now, NMSupplicantManager has an asynchronous method to create interface
instances. The manager only creates an interface instance after the D-Bus
path is known. That means, a NMSupplicantInterface instance is now
strongly tied to a name-owner and D-Bus path.

It follows that the state of NMSupplicantInterface can only go from STARTING,
via the supplicant states, to DOWN. Never back. That was already previously
the case that the state from DOWN was final and once the 3 initial
states were passed, the interface's state would never go back to the initial
state. Now this is more strict and more formalized. The 3 initialization states
are combined.

I think the tighter state handling simplifies users of NMSupplicantInterface.
See for example "nm-device-ethernet.c". It's still complicated, because handling
state is fundamentally difficult.

NMSupplicantManager will take care to D-Bus activate wpa_supplicant only
when necessary (poke). Previously, creating the manager instance
would always start suppliant service. Now, it's started on demand.
2020-03-12 10:16:22 +01:00
Thomas Haller
0586e9700d wifi: delay release of old wfd_ies array in nm_wifi_p2p_peer_set_wfd_ies()
We should first ref the new instance and emit the notify signal,
before unref the old value. It feels better in this order.
2020-03-12 10:16:22 +01:00
Rafael Fontenelle
e33b200880 po: update Brazilian Portuguese (pt_BR) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/434
2020-03-10 20:29:37 +01:00