Commit graph

23230 commits

Author SHA1 Message Date
Beniamino Galvani
b3ec3fa5ab
manager: fix race condition when resuming from sleep
If the device state change (to disconnected or unmanaged) triggered by
a sleep event happens after the wake, the devices becomes wrongly
unmanaged and it's necessary to manually manage it again, or restart
NM.

During the wake event we should disconnect the device_sleep_cb()
callback for all devices because we don't want to react to state
changes anymore; in particular we don't need to detect when the device
becomes disconnected to unmanage it.

(cherry picked from commit fe2d93980b)
(cherry picked from commit 971897195a)
(cherry picked from commit 7913275b02)
(cherry picked from commit 6d0e8a2acf)
(cherry picked from commit 61c44dad91)
2020-08-17 20:11:15 +02:00
Beniamino Galvani
03b9634519
device: restart DHCP only for devices that are active or activating
do_sleep_wake() tries to restart DHCP for all devices, even ones that
are disconnecting. When a device is disconnecting, it still has a DHCP
client instance but we shouldn't restart it because it makes no sense;
and especially, the device could be already removed.

https://bugzilla.redhat.com/show_bug.cgi?id=1852612
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/561
(cherry picked from commit 2c50438987)
(cherry picked from commit 5321490180)
(cherry picked from commit ef755588ad)
(cherry picked from commit da54b35af3)
(cherry picked from commit b0be1285cc)
2020-08-17 20:11:02 +02:00
Beniamino Galvani
4c8edaedc7
ovs: ignore failures of patch interfaces
When there are two patch ports connected, each of them must reference
the other; however they can't be created in a single transaction
because they are part of different bridges (so, different
connections). Therefore, the first patch that gets activated will
always fail with "No usable peer $x exists in 'system' datapath" until
the second patch exists.

In theory we could also match the error message, however this doesn't
seem very robust as the message may slightly change in the future.

(cherry picked from commit ffeac35f04)
(cherry picked from commit 75cbf21738)
(cherry picked from commit 399aad15bf)
(cherry picked from commit 692689ead8)
2020-08-17 20:11:02 +02:00
Beniamino Galvani
b2d5976950
ovsdb: retry calls in case of communication error with server
When the server is restarted the write to unix socket fails with
EPIPE. In such case, don't fail all the calls in queue; instead, after
a sync of the ovsdb state (through a monitor call), start processing
the queue again, including the call that previously failed.

Add a retry counter to avoid that calls are stuck in the queue forever
in a hypothetical scenario in which the write always fails.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/459
(cherry picked from commit db37e530e8)
(cherry picked from commit 54254bf6fe)
(cherry picked from commit 166ad887f9)
2020-08-17 20:11:02 +02:00
Beniamino Galvani
fee0dfc764
ovs: merge branch 'bg/ovs-interface-mtu-rh1808124'
https://bugzilla.redhat.com/show_bug.cgi?id=1807726
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/433
(cherry picked from commit 2da77547ba)

(cherry picked from commit f0b7cb60dd)

(cherry picked from commit e62afcf0bd)
2020-08-17 20:10:40 +02:00
Beniamino Galvani
04264be151
ovs: set the MTU in ovsdb when changing platform MTU of ovs-interface
If we change the the MTU of an ovs interface only through netlink, the
change could be overridden by ovs-vswitchd at any time when other
interfaces change. Set the MTU also in the ovsdb to prevent such
changes.

Note that if the MTU comes from the connection, we already set the
ovsdb MTU at creation time and so this other update becomes
useless. But it is needed when changing the MTU at runtime (reapply)
or when the MTU comes from a different source (e.g. DHCP).

(cherry picked from commit c2a9712945)
(cherry picked from commit e27a59c69e)
(cherry picked from commit 99ef891db6)
2020-08-17 20:10:40 +02:00
Beniamino Galvani
59787018c9
ovs: set MTU from connection when creating an internal interface
The ovs-vswitchd.conf.db(5) man page says about the the mtu_request
column in the Interface table:

  "Requested MTU (Maximum Transmission Unit) for the interface. A
   client can fill this column to change the MTU of an
   interface [...] If this is not set and if the interface has
   internal type, Open vSwitch will change the MTU to match the
   minimum of the other interfaces in the bridge."

Therefore, if the connection specifies a MTU, set it early when adding
the interface to the ovsdb so that it will not be changed to the
minimum of other interfaces.

