Commit Graph

21088 Commits

Author SHA1 Message Date
Lubomir Rintel
7c1de05f41 libnm-core: add functionality for dealing with tc-style qdisc specifiers
Tailored to fit both nmcli and keyfile needs.
2017-12-11 10:52:22 +01:00
Lubomir Rintel
da13c7a1a4 libnm-core: add NMSettingTCConfig with qdisc support
Currently is only able to hold the queueing disciplines.
2017-12-11 10:52:22 +01:00
Lubomir Rintel
0b0fb045bc platform/tests: tests qdisc caching behavior
Just the most rudimentary tests.
2017-12-11 10:52:22 +01:00
Lubomir Rintel
ff9f27eb12 platform: add support for queueing disciplines 2017-12-11 10:52:22 +01:00
Thomas Haller
82befe3c40 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.
2017-12-11 10:50:43 +01:00
Thomas Haller
7573594a21 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.
2017-12-11 10:30:26 +01:00
Lubomir Rintel
44be0dfca7 platform/nmp-object: (trivial) keep enum ordered by a numeric value 2017-12-11 10:30:26 +01:00
Lubomir Rintel
ffe89f86e0 platform/linux: stringify also NLMSG_* in logs 2017-12-11 10:30:26 +01:00
Lubomir Rintel
273fb58e35 generate-setting-docs: document aa{sv} type
Will be useful for tc qdiscs.
2017-12-11 10:30:26 +01:00
Lubomir Rintel
93ac0e455b 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.
2017-12-11 10:30:26 +01:00
Lubomir Rintel
18dd937b81 libnm-core/utils: allow use of bytestring with attributes 2017-12-11 10:30:26 +01:00
Lubomir Rintel
47b1dc3828 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
2017-12-11 10:30:26 +01:00
Lubomir Rintel
48a619e62b libnm-core/utils: allow using the same character for key/value and attribute separators
Allows doing a nm_utils_parse_variant_attributes(..., ' ', ' ').
2017-12-11 10:30:26 +01:00
Lubomir Rintel
9a00750c06 libnm-core/utils: (trivial) use g_set_error_literal() where appropriate 2017-12-11 10:30:25 +01:00
Lubomir Rintel
b49c7e026f ifcfg-rh: drop unused functions
Perhaps a cargo cult leftover.
2017-12-11 10:30:25 +01:00
Lubomir Rintel
17462a5a5f ifcfg-rh: drop unused and confusing error arguments 2017-12-11 10:30:25 +01:00
Lubomir Rintel
0583f8bb3c platform/tests: add a missing copyright notice 2017-12-11 10:30:25 +01:00
Lubomir Rintel
23b7f24d9e platform/tests: drop bad comment 2017-12-11 10:30:25 +01:00
Thomas Haller
45ad3ec886 core: fix typo for logging of NMSettingsConnectionFlags "nm-generated"
Fixes: c3dd5d8df2
2017-12-11 09:56:57 +01:00
Thomas Haller
b11eac1a0d libnm: use nm_utils_named_values_from_str_dict()
Make use of NMUtilsNamedValue in nm_utils_format_variant_attributes().
This avoids creating a GList and sorting it.

Also, reuse nm_utils_named_values_from_str_dict() in
nm_setting_bond_get_option().
2017-12-08 18:48:36 +01:00
Thomas Haller
097bd72e2e shared: add nm_utils_named_values_from_str_dict()
NMUtilsNamedValue's purpose is precisely to create
a list and sort by entires.

Add nm_utils_named_values_from_str_dict() as helper
function to do that.
2017-12-08 18:47:37 +01:00
Thomas Haller
e7d18548b9 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.
2017-12-08 16:31:28 +01:00
Thomas Haller
ae5af6b368 libnm: adjust symbol versioning after backporting team API to 1.10.2
The team API was backported to nm-1-10 branch.
It will be released both as 1.12.0 and 1.10.2.

To ensure the upgrade path from 1.10.2+ to 1.12+ works, the symbols
in libnm must be present on both versions.

Usually, we would duplicate the symbols on master via
NM_BACKPORT_SYMBOL() macro.

However, as we are sure that we will release 1.10.2 before 1.12.0,
we can just update the linker version of these symbols. So, although
the symbols will be first released on major release 1.12.0, their linker
version tag is libnm_1_10_2, to ease upgrade and to avoid duplicating the
symbols.
2017-12-08 13:48:58 +01:00
Thomas Haller
41803aac2d libnm: fix libnm.ver file to export libnm_1_10_2 ABI
Fixes: cb9facdfef
2017-12-08 13:43:49 +01:00
Thomas Haller
6c93e32212 libnm: don't use g_strsplit_set() to search string for invalid characters 2017-12-08 11:09:34 +01:00
Thomas Haller
79d5a06c8b build: don't link libnm against libjansson when building --without-json-validation
Also, don't add the CFLAGS for libjansson to dflt_cppflags_libnm_core.
dflt_cppflags_libnm_core is used also by core and libnm. But those
components do not (directly) link against libjansson. The cannot use
these flags.
2017-12-08 11:09:34 +01:00
Thomas Haller
b1c65d32fe Revert "Makefile: rework team compilation flags"
I don't think we should do this.

