Commit graph

12926 commits

Author SHA1 Message Date
Antonio Cardace
2ce0e714b6
nm-device: apply ethtool ring settings when activating a connection
nm-device now applies ethtool ring settings during stage 2 "device
config" of the connection activation.

ring settings will be then restored (according to what the state
was before the connection got activated on the device) when the
connection is deactivated during the device cleanup.

One thing to be noted is that unset ring settings (in the profile)
will not be touched at all by NetworkManager so that if the NIC driver
sets some default values these will be preserved unless specifically
overridden by the connection profile.

https://bugzilla.redhat.com/show_bug.cgi?id=1614700
2020-05-20 10:55:02 +02:00
Antonio Cardace
2d2c111304
platform: add support for ring settings using ioctl()
https://bugzilla.redhat.com/show_bug.cgi?id=1614700
2020-05-20 10:55:02 +02:00
Antonio Cardace
e04e5a5c2a
ifcfg-rh: add support for ethtool ring settings
Also update unit tests.

https://bugzilla.redhat.com/show_bug.cgi?id=1614700
2020-05-20 10:55:01 +02:00
Thomas Haller
12063d6cb6
platform: simplify NMEthtoolCoalesceState to only track one state
Only in one moment we need the old and requested settings together:
during _ethtool_coalesce_set(). But for that we shouldn't track both
states in "NMEthtoolCoalesceState".

Simplify "NMEthtoolCoalesceState" to only contain one set of options.
By tracking less state, the code becomes simpler, because you don't
need to wonder where the old and requested state is used.
2020-05-20 10:54:57 +02:00
Beniamino Galvani
02ea74c920 core: signal parent-active only when the parent AC is activated
The parent-active signal is used by the manager to determine when the
parent active-connection is ready and a connection that depend on it
can proceed.

The AC state could transition from ACTIVATING directly to
DEACTIVATING; in such case we should not emit the signal but instead
just stop watching the parent AC.

Fixes: 6e382ea91d ('active-connection: add parent active connection tracking')
https://bugzilla.redhat.com/show_bug.cgi?id=1778073
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/510
2020-05-19 21:40:51 +02:00
Beniamino Galvani
3e2b723532 device: use the nm-shared firewalld zone in shared mode
When the interface is in IPv4 or IPv6 shared mode and the user didn't
specify an explicit zone, use the nm-shared one.

Note that masquerade is still done through iptables direct calls
because at the moment it is not possible for a firewalld zone to do
masquerade based on the input interface.

The firewalld zone is needed on systems where firewalld is using the
nftables backend and the 'iptables' binary uses the iptables API
(instead of the nftables one). On such systems, even if the traffic is
allowed in iptables by our direct rules, it can still be dropped in
nftables by firewalld.
2020-05-15 19:06:24 +02:00
Beniamino Galvani
fa4fbd3333 ip-tunnel: set ip6gretap MAC address when creating the link 2020-05-15 09:48:25 +02:00
Beniamino Galvani
0494a84878 ip-tunnel: set cloned-mac-address only for layer2 tunnel devices
For ip-tunnel modes that encapsulate layer2 packets (gretap and
ip6gretap) we allow the presence of an ethernet setting in the
connection and honor the cloned-mac-address specified in it.

For all other modes, the ethernet setting is removed during
normalization, but a value different from 'preserve' could be set via
global default.

The kernel doesn't allow setting a MAC for layer3 devices, don't do
it.
2020-05-15 09:48:25 +02:00
Thomas Haller
0f22f77b1c
shared: support stripping whitespace from nm_utils_buf_utf8safe_unescape()
When parsing user input if is often convenient to allow stripping whitespace.
Especially with escaped strings, the user could still escape the whitespace,
if the space should be taken literally.

Add support for that to nm_utils_buf_utf8safe_unescape().

Note that this is not the same as calling g_strstrip() before/after
unescape. That is, because nm_utils_buf_utf8safe_unescape() correctly
preserves escaped whitespace. If you call g_strstrip() before/after
the unescape, you don't know whether the whitespace is escaped.
2020-05-13 10:28:04 +02:00
Antonio Cardace
e2be41cbbe
nm-device: apply ethtool coalesce settings when activating a connection
nm-device now applies ethtool coalesce settings during stage 2 "device
config" of the connection activation.

Coalesce settings will be then restored (according to what the state
was before the connection got activated on the device) when the
connection is deactivated during the device cleanup.

One thing to be noted is that unset coalesce settings (in the profile)
will not be touched at all by NetworkManager so that if the NIC driver
sets some default values these will be preserved unless specifically
overridden by the connection profile.

https://bugzilla.redhat.com/show_bug.cgi?id=1614700
2020-05-13 10:15:23 +02:00
Antonio Cardace
d8f551cf4a
platform: add support for coalesce settings using ioctl()
https://bugzilla.redhat.com/show_bug.cgi?id=1614700
2020-05-13 10:15:23 +02:00
Antonio Cardace
4fce8b3efb
ifcfg-rh: add support for ethtool coalesce settings
Also update unit tests.

https://bugzilla.redhat.com/show_bug.cgi?id=1614700
2020-05-13 10:15:23 +02:00
Antonio Cardace
b0240db068
ethtool: add coalesce settings
This is the initial support for coalesce settings and only allows
getting/setting, nothing is yet implemented in nm-device.

Also add unit test.

https://bugzilla.redhat.com/show_bug.cgi?id=1614700
2020-05-13 10:15:23 +02:00
Sven Schwermer
99efe69f68
wwan: Set MTU based on what ModemManager exposes
Signed-off-by: Sven Schwermer <sven.schwermer@disruptive-technologies.com>
2020-05-13 10:07:33 +02:00
Thomas Haller
1c216ca3be
wifi: drop extra conditions in nm_wifi_utils_parse_ies() and use NM_SET_OUT()
NM_SET_OUT() macro already has an "if" condition to only do
anything if the output pointer is not NULL.

As such, we don't need to check first. In practice, this only reorders
the checks, which the compiler may anyway do.

Note that above the checks are still relevant, because we want to
avoid the more expensive parsing, if we don't care about the result.
2020-05-12 14:41:09 +02:00
Thomas Haller
b7a2e73bd2
core: add FIXME(release-blocker) comments for match.kernel-command-line behavior
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/431#note_490830
2020-05-12 09:39:51 +02:00
Thomas Haller
b533bef8cd
ovs: enable trace logging not only with NM_MORE_LOGGING
The logging is useful. Always compile it in.
2020-05-08 14:24:14 +02:00
Thomas Haller
2929392855
all: use "int/char" instead of "gint/gchar" typedefs
This is also recommended by our checkpatch.pl script.
2020-05-08 12:56:29 +02:00
Thomas Haller
6044fce960
bridge: refactor definition of options array to use a macro and C99 designated initializer
Yes, it's a macro and it's more lines of code.

But I think this is much easier to read and to maintain.
2020-05-08 08:02:51 +02:00
Thomas Haller
7c22710c17
libnm: use boolean values for range of NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE in slave_options 2020-05-08 08:02:51 +02:00
Thomas Haller
bfcfdc2955
libnm: adjust bridge defines NM_BRIDGE_VLAN_STATS_ENABLED_DEF 2020-05-08 08:02:51 +02:00
Thomas Haller
f34144f70b
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_STARTUP_QUERY_INTERVAL_* 2020-05-08 08:02:51 +02:00
Thomas Haller
55311c6a6a
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_STARTUP_QUERY_COUNT_* 2020-05-08 08:02:51 +02:00
Thomas Haller
433bb1fbe4
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_SNOOPING_DEF 2020-05-08 08:02:50 +02:00
Thomas Haller
96bb90a1ef
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_QUERY_USE_IFADDR_DEF 2020-05-08 08:02:50 +02:00
Thomas Haller
0db1d28e6d
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_QUERY_RESPONSE_INTERVAL_* 2020-05-08 08:02:50 +02:00
Thomas Haller
58001f70e8
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_QUERY_INTERVAL_* 2020-05-08 08:02:50 +02:00
Thomas Haller
08cfe812ec
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_QUERIER_DEF 2020-05-08 08:02:50 +02:00
Thomas Haller
da6bbd73aa
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_QUERIER_INTERVAL_* 2020-05-08 08:02:50 +02:00
Thomas Haller
a75ec12d8b
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_MEMBERSHIP_INTERVAL_* 2020-05-08 08:02:50 +02:00
Thomas Haller
ec9e58ee01
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_LAST_MEMBER_INTERVAL_* 2020-05-08 08:02:50 +02:00
Thomas Haller
769b176263
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_LAST_MEMBER_COUNT_* 2020-05-08 08:02:50 +02:00
Thomas Haller
4c3691e52e
libnm: adjust bridge defines NM_BRIDGE_PORT_PATH_COST_* 2020-05-08 08:02:49 +02:00
Thomas Haller
a7421f8bf2
libnm: adjust bridge defines NM_BRIDGE_PORT_PRIORITY_* 2020-05-08 08:02:49 +02:00
Thomas Haller
a690cedcba
libnm: adjust bridge defines NM_BRIDGE_PRIORITY_* 2020-05-08 08:02:49 +02:00
Thomas Haller
e2cb0837cc
libnm: adjust bridge defines NM_BRIDGE_MAX_AGE_* 2020-05-08 08:02:49 +02:00
Thomas Haller
d7dd4c70d0
libnm: adjust bridge defines NM_BRIDGE_HELLO_TIME_* 2020-05-08 08:02:49 +02:00
Thomas Haller
696fae40b7
libnm: adjust bridge defines NM_BRIDGE_STP_DEF 2020-05-08 08:02:49 +02:00
Thomas Haller
8ee4dbf709
libnm: adjust bridge defines NM_BRIDGE_FORWARD_DELAY_* 2020-05-08 08:02:49 +02:00
Thomas Haller
f61e354cfa
libnm: adjust bridge defines NM_BRIDGE_AGEING_TIME_* 2020-05-08 08:02:48 +02:00
Thomas Haller
f5527ecc5a
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_HASH_MAX_* 2020-05-08 08:02:48 +02:00
Thomas Haller
4338cf3800
ifcfg-rh/trivial: rename variable i in write_bridge_*setting() to indicate integer type 2020-05-08 08:02:48 +02:00
Thomas Haller
9996597666
ifcfg: refactor GObject accessors in write_bridge_setting() 2020-05-08 08:02:48 +02:00
Thomas Haller
83830badda
device: use NM_G_PARAM_SPEC_GET_DEFAULT_*() in NMDeviceBridge's commit_option() 2020-05-08 08:02:48 +02:00
Thomas Haller
6e9967939b
acd: fix char buffer argument to _acd_event_to_string_buf() 2020-05-08 07:43:27 +02:00
Thomas Haller
85fa23a6b5
config: minor cleanup in _sort_groups_cmp() and _intern_config_write_sort_fcn() 2020-05-07 14:08:34 +02:00
Thomas Haller
9ea7bf0da7
config: use nm_streq() and NM_STR_HAS_PREFIX() in "nm-config.c"
- nm_streq() is easier to read.

- NM_STR_HAS_PREFIX() works only with string literals, and gets
  inlined up to one strncmp() call. There is no need to call glib,
  to determine strlen(prefix) (that we already know), and then to
  call strncmp().
2020-05-07 14:08:34 +02:00
Thomas Haller
ff321e250e
config: use NM_STR_HAS_PREFIX_WITH_MORE() instead of duplicate implementation 2020-05-07 14:08:33 +02:00
Thomas Haller
3201b06925
config: use cleanup attribute in read_config() 2020-05-07 14:08:33 +02:00
Thomas Haller
f588dabb4f
settings: ensure that "plugins-=ifcfg-rh" works with the default plugins
On Fedora/RHEL, the default for main.plugins is "ifcfg-rh". You would
expect that a single configuration file

  [main]
  plugins-=ifcfg-rh

would result in an empty list of plugins (which subsequently gets
completed with "keyfile").

That didn't happen due to a bug. Fix it.
2020-05-07 14:08:33 +02:00