(cherry picked from commit ad12f26312)
(cherry picked from commit 7311d5e294)
(cherry picked from commit b81370f70b)
2020-08-17 20:10:40 +02:00
Beniamino Galvani
021141481e
ovs/ovsdb: support changing the MTU of an ovs interface
Introduce a nm_ovsdb_set_interface_mtu() function to update the MTU of
an ovs interface in the ovsdb.

(cherry picked from commit a4c2c1a843)
(cherry picked from commit c1be15a66e)
(cherry picked from commit 990f46505d)
2020-08-17 20:10:39 +02:00
Beniamino Galvani
a85c231b0c
ovs: merge branch 'bg/ovs-deactivate-async-pt2'
https://bugzilla.redhat.com/show_bug.cgi?id=1787989
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/412
(cherry picked from commit e24fd88494)

(cherry picked from commit 53b878818c)

(cherry picked from commit 505aab90e0)
2020-08-17 20:10:28 +02:00
Beniamino Galvani
b22a20880e
ovs: discard link updates when deactivating
When the ovs interface gets deactivated, it is released from the
master port and we call nm_device_update_from_platform_link (dev,
NULL) to ignore any later event for the interface. This is important
especially because it sets a zero ifindex on the interface and so,
later when the link disappears, we don't unmanage the device but
directly remove it.

However, since ovs commands are queued, the link could appear during
the deactivation and we need to ignore such events. Add a new device
method can_update_from_platform_link() for such purpose.

(cherry picked from commit e9fc1dea43)
(cherry picked from commit c4eb0c6852)
(cherry picked from commit 34a9247a64)
2020-08-17 20:10:27 +02:00
Beniamino Galvani
296d4e3926
ovs: rework asynchronous deactivation of ovs interfaces
Tracking the deletion of link by ifindex is difficult because the
ifindex of the device is updated through delayed (idle) calls in
NMDevice and so there is the possibility that at a certain time the
device ifindex is not in sync with platform state. It seems simpler to
watch instead the interface name. The ugly thing is that the interface
name can be changed externally, but if users do that on an activating
device they are looking for trouble.

Also change the deactivate code to deal with the scenario where we
already created the interface in the ovsdb but the link didn't show up
yet. To ensure a proper cleanup we must wait that the link appears and
then goes away; however the link may never appear if vswitchd sees
only the last state in ovsdb, and so we must use a ugly timeout to
avoid waiting forever.

https://bugzilla.redhat.com/show_bug.cgi?id=1787989
(cherry picked from commit 9c49f8a879)
(cherry picked from commit 2e5e409bf2)
(cherry picked from commit 628706fab5)
2020-08-17 20:10:27 +02:00
Beniamino Galvani
b0aad945b4
ovs: wait that link disappears before continuing with deactivation
When we deactivate a virtual device, we usually schedule the deletion
of the link in an idle handler. That action will be executed at a
later time when the device is already in the disconnected state.

Similarly, for ovs interfaces we send the deletion command to the
ovsdb and then proceed to the disconnected state.

However, in the first case there is the guarantee that the link will
be deleted at some point, while for ovs interfaces it may happen that
ovs decides to reuse the same link if there is an addition
queued. Since reusing the same link confuses NM, let's implement
deactivate_async() for ovs-interfaces and wait that the link actually
goes away before proceeding.

https://bugzilla.redhat.com/show_bug.cgi?id=1782701
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/402
(cherry picked from commit 623a1e1f99)
(cherry picked from commit a1b0edd24b)
(cherry picked from commit cb7c7c29bd)
2020-08-17 20:10:17 +02:00
Lubomir Rintel
c68d401df4
merge: branch 'lr/ovs-failures'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/182

(cherry picked from commit d0f0d778f3)
2020-08-17 20:09:58 +02:00
Lubomir Rintel
ba2c71a01d
ovs/factory: fail the NMDevice if there's an error in OVSDB
(cherry picked from commit 02950ec600)
2020-08-17 20:09:58 +02:00
Lubomir Rintel
83a42ef8ad
ovs/ovsdb: track the devices before we signal addition
This doesn't make any difference in practice, but it seems more correct.
It would cause issues if we decided to remove an interface from the
signal handler.

