Commit graph

26772 commits

Author SHA1 Message Date
Thomas Haller
dc3a477884
all/style: remove duplicate semicolon (";;") in sources 2020-09-23 12:43:47 +02:00
Thomas Haller
20ce16cc7b
license: add Kjartan to RELICENSE.md
https://mail.gnome.org/archives/networkmanager-list/2020-September/msg00008.html
2020-09-23 12:32:56 +02:00
Thomas Haller
b8811d97a4
all: require a semicolon after NM_CACHED_QUARK_FCN() 2020-09-23 10:55:17 +02:00
Antonio Cardace
41147c4d17
clang-format: proposed style 2020-09-23 09:07:10 +02:00
Thomas Haller
bad4065d67
contrib/release: implement "rc1" release mode 2020-09-23 08:58:47 +02:00
Thomas Haller
e8e5c12480
libnm: hide nm_setting_ip_config_next_valid_dns_option() function from headers
nm_setting_ip_config_next_valid_dns_option() API was added in libnm 1.2, but
it was never exported in the ABI of libnm. It thus was unusable, and any user
trying to link against it would have been unable to do so.

Hide the API now entirely. It doesn't seem a very nice API. If we want to
allow the user to validate option names, we should expose such a function
to validate an option (not to fetch the next valid option from a
profile).

Fixes: 019943bb5d ('libnm-core: add dns-options property to NMSettingIPConfig')
2020-09-22 18:04:11 +02:00
Thomas Haller
e8dd19bb01
shared: extend nm_utils_hexstr2bin_full() to require hexdigits in pairs
nm_utils_hexstr2bin_full() is our general hexstr to binary parsing
method. It uses (either mandatory or optional) delimiters. Before,
if delimiters are in use, it would accept individual hexdigits.
E.g. "a:b" would be accepted as "0a:0b:.

Add an argument that prevents accepting such single digits.
2020-09-22 17:40:41 +02:00
letmestudy
798cf37621
po: correct Chinese translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/628
2020-09-21 12:59:21 +02:00
Thomas Haller
f0ec4bb59a
license: add SUSE LLC to RELICENSE.md
This also includes the contributions made by Ximian (bought
by Novell) and by Novell.

https://mail.gnome.org/archives/networkmanager-list/2020-September/msg00000.html
2020-09-18 15:47:04 +02:00
Thomas Haller
86f2ea66f5
l3cfg: merge branch 'th/l3cfg-9'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/626
2020-09-18 15:26:49 +02:00
Thomas Haller
5e84143378
core: assert that nm_dbus_utils_get_property() returns a variant of the expected type
g_dbus_gvalue_to_gvariant() doesn't check/assert that the value has the
right variant signature, if the value is already a GVariant.

Add an assertion.
2020-09-18 15:26:40 +02:00
Thomas Haller
51b7d351fa
core: fix D-Bus type for "org.freedesktop.NetworkManager.Capabilities" property
Fixes: 297d4985ab ('core/dbus: rework D-Bus implementation to use lower layer GDBusConnection API')
2020-09-18 15:26:39 +02:00
Thomas Haller
0a579fd16e
device: return same singleton variant for NM_DEVICE_IP4_ADDRESS property
All our devices will return the same value on D-Bus: a "u" variant with zero value.
Since NMDBusObject caches all the property values, we can share the instance.
2020-09-18 15:26:38 +02:00
Thomas Haller
479de883b3
shared: add m_g_variant_singleton_u_0()
We anyway cache our variants for the properties of NMDBusObject instances.
If such a variant is well known to be always the same, there is no need
to allocate a new instance every time. In particular, because GVariant
is an immutable and ref counted type.

Add a singleton getter for a "u" variant with numeric value 0.
2020-09-18 15:26:37 +02:00
Thomas Haller
72d6062cb0
device: break deprecated "Ip4Address" D-Bus property of Device interface
The "Ip4Address" property of "org.freedesktop.NetworkManager.Device"
interface is deprecated since version 0.9.9.1 (2013). Also, the property
is not exposed by libnm and generally not useful.

Drop the code to maintain it. The property still exists but always
returns 0 (0.0.0.0).
2020-09-18 15:26:21 +02:00
Thomas Haller
535fb95745
l3cd/ndisc: add nm_ndisc_data_to_l3cd() helper
NML3ConfigData is a simple container structure that contains no logic.
Also, DHCP code already is intimately related to NMIP[46]Config (for
now, later that will be NML3ConfigData).

