Commit graph

18844 commits

Author SHA1 Message Date
Thomas Haller
fda3458201 shared: rework _NM_GET_PRIVATE() to use _Generic()
_NM_GET_PRIVATE() used typeof() to propagate constness of the @self
pointer. However, that means, it could only be used with a self pointer
of the exact type. That means, you explicitly had to cast from (GObject *)
or from (void *).
The requirement is cumbersome, and often led us to either create @self
pointer we didn't need:

    NMDeviceVlan *self = NM_DEVICE_VLAN (device);
    NMDeviceVlanPrivate *priv = NM_DEVICE_VLAN_GET_PRIVATE (self);

or casting:

    NMDeviceVlanPrivate *priv = NM_DEVICE_VLAN_GET_PRIVATE ((NMDevice *) device);

In both cases we forcefully cast the source variable, loosing help from
the compiler to detect a bug.

For "nm-linux-platform.c", instead we commonly have a pointer of type
NMPlatform. Hence, we always forcefully cast the type via _NM_GET_PRIVATE_VOID().

Rework the macro to use _Generic(). If compiler supports _Generic(), then we
will get all compile time checks as desired. If the compiler doesn't support
_Generic(), it will still work. You don't get the compile-time checking of course,
but you'd notice that something is wrong once you build with a suitable
compiler.

(cherry picked from commit b1810d7a68)
2017-11-13 14:37:21 +01:00
Thomas Haller
3c830ce5cf core: replace nm_dns_ip_config_data_get_dns_priority()
Add instead nm_ip_config_get_dns_priority(). If we want to treat NMIP4Config/NMIP6Config
generically, then the accessor should be right there.

(cherry picked from commit 6246364747)
2017-11-13 14:37:11 +01:00
Thomas Haller
a80b8a696e core: add generic opaque NMIPConfig type
One day, I hope to merge NMIP4Config and NMIP6Config implementations.
A small step, and a typesafe cast-macro.

(cherry picked from commit 10d38a950d)
2017-11-13 14:37:07 +01:00
Thomas Haller
dd4e8ef9dc policy: merge IPv4 and IPv6 implementation of update_ip_dns()
(cherry picked from commit 157932f7dd)
2017-11-13 14:37:03 +01:00
Thomas Haller
dbe2f20aba merge: core: fix build without connectivity check 2017-11-13 14:17:47 +01:00
Thomas Haller
ddc889ff6b release: bump version to 1.10.1 (development) 2017-11-13 13:58:18 +01:00
Beniamino Galvani
9b72cdb862 core: fix build without connectivity check
Fixes: 4dd30b784c

https://bugzilla.gnome.org/show_bug.cgi?id=790222
(cherry picked from commit a33baf8bf7)
2017-11-13 11:03:22 +01:00
Beniamino Galvani
1193fb1b08 release: bump version to 1.10.0 2017-11-10 16:15:23 +01:00
Beniamino Galvani
4fce1b90bf release: update NEWS 2017-11-10 16:15:23 +01:00
Beniamino Galvani
cc6c140f5e po: make update-po 2017-11-10 16:15:22 +01:00
Beniamino Galvani
6dc6b0f3d8 device: silent compiler warning
Fix the following warning:

 src/devices/nm-device.c: In function ‘activation_source_schedule’:
 src/devices/nm-device.c:4995:9: error: ‘source_func’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   new_id = g_idle_add (source_func, self);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(cherry picked from commit bdfa7d882e)
2017-11-10 16:15:22 +01:00
Beniamino Galvani
f8266cfde9 ofono: merge branch 'th/ofono-ip-config-fix'
Fixes for oFono support.
(cherry picked from commit f2ebf6dfef)
2017-11-10 15:25:29 +01:00
Thomas Haller
ef0977b7f0 ofono: refactor error handling in context_property_changed()
(cherry picked from commit 6781fad88f)
2017-11-10 15:22:32 +01:00
Thomas Haller
43987d8a60 ofono: fix creating IP config with proper ifindex of Interface
This was broken with the routing-rework. We need to determine
the ifindex on which the configuration applies.