(cherry picked from commit e948ce7deb)
2020-08-17 20:09:58 +02:00
Lubomir Rintel
cb19680d34
ovs/ovsdb: signal a failure when an error column is set
When an interface (other OVS device types can not fail)  encounters an error
it indicates it by changing the error column. Watch for those changes so
that we can eventually communicate them to the OVS factory to deal with
them.

(cherry picked from commit f2c066e104)
2020-08-17 20:09:58 +02:00
Lubomir Rintel
4107490c89
ovs/ovsdb: fix signal handler argument types
(cherry picked from commit dedc0cba23)
2020-08-17 20:09:57 +02:00
Lubomir Rintel
7448ad8467
ovs/ovsdb: remove the device-changes signal
It doesn't communicate anything about the nature of the change and
indeed nothing uses it.

(cherry picked from commit b1feebc43a)
2020-08-17 20:09:57 +02:00
Lubomir Rintel
3455c30a58
ovs/ovsdb: guard against OVSDB integrity issues
Don't crash in situations, where the bridge or a port has a child with
UUID we don't know. This could happen if we mess up the parsing of
messages from OVSDB, but could also theoretically happen in OVSDB sends
us bad data.

(cherry picked from commit 99c7adc1e1)
2020-08-17 20:09:57 +02:00
Thomas Haller
a1f4bcd611
tests: suppress valgrind warning about unsupported syscall for "test-config"
(cherry picked from commit d507563a80)
(cherry picked from commit 4036bc48e4)
(cherry picked from commit 9ff160d155)
(cherry picked from commit 1b9da18693)
2020-08-17 20:09:42 +02:00
Thomas Haller
8f644537a4
shared: add nm_g_slice_free() helper
How odd that such a macro does not exist yet. It seems like
the majorities of calls to g_slice_free() could be replaced
by this.

(cherry picked from commit dcdbe98406)
2020-08-17 20:09:42 +02:00
Thomas Haller
9e32b33d05
libnm: add internal _nm_connection_get_setting() accessor
nm_connection_get_setting() returns a pointer of type NMSetting.
That is very inconvenient, because most callers will need the
the result pointer as a setting subtype (like NMSettingConnection).

That would be like g_object_new() returning a "GObject *" pointer,
which is technically correct but annoying.

In the past that problem was avoided by having countless accessors
like nm_connection_get_setting_ip4_config(), etc. But that just blows
up the API and also is not generic. Meaning: the type is not a function
argument but the function itself. That makes composing the code harder
as the setting type cannot be treated generically (as a function argument).

Anyway. Add an internal wrapper that returns a void pointer.

(cherry picked from commit c4788e611e)
2020-08-17 20:09:42 +02:00
Thomas Haller
c850015138
release: bump version to 1.18.9 (development) 2020-05-29 13:54:27 +02:00
Thomas Haller
5af9a6dbc0
release: bump version to 1.18.8 2020-05-29 13:51:12 +02:00
Thomas Haller
944b88b79d
NEWS: update 2020-05-29 13:39:16 +02:00
Thomas Haller
8699d27173
ifcfg-rh: merge branch 'th/ifcfg-rh-802-1x-pin'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/520

(cherry picked from commit 266d054808)
(cherry picked from commit 698acfef4b)
(cherry picked from commit 4d1b316f91)
(cherry picked from commit a4e7994ac4)
2020-05-29 13:28:05 +02:00
Thomas Haller
d286e3dc28
ifcfg-rh: support persisting 802-1x.pin and pin-flags property
(cherry picked from commit 655fd1ebd8)
(cherry picked from commit 799cee5068)
(cherry picked from commit 77e1132845)
(cherry picked from commit 73865ffb0b)
2020-05-29 13:27:42 +02:00
Thomas Haller
80fccd5a16
libnm,ifcfg-rh: fix documentation for IEEE_8021X_SYSTEM_CA_CERTS in man nm-settings-ifcfg-rh
Fixes: 2a4fb75d3b ('ifcfg: add support for "802-1x.system-ca-certs" setting')
(cherry picked from commit b4537f2c03)
(cherry picked from commit 5d8a0837b3)
(cherry picked from commit e11232de96)
(cherry picked from commit e00e764167)
2020-05-29 13:27:14 +02:00
Thomas Haller
68420568e4
libnm,ifcfg-rh: fix documentation for IEEE_8021X_PASSWORD_RAW_FLAGS in man nm-settings-ifcfg-rh
Fixes: a83ab252ee ('ifcfg-rh: add support for 802-1x.password-raw property')
(cherry picked from commit 9fde21504e)
(cherry picked from commit 36ddd266a5)
(cherry picked from commit 52bb253f6b)
(cherry picked from commit 3afbaeb597)
2020-05-29 13:27:14 +02:00
Thomas Haller
fa9d237be0
libnm,ifcfg-rh: merge branch 'th/ifcfg-rh-ca-path'
https://bugzilla.redhat.com/show_bug.cgi?id=1840210
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/448

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