- renamining/dropping configure options is still an annoyance,
  because it requires to different ./configure options depending
  on the version. The rename from --enable-teamctl to --enable-team
  might be theoretically nice, but more annoying then helpful.

- There is no strict dependency between --enable-team and
  --enable-json-validation. At most, one could argue that
  when enabling the team plugin (--enable-teamctl), then
  libnm must also be build with --enable-json-validation.
  But in fact, the team plugin will happily work with a
  libnm that doesn't link against libjansson.
  That is --enable-teamctl --disable-json-validation will work
  in practice just fine.
  On the other hand, libnm is a client library to create connection
  profiles, fully supporting team profiles also makes sense if the
  actual plugin is not installed (or build). Thus, --disable-teamctl
  --enable-json-validation certainly makes sense.

At this point, one might ask whether libnm is even still complete without
libjansson. Maybe libnm should *require* --enable-json-validation.
But that is not what the patch was doing, and it would also need
some careful consideration before doing so.

This reverts commit 9d5cd7eae8.
2017-12-08 09:07:30 +01:00
Thomas Haller
af6f62be8d libnm/tests: fix memleak in test 2017-12-08 08:51:21 +01:00
Thomas Haller
d5d4911b58 gitignore: readd removed libnm-core/tests/test-setting* programs
Although removed, they show up whenever switching to an
old branch. Keep ignoring them.
2017-12-08 08:45:51 +01:00
Thomas Haller
1b8ae83967 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.
2017-12-08 08:39:02 +01:00
Francesco Giudici
4d1796b2c7 merge: branch 'fg/team_abstraction_tests_and_fixes_rh1398925'
https://bugzilla.redhat.com/show_bug.cgi?id=1398925
2017-12-08 00:53:46 +01:00
Francesco Giudici
9d5cd7eae8 Makefile: rework team compilation flags
Rename the team functionality enablement from 'teamdctl' to 'team'.
Force jansson lib requirement for team functionality: NetworkManager
requires the teamd daemon to manage team. As teamd depends upon jansson
lib, adding jansson requirement for teaming support in NetworkManager
seems reasonable.
Remove the jansson_validation flag, as the only generic json function in
nmcli (not related to team) was the one to check if a string was in json
format. Anyway, that function is used for team checks only. So, move
also json validation functions under the WITH_TEAM flag.
2017-12-08 00:46:27 +01:00
Francesco Giudici
b5f0d61d03 libnm-core: add test cases for NMSettingTeamPort 2017-12-08 00:46:27 +01:00
Francesco Giudici
1248969342 libnm-core: add test cases for NMSettingTeam 2017-12-08 00:46:27 +01:00
Francesco Giudici
540b7b3dfd 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.
2017-12-08 00:46:27 +01:00
Lubomir Rintel
9bb30f86ec libnm-core: merge the settings tests into a single one
Thomas likes this more and who am I to argue.
2017-12-08 00:46:27 +01:00
Francesco Giudici
bb4c95e168 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.
2017-12-08 00:46:27 +01:00
Francesco Giudici
4c7a841823 libnm-core: team: change tx-hash APIs idx type from int to guint 2017-12-08 00:46:27 +01:00
Francesco Giudici
a5642fd93a 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.
2017-12-08 00:46:27 +01:00
Francesco Giudici
ed2a1a153b 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
2017-12-08 00:46:27 +01:00
Francesco Giudici
fdd41852ee 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).
2017-12-08 00:46:27 +01:00
Francesco Giudici
f0ae71e7d6 libnm-core: trivial: just move static json functions 2017-12-08 00:46:27 +01:00
Francesco Giudici
8648aa576e libnm-core: trivial: move json key deletion code to a separate function 2017-12-08 00:46:27 +01:00
Francesco Giudici
16c9435c5b libnm-core: use proper writer for team-port link-watchers 2017-12-08 00:46:26 +01:00
Francesco Giudici
c5228b8a83 cli: add support to TeamPort link watchers 2017-12-08 00:46:26 +01:00
Francesco Giudici
f094837d73 libnm-core: team-port: expose the new link-watchers property
It will allow explicit configuration of link-watchers in the team port
configuration.
2017-12-08 00:46:26 +01:00
Francesco Giudici
0d8fcc39ab libnm-core: add keyfile writer for team link watcher
Allow tests to dump the content of the property when getting a failure.
2017-12-08 00:46:26 +01:00
Francesco Giudici
363a2cfe95 libnm-core: synchronize team.link_watchers when team.config is set. 2017-12-08 00:46:26 +01:00
Francesco Giudici
e59878ce19 libnm-core: synchronize team.config when team.link_watchers is set. 2017-12-08 00:46:26 +01:00
Francesco Giudici
4657390d45 cli: add support to Team link watchers 2017-12-08 00:46:26 +01:00