Commit graph

25022 commits

Author SHA1 Message Date
Thomas Haller 5af17d80f3 session-monitor: don't use GIOChannel to watch plain file descriptor 2020-01-13 15:46:04 +01:00
Thomas Haller cc1822d783 lndp: don't use GIOChannel to watch plain file descriptor for socket 2020-01-13 15:46:04 +01:00
Thomas Haller 7848c165a1 platform: don't use GIOChannel to watch plain file descriptor for netlink socket 2020-01-13 15:46:04 +01:00
Thomas Haller e832c478b0 acd: don't use GIOChannel to watch plain file descriptor for event fd 2020-01-13 15:46:04 +01:00
Thomas Haller 4b46e3a5fa dhcp/nettools: don't use GIOChannel to watch plain file descriptor for event fd 2020-01-13 15:46:04 +01:00
Thomas Haller e4ab27722a bluez: don't use GIOChannel to watch plain file descriptor for rfcomm 2020-01-13 15:46:04 +01:00
Thomas Haller c15411d7c9 bluez: don't use GIOChannel to watch plain file descriptor
Also, don't track the GSource via the guint ID but the full
GSource pointer.
2020-01-13 15:46:04 +01:00
Thomas Haller cccfeb3891 cli: don't use GIOChannel to watch plain file descriptor for nmc_readline_helper() 2020-01-13 15:46:04 +01:00
Thomas Haller 9cc6d3a26d tui: don't use GIOChannel to watch plain file descriptor for key press 2020-01-13 15:46:04 +01:00
Thomas Haller a3b29b06dc shared/udev: don't use GIOChannel to watch plain file descriptor 2020-01-13 15:46:04 +01:00
Thomas Haller e90c1de868 all: use nm_g_unix_fd_source_new() instead of g_unix_fd_source_new()
Its source-func argument has the right signature. Otherwise, this is an
easy to make mistake.
2020-01-13 15:46:04 +01:00
Thomas Haller 421256073b shared: add nm_g_unix_fd_source_new() helper 2020-01-13 15:46:04 +01:00
Thomas Haller 4972ba0957 platform: use NM_MAKE_STRV() in NMLinuxPlatform:constucted() 2020-01-13 15:46:04 +01:00
Thomas Haller 78c4bc58c7 shared: use G_SOURCE_FUNC() macro in "shared/nm-test-utils-impl.c" 2020-01-13 15:46:04 +01:00
Thomas Haller 38323216f5 tui: fix signature for nmt_newt_form_keypress_callback() callback
Fixes: 3bda3fb60c ('nmtui: initial import of nmtui')
2020-01-13 15:46:04 +01:00
Thomas Haller d63cd26e60 shared: improve nm_free_secret() to clear entire memory buffer
The purpose is to clear the entire available buffer, not only
up to the first '\0'. This is done, because otherwise we might
leak sensitive data that happens to be after the first '\0',
or we might give away the length of the secrets.