It makes sense that NMNDisc is aware of NML3ConfigData and knows how to
conver the RA data into an l3cd instance.
2020-09-15 18:58:50 +02:00
Thomas Haller
d69b8ecd34
l3cfg: add nm_l3_config_data_clear_searches() API 2020-09-15 18:58:49 +02:00
Thomas Haller
b850cea874
l3cfg: add nm_l3_config_data_{get,set}_ip6_mtu() API 2020-09-15 18:07:24 +02:00
Thomas Haller
9802c89972
l3cfg: add nm_l3_config_data_{get,set}_ndisc_*() API 2020-09-15 17:45:35 +02:00
Thomas Haller
ef26ed3092
l3cfg: fix handling of mtu during nm_l3_config_data_merge()
Fixes: 25d404dadb ('l3cfg: add more API to NML3ConfigData')
2020-09-15 16:06:33 +02:00
Thomas Haller
81d7009956
l3cfg: track ip6_privacy (use_tempaddr) in NML3ConfigData
NMDevice currently configures use_tempaddr sysctl itself. Later,
NML3Cfg should do that, so we need to keep track of that as part
of the configuration.
2020-09-15 16:06:32 +02:00
Thomas Haller
be5f7ab7c9
device/ndisc: explicitly call nm_ndisc_stop() during addrconf6_cleanup() 2020-09-15 15:37:19 +02:00
Thomas Haller
6ce482c526
device/ndisc: add nm_ndisc_stop() method
It is bad style to rely on the last unref of an object for stopping
the operation. With a ref-counted object you should never rely on
anybody else still having (or not having) a reference. Hence, you
should not rely on stopping the ND during the last unref.

Add an explicit nm_ndisc_stop() function.
2020-09-15 15:36:19 +02:00
Thomas Haller
e8eaaa78d1
device/ndisc: let calling code determine the used RA timeout for NMNDisc
Previously, if we passed ra_timeout 0 to NMNDisc, then it would
calculate the effective timeout based on the router-solicitations
and the router-solicitation-interval.