(cherry picked from commit 52f0800987)
2017-11-10 15:22:31 +01:00
Thomas Haller
06e2d355f6 ofono: refactor error handling for missing Interface in context_property_changed()
(cherry picked from commit 481c15e287)
2017-11-10 15:22:30 +01:00
Thomas Haller
abbb62a813 ofono: fix leaks in context_property_changed()
(cherry picked from commit 99013e020b)
2017-11-10 15:22:28 +01:00
Beniamino Galvani
e4e6ed5b0a device: don't necessarily fail the connection when ipv4 DAD fails
Don't necessarily fail the entire connection if a duplicate IPv4
address is detected, but instead look at the may-fail property and at
the outcome of IPv6.

https://bugzilla.redhat.com/show_bug.cgi?id=1508001
(cherry picked from commit 14ad1d0cd1)
2017-11-09 22:30:27 +01:00
Beniamino Galvani
e25d6ad0d3 checkpoint: don't include unrealized devices
Don't include unrealized devices in checkpoint because, as the name
says, they are not real.

While at it, remove nm_manager_get_device_paths() as it is no longer
used.

(cherry picked from commit 974f21eca3)
2017-11-09 10:33:26 +01:00
Beniamino Galvani
de5de2d4ee checkpoint: specify path of already existing checkpoint on error
(cherry picked from commit 66d048023c)
2017-11-09 10:33:20 +01:00
Beniamino Galvani
cba9614298 libnm: don't invert order in array properties
The order of elements in array properties was inverted when
reconstructing the array. Keep the original order from D-Bus.

(cherry picked from commit c90118ff60)
2017-11-09 10:33:18 +01:00
Thomas Haller
0a0b417882 core: merge branch 'th/autoconnect-rh1401515-3'
https://bugzilla.redhat.com/show_bug.cgi?id=1401515

(cherry picked from commit 0e4405e924)
2017-11-08 12:35:38 +01:00
Thomas Haller
8f131e4e18 policy: don't block autoconnect for connections when disconnecting software devices
This was added by commit 979b8920b4
(core: move virtual device autoconnect tracking bits out of NMManager)
to avoid autoconnecting software devices repeatedly. That was done,
because disconnecting a software device would delete the NMDevice
instance, and there is no property on a device to prevent autoconnect.

In the meantime, we only unrealize software devices and don't delete
them entirely. Also, the autoconnect-blocked flags of the device are
preserved when the device unrealized.

It was anyway odd, that deactivating one software-device would block
autoconnection for all matching connections.

(cherry picked from commit 146fbfab33)
2017-11-08 12:35:10 +01:00
Thomas Haller
186d9de66a device: improve tracking autoconnect-blocked flags of NMDevice
- split NM_DEVICE_AUTOCONNECT_BLOCKED_INTERN in two parts:
  "wrong-pin" and "manual-disconnect". Setting/unsetting them
  should be tracked differently, as their reason differs.

- no longer initialize/clear the autoconnect-blocked reasons
  during realize/unrealize of the device. Instead, initialize
  it once when the object gets created (nm_device_init()), and
  keep the settings beyond unrealize/realize cycles. This only
  matters for software devices, as regular devices get deleted
  after unrealizing once. But for software devices it is essential,
  because we don't want to forget the autoconnect settings of
  the device instance.

- drop verbose logging about blocking autoconnect due to failed
  pin. We already log changes to autoconnect-blocked flags with
  TRACE level. An additional message about this particular issue
  seems not necessary at INFO level.

- in NMManager's do_sleep_wake(), no longer block autoconnect
  for devices during sleep. We already unmanage the device, which
  is a far more effective measure to prevent activation. We should
  not also block autoconnect.

(cherry picked from commit 3c2b9485a7)
2017-11-08 12:35:10 +01:00
Thomas Haller
f0731dc716 device: refactor autoconnect blocking by introducing NMDeviceAutoconnectBlockedFlags enum
The flags allow for more then two reasons. Currently the only reasons
for allowing or disallowing autoconnect are "user" and "intern".

It's a bit odd, that NMDeviceAutoconnectBlockedFlags has a negative
meaning. So
  nm_device_set_autoconnect_intern (device, FALSE);
gets replaced by
  nm_device_set_autoconnect_blocked_set (device, NM_DEVICE_AUTOCONNECT_BLOCKED_INTERN);
and so on.

However, it's chosen this way, because autoconnect shall be allowed,
unless any blocked-reason is set. That is, to check whether autoconnect
is allowed, we do
  if (!nm_device_get_autoconnect_blocked (device, NM_DEVICE_AUTOCONNECT_BLOCKED_ALL))