Of course, those are very (very) minor concerns. But avoiding them is
easy enough.
2020-01-09 17:45:01 +01:00
Yuri Chornoivan 1c7ea45aaa po: update Ukrainian (uk) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/388
2020-01-09 14:09:20 +01:00
Thomas Haller e1a76a201a license: add Beniamino Galvani to RELICENSE.md
https://mail.gnome.org/archives/networkmanager-list/2020-January/msg00011.html
2020-01-09 14:07:46 +01:00
Beniamino Galvani 3a9b069c41 n-dhcp4: use C_CLAMP() macro instead of c_clamp()
The latter requires __auto_type which is not available in GCC versions
older than 4.9. Fix the following compile error on RHEL 7.8:

 CC       src/src_libNetworkManagerBase_la-NetworkManagerUtils.lo
 shared/n-dhcp4/src/n-dhcp4-c-probe.c: In function 'n_dhcp4_client_probe_transition_nak':
 shared/n-dhcp4/src/n-dhcp4-c-probe.c:1008:17: error: unknown type name '__auto_type'
                  probe->ns_nak_restart_delay = c_clamp(probe->ns_nak_restart_delay * 2,
                  ^
 shared/n-dhcp4/src/n-dhcp4-c-probe.c:1008:17: error: unknown type name '__auto_type'
 shared/n-dhcp4/src/n-dhcp4-c-probe.c:1008:17: error: unknown type name '__auto_type'

Fixes: 218782a9a3 ('n-dhcp4: restart the transaction after a NAK')
2020-01-09 13:19:54 +01:00
Thomas Haller d9451fcc0b license: add RELICENSE.md file to track consent/disapproval for relicensing under LGPL-2.1+ 2020-01-09 11:34:55 +01:00
Thomas Haller 5fc1b1a681 platform,device: merge branch 'th/device-ip-tunnel-mac'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/377
2020-01-09 10:42:45 +01:00
Thomas Haller a90397b963 core: set MAC address for IP tunnels when creating device
There is however a serious issue currently: when NetworkManager creates
virtual devices, it starts from an unrealized NMDevice, creates the
netdev device, realizes the device, and transitions through states
UNMANAGED and DISCONNECTED. Thereby, the state of NMDevice gets cleared
again. That means, if the profile has "connection.stable-id=${RANDOM}"
and "ethernet.cloned-mac-address=stable", then we will first set a
random MAC address when creating the device. Then, the NMDevice
transitions through UNMANAGED state, forgets the MAC address it
generated and creates a new MAC address in stage 1. This should be
fixed by better handling unrealized devices. It also affects all
software devices that set the MAC address upon creation of the
interfaces (as they all should).
2020-01-09 10:42:32 +01:00
Thomas Haller 81d83b9e00 platform: support setting MAC address during nm_platform_link_gre_add()
We should set the MAC address of devices early on, and not later.
2020-01-09 10:42:32 +01:00
Thomas Haller cb4093fc8f platform: drop NMPlatformLnkMacvtap typedef
In several cases, the layer 2 and layer 3 type are very similar, also from
kernel's point of view. For example, "gre"/"gretap" and "ip6tnl"/"ip6gre"/"ip6gretap"
and "macvlan"/"macvtap".

While it makes sense that these have different NMLinkType types
(NM_LINK_TYPE_MACV{LAN,TAP}) and different NMPObject types
(NMPObjectLnkMacv{lan,tap}), it makes less sense that they have
different NMPlatformLnk* structs.

Remove the NMPlatformLnkMacvtap typedef. A typedef does not make things simpler,
but is rather confusing. Because several API that we would usually have, does
not exist for the typedef (e.g. there is no nm_platform_lnk_macvtap_to_string()).

Note that we also don't have such a typedef for NMPlatformLnkIp6Tnl
and NMPlatformLnkGre, which has the same ambiguity between the link type
and the struct with the data.
2020-01-09 10:42:32 +01:00
Thomas Haller f30ae56608 platform: implement link_macvlan_add via nm_platform_link_add() 2020-01-09 10:42:32 +01:00
Thomas Haller 1ffdca6331 platform: implement link_macsec_add via nm_platform_link_add() 2020-01-09 10:42:32 +01:00
Thomas Haller 14b5627633 platform: implement link_ipip_add via nm_platform_link_add() 2020-01-09 10:42:32 +01:00
Thomas Haller 16fd8ddf95 platform: implement link_ip6gre_add via nm_platform_link_add() 2020-01-09 10:42:31 +01:00
Thomas Haller bfd74974dc platform: implement link_ip6tnl_add via nm_platform_link_add() 2020-01-09 10:42:31 +01:00
Thomas Haller 8b417300ca platform: implement link_6lowpan_add via nm_platform_link_add() 2020-01-09 10:42:31 +01:00
Thomas Haller d3963e4ac7 platform: implement link_vxlan_add via nm_platform_link_add() 2020-01-09 10:42:31 +01:00
Thomas Haller 62b9d8ee33 platform: implement link_vlan_add via nm_platform_link_add() 2020-01-09 10:42:31 +01:00
Thomas Haller 4029f9cd2e platform: implement link_sit_add via nm_platform_link_add() 2020-01-09 10:42:31 +01:00
Thomas Haller 385764398e platform: implement link_gre_add via nm_platform_link_add() 2020-01-09 10:42:31 +01:00
Thomas Haller 792118558c platform: add parent argument to nm_platform_link_add()
This is to set the IFLA_LINK parameter.
2020-01-09 10:42:31 +01:00
Thomas Haller 9763d9f8a9 platform: move special link-add functions to header
These are thin abstractions over nm_platform_link_add(). Move them to
the header.
2020-01-09 10:42:31 +01:00
Thomas Haller 4a743aba65 platform: extend nm_platform_link_add() to accept type specific extra parameter
This will be used to unify all link-add implementation.
2020-01-09 10:42:31 +01:00
Thomas Haller 6e8653eb5b platform: log name of link that gets added by nm_platform_link_add() 2020-01-09 10:42:31 +01:00
Thomas Haller 6ccd88a286 device: avoid assertion failure when setting MAC address of unexpected address length
IP tunnels honor ethernet.cloned-mac-address. That is a MAC address of 6 bytes (ETH_ALEN).
Note that for example for gre tunnels, kernel exposes an address 00:00:00:00. Hence, trying
to set ethernet.cloned-mac-address with an gre tunnel leads to an assertion failure.

Instead, report and log a regular error.
2020-01-09 10:42:31 +01:00
Beniamino Galvani 7129e669c0 dhcp: merge branch 'bg/nettools-fixes-pt2'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/387
2020-01-09 09:43:37 +01:00
Beniamino Galvani 2523000b36 dhcp: nettools: handle 'retracted' event as 'expired'
The 'retracted' event is emitted when the client receives a NAK in the
rebooting, requesting, renewing or rebinding state, while 'expired'
means that the client wasn't able to renew the lease before expiry.

In both cases the old lease is no longer valid and n-dhcp4 keep trying
to get a lease, so the two events should be handlded in the same way.

Note that the systemd client doesn't have a 'retracted' event and
considers all NAKs as 'expired' events.
2020-01-09 09:04:08 +01:00
Beniamino Galvani 218782a9a3 n-dhcp4: restart the transaction after a NAK
It is not enough to set the INIT state after a NAK; a timeout
(ns_deferred) must be set so that it is added to the event fd. The
client retries immediately the first time, so that in the successful
case it gets an address quickly. To avoid flooding the network in case
of servers always replying with NAKs, next attempts are done with
intervals from 2 seconds to 5 minutes using exponential backoff. See
also systemd commit [1].

[1] 1d1a3e0afb

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/325
2020-01-09 09:04:08 +01:00
Beniamino Galvani 4bcdc3c1eb n-dhcp4: allow calling listen() on already listening connection
When the client enters the INIT state, it calls listen() on the
connection connection to create the packet socket. However, if the
client is coming from the REBOOTING state after a NAK, the connection
is already in the listening state; do nothing in such case.
2020-01-09 09:04:08 +01:00
Thomas Haller 900af25263 client: add nm_client_get_object_by_path() and nm_object_get_client() API
When iterating the GMainContext of the NMClient instance, D-Bus events
get processed. That means, every time you iterate the context (or "return to
the main loop"), the content of the cache might change completely.

It makes sense to keep a reference to an NMObject instance, do something,
and afterwards check whether the instance can still be found in the cache.

Add an API for that. nm_object_get_client() allows to know whether the
object is still cached.

Likewise, while NMClient abstracts D-Bus, it should still provide a way
to look up an NMObject by D-Bus path. Add nm_client_get_object_by_path()
for that.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/384
2020-01-08 18:33:10 +01:00
Thomas Haller 5080dfa46f wifi: merge branch 'th/ssids-options-to-ptrarray'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/385
2020-01-08 12:14:51 +01:00
Thomas Haller e6d256fe81 device/wifi: cleanup ssids_options_to_ptrarray()
- use proper gsize type to hold g_variant_n_children()

- use cleanup attribute for GPtrArray

- move variables inside nested scope where they are used
2020-01-08 11:23:24 +01:00
Thomas Haller 023dc9646c wifi/tests: add test for ssids_options_to_ptrarray() 2020-01-08 11:23:24 +01:00
Thomas Haller 7d8da6c9c1 build: build intermediate library with core wifi for device-plugin and tests
Don't build the same sources multiple times. The test code should
statically link against the tested code, just like the device plugin
that uses the code in production.
2020-01-08 11:23:24 +01:00
Thomas Haller 5ed1edc02a device/wifi: fix memleak parsing SSID arguments for "RequestScan"
Oddly enough, valgrind was not complaining about this leak...

Fixes: 87b2d783b6 ('core: accept 'ssids':aay option in RequestScan() dictionary parameter')
2020-01-08 10:29:04 +01:00
Thomas Haller 6da9e06508 libnm: merge branch 'th/utils-security-valid'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/382
2020-01-08 10:14:15 +01:00