The caller may want to know the used timeout, to also run its own timers
with the same timeout. Hence, it cannot leave this automatism internal
to NMNDisc.
2020-09-15 15:08:03 +02:00
Thomas Haller
f6692367b1
libnm: mark static buffer for nm_utils_inet[46]_ntop() as thread local
I think the convenience feature about omitting the output buffer is
undesirable. Anyway, try to make it safer by using a thread local
buffer.
2020-09-15 15:08:03 +02:00
Thomas Haller
f295e1313a
core: use _nm_utils_inet4_ntop() instead of nm_utils_inet4_ntop()
nm_utils_inet4_ntop() is public API of libnm. Also, it accepts a
%NULL buffer to use a static buffer. That is error prone and we
should not use such convenience behavior for our own code.
2020-09-15 15:08:02 +02:00
Thomas Haller
026389fc1f
supplicant: fix crash in _scan_notify_allowed() when supplicant disconnects
When stopping wpa_supplicant, I got an assertion failure:

  #0  g_logv (log_domain=0x55f8e4a43013 "NetworkManager", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=<optimized out>) at ../glib/gmessages.c:1377
  #1  0x00007f2d33245233 in g_log (log_domain=log_domain@entry=0x55f8e4a43013 "NetworkManager", log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=format@entry=0x7f2d332976ff "%s: assertion '%s' failed") at ../glib/gmessages.c:1415
  #2  0x00007f2d33245a2d in g_return_if_fail_warning (log_domain=log_domain@entry=0x55f8e4a43013 "NetworkManager", pretty_function=pretty_function@entry=0x55f8e4acc1e0 <__func__.14> "nm_supplicant_interface_get_state", expression=expression@entry=0x55f8e4acb450 "NM_IS_SUPPLICANT_INTERFACE (self)") at ../glib/gmessages.c:2771
  #3  0x000055f8e49ab3f2 in nm_supplicant_interface_get_state (self=0x0) at src/supplicant/nm-supplicant-interface.c:2581
  #4  0x00007f2d1f7307a4 in _scan_notify_allowed (self=self@entry=0x55f8e5199cf0 [NMDeviceWifi], do_kickoff=do_kickoff@entry=NM_TERNARY_FALSE) at src/devices/wifi/nm-device-wifi.c:514
  #5  0x00007f2d1f730ed3 in supplicant_iface_state (self=0x55f8e5199cf0 [NMDeviceWifi], new_state=<optimized out>, old_state=NM_SUPPLICANT_INTERFACE_STATE_COMPLETED, disconnect_reason=<optimized out>, is_real_signal=<optimized out>) at src/devices/wifi/nm-device-wifi.c:2492
  #6  0x00007f2d32339af0 in ffi_call_unix64 () at ../src/x86/unix64.S:76
  #7  0x00007f2d323392ab in ffi_call (cif=cif@entry=0x7ffcaf6c3120, fn=fn@entry=0x7f2d1f731920 <supplicant_iface_state_cb>, rvalue=<optimized out>, avalue=avalue@entry=0x7ffcaf6c3050) at ../src/x86/ffi64.c:525
  #12 0x00007f2d3334ac63 in <emit signal ??? on instance 0x55f8e4f49bb0 [NMSupplicantInterface]> (instance=instance@entry=0x55f8e4f49bb0, signal_id=<optimized out>, detail=detail@entry=0) at ../gobject/gsignal.c:3554
      #8  0x00007f2d3333238d in g_cclosure_marshal_generic (closure=closure@entry=0x55f8e521eb10, return_gvalue=return_gvalue@entry=0x0, n_param_values=n_param_values@entry=4, param_values=param_values@entry=0x7ffcaf6c3320, invocation_hint=invocation_hint@entry=0x7ffcaf6c32a0, marshal_data=marshal_data@entry=0x0) at ../gobject/gclosure.c:1500
      #9  0x00007f2d3333188a in g_closure_invoke (closure=0x55f8e521eb10, return_value=return_value@entry=0x0, n_param_values=4, param_values=param_values@entry=0x7ffcaf6c3320, invocation_hint=invocation_hint@entry=0x7ffcaf6c32a0) at ../gobject/gclosure.c:810
      #10 0x00007f2d33344423 in signal_emit_unlocked_R (node=node@entry=0x7f2d200066c0, detail=detail@entry=0, instance=instance@entry=0x55f8e4f49bb0, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7ffcaf6c3320) at ../gobject/gsignal.c:3742
      #11 0x00007f2d3334aaf9 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7ffcaf6c34f0) at ../gobject/gsignal.c:3498
  #13 0x000055f8e49a880b in _emit_signal_state (disconnect_reason=0, old_state=NM_SUPPLICANT_INTERFACE_STATE_COMPLETED, new_state=<optimized out>, self=0x55f8e4f49bb0 [NMSupplicantInterface]) at src/supplicant/nm-supplicant-interface.c:1083
  #14 set_state_down (self=0x55f8e4f49bb0 [NMSupplicantInterface], force_remove_from_supplicant=0, reason=0x55f8e4acd918 "InterfaceRemoved signal from wpa_supplicant") at src/supplicant/nm-supplicant-interface.c:1083
  #15 0x000055f8e49acb0b in _supp_iface_remove_one (self=0x55f8e51990c0 [NMSupplicantManager], supp_iface=0x55f8e4f49bb0 [NMSupplicantInterface], force_remove_from_supplicant=0, reason=0x55f8e4acd918 "InterfaceRemoved signal from wpa_supplicant") at src/supplicant/nm-supplicant-manager.c:1067
  #16 0x000055f8e49accec in _dbus_interface_removed_cb (connection=<optimized out>, sender_name=0x7f2d20038f20 ":1.4741", object_path=<optimized out>, signal_interface_name=<optimized out>, signal_name=<optimized out>, parameters=<optimized out>, user_data=0x55f8e51990c0) at src/supplicant/nm-supplicant-manager.c:902
  #17 0x00007f2d33483c0f in emit_signal_instance_in_idle_cb (data=data@entry=0x7f2d20034750) at ../gio/gdbusconnection.c:3777
  #18 0x00007f2d3323945b in g_idle_dispatch (source=source@entry=0x7f2d20038db0, callback=0x7f2d33483b90 <emit_signal_instance_in_idle_cb>, user_data=0x7f2d20034750) at ../glib/gmain.c:5755
  #19 0x00007f2d3323d78f in g_main_dispatch (context=0x55f8e4ee31e0) at ../glib/gmain.c:3309
  #20 g_main_context_dispatch (context=0x55f8e4ee31e0) at ../glib/gmain.c:3974
  #21 0x00007f2d3323db18 in g_main_context_iterate (context=0x55f8e4ee31e0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4047
  #22 0x00007f2d3323de33 in g_main_loop_run (loop=0x55f8e4ec4d20) at ../glib/gmain.c:4241
  #23 0x000055f8e4755a3b in main (argc=<optimized out>, argv=<optimized out>) at src/main.c:456

Fixes: 7500e90b53 ('wifi: rework scanning of Wi-Fi device')
2020-09-15 15:00:14 +02:00
Sayed Shah
518187e8db platform: add support for mcast_hash_max netlink attribute for bridges
Adding the mcast_hash_max property. The value must be the power of 2.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/624
2020-09-15 13:41:29 +02:00
Thomas Haller
88425e569f
device: merge branch 'th/device-track-shared-ips'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/625
2020-09-15 12:01:52 +02:00
Thomas Haller
3338ea0530
device: track used shared-ips via NMNetns
Note that when NetworkManager tries to allocate more than 256 networks,
then previously the allocation would fail. We no longer fail, but log an
error and reuse the last address (10.42.255.1/24).

