The NMVpnPluginInfo is essentially the .name file, that is, a
configuration file about the plugin itself. Via NMVpnPluginInfo
instance, the NMVpnEditorPlugin can be created.
Usually, one would create a NMVpnPluginInfo (that is, reading the
.name file) and then create a NMVpnEditorPlugin instance from there.
In this case, usually the editor-plugin is owned by the plugin-info
instance (although the API allows for creating the editor-plugin
independently).
Now, pass the NMVpnPluginInfo to the editor-plugin too.
This is useful, because then the editor-plugin can look at the .name
file.
The .name file is not user configuration. Instead it is configuration
about the plugin itself. Although the .name file is part of the plugin
build artefacts, it is useful to allow the plugin to access the .name
file. The reason is, that this can allow the user to easily change a
configuration knob of the plugin without requiring to patch or the
plugin.
At various places, nmcli requires to specify a VPN type by name, for example
$ nmcli connection add type vpn ifname '*' vpn-type $VPN_TYPE
This $VPN_TYPE used to be a hard-coded list of known VPN plugin names.
But actually, it should be a VPN service-type. A service-type used to be
the D-Bus name of the VPN plugin. Now, with multiple VPN support that
is no longer the case, but it still has the form of a D-Bus bus name.
Alternativley, it could be an alias, which is just a way for plugins
to support multiple service-types.
Fix that, to support fully qualified service-types in the form
of D-Bus bus names. Also, support lookup by name, in which case
the present plugin-info instances are searched.
Finally, support a list of hard-code short-names.
All the logic how to translate a short-name to a fully qualified
service-type is now inside libnm, so that various user agree on
those names and don't have to hard-code them each.
Refactor code to add function _list_find_by_service(), which will be used in the
next commit.
A notable change is that we now search also through the aliases
together with the service-name.
That makes a difference, if one plugin privdes an "alias" which another
plugin provides as "service". Due to that change, we would also find the
aliased plugin first.
In practice it shouldn't matter, because different plugins are
not supposed to provide identical services.
g_qsort_with_data() passes the pointers to the compared items to the
compare function, that is not the "const char *" pointers itself.
Fixes: 41976e3069
Commit bdd0e7fec0 which added symbol
nm_setting_ip_config_get_dns_priority to libnm_1_4_0 was backported
to nm-1-2 in commit ad1cdcf6571da23e3197b09f1b4b14d23b8899d1.
Add the backported symbol to master to allow seemless upgrading
from 1.2.4 to 1.4.0.
Assertions like g_assert*() and g_return_*() contain the stringified
test expression. This string ends up in the binary and increases its
size.
We usually don't have failing assertions. These string are a waste,
instead the file and line number shall suffice.
It reduces the striped size of the NetworkManager binary from 2500k
to 2392k, that is -108k, -4.3%.
This changes
- "g_assert (1 == 2);"
from: NetworkManager:ERROR:source.c:347:some_function: assertion failed: (1 == 2)
to: NetworkManager:ERROR:source.c:347:<unknown-fcn>: assertion failed: (<dropped>)
- "g_return_if_fail (1 == 2);"
from: (process:21024): NetworkManager-CRITICAL **: some_function: assertion '1 == 2' failed
to: (process:21024): NetworkManager-CRITICAL **: ((source.c:347)): assertion '<dropped>' failed
When doing a non-debug build, those string are now removed. Debug-builds
can be enabled by setting --with-more-assert=$LEVEL to larger then zero.
https://bugzilla.gnome.org/show_bug.cgi?id=767296
A failure to g_return*() by default prints a g_critical() with stringifing the
condition. Add a macro NMTST_G_RETURN_MSG() that reproduces that line to more
accurately match the failure message.
When a reverse DNS entry must be added to dnsmasq, instead of
considering IP addresses as classful use the prefix to compute one or
more "in-addr.arpa" according to CIDR rules.
https://bugzilla.gnome.org/show_bug.cgi?id=767174
There are valid failures, for which sanitizer would kill
NetworkManager:
audit[1380]: AVC avc: denied { setrlimit } for pid=1380 comm="NetworkManager" scontext=system_u:system_r:NetworkManager_t:s0 tcontext=system_u:system_r:NetworkManager_t:s0 tclass=process permissive=0
NetworkManager[1380]: ==1380==ERROR: AddressSanitizer setrlimit() failed 13
Disable sanitizer to make debug builds working again, at least for now.
The linking test causes a crash to check whether libnm and libnm-util
are both linked. If abrt or systemd-coredump are enabled, the core
dump processing will take a long time when the address sanitizer is
enabled, due to the huge process address space. It seems a good choice
to disable the test when NM was compiled with -fsanitize=address.
This adds two new options to the configure scripts to compile NM,
clients and libraries with the address and undefined-behavior
sanitizers available in recent GCC versions. Clang is not supported at
moment.
We break the aliasing rules in the code, and thus the flag should
always be enabled to prevent wrong optimizations, even without
--enable-more-warnings.
It contains useful macros for determining compiler support for
flags/attributes. We already similar macros in compiler_options.m4,
but the plan is to replace them.
With
[main]
#dns=
we would see in the log:
dns-mgr: init: dns=(null), rc-manager=symlink
Instead, it should be
dns-mgr: init: dns=default, rc-manager=symlink
Also, we should avoid logging NULL values with "%s", although
glib's printf is fine with that.
Before, we would first check whether the file is immuable before
parsing main.rc-manager setting. That means, if you configured
[main]
dns=default
rc-manager=unmanged
we would still first try to detect whether the file is immutable.
The result of course is only minor, e.g. showing up in logging
as rc-manager=immutable instead of rc-manager=unmanged.
Also, an immutable resolv.conf would suppress a warning about
a bogus rc-manager setting.
Also, when selecting rc-manager=symlink and resolv.conf is a symlink
to an immutable file, we don't actually care about that. The reason is,
that if the link-target is not /var/run/NetworkManager/resolv.conf,
we anyway wouldn't modify the file.
The effect of this change is pretty minor, now in logging you would see:
dns-mgr: init: dns=default, rc-manager=symlink
dns-mgr: update-resolv-conf: write internal file /var/run/NetworkManager/resolv.conf succeeded but don't update /etc/resolv.conf as it points to /some/where/else
instead of
dns-mgr: init: dns=default, rc-manager=immutable
dns-mgr: update-resolv-conf: write internal file /var/run/NetworkManager/resolv.conf succeeded
Which feels slightly more right.
Note that symlinks cannot have file attributes.
Until before 1.2.0, NetworkManager would always write resolv.conf as file, but
if /etc/resolv.conf was a symlink, it would follow the link instead of
replacing it with a file ([1], [2]).
With 1.2.0, we initially dropped that behavior and added a new 'rc-manager=none'
which writes resolv.conf to /var/run/NetworkManager and symlinks resolv.conf [3].
In case resolv.conf being already a symlink to another target, it would
not be replaced [4].
Later, we added 'rc-manager=file', which always writes /etc/resolv.conf as
file [5].
With 1.4.0, we will rename 'rc-manager=none' to 'rc-manager=symlink' [6].
This commit now fixes 'rc-manager=file' to restores the pre-1.2 behavior
and follow symlinks.
[1] 5761e328b8
[2] https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/324233
[3] 4805be2ed2
[4] 583568e12f
[5] 288799713d
[6] cd6a469668https://github.com/NetworkManager/NetworkManager/pull/7
rpmdiff complains:
Subpackage NetworkManager-bluetooth on aarch64 x86_64 ppc64 ppc64le s390x
consumes library libnm-wwan.so()(64bit) from subpackage NetworkManager-wwan
but does not have explicit package version requirement.
Please add Requires: NetworkManager-wwan = %{version}-%{release} to
NetworkManager-bluetooth in the specfile to avoid the need to test
interoperability between the various combinations of old and new subpackages.
And indeed, device plugins don't have a stable API/ABI, and requires
exact NetworkManager and wwan versions. This was already enforced implicitly,
because all device plugins require the same exact NetworkManager version.