Commit graph

19109 commits

Author SHA1 Message Date
Lubomir Rintel
775893fc00 ifcfg-rh: add tc support
Format:

  QDISC1=ingress
  QDISC2="root handle 1234: fq_codel"
  FILTER1="parent ffff: matchall action simple sdata Input"
  FILTER2="parent 1234: matchall action simple sdata Output"

(cherry picked from commit 902bbfdb18)
2017-12-11 19:53:09 +01:00
Lubomir Rintel
626bf76972 device: set traffic filters when device comes up
(cherry picked from commit 8bffb2c750)
2017-12-11 19:53:09 +01:00
Thomas Haller
014b50fcbe platform: fix TC to-string/hash/cmp functions to include the action
Also add a define NM_PLATFORM_ACTION_KIND_SIMPLE. It makes the
uses of "simple" grepable.

(cherry picked from commit fe3d7209e7)
2017-12-11 19:53:09 +01:00
Lubomir Rintel
97eeadb990 platform: add support for traffic filters
(cherry picked from commit b0fd3ecbaf)
2017-12-11 19:53:09 +01:00
Lubomir Rintel
81967af3fc clients: add tc tfilter support
What works:

  nmcli c add con-name dum0 ifname dum0 type dummy \
      tc.tfilters 'parent 1234: matchall action drop, parent ffff: matchall action drop'
  nmcli c modify dum0 -tc.tfilters 'parent ffff: matchall action drop'
  nmcli c modify dum0 +tc.tfilters 'parent ffff: matchall action simple sdata Hello'

(cherry picked from commit 3261820004)
2017-12-11 19:43:40 +01:00
Lubomir Rintel
e881d0ab33 keyfile/tests: test tc traffic filter reading and writing
(cherry picked from commit bc471c8e7a)
2017-12-11 19:43:37 +01:00
Lubomir Rintel
6237650803 keyfile: add ability to read/write tc filters
The idea is

  tfilter.<parent>=[handle <handle>] <tfilter> [<options>] [action [<action options>...]]

What works now:

  [tc]
  qdisc.root=handle 1234: fq_codel
  qdisc.ffff:fff1=ingress
  tfilter.1234:=matchall action drop
  tfilter.ffff:=matchall action simple sdata Hello

(cherry picked from commit 2e8fc6947d)
2017-12-11 19:43:08 +01:00
Thomas Haller
7257c5ec83 libnm: disable g_warning() from library
Printing a g_warning() from the library is not helpful.

Client-side, libnm should support newer server versions and changing
formats. To support forward-compatibility, it should parse the received
GVariant best-effort like, without complaining.

Server-side, libnm-core should return errors when receiving invalid
configuration. It must not maintain forward-compatibility, only
backward-compatibility -- which is implemented by handling old
and newer formats. But never should server allow a configuration
that is invalid.

Currently, the libnm API cannot yet fail at this point. Hence,
it cannot return an error. It would need a strict and relaxed
parsing mode. Until that exists, just comment out the warnings.

(cherry picked from commit 7cd2b6178d)
2017-12-11 19:42:39 +01:00
Lubomir Rintel
0e7a179910 libnm-core/tests: test NMSettingTCConfig traffic filter support
(cherry picked from commit dbef7e684f)
2017-12-11 19:42:11 +01:00
Lubomir Rintel
69d86d91b3 libnm-core: add functionality for dealing with tc-style traffic filter specifiers
Tailored to fit both nmcli and keyfile needs.

(cherry picked from commit de41c45e61)
2017-12-11 19:40:22 +01:00
Lubomir Rintel
457a17ae83 libnm-core: add traffic filter support to NMSettingTCConfig
(cherry picked from commit e035cb7be0)
2017-12-11 19:38:37 +01:00
Lubomir Rintel
4a35c71354 libnm-core/tests: test NMSettingTCConfig action support
(cherry picked from commit 883e565b7d)
2017-12-11 19:38:35 +01:00
Lubomir Rintel
946bbcc69d libnm-core: add functionality for dealing with tc-style action specifiers
Tailored to fit both nmcli and keyfile needs.

(cherry picked from commit 733464ada3)
2017-12-11 19:36:53 +01:00
Thomas Haller
ddd3fa8ee2 libnm-core: consider attributes in nm_tc_action_equal()
(cherry picked from commit b0ba17e903)
2017-12-11 19:36:26 +01:00
Lubomir Rintel
fa8e896f94 libnm-core: add action support to NMSettingTCConfig
The actions are not too useful my themselves, but it will be possible to
embed them into traffic filters in subsequent commits.

(cherry picked from commit 7c8ce778fb)
2017-12-11 19:34:44 +01:00
Lubomir Rintel
f8da7febbc device: set qdiscs when device comes up
(cherry picked from commit e4bdb21909)
2017-12-11 19:34:31 +01:00
Lubomir Rintel
47e5e3ba7d clients: add tc qdisc support
What works:

  nmcli c add con-name dum0 ifname dum0 type dummy \
      tc.qdiscs 'ingress, root pfifo_fast'
  nmcli c modify dum0 -tc.qdiscs 'root pfifo_fast'
  nmcli c modify dum0 +tc.qdiscs 'root handle 666: fq_codel'

(cherry picked from commit 92f8f30d47)
2017-12-11 19:06:31 +01:00
Lubomir Rintel
bb50e73626 keyfile/tests: test tc qdisc reading and writing
(cherry picked from commit 8547387942)
2017-12-11 19:06:28 +01:00
Lubomir Rintel
f3d127c502 keyfile: add ability to read/write qdiscs from tc setting
The format for qdiscs is

  qdisc.<parent>=[handle <handle>] <qdisc> [<options>...]

E.g.:

  [tc]
  qdisc.root=fq_codel handle de4d:
  qdisc.ffff:fff1=ingress

That is pretty much what is supported at this point.

(cherry picked from commit 9d0eeb30b6)
2017-12-11 19:06:23 +01:00
Lubomir Rintel
650fcffb9a libnm-core/tests: test NMSettingTCConfig qdisc support
...so that we have an excuse when it breaks.

(cherry picked from commit 0ab77ebd1d)
2017-12-11 19:06:17 +01:00
Lubomir Rintel
0bae63d701 libnm-core: add functionality for dealing with tc-style qdisc specifiers
Tailored to fit both nmcli and keyfile needs.

(cherry picked from commit 7c1de05f41)
2017-12-11 19:05:10 +01:00
Lubomir Rintel
93b3fc8c57 libnm-core: add NMSettingTCConfig with qdisc support
Currently is only able to hold the queueing disciplines.

(cherry picked from commit da13c7a1a4)
2017-12-11 19:04:02 +01:00
Lubomir Rintel
ea532fd527 platform/tests: tests qdisc caching behavior
Just the most rudimentary tests.

(cherry picked from commit 0b0fb045bc)
2017-12-11 19:00:51 +01:00
Lubomir Rintel
f29db02aac platform: add support for queueing disciplines
(cherry picked from commit ff9f27eb12)
2017-12-11 19:00:46 +01:00
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