Commit graph

19085 commits

Author SHA1 Message Date
Thomas Haller
0dbcbbcd86 platform: add <linux/tc_act/tc_defact.h> header
We're going to need that one for TC filter & action support.

<linux/tc_act/tc_defact.h> was moved to user-space API only in 2013
by commit 5bc3db5c9ca8407f52918b6504d3b27230defedc. Our travis CI currently
fails to build due to that.

Re-implement the header.

(cherry picked from commit 82befe3c40)
2017-12-11 19:00:44 +01:00
Thomas Haller
c38ed3afa5 platform: merge nm_platform_*_delete() delete functions
It only makes sense to call delete() with NMPObjects that
we obtained from the platform cache. Otherwise, if we didn't
get it from the cache in the first place, we wouldn't know
what to delete.

Hence, the input argument is (almost) always an NMPObject
in the first place. That is different from add(), where
we might create a new specific NMPlatform* instance on the
stack. For add() it makes slightly more sense to have different
functions depending on the type. For delete(), it doesn't.

(cherry picked from commit 7573594a21)
2017-12-11 19:00:41 +01:00
Lubomir Rintel
3db46feb16 platform/nmp-object: (trivial) keep enum ordered by a numeric value
(cherry picked from commit 44be0dfca7)
2017-12-11 18:56:48 +01:00
Lubomir Rintel
cb4c51f014 platform/linux: stringify also NLMSG_* in logs
(cherry picked from commit ffe89f86e0)
2017-12-11 18:56:47 +01:00
Lubomir Rintel
7ed5ff611f generate-setting-docs: document aa{sv} type
Will be useful for tc qdiscs.

(cherry picked from commit 273fb58e35)
2017-12-11 18:56:44 +01:00
Lubomir Rintel
f7df4f0cde platform/trivial: s/ADDRROUTE/OBJECT/ for the cache lookup
It's going to be useful for other objects that have a type (of course)
and an ifindex.

(cherry picked from commit 93ac0e455b)
2017-12-11 18:56:41 +01:00
Lubomir Rintel
595a06b689 libnm-core/utils: allow use of bytestring with attributes
(cherry picked from commit 18dd937b81)
2017-12-11 18:56:38 +01:00
Lubomir Rintel
1a41724998 libnm-core/utils: add some special properties for the attributes
"no_value" indicates that the the attribute is a single word, not a
key=value pair. If the type is BOOLEAN then the attribute is considered
true, if it's a STRING then the key is used instead of a value.

"consumes_rest" indicates that the particular key takes the unparseable
tail of the string for a value.

This allows parsing tc-style strings. Consider this filter:

              ,------ regular key/value pair
       ,-----'----.
  root handle 1234: matchall action simple foo bar baz
    |                  |     `-----------.-----------'
    |                  |                 `- "", STRING, consumes_rest
    |                  `------------------- "kind", STRING, no_value
    `-------------------------------------- "root', BOOLEAN, no_value

(cherry picked from commit 47b1dc3828)
2017-12-11 18:56:32 +01:00
Lubomir Rintel
51d5b97bd7 libnm-core/utils: allow using the same character for key/value and attribute separators
Allows doing a nm_utils_parse_variant_attributes(..., ' ', ' ').

(cherry picked from commit 48a619e62b)
2017-12-11 18:56:27 +01:00
Lubomir Rintel
faa6ddc272 libnm-core/utils: (trivial) use g_set_error_literal() where appropriate
(cherry picked from commit 9a00750c06)
2017-12-11 18:56:24 +01:00
Lubomir Rintel
d3abc7aed1 ifcfg-rh: drop unused functions
Perhaps a cargo cult leftover.

(cherry picked from commit b49c7e026f)
2017-12-11 18:56:20 +01:00
Lubomir Rintel
b65955148a ifcfg-rh: drop unused and confusing error arguments
(cherry picked from commit 17462a5a5f)
2017-12-11 18:56:13 +01:00
Thomas Haller
5ee3c8912f settings: mark the connection as UNSAVED if it was modified in-memory
(cherry picked from commit 023ce50d21)
2017-12-11 18:49:29 +01:00
Thomas Haller
1702531ce5 settings: for persist-mode KEEP do not ever save the connection to disk
KEEP means to don't do anything, really.

(cherry picked from commit e8299e30b8)
2017-12-11 18:49:28 +01:00
Thomas Haller
70873b541c settings: fix clearing nm-generated/volatile flags of connection
There are a few cases where we don't want to clear a potential
nm-generated/volatile flag, but only mark the connection as
unsaved.