The alternative check would be
  if (nm_device_get_autoconnect_allowed (device, NM_DEVICE_AUTOCONNECT_ALLOWED_ALL) == NM_DEVICE_AUTOCONNECT_ALLOWED_ALL)
which seems odd too.

So, add the inverse flags to block autoconnect.

Beside refactoring and inverting the meaning of the autoconnect
settings, there is no change in behavior.

(cherry picked from commit 5279ab5be6)
2017-11-08 12:35:10 +01:00
Thomas Haller
f7e72d9d70 policy: don't check autoconnect flag of connection in nm_device_can_auto_connect()
nm_device_can_auto_connect() only has one caller, auto_activate_device()
in NMPolicy.

That caller already checks whether the connection has autoconnect
enabled, so drop the duplicate check.

This saves some duplication, but it also makes some sense:
NMSettingsConnection has a complex blocking of autoconnect,
so just looking at connection.autoconnect is not enough in
any case to determine whether the connection should autoconnect.
We move thus more handling of autoconnect to NMPolicy, where
it belongs.

(cherry picked from commit 6fff832fe3)
2017-11-08 12:35:10 +01:00
Thomas Haller
bb0536fc00 policy: refactor auto_activate_device() to return early
(cherry picked from commit a7ef46eaaa)
2017-11-08 12:35:10 +01:00
Thomas Haller
baa0d95c95 policy: optimize nm_device_can_auto_connect() to not check nm_device_autoconnect_allowed()
(cherry picked from commit bfe66fb8f4)
2017-11-08 12:35:10 +01:00
Thomas Haller
f77b48a59a device: minor refactoring of condition in nm_device_autoconnect_allowed()
Makes it clearer what is happening (to me).

(cherry picked from commit 45da11f370)
2017-11-08 12:35:10 +01:00
Thomas Haller
816adbe89c device/olpc-mesh: reject autoconnect requests early via get_autoconnect_allowed()
OLPC devices cannot autoconnect, according to can_auto_connect().
We should instead reject any attempt to autoconnect earlier, via
get_autoconnect_allowed().

(cherry picked from commit 7074b88a6a)
2017-11-08 12:35:10 +01:00
Thomas Haller
1433682c28 device: inline NMDevice's implementation of can_auto_connect()
Derived classes should not modify or overwrite this essential behavior
of can_auto_connect(). It doesn't belong to the virtual function.

(cherry picked from commit 715aebe08a)
2017-11-08 12:35:10 +01:00
Thomas Haller
d8bb62c909 policy: remove redundant check in device_autoconnect_changed()
schedule_activate_check() also checks for nm_device_autoconnect_allowed()
and aborts if there is nothing to do.