(cherry picked from commit e0c220e7e9)
(cherry picked from commit 8affcc19b6)
(cherry picked from commit 6066e16367)
(cherry picked from commit e18f4a3ca5)
2020-05-27 11:39:52 +02:00
Thomas Haller
ba21cae6da
libnm: update documentation for 802-1x ca-cert, ca-path and system-ca-certs
(cherry picked from commit 4f21b14b90)
(cherry picked from commit 0d35d14faf)
(cherry picked from commit 1a989a98bf)
(cherry picked from commit 388f3e18a9)
2020-05-27 11:30:45 +02:00
Thomas Haller
70479d0501
ifcfg-rh: fix handling "802-1x.{phase2-,}ca-path" in ifcfg-rh settings plugin
https://bugzilla.redhat.com/show_bug.cgi?id=1840210
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/448
(cherry picked from commit b6b6639c7c)
(cherry picked from commit 67f1da27fe)
(cherry picked from commit 7a20dd4dbb)
(cherry picked from commit 97b12a3c34)
2020-05-27 11:30:35 +02:00
Thomas Haller
d04144afdb
build: log system-ca-path configure setting in build scripts
(cherry picked from commit f8dcb3fc47)
(cherry picked from commit f3f179728e)
(cherry picked from commit eb9767a6c8)
(cherry picked from commit 359f7f3544)
2020-05-27 11:29:48 +02:00
Beniamino Galvani
04f5707731 ip-tunnel: merge branch 'bg/ip-tunnel-cloned-mac-rh1832170'
https://bugzilla.redhat.com/show_bug.cgi?id=1832170
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/503
(cherry picked from commit 2d8c87e22e)
(cherry picked from commit f50ed7a25e)
(cherry picked from commit bef2f8a4dd)
(cherry picked from commit b4fedfc57c)
2020-05-15 10:26:23 +02:00
Beniamino Galvani
d4c2be5f28 ip-tunnel: set cloned-mac-address only for layer2 tunnel devices
For ip-tunnel modes that encapsulate layer2 packets (gretap and
ip6gretap) we allow the presence of an ethernet setting in the
connection and honor the cloned-mac-address specified in it.

For all other modes, the ethernet setting is removed during
normalization, but a value different from 'preserve' could be set via
global default.

The kernel doesn't allow setting a MAC for layer3 devices, don't do
it.

(cherry picked from commit 0494a84878)
(cherry picked from commit 78ed14166c)
(cherry picked from commit d69d92c658)
(cherry picked from commit 60b4bdafcf)
2020-05-15 10:25:49 +02:00
Beniamino Galvani
ae208023f2 libnm-core: add _nm_ip_tunnel_mode_is_layer2()
(cherry picked from commit 48c93b3bba)
(cherry picked from commit 5d2f2a6549)
(cherry picked from commit d0f275e7f5)
(cherry picked from commit db82b52dbd)
2020-05-15 10:24:48 +02:00
Thomas Haller
20fa4433f2
acd: fix char buffer argument to _acd_event_to_string_buf()
(cherry picked from commit 6e9967939b)
(cherry picked from commit 1e1ae9ba07)
(cherry picked from commit c0997fa4f3)
(cherry picked from commit 53cb8ce245)
2020-05-08 07:59:05 +02:00
Thomas Haller
4a636dda9f
acd: avoid alloca() inside an unbounded loop
(cherry picked from commit b447c80ad8)
(cherry picked from commit ecb9e0e3df)
(cherry picked from commit 198e233b91)
(cherry picked from commit 78618ccbaf)
2020-05-07 14:13:13 +02:00
Thomas Haller
d0932fa988
libnm: fix gtk-doc annotations for nm_setting_match_get_interface_names()
Otherwise the function is not usable via generated bindings.

Fixes: 9b9dce9486 ('all: add 'match' setting')
(cherry picked from commit 180cda7632)
(cherry picked from commit 805adec9ca)
(cherry picked from commit b5a66b88b3)
(cherry picked from commit 2630758cb4)
2020-05-06 15:12:38 +02:00
Thomas Haller
307bc73fc7
all: merge branch 'th/strtoll-workaround'
https://bugzilla.redhat.com/show_bug.cgi?id=1797915

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

(cherry picked from commit d342fa267d)
(cherry picked from commit 85811e67dd)
(cherry picked from commit 32e0bd7e72)
2020-05-02 17:07:17 +02:00
Thomas Haller
2792b6619b
all: use wrappers for g_ascii_strtoll(), g_ascii_strtoull(), g_ascii_strtod()
Sometimes these function may set errno to unexpected values like EAGAIN.
This causes confusion. Avoid that by using our own wrappers that retry
in that case. For example, in rhbz#1797915 we have failures like:

    errno = 0;
    v = g_ascii_strtoll ("10", 0, &end);
    if (errno != 0)
        g_assert_not_reached ();

as g_ascii_strtoll() would return 10, but also set errno to EAGAIN.

Work around that by using wrapper functions that retry. This certainly
should be fixed in glib (or glibc), but the issues are severe enough to
warrant a workaround.

Note that our workarounds are very defensive. We only retry 2 times, if
we get an unexpected errno value. This is in the hope to recover from
a spurious EAGAIN. It won't recover from other errors.

https://bugzilla.redhat.com/show_bug.cgi?id=1797915
(cherry picked from commit 7e49f4a199)
(cherry picked from commit eec2740d71)
(cherry picked from commit 500f0b96ae)
2020-05-02 17:05:15 +02:00
Thomas Haller
12ab561ee9
shared: add nm_g_ascii_strtoull() to workaround bug
(cherry picked from commit 3b58c5fef4)
(cherry picked from commit 95565bef77)
(cherry picked from commit d629db4a0e)
2020-05-02 17:04:46 +02:00
Thomas Haller
e2bfbd9c81
shared: add nm_g_ascii_strtod() to workaround bug
(cherry picked from commit 35a9f632a8)
(cherry picked from commit f8cae1ed18)
(cherry picked from commit 0de1c3a53a)
2020-05-02 17:04:45 +02:00
Thomas Haller
4633d6a8b5
shared: add nm_g_ascii_strtoll() to workaround bug
(cherry picked from commit f4446e34c6)
(cherry picked from commit 6836679878)
(cherry picked from commit 49c523cf1e)
2020-05-02 17:04:44 +02:00
Thomas Haller
2511c64ea4
device/bluetooth: avoid g_ascii_strtoull() to parse capabilities
Avoid g_ascii_strtoull() calling directly. It has subtle issues, which is why
we have a wrapper for it.

(cherry picked from commit 659ac9cc12)
(cherry picked from commit 62469c1401)
(cherry picked from commit 386ea3ff26)
2020-05-02 17:04:35 +02:00
Thomas Haller
5b552d2946
ifupdown: use _nm_utils_ascii_str_to_int64() for converting netmask to string
(cherry picked from commit 3930ef194e)
(cherry picked from commit 1a80179c60)
(cherry picked from commit 1a54909bb4)
2020-05-02 17:03:24 +02:00
Thomas Haller
d446c90985 vpn: clear host part of IPv6 routes received from VPN plugin
Kernel would reject adding a route with a destination host part not
all zero. NetworkManager generally coerces such routes and there
are assertions in place to ensure that.

We forgot to ensure that for certain IPv6 routes from VPN plugins.
This can cause an assertion failure and wrong behavior.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/425

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/482
(cherry picked from commit b437bb4a6e)
(cherry picked from commit c7586e6388)
(cherry picked from commit 55c361453b)
(cherry picked from commit 75933cd6ff)
2020-04-28 09:44:43 +02:00
Beniamino Galvani
9f4ac106a2 release: bump version to 1.18.7 (development) 2020-04-24 16:15:03 +02:00
Beniamino Galvani
62f3dc4118 release: bump version to 1.18.6 2020-04-24 16:15:01 +02:00
Beniamino Galvani
251fcff9c6 release: update NEWS 2020-04-24 16:14:59 +02:00