Otherwise, we wrongly end up clearing these flags and the connection
is wrongly not NM_DEVICE_SYS_IFACE_STATE_EXTERNAL.

Fixes: 35dc6421de
(cherry picked from commit 7044febf97)
2017-12-11 12:14:57 +01:00
Thomas Haller
9c6f8ae2d5 core: fix typo for logging of NMSettingsConnectionFlags "nm-generated"
Fixes: c3dd5d8df2
(cherry picked from commit 45ad3ec886)
2017-12-11 09:57:35 +01:00
Thomas Haller
fae720edc4 cli: fix integer types in get-functions to match libnm origin
The num/i variables are initialized from libnm API and used
back at them. The integer types should match.

(cherry picked from commit e7d18548b9)
2017-12-08 16:52:35 +01:00
Thomas Haller
3b68867123 libnm: don't use g_strsplit_set() to search string for invalid characters
(cherry picked from commit 6c93e32212)
2017-12-08 11:33:34 +01:00
Thomas Haller
1268038b4a libnm/tests: fix memleak in test
(cherry picked from commit af6f62be8d)
2017-12-08 11:33:15 +01:00
Thomas Haller
8188c16dd7 gitignore: readd removed libnm-core/tests/test-setting* programs
Although removed, they show up whenever switching to an
old branch. Keep ignoring them.

(cherry picked from commit d5d4911b58)
2017-12-08 11:33:01 +01:00
Thomas Haller
f13b97a9e4 keyfile: reject team properties in parser
We don't properly coordinate reading the team properties from keyfile.
They must be ignored, at least for now.

(cherry picked from commit 1b8ae83967)
2017-12-08 11:32:41 +01:00
Francesco Giudici
f092cc0f94 merge: branch 'fg/team_abstraction_tests_and_fixes_rh1398925'
https://bugzilla.redhat.com/show_bug.cgi?id=1398925

(cherry picked from commit 4d1796b2c7)
2017-12-08 04:00:09 +01:00
Francesco Giudici
78d10c9d18 libnm-core: add test cases for NMSettingTeamPort
(cherry picked from commit b5f0d61d03)
2017-12-08 04:00:09 +01:00
Francesco Giudici
7abcede5bb libnm-core: add test cases for NMSettingTeam
(cherry picked from commit 1248969342)
2017-12-08 04:00:09 +01:00
Francesco Giudici
ace038539a gitignore: ignore libnm-core/tests/test-setting
We now have merged in libnm-core/tests/test-setting test file the test
files for 8021x, bond and dcb... add the new test file to .gitignore and
remove the old ones.

(cherry picked from commit 540b7b3dfd)
2017-12-08 04:00:09 +01:00
Lubomir Rintel
bb3fc9769b libnm-core: merge the settings tests into a single one
Thomas likes this more and who am I to argue.

(cherry picked from commit 9bb30f86ec)
2017-12-08 04:00:09 +01:00
Francesco Giudici
bc92380a76 libnm-core: team: skip writing in the keyfile all the exposed properties
Their values are already saved in the team.config and team-port.config
properties, from which they are synced.

(cherry picked from commit bb4c95e168)
2017-12-08 04:00:09 +01:00
Francesco Giudici
4525b7e208 libnm-core: team: change tx-hash APIs idx type from int to guint
(cherry picked from commit 4c7a841823)
2017-12-08 04:00:09 +01:00
Francesco Giudici
5d79b6cc42 libnm-core: team: rework defaults management on runner properties
till now when no explicit value was set on a property, the default value
for that property was returned, also if the property was not applicable
to the selected runner.
Fix this, showing default values for properties only when relevant and
showing instead -1 or null when the property is not relevant for the
selected runner.
Moreover, reset all the properties but the link-watchers when the team.runner
is changed: this is required to clean up the properties unrelated to the
new runner and start with the runner-specific defaults.

(cherry picked from commit a5642fd93a)
2017-12-08 04:00:08 +01:00
Francesco Giudici
07a49b30af libnm-core: team: use the correct name for teamd property 'balancing_interval'
the teamd 'runner.tx_balancer.balancing_interval' property was wrongly
set and searched as 'runner.tx_balancer.interval'. Fixed.

Fixes: fc3b7d61e2
(cherry picked from commit ed2a1a153b)
2017-12-08 04:00:08 +01:00
Francesco Giudici
dd18259c63 libnm-core: json: share code to load defaults in team(-port).config
Move code from _nm_utils_team_config_get to the brand new
_json_team_add_defaults function without any change.
Then remove the duplicated code from _nm_utils_team_config_equal and
leverage the new function. Here the only functional change is that
the defaults for "notify_peers" and "mcast_rejoin" for the
"activebackup" runner are added (the only case in which their default
values are different than 0).

