core,libnm: don't touch device TC configuration by default

NetworkManager supports a very limited set of qdiscs. If users want to
configure a unsupported qdisc, they need to do it outside of
NetworkManager using tc.

The problem is that NM also removes all qdiscs and filters during
activation if the connection doesn't contain a TC setting. Therefore,
setting TC configuration outside of NM is hard because users need to
do it *after* the connection is up (for example through a dispatcher
script).

Let NM consider the presence (or absence) of a TC setting in the
connection to determine whether NM should configure (or not) qdiscs
and filters on the interface. We already do something similar for
SR-IOV configuration.

Since new connections don't have the TC setting, the new behavior
(ignore existing configuration) will be the default. The impact of
this change in different scenarios is:

 - the user previously configured TC settings via NM. This continues
   to work as before;

 - the user didn't set any qdiscs or filters in the connection, and
   expected NM to clear them from the interface during activation.
   Here there is a change in behavior, but it seems unlikely that
   anybody relied on the old one;

 - the user didn't care about qdiscs and filters; NM removed all
   qdiscs upon activation, and so the default qdisc from kernel was
   used. After this change, NM will not touch qdiscs and the default
   qdisc will be used, as before;

 - the user set a different qdisc via tc and NM cleared it during
   activation. Now this will work as expected.

So, the new default behavior seems better than the previous one.

https://bugzilla.redhat.com/show_bug.cgi?id=1928078
This commit is contained in:
Beniamino Galvani
2021-05-25 16:58:28 +02:00
parent 04ae0d905c
commit a48edd0410
4 changed files with 33 additions and 17 deletions

View File

@@ -1810,6 +1810,15 @@ nm_setting_tc_config_class_init(NMSettingTCConfigClass *klass)
* NMSettingTCConfig:qdiscs: (type GPtrArray(NMTCQdisc))
*
* Array of TC queueing disciplines.
*
* When the #NMSettingTCConfig setting is present, qdiscs from this
* property are applied upon activation. If the property is empty,
* all qdiscs are removed and the device will only
* have the default qdisc assigned by kernel according to the
* "net.core.default_qdisc" sysctl.
*
* If the #NMSettingTCConfig setting is not present, NetworkManager
* doesn't touch the qdiscs present on the interface.
**/
/* ---ifcfg-rh---
* property: qdiscs
@@ -1834,6 +1843,13 @@ nm_setting_tc_config_class_init(NMSettingTCConfigClass *klass)
* NMSettingTCConfig:tfilters: (type GPtrArray(NMTCTfilter))
*
* Array of TC traffic filters.
*
* When the #NMSettingTCConfig setting is present, filters from this
* property are applied upon activation. If the property is empty,
* NetworkManager removes all the filters.
*
* If the #NMSettingTCConfig setting is not present, NetworkManager
* doesn't touch the filters present on the interface.
**/
/* ---ifcfg-rh---
* property: qdiscs