Originally, the "callouts" directory contained various programs
that NetworkManager would call, for example the dhcp helper.
For a while, it only contains nm-dispatcher. Thus rename the directory
to indicate that it's for dispatcher.
Backported symbols only make sense for libnm itself, not for
libnm-core which is statically linked with NetworkManager and
nm-ifcace-helper. Declaring the symbols in libnm-core, means
that NetworkManager binary also contains them, although there
are not used.
Move them to libnm.
- this allows the linker to drop unused symbols via link-time optimization
or with --gc-sections:
git clean -fdx
./autogen.sh --enable-ld-gc --enable-ifcfg-rh --enable-ifupdown \
--enable-ifnet --enable-ibft --enable-teamdctl --enable-wifi \
--with-modem-manager-1 --with-ofono --with-more-asserts \
--with-more-logging
make -j20
strip ./src/NetworkManager
gives 2822840 vs. 2625960 bytes (-7%).
- this also gives more control over the symbols that are used by the
plugins. Yes, it means if you modify a plugin to use a new symbols,
you have to extend NetworkManager.ver file.
You can run the script to create the version file:
$ ./tools/create-exports-NetworkManager.sh update
but be sure that your current configuration enables all plugins
and debugging options to actually use all symbols that are in use.
- If you compile with certain plugins enabled, you could theoretically
re-compile NetworkManager to expose less symbols. Try:
$ ./tools/create-exports-NetworkManager.sh build
- note that we have `make check` tests to ensure that all used
symbols of the plugins can be found. So, it should not be possible
to accidentally forget to expose a symbol.
We should enable tests by default, probably we even should drop
the configure flags to enable tests and just always build them.
Anyway, at this point there is no use in guarding check-local
with a check for ENABLE_TESTS. A user who does't want to run
the tests, should just not call `make check`.
Pacrunner uses the interface information to implement a myIpAddress()
function which returns the first IPv4 address of the interface
associated to a proxy. That function doesn't deal with multiple
addresses per interface, and so in case of a VPN which configures
addresses on the parent interface (e.g. IPsec), we currently pass a
NULL interface. That is correct, but triggers the following assertion:
GLib-CRITICAL **: g_variant_new_variant: assertion 'value != NULL' failed
#0 g_logv () from target:/lib64/libglib-2.0.so.0
#1 g_log () from target:/lib64/libglib-2.0.so.0
#2 g_variant_new_string () from target:/lib64/libglib-2.0.so.0
#3 nm_pacrunner_manager_send (self=0xab3230, iface=iface@entry=0x0, proxy_config=proxy_config@entry=0xc83470, ip4_config=ip4_config@entry=0x7f66b4002710, ip6_config=ip6_config@entry=0x0) at nm-pacrunner-manager.c:334
#4 _set_vpn_state (self=self@entry=0xd0c120, vpn_state=vpn_state@entry=STATE_ACTIVATED, reason=reason@entry=NM_VPN_CONNECTION_STATE_REASON_NONE, quitting=quitting@entry=0) at vpn-manager/nm-vpn-connection.c:571
#5 dispatcher_pre_up_done (call_id=<optimized out>, user_data=<optimized out>) at vpn-manager/nm-vpn-connection.c:460
#6 dispatcher_done_cb (proxy=0x988870, result=<optimized out>, user_data=0xae1740) at nm-dispatcher.c:444
Ignore the interface parameter when it's NULL.
In some places we use g_file_set_contents() after a umask() to limit
the permissions of the created file. Unfortunately if the containing
directory has a default ACL the umask will be ignored and the new file
will have a mode equal to the default ACL (since g_file_set_contents()
opens the file with mode 0666).
Calling a chmod() after the file gets created is insecure (see commit
60b7ed3bdc) and so the only solution seems to be to reimplement
g_file_set_contents() and accept a mode as parameter.
We already had similar functions in the tree, consolidate them into a
new generic utility function.
https://bugzilla.gnome.org/show_bug.cgi?id=769702
g_assert() uses G_LIKELY(), which in turn uses _G_BOOLEAN_EXPR().
As glib's version of _G_BOOLEAN_EXPR() uses a local variable
_g_boolean_var_, we cannot nest a G_LIKELY() inside a G_LIKELY(),
or inside a g_assert(), or a g_assert() inside a g_assert().
Workaround that, by redefining the macro.
I already encountered this problem before, when having a nm_assert()
inside a ({...}) block, inside a g_assert(). Then I just avoided that
combination, but this situation is quite easy to encounter.
Internal device types are a static thing. Let's not do a
constructor function to register the device factory.
This gets rid of all attribute((constructor)) functions inside
NetworkManager core. That is desired, because we don't want to
run code before main(). For example, at that point logging is
not yet initialized, but with code that runs before main() it
is hard to ensure that we don't log anything yet.
An interface would make sense to allow the actual device-factory to inherit
from another type.
However, glib interfaces make code much harder to follow and less
efficient. The device factory shall be a very simple type with meta data
about supported device types and the ability to create device instances.
There is no need to make this an interface implementation, instead just
let the factories inherit from NM_TYPE_DEVICE_FACTORY directly.
Don't have the test recompile parts of the settings plugin.
Instead, build one core library that is used both by the test
and the settings plugin.
Advantage: might save some compilation time, but more importantly: the
test use the same object code then NetworkManager itself, avoiding
different behavior due to compilation flags.
We don't need need separate unit tests for basic tests that can
just run in the same test-run. If you really need to run only
a particular set of tests, try
./src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh -p /settings/plugins/ifcfg-rh/utils
Results in less compilation (time), and less binaries to test during
`make check`.
Previously, the default values were only printed if the corresponding
section was already present. Fix that.
Also, we call nm_config_data_log() also to dump the configuration
into the logfile. In that case (!stream), exclude the default values.
VPN_PLUGIN is special. With
# nmcli general logging level TRACE domains ALL
the logging verbosity of VPN_PLUGIN domain should not be set higher then
info. The user has to explicitly set it via:
# nmcli general logging level TRACE domains ALL,VPN_PLUGIN:TRACE
This was not the case for
# nmcli general logging level TRACE
Fix that.