(cherry picked from commit fdd41852ee)
2017-12-08 04:00:08 +01:00
Francesco Giudici
a2357fea43 libnm-core: trivial: just move static json functions
(cherry picked from commit f0ae71e7d6)
2017-12-08 04:00:08 +01:00
Francesco Giudici
ad1be3a472 libnm-core: trivial: move json key deletion code to a separate function
(cherry picked from commit 8648aa576e)
2017-12-08 04:00:08 +01:00
Francesco Giudici
e8eb416675 libnm-core: use proper writer for team-port link-watchers
(cherry picked from commit 16c9435c5b)
2017-12-08 04:00:08 +01:00
Francesco Giudici
07b1e80803 cli: add support to TeamPort link watchers
(cherry picked from commit c5228b8a83)
2017-12-08 04:00:08 +01:00
Francesco Giudici
704f0acb77 libnm-core: team-port: expose the new link-watchers property
It will allow explicit configuration of link-watchers in the team port
configuration.

(cherry picked from commit f094837d73)
2017-12-08 04:00:08 +01:00
Francesco Giudici
10745107f2 libnm-core: add keyfile writer for team link watcher
Allow tests to dump the content of the property when getting a failure.

(cherry picked from commit 0d8fcc39ab)
2017-12-08 04:00:08 +01:00
Francesco Giudici
62876cee9a libnm-core: synchronize team.link_watchers when team.config is set.
(cherry picked from commit 363a2cfe95)
2017-12-08 04:00:07 +01:00
Francesco Giudici
a1c25edfe8 libnm-core: synchronize team.config when team.link_watchers is set.
(cherry picked from commit e59878ce19)
2017-12-08 04:00:07 +01:00
Francesco Giudici
2eacf89f38 cli: add support to Team link watchers
(cherry picked from commit 4657390d45)
2017-12-08 04:00:07 +01:00
Francesco Giudici
466f8e0dd5 libnm-core: team: expose the new link-watchers property
It will allow explicit configuration of link-watchers in the team
configuration.

(cherry picked from commit ca816ae10e)
2017-12-08 04:00:07 +01:00
Francesco Giudici
574d70b2eb libnm-core: add backend for GVariant de/serialization of link_watchers.
(cherry picked from commit ba4ce843fa)
2017-12-08 04:00:07 +01:00
Francesco Giudici
e9d5836937 libnm-core: team: add NMTeamLinkWatcher boxed type
Team allows to specify multiple link watchers for each link.
Define a link watcher object in order to allow to specify multiple ones
for each Team configuration.

(cherry picked from commit 72f6d08714)
2017-12-08 03:59:59 +01:00
Francesco Giudici
000e02f56a ifcfg-rh: tests: align json team configuration format to jansson one
(cherry picked from commit 53821a4b13)
2017-12-08 02:18:01 +01:00
Francesco Giudici
5cbe512fd3 libnm-core: preserve keys order in team.config with old jansson libs
When jansson lib version is < 2.8 the order of the keys of json objects
is not preserved automatically. In particular, when loading the json
string, parsing it and dumping it back to a string the key order will be
lost if the now deprecated JSON_PRESERVE_ORDER flag is not set.
Add the flag: will do nothing on recent jansson versions but will fix
behavior for legacy ones.

(cherry picked from commit 5e6f7de4be)
2017-12-08 02:16:52 +01:00
Francesco Giudici
f5e358eb46 merge: branch 'fg/team_abstraction_rh1398925'
https://bugzilla.redhat.com/show_bug.cgi?id=1398925

(cherry picked from commit 9022b14478)
2017-12-08 02:10:27 +01:00
Francesco Giudici
921635d3ae libnm-core: enforce team and team-port defaults
Rework a bit the way default values are check, set and aligned.

(cherry picked from commit 3e34e404b4)
2017-12-08 02:10:27 +01:00
Francesco Giudici
5b9f4202d6 cli: add team-port properties
(cherry picked from commit 81527f1a09)
2017-12-08 02:10:27 +01:00
Francesco Giudici
8b171fd8ae libnm-core: enforce team-port config and properties alignment
Ensure .config is aligned when an explicit team-port is set and vice
versa

(cherry picked from commit ec60e01d39)
2017-12-08 02:10:26 +01:00
Francesco Giudici
7d9553da50 libnm-core: add explicit team properties to NMSettingTeamPort
(cherry picked from commit 1c99d379eb)
2017-12-08 02:10:22 +01:00