(cherry picked from commit 990af413ac)
2017-11-08 12:35:10 +01:00
Thomas Haller
d0f82352ea device: move nm_device_get_enabled() from schedule_activate_check() to nm_device_autoconnect_allowed()
(cherry picked from commit fc18ff30cf)
2017-11-08 12:35:09 +01:00
Thomas Haller
b49c6fb98a device: drop stub implementation of get_autoconnect_allowed() in NMDevice
(cherry picked from commit 9a7e668dbb)
2017-11-08 12:35:09 +01:00
Josef Andersson
1729255940 po: update Swedish (sv) translation (bgo #790018)
Reviewed-by: Anders Jonsson <anders.jonsson@norsjovallen.se>

https://bugzilla.gnome.org/show_bug.cgi?id=790018
(cherry picked from commit 80687ed0ce)
2017-11-07 19:27:29 +01:00
Beniamino Galvani
293710434d ifcfg-rh: persist the connection type for TeamPort connections
Currently the ifcfg-rh plugin doesn't explicitly store the connection
type for team slaves and is only able to read back ethernet and vlan
connections.

Leave this unchanged for ethernet and vlan slaves, but store the TYPE
variable for other connection types (Wi-Fi and Infiniband) so that we
can properly determine their type when the connection is read.

(cherry picked from commit 29a576496e)
2017-11-06 16:46:22 +01:00
Piotr Drąg
e8a7d1500a po: update Polish (pl) translation (bgo #789874)
https://bugzilla.gnome.org/show_bug.cgi?id=789874
(cherry picked from commit b7b052c41e)
2017-11-06 12:29:24 +01:00
Thomas Haller
e2e4cdd2c1 doc: fix type on documentation for NMSettingOvsPort:bond-updelay
Fixes: 8a1ae40a80

https://bugzilla.gnome.org/show_bug.cgi?id=789880
(cherry picked from commit 5986d92053)
2017-11-06 12:27:21 +01:00
Thomas Haller
45fc95f051 logging: configure dnsmasq's logging in shared mode via nm-logging
(cherry picked from commit cc993aa020)
2017-11-06 12:25:23 +01:00
Thomas Haller
90d8e26159 man: document PROXY logging domain
(cherry picked from commit 43da186ec3)
2017-11-06 12:25:23 +01:00
Beniamino Galvani
de6b348bfc release: bump version to 1.9.90 (1.10-rc1) 2017-11-03 15:46:53 +01:00
Beniamino Galvani
affeeb5a23 NEWS: update for a release candidate 2017-11-03 15:46:02 +01:00
Beniamino Galvani
db41380c15 ndisc: fix ordering of gateways
Insert the new gateway at the end when it has the least preference.

Fixes the following runtime error:
 src/ndisc/nm-ndisc.c:204:_ASSERT_data_gateways: assertion failed:
 (_preference_to_priority (item_prev->preference) >=
 _preference_to_priority (item->preference))
2017-11-03 10:44:48 +01:00
Beniamino Galvani
4a9ec4d39b clients: merge branch 'bg/cli-agent-race-rh1438476'
https://bugzilla.redhat.com/show_bug.cgi?id=1438476
2017-11-02 15:26:07 +01:00
Beniamino Galvani
61b666902b cli: enable secret-agent only after activation
Change the activation procedure for connections that require secrets
in the following way:

 - nmcli creates a secret-agent and leaves it disabled so that
   incoming requests are queued
 - nmcli calls ActivateConnection()
 - when the method returns success, the secret-agent gets enabled and
   all queued requests are processed

When the user activates a connection which is already auto-activating,
NM will deactivate the current active-connection and will call
CancelGetSecrets() for it before the new ActivateConnection()
returns. In this way, when the secret-agent is enabled by nmcli, we
have the guarantee that there aren't any queued requests for
the deactivating connections.

https://bugzilla.redhat.com/show_bug.cgi?id=1438476
2017-11-02 15:25:59 +01:00
Beniamino Galvani
a25db64f7c clients: implement CancelGetSecrets() secret-agent API 2017-11-02 15:25:59 +01:00
Thomas Haller
28b97f02f6 systemd: let "NetworkManager-wait-online.service" require "NetworkManager.service"
`systemctl start network-online.target` should suffice to start
"NetworkManager.service".

That would work because
 - "network-online.target" has "Wants=NetworkManager-wait-online.service"
 - "NetworkManager-wait-online.service" has "Require=NetworkManager.service".

But previously, "NetworkManager-wait-online.service" would just
fail with missing dependency.

See also https://github.com/systemd/systemd/pull/6065 which does the
same for networkd's wait-online serice, and see rh#1452866 for a
use-case.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1452866
2017-11-02 15:21:42 +01:00
Beniamino Galvani
efe815737b contrib/rpm: fix builds without ovs support
Don't compile ovs support when the RPM is built --without=ovs, to fix
the following error:

error: Installed (but unpackaged) file(s) found:
   /usr/lib/systemd/system/NetworkManager.service.d/NetworkManager-ovs.conf
   /usr/lib64/NetworkManager/libnm-device-plugin-ovs.so
   /usr/share/man/man7/nm-openvswitch.7.gz

Fixes: 830a5a14cb
2017-11-02 11:54:18 +01:00
Thomas Haller
eed8ea458b all: merge branch 'th/autoconnect-rh1401515-2'
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1401515
2017-11-02 11:42:57 +01:00
Thomas Haller
72756994d4 wifi: use connection.auth-retries to handle authentication in NMDeviceWifi 2017-11-02 11:41:01 +01:00
Thomas Haller
32acaccf2a device: move tracking auth_retry to NMDevice
It will be also used by NMDeviceWifi. It might waste a 4 bytes for device types
that don't require authentication. But it deduplicates code.
2017-11-02 11:41:01 +01:00