It's simpler to have code that cannot fail, because it's often hard to
handle failure properly. Also, if the user would configure two shared
profiles that explicitly use the same subnet, we also wouldn't fail. Why
not? Is that not a problem as well? If it is not, there is no need to
fail in this case. If it is a problem, then it would be much more
important to handle this case otherwise -- since it's more likely to
activate two profiles that accidentally use the same subnet than
activating 257+ shared profiles.
2020-09-14 17:30:59 +02:00
Thomas Haller
3fcfb53c4b
core: add nm_netns_shared_ip_reserve() API
Add a better way of tracking the shared IP addresses that are in use.
This will replace NMDevice's usage of a global hash table. For one, the
API is more formalized with reserve() and release() functions.
Also, it ties the used IP addresses to the netns, which would be more
correct (in the future when we may support more netns).
2020-09-14 17:28:10 +02:00
Thomas Haller
991999489a
contrib/build: reword howto for "release.sh" script 2020-09-14 16:11:54 +02:00
Beniamino Galvani
7f8426538b release: bump version to 1.27.3 (development) 2020-09-14 15:23:59 +02:00
Thomas Haller
d65fdda8df
libnm/doc: improve description for ipv[46].dns-priority and ipv[46].dns-search regarding DNS leaks 2020-09-14 13:09:54 +02:00
Thomas Haller
ebd07a809c
l3cfg: merge branch 'th/l3cfg-8'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/623
2020-09-11 16:21:57 +02:00
Thomas Haller
2535b3a539
device/trivial: move code around 2020-09-11 16:18:44 +02:00
Thomas Haller
3d6fef2d9a
platform: add nm_platform_iter_obj_for_each() macro 2020-09-11 16:18:42 +02:00
Thomas Haller
b6c3211fcc
core: use nm_platform_ip6_address_match() in nm_ip6_config_find_first_address() 2020-09-11 16:18:41 +02:00
Thomas Haller
94fbc7bdba
platform: add nm_platform_ip6_address_match() 2020-09-11 16:18:40 +02:00
Thomas Haller
345aeefaf3
dhcp: drop "event_id" parameter from NM_DHCP_CLIENT_SIGNAL_STATE_CHANGED signal
It is solely computed from the lease information (the GHashTable).
No need to pass it along as separate argument in NM_DHCP_CLIENT_SIGNAL_STATE_CHANGED,
especially since it only applies to IPv6.
2020-09-11 16:18:39 +02:00
Thomas Haller
ee447cbb52
device: mark NMDevicePrivate.sys_iface_state as const
It's important to find place in code where are field (state) gets
mutated. Make sys_iface_state field const, but add a mutable alias
via a union. You can now grep for places that change the field.
2020-09-11 16:18:38 +02:00
Thomas Haller
b6dc2e15d2
device/trivial: unify (rename) functions in "nm-device.c" 2020-09-11 16:18:37 +02:00
Thomas Haller
ed8d7ae264
core: move nm_utils_generate_duid_from_machine_id() to "nm-core-utils.c" 2020-09-11 16:18:36 +02:00
Thomas Haller
b23825f457
l3cfg: add nm_l3cfg_get_combined_l3cd() function 2020-09-11 16:18:36 +02:00
Thomas Haller
d16776b5fd
l3cfg: gracefully accept %NULL argument in nm_l3_config_data_lookup_objs()
This way we can safely iterate over a %NULL instance with
nm_l3_config_data_iter_obj_for_each(). This avoids a NULL check,
which in this case seems more annoying than helpful.
2020-09-11 16:18:35 +02:00
Thomas Haller
6358d10688
l3cfg: add nm_l3cfg_get_best_default_route() function
This is the best default route that we commited the last time (if any).
It may not reflect what is currently configured (in NMPlatform) and it
may not reflect the latest changes since nm_l3cfg_add_config().
2020-09-11 16:18:35 +02:00
Thomas Haller
3b8b683f8a
l3cfg: add nm_l3cfg_get_pllink() helper
NML3Cfg already keeps track of the current NMPlatformLink object.
Allow accessing it directly from an NML3Cfg instance, which saves
a cache lookup from NMPlatform.
2020-09-11 16:18:34 +02:00
Thomas Haller
16e59cc37c
l3cfg: support tracking the DHCP lease in NML3ConfigData 2020-09-11 16:18:34 +02:00
Thomas Haller
2fd53eb509
core: add NMDhcpLease typedef and simple accessor functions 2020-09-11 16:18:34 +02:00
Thomas Haller
348ab39f6d
shared: add nm_utils_hashtable_{equal,cmp}() helper function 2020-09-11 10:45:40 +02:00