Commit graph

26414 commits

Author SHA1 Message Date
Sayed Shah
e3cd3b73ed
cloud-setup: don't require delimiter in 'nmcs_utils_hwaddr_normalize'
Azure gives MAC address without delimiter. So, make the normalize function
more liberal so that it can accept this format.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/576
2020-07-14 19:10:29 +02:00
Thomas Haller
aa4cb0e5eb
contrib: improve code comments to release.sh scripts 2020-07-13 23:54:34 +02:00
Thomas Haller
7b14686ae2
release: bump version to 1.27.1 (development) 2020-07-13 23:40:48 +02:00
Thomas Haller
5542275672
contrib: add "major-post" step for release.sh script 2020-07-13 23:28:05 +02:00
Thomas Haller
8582a5f356
release: bump version to 1.26.0 2020-07-13 20:11:58 +02:00
Thomas Haller
ca75400f00
NEWS: update
(cherry picked from commit c2f7428bc0)
2020-07-13 20:10:39 +02:00
Thomas Haller
c2f7428bc0
NEWS: update 2020-07-13 19:09:00 +02:00
Thomas Haller
c3b04c4fd9
contrib: support "major" release in release.sh script 2020-07-13 18:05:32 +02:00
Thomas Haller
a802192f75
NEWS: update 2020-07-13 18:02:20 +02:00
Beniamino Galvani
b76f7cc555
NEWS: update
(cherry picked from commit 2a9f5f25b2)
2020-07-13 18:02:20 +02:00
Thomas Haller
8c2f8169aa
libnm: fix -Werror=maybe-uninitialized warning _setting_bond_validate_option()
Fixes: e96051d734 ('libnm: cleanup validating bond option "arp_ip_target"')
(cherry picked from commit 826c83ce41)
2020-07-13 17:41:36 +02:00
Thomas Haller
826c83ce41
libnm: fix -Werror=maybe-uninitialized warning _setting_bond_validate_option()
Fixes: e96051d734 ('libnm: cleanup validating bond option "arp_ip_target"')
2020-07-13 17:40:40 +02:00
Thomas Haller
2e780878f0
cli: fix leak in do_device_modify() and minor cleanup
(cherry picked from commit 5deb71625d)
2020-07-13 17:20:48 +02:00
Thomas Haller
fd9e7d6167
cli: fix accessing argv with zero elements in nmc_process_connection_properties()
Without this, `nmcli device modify "$DEVICE"` leads to a crash. At least
since commit c5d45848dd ('cli: mark argv argument for command line
parsing as const'), when this happens.

That is, because it passes a NULL strv array with argc being set to
zero. nmc_process_connection_properties() is not supposed to access
the array, if there are no elements there.

Fixes: c5d45848dd ('cli: mark argv argument for command line parsing as const')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/492
(cherry picked from commit 09c94bc24f)
2020-07-13 17:20:47 +02:00
Thomas Haller
5deb71625d
cli: fix leak in do_device_modify() and minor cleanup 2020-07-13 17:16:28 +02:00
Thomas Haller
09c94bc24f
cli: fix accessing argv with zero elements in nmc_process_connection_properties()
Without this, `nmcli device modify "$DEVICE"` leads to a crash. At least
since commit c5d45848dd ('cli: mark argv argument for command line
parsing as const'), when this happens.

That is, because it passes a NULL strv array with argc being set to
zero. nmc_process_connection_properties() is not supposed to access
the array, if there are no elements there.

Fixes: c5d45848dd ('cli: mark argv argument for command line parsing as const')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/492
2020-07-13 17:15:56 +02:00
Frazer Clews
2fba8a3ece
cloud-setup: fix nmcs_utils_poll argument ordering
the order of the arguments in the header and C file did not match

Fixes: 69f048bf0c ('cloud-setup: add tool for automatic IP configuration in cloud')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/574
(cherry picked from commit 16abfca78a)
2020-07-13 13:18:12 +02:00
Frazer Clews
16abfca78a
cloud-setup: fix nmcs_utils_poll argument ordering
the order of the arguments in the header and C file did not match

Fixes: 69f048bf0c ('cloud-setup: add tool for automatic IP configuration in cloud')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/574
2020-07-13 13:13:58 +02:00
Thomas Haller
4168c19e04
shared: move nm_close(), nm_auto_close, nm_steal_fd(), nm_steal_int() to nm-std-aux 2020-07-12 13:05:13 +02:00
Thomas Haller
6225ace76f
bond: merge branch 'th/bond-normalize'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/570

(cherry picked from commit ecba921920)
2020-07-11 15:07:49 +02:00
Thomas Haller
a55b514477
tui: fix default values for bond options in nmtui
When configuring miimon settings, the updelay/downdelay fields with
value zero may not be stored in the setting.

For example:

- have a profile with "mode=balance-rr,arp_interval=11,arp_ip_target=10.10.10.1,miimon=10"
  Switch the link monitoring mode to "MII" and press <OK>. Previously,
  the change of the link monitoring did not update the settings, and
  nothing was changed.

- when loading settings, initialize all fields with the values from the
  settings, regardless whether they are currently visible or not.
  Otherwise, if you edit a profile with
  "mode=balance-rr,arp_interval=11,arp_ip_target=10.10.10.1,miimon=10"
  and switch link monitoring mode to "MII", the miimon setting was not
  initialized to 10.

- accept empty bond settings, for example for updelay. In that case,
  initialize the text input to "0". Likewise, when the text entry is
  empty, set the bond option to the respective default.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/488
(cherry picked from commit 61d4bc62e0)
2020-07-11 15:07:48 +02:00
Thomas Haller
b3775325af
libnm: add _nm_setting_bond_mode_from_string() to nm-libnm-core-intern
(cherry picked from commit a0b22b5b40)
2020-07-11 15:07:48 +02:00
Thomas Haller
131794b57b
tui: fix alternating miimon/arp_interval settings for bond options in nmtui
(cherry picked from commit 211d799817)
2020-07-11 15:07:47 +02:00
Thomas Haller
9d918e556f
cli: fix alternating miimon/arp_interval settings for bond options in nmcli
Before 1.24, nm_setting_bond_add_option() would clear
miimon/arp_interval settings when the respective other was set.

That was no longer done, with the effect that enabling (for example)
miimon on a bond profile that has arp_interval enabled, sets both
conflicting options.

That is not a severe problem, because the profile still validates.
However, at runtime only one of the settings can be actually configured.

Fix that, by restoring the previous behavior for the client. But note
that this time it's implemented in the client, and not in libnm's
nm_setting_bond_add_option().

(cherry picked from commit b55578bf6e)
2020-07-11 15:07:47 +02:00
Thomas Haller
0c75899d3e
bond: log only skipped bond options if they are set in the profile
(cherry picked from commit 3a25b3bfc7)
2020-07-11 15:07:46 +02:00
Thomas Haller
96edc84b4d
libnm,core: fix handling miimon and arp_interval as conflicting kernel options
We use sysfs API for setting bond options. Note that the miimon and
arp_interval settings conflict each other, and whenever setting one
of these sysfs values, the other one gets reset. That means,
NetworkManager needs to mediate and handle a profile which has both
these options set.

Before 1.24, the libnm API nm_setting_bond_add_option() API would mangle
the content of the bond settings, to clear the respective other fields
when setting miimon/arp_interval. That also had the effect that the
settings plugins, weren't able to read such (conflicting) settings
back from disk (but they would write them to disk). If a keyfile
specified both miimon and arp_interval keys, then it would depend on
their order in the keyfile which wins.
It is wrong that a libnm property setter mangles the option in such a way,
especially, because you still could set the NM_SETTING_BOND_OPTIONS
property directly and bypass this. So, since 1.24, you can create
profiles that have conflicting options.

Also, we can now not start to reject such settings as invalid, because that
would be an API break. Instead, just make sure that when one of the
settings is set, that the other one consistently gets deactivated.

Also, before 1.24 already, NMDeviceBond would mediate whether to either set
miimon or arp_interval settings. Despite that the keyfile reader would
mangle the settings, it would also prefer miimon over arp_interval,
if both were set.

This mechanism was broken since we switch to _bond_get_option_normalized()
for that. As a consequence, NetworkManager would try to set both the
conflicting options. Fix that.

(cherry picked from commit 4aa46328ca)
2020-07-11 15:07:46 +02:00
Thomas Haller
491cd1d2cd
libnm: don't fail assertion for _bond_get_option_normalized() with invalid bond mode
_bond_get_option_normalized() gets called with code paths that don't
assume a valid options hash. That means, the bond mode might be invalid
and we should fail an assertion.

(cherry picked from commit 1543f8a1a1)
2020-07-11 15:07:46 +02:00
Thomas Haller
45c95e9314
device/bond: rework setting of arp_ip_target bond options
- the arp_ip_target option in the settings might not have normalized
  IP addresses or duplicates. If there would be duplicates, setting
  them twice would fail with EINVAL. Hence, first normalize them
  and make them unique.

- if what we want to set is identical to what is already set, don't
  do anything.

(cherry picked from commit 6a923a5d57)
2020-07-11 15:07:45 +02:00
Thomas Haller
c284f3c7fa
libnm: cleanup validating bond option "arp_ip_target"
We already have meta data for all bond options. For example,
"arp_ip_target" has type NM_BOND_OPTION_TYPE_IP.

Also, verify() already calls nm_setting_bond_validate_option() to validate
the option. Doing a second validation below is redundant (and done
inconsistently).

Validate the setting only once.

Also beef up the validation and use nm_utils_bond_option_arp_ip_targets_split()
to parse the IP addresses. This now strips extra whitespace and (as
before) removes empty entries.

(cherry picked from commit e96051d734)
2020-07-11 15:07:45 +02:00
Thomas Haller
2f43cde20d
libnm: add nm_utils_bond_option_arp_ip_targets_split() helper
Note yet used. The way how we split the option is relevant at various
places. The code should use the same helper function.

(cherry picked from commit 4ee0e8f075)
2020-07-11 15:07:45 +02:00
Thomas Haller
b5e5356ad5
shared: assert that nm_utils_strsplit_set_full() returns non-empty strv array
(cherry picked from commit f78e0bf246)
2020-07-11 15:07:45 +02:00
Thomas Haller
ecba921920
bond: merge branch 'th/bond-normalize'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/570
2020-07-11 15:06:50 +02:00
Thomas Haller
61d4bc62e0
tui: fix default values for bond options in nmtui
When configuring miimon settings, the updelay/downdelay fields with
value zero may not be stored in the setting.

For example:

- have a profile with "mode=balance-rr,arp_interval=11,arp_ip_target=10.10.10.1,miimon=10"
  Switch the link monitoring mode to "MII" and press <OK>. Previously,
  the change of the link monitoring did not update the settings, and
  nothing was changed.

- when loading settings, initialize all fields with the values from the
  settings, regardless whether they are currently visible or not.
  Otherwise, if you edit a profile with
  "mode=balance-rr,arp_interval=11,arp_ip_target=10.10.10.1,miimon=10"
  and switch link monitoring mode to "MII", the miimon setting was not
  initialized to 10.

- accept empty bond settings, for example for updelay. In that case,
  initialize the text input to "0". Likewise, when the text entry is
  empty, set the bond option to the respective default.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/488
2020-07-11 15:06:28 +02:00
Thomas Haller
a0b22b5b40
libnm: add _nm_setting_bond_mode_from_string() to nm-libnm-core-intern 2020-07-11 11:18:55 +02:00
Thomas Haller
211d799817
tui: fix alternating miimon/arp_interval settings for bond options in nmtui 2020-07-11 11:18:54 +02:00
Thomas Haller
b55578bf6e
cli: fix alternating miimon/arp_interval settings for bond options in nmcli
Before 1.24, nm_setting_bond_add_option() would clear
miimon/arp_interval settings when the respective other was set.

That was no longer done, with the effect that enabling (for example)
miimon on a bond profile that has arp_interval enabled, sets both
conflicting options.

That is not a severe problem, because the profile still validates.
However, at runtime only one of the settings can be actually configured.

Fix that, by restoring the previous behavior for the client. But note
that this time it's implemented in the client, and not in libnm's
nm_setting_bond_add_option().
2020-07-11 11:18:54 +02:00
Thomas Haller
3a25b3bfc7
bond: log only skipped bond options if they are set in the profile 2020-07-10 16:45:37 +02:00
Thomas Haller
4aa46328ca
libnm,core: fix handling miimon and arp_interval as conflicting kernel options
We use sysfs API for setting bond options. Note that the miimon and
arp_interval settings conflict each other, and whenever setting one
of these sysfs values, the other one gets reset. That means,
NetworkManager needs to mediate and handle a profile which has both
these options set.

Before 1.24, the libnm API nm_setting_bond_add_option() API would mangle
the content of the bond settings, to clear the respective other fields
when setting miimon/arp_interval. That also had the effect that the
settings plugins, weren't able to read such (conflicting) settings
back from disk (but they would write them to disk). If a keyfile
specified both miimon and arp_interval keys, then it would depend on
their order in the keyfile which wins.
It is wrong that a libnm property setter mangles the option in such a way,
especially, because you still could set the NM_SETTING_BOND_OPTIONS
property directly and bypass this. So, since 1.24, you can create
profiles that have conflicting options.

Also, we can now not start to reject such settings as invalid, because that
would be an API break. Instead, just make sure that when one of the
settings is set, that the other one consistently gets deactivated.

Also, before 1.24 already, NMDeviceBond would mediate whether to either set
miimon or arp_interval settings. Despite that the keyfile reader would
mangle the settings, it would also prefer miimon over arp_interval,
if both were set.

This mechanism was broken since we switch to _bond_get_option_normalized()
for that. As a consequence, NetworkManager would try to set both the
conflicting options. Fix that.
2020-07-10 16:45:06 +02:00
Thomas Haller
1543f8a1a1
libnm: don't fail assertion for _bond_get_option_normalized() with invalid bond mode
_bond_get_option_normalized() gets called with code paths that don't
assume a valid options hash. That means, the bond mode might be invalid
and we should fail an assertion.
2020-07-10 16:42:23 +02:00
Thomas Haller
6a923a5d57
device/bond: rework setting of arp_ip_target bond options
- the arp_ip_target option in the settings might not have normalized
  IP addresses or duplicates. If there would be duplicates, setting
  them twice would fail with EINVAL. Hence, first normalize them
  and make them unique.

- if what we want to set is identical to what is already set, don't
  do anything.
2020-07-10 16:42:23 +02:00
Thomas Haller
e96051d734
libnm: cleanup validating bond option "arp_ip_target"
We already have meta data for all bond options. For example,
"arp_ip_target" has type NM_BOND_OPTION_TYPE_IP.

Also, verify() already calls nm_setting_bond_validate_option() to validate
the option. Doing a second validation below is redundant (and done
inconsistently).

Validate the setting only once.

Also beef up the validation and use nm_utils_bond_option_arp_ip_targets_split()
to parse the IP addresses. This now strips extra whitespace and (as
before) removes empty entries.
2020-07-10 13:12:43 +02:00
Thomas Haller
4ee0e8f075
libnm: add nm_utils_bond_option_arp_ip_targets_split() helper
Note yet used. The way how we split the option is relevant at various
places. The code should use the same helper function.
2020-07-10 13:12:43 +02:00
Thomas Haller
f78e0bf246
shared: assert that nm_utils_strsplit_set_full() returns non-empty strv array 2020-07-10 13:12:40 +02:00
Thomas Haller
0d65b24b93
format: some adjustments to the style and mark ForEachMacros
"ForEachMacros" requires us to maintain a list of for each macros.
However, that seems doable, as we only seldom add such macros.
2020-07-10 10:59:36 +02:00
Beniamino Galvani
446ad4a03d merge: branch 'bg/sriov-reset-on-failure'
https://bugzilla.redhat.com/show_bug.cgi?id=1819587
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/457

(cherry picked from commit 6ca98f5b04)
2020-07-10 10:26:58 +02:00
Beniamino Galvani
ef9f26a1bf device: reset SR-IOV parameters on activation failure
SR-IOV parameters are reset when deactivating a connection; do the
same also on failure.

https://bugzilla.redhat.com/show_bug.cgi?id=1819587
(cherry picked from commit 4d6ea18de4)
2020-07-10 10:26:58 +02:00
Beniamino Galvani
b140adc40d device: allow queuing SR-IOV operation from a callback
Keep priv->sriov.pending set during the callback set so that it
becomes possible to insert a new operation from the callback itself.

(cherry picked from commit 74ccda8a71)
2020-07-10 10:26:57 +02:00
Beniamino Galvani
01997b2550 device: clear queued sriov operation on dispose
When dispose() is called, there can't be any pending operation because
they keep a reference to the device. Instead, there can be a a queued
operation not yet executed. Destroy it.

(cherry picked from commit 6fcb077a98)
2020-07-10 10:26:57 +02:00
Beniamino Galvani
ed849eadc1 platform: do not rely on the presence of sriov_totalvfs sysfs file
The file doesn't exist for all interfaces that support SR-IOV. In
particular, netdevsim devices support SR-IOV but don't expose the
file.

(cherry picked from commit 63a932b851)
2020-07-10 10:26:57 +02:00
Beniamino Galvani
6ca98f5b04 merge: branch 'bg/sriov-reset-on-failure'
https://bugzilla.redhat.com/show_bug.cgi?id=1819587
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/457
2020-07-10 10:19:21 +02:00