- add new file 'nm-platform-utils.c' and moves some independent utility
functions there (ethtool, udev).
- some refactoring of platform code, including initialization of
NMPlatform instance.
- run platform tests in a separate user namespace, which allow
us to run root-tests as non-root.
https://bugzilla.gnome.org/show_bug.cgi?id=747981
There is no general purpose file for platform utilities.
We only have nm-platform.h, which contains (mostly) functions
that operate on a NMPlatform instance (and that can be mocked
using NMFakePlatform).
Add a new file for independent utility functions. nm-platform-utils.c
should not call into functions having a NMPlatform instance, to
have them independent from platform caching and the platform
singleton.
nm_platform_query_devices() would raise an 'added' signal
for all its links. That is bad style because it could
confuse other listeners for platform signals which don't
expect such artificial change signals.
The public API of NMPlatform already gives NMManager the ability
to 'pull' all the links and iterate them itself.
Before, nm_platform_query_devices() would also initialize udev
devices, so there was a more compelling reason for this function.
We already populate the netlink cache in constructed(). No need
to wait with udev devices until nm_platform_query_devices(). Just
do it right away.
Add a hack to keep 'lo' default-unmanaged. Now that we load
udev devices earlier, we end up clearing the default-unmanged
flag on 'lo', which has bad consequences.
We don't want error logging for nm_platform_link_add() which
tries to load the bonding module. Later we will run tests as non-root,
where modprobe will fail. Logging an error would break the tests.
Even if asserts are not enabled, still let the compiler see what we would
assert. Otherwise, we get warnings about unused variables or we migth miss
compile errors inside nm_assert().
Since introduction for support of ip6-privacy (use_tempaddr,
RFC4941) with commit d376270bfe,
the sysctl value from /etc was always read first.
This is problematic, because an explicit setting in the
connection should not be ignored over a global configuration.
Drop that old behavior. It was also problematic, because we did
not read any files under /etc/sysctl.d (except for sysctl.conf).
Also, we did not honor per-interface configurations.
Now we also use as last fallback the value from
/proc/sys/net/ipv6/conf/default/use_tempaddr
That has the advantage of falling back to the system default value
so that NM doesn't need to have it's own default policy
(Related: https://bugzilla.redhat.com/show_bug.cgi?id=1187525).
This is a change in behavior.
Support default value for setting 'ipv6.ip6-privacy' in
NetworkManager.conf.
If the global value is unset, preserve old behavior of looking into
/etc/sycctl.conf first. That behavior was introduced with commit
d376270bfe, since we support ip6-privacy
setting.
If the global value is set to "unknown", add a new fallback
that instead reads the runtime value from
"/proc/sys/net/ipv6/conf/default/use_tempaddr"
This seems more sensible behavior because we fallback to sysctl,
but instead of looking at static files in /etc, read /proc.
But to preserve the old behavior, we only do that when a global
value is configured at all.
https://bugzilla.gnome.org/show_bug.cgi?id=721200
The route-metric can be configured per connection via the
ipv4.route-metric and ipv6.route-metric fields. When the
value is left at -1 (the default), we would determine the
route-metric based on the device type (nm_device_get_priority()).
Extend that scheme by making the default value overwritable in
NetworkManager.conf.
Add support for a new section [connection] in NetworkManager.conf.
If the connection leaves an option at "unknown"/"default", we can
support overwriting the value from global configuration.
We also support other sections that are named with "connection"
as a prefix, such as [connection2], [connection-wifi]. This is
to support multiple default values that can be applied depending
on the used device.
I think this has great potential. Only downside is that when
the user looks at a connection value, it will see that it is
unspecified. But the actually used value depends on the device
type and might not be obvious.
https://bugzilla.gnome.org/show_bug.cgi?id=695383https://bugzilla.redhat.com/show_bug.cgi?id=1164677
Add a function to get a concise representation of the
device type.
libnm already has nm_device_get_type_description() for that
and it is shown by
nmcli -f GENERAL.TYPE device show
Reimplement that function for nm-core. Just take care that the
two implementations don't diverge.
You can reset the default value via
$ nmcli connection modify id CON ipv4.dns-options ""
and set an empty value with
$ nmcli connection modify id CON ipv4.dns-options " "
The advantage of this is that if we later add another function
pointer we don't have to touch any existing calls which would
only pass NULL to that argument.
Using a variadic argument and partial initialization of an
auto variable gives us that flexibility.
Instead of having a get_func() and out2in_func(), have only one
get_func() that accepts an argument of the output format.
This way, a conversion to parsable input format, doesn't have to go
first thourgh get_func() and mangle the pretty string in out2in_func().
This fixes conversions via nmc_property_out2in_cut_paren().
For example, nmc_property_802_1X_get_private_key_password_flags()
would return a localized string _("0 (none)"). There is no guarantee
that out2in_func() would find the expected output format after
localizing.
This also fixes nmc_property_out2in_routes() which expected
a format "dst =" (would be "ip =") and expects mandatory
'nh' and 'mt' arguments. In fact, the regex didn't match and
nmc_property_out2in_routes() always failed.
While at it, also combine the implementation of
nmc_property_ipv4_get_routes() and nmc_property_ipv6_get_routes().
Previously, it would silently accept a value set to "empty".
This is however not a valid number and we should raise a
warning just like for any other invalid number.
Before, get_property_for_dbus() would @ignore_defaults.
That is for example wrong for properties of type G_TYPE_STRV.
In this case, if one operand has the property at its default
(NULL) and the other has it to an empty string list, both would
compare equal.
This has the effect that different settings might compare equal.
When generating a connection to assume it, also record the route-metric.
Do that by looking at the metric of the (best) default-route.
This is especially important since d51975ed92.
Now NM would also manage the default-route for assumed connections.
So the generated assumed connection would have a route metric based on
the device type, which might differ from the external configuration.
This caused NM to replace the externally configured default-route.
https://bugzilla.gnome.org/show_bug.cgi?id=750405
If the valgrind logfile is empty, don't log an error message with
the location of the logfile.
Also, if the test didn't fail due to memleaks, log a different message.
Turns out the dconf modules is leaky and breaks the valgrind run. In any case,
it's not a good idea to load the modules for the daemon, it just takes time
and memory.
On a Fedora/x86_64 desktop it adds up to 5M to the RSS.