Commit Graph

23243 Commits

Author SHA1 Message Date
Thomas Haller
b927287c7d shared/utils: add nmtst_assert_setting_dbus_roundtrip() util 2019-05-23 18:09:49 +02:00
Thomas Haller
892440c4ab shared/tests: add nmtst_assert_setting_is_equal() util 2019-05-23 18:09:49 +02:00
Thomas Haller
ae7f32e03b shared/tests: add nmtst_variant_from_string() util 2019-05-23 18:09:49 +02:00
Thomas Haller
5d3b033072 shared: add nm_utils_gvariant_vardict_filter*() helpers
Usually, such an operation does not make much sense. It's also not good
performance wise.

But for unit testing this becomes very interesting.
2019-05-23 18:09:49 +02:00
Thomas Haller
848a80598e shared: add JSON helper functions for NMValueType 2019-05-23 18:09:49 +02:00
Thomas Haller
75703a2425 shared: add accessor functions for NMValueType
"nm-value-type.h" is a header-only file, as it contains only small
accessors that should be inlined.

As such, the implementation of these functions is guarded by "#ifdef
NM_VALUE_TYPE_DEFINE_FUNCTIONS", so that one can use this header (and
NMValueType enum) with less overhead (at compile time).
2019-05-23 18:09:49 +02:00
Thomas Haller
e64fdeeaf6 shared: add "shared/nm-glib-aux/nm-value-type.h"
Glib has GValue which used for boxing value.

Add NMValueType enum, which has a similar purpose, but it's much more
limited.

- contrary to GValue, the type must be tracked separately from the
  user-data. That is, the "user-data" is only a pointer of appropriate
  type, and the knowledge of the actual NMValueType is kept separately.
  This will be used to have a static list of meta-data that knows the
  value types, but keeping the values independent of this type
  information. With GValue this would not be possible.

- the use case is much more limited. Just support basic integers,
  boolean and strings. Nothing fancy.

Note that we already do something similar at muliple places. See for
example NMVariantAttributeSpec and nm_utils_team_link_watcher_to_string().
These could/should instead use NMValueType.
2019-05-23 18:09:49 +02:00
Thomas Haller
efccc2a53c shared: add nm_json_aux_gstr_append_*() helper 2019-05-23 18:09:49 +02:00
Thomas Haller
50dbcda015 shared: add nm_jansson_json_as_*() helpers to "shared/nm-glib-aux/nm-jansson.h" 2019-05-23 18:09:49 +02:00
Thomas Haller
f84e623732 shared: add "shared/nm-glib-aux/nm-json-aux.h"
This will be a set of JSON related utilities, that are independent of
libjansson.
2019-05-23 18:09:49 +02:00
Thomas Haller
f5482013ac shared: add NM_GOBJECT_PROPERTIES_DEFINE_NOTIFY() macro as part of NM_GOBJECT_PROPERTIES_DEFINE()
This will be needed independently from NM_GOBJECT_PROPERTIES_DEFINE().
2019-05-23 18:09:49 +02:00
Thomas Haller
dadd38c484 shared: add nm_utils_strv_make_deep_copied_n() helper 2019-05-23 18:09:49 +02:00
Thomas Haller
79ef1abcca shared: add nm_strcmp0()
g_strcmp0() is not inlineable, so we first need to call to glib, only to
call to libc.
2019-05-23 18:09:49 +02:00
Thomas Haller
9e544d527a shared: fix invalid assertion in nm_utils_team_link_watcher_from_string()
Fixes: a473ab431a ('cli: refactor team-link-watcher to/from strings')
2019-05-23 18:09:49 +02:00
Thomas Haller
61b1d1e963 libnm: fix parsing "nsna_ping" team link watcher from GVariant
Fixes: ba4ce843fa ('libnm-core: add backend for GVariant de/serialization of link_watchers.')
2019-05-23 18:09:49 +02:00
Thomas Haller
4b8a9cc51b ifcfg: use proper define for D-Bus interface name in "nms-ifcfg-rh-plugin.c"
No difference in practice, as both defines define the same name.
2019-05-23 11:07:26 +02:00
Thomas Haller
f01866060b build: merge branch 'th/build-link-static-libraries-later'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/149
2019-05-22 20:05:24 +02:00
Thomas Haller
e7056d4efd build: don't statically link static libraries with other static libraries (6) 2019-05-22 20:04:08 +02:00
Thomas Haller
15e224fd59 build: don't statically link static libraries with other static libraries (5) 2019-05-22 20:04:08 +02:00
Thomas Haller
0a510ed1cf build: don't statically link static libraries with other static libraries (4) 2019-05-22 20:04:08 +02:00
Thomas Haller
53168b0d2c build: drop trivial variables from Makefile.am
It just hides what we link. Link against GLIB explicitly
instead of indirectly via another variable.
2019-05-22 20:04:08 +02:00
Thomas Haller
c808191846 build: don't statically link static libraries with other static libraries (3) 2019-05-22 20:04:08 +02:00
Thomas Haller
b5850cb4d4 build: don't statically link static libraries with other static libraries (2) 2019-05-22 20:04:08 +02:00
Thomas Haller
1a24f3ae8d build: don't statically link static libraries with other static libraries (1)
When we link static libraries together, there must be no duplicate
symbols.

Since we have a lot of static/intermediate libraries, getting this right
is complicated and sometimes leads to ugly solutions.

As a new rule: don't let static libraries link with other static
libraries. Only binaries and libnm/libnm.la should explicitly link
with all the static libraries that they require.

There are exceptions: "src/libNetworkManager.la" and "libnm/liblibnm.la".
These are static, internal libraries, but they are basically *everything*
that ends up in "src/NetworkManager" and "libnm/libnm.la", respecitively.
Hence, these static libraries also link against other static libraries.
Another exception to this rule is "src/libNetworkManagerTest.la", for
similar reasons.
2019-05-22 20:04:08 +02:00
Thomas Haller
d8eb9e7515 build: link src/NetworkManager explicitly with glib
We compile src/main.c as part of src/NetworkManager. Explicitly link with
glib, because that is required by the source code. Apparently, it also
works without this, but still do it for correctness.
2019-05-22 20:04:08 +02:00
Thomas Haller
105d0d56d3 build: link libnm/liblibnm.la with udev library
libnm/liblibnm.la compiles "libnm/nm-device.c" and "libnm/nm-client.c",
both include libudev.h.

Let's explicitly link this library with libudev.
2019-05-22 20:04:08 +02:00
Thomas Haller
aff1d66b81 Revert "libnm: don't assert for success of g_dbus_error_register_error()"
Now that unit tests no longer dynamically link against libnm/libnm.la,
and statically against the same code, we can enable this assertion
again.

This reverts commit 7a0e347b38.
2019-05-22 20:04:08 +02:00
Thomas Haller
6b7264e4aa build/meson: introduce libnm/liblibnm.la as static library for libnm/libnm.la
Same as done for autotools.
2019-05-22 20:04:08 +02:00
Thomas Haller
09557fa69d build: introduce libnm/liblibnm.la as static library for libnm/libnm.la
We have "src/libNetworkManager.la" which is an intermediate static
library containing everything that ends up in "src/NetworkManager".

Likewise, add "libnm/liblibnm.la" to be the static library that contains
everything from "libnm/libnm.la".

The point of these libraries is to tie everything together that is used
by "src/NetworkManager" and "libnm/libnm.la" so that it also can be used
by unit-tests. Thereby, the unit tests will link statically against the
code of libnm. The problem is that the unit tests also want to access
internal functionality of libnm that is not accessible when dynamically
linking.

In part, this new library replaces "libnm/libnm-utils.la". The previous
name was confusing, because to us everything is an "utils", and it's
unclear what the purpose of that library was. Now the purpose should be
a bit clearer: liblibnm.la is a step before libnm.la, similar to what
libNetworkManager.la is to NetworkManager.
2019-05-22 20:04:08 +02:00
Thomas Haller
57e21dc889 build: style cleanups of Makefile.am 2019-05-22 20:04:08 +02:00
Thomas Haller
2946d07085 shared: implement _nm_utils_monotonic_timestamp_initialized() in "nm-logging-stub.c" 2019-05-22 20:04:08 +02:00
Lubomir Rintel
4c78434a0b Revert "Do not manage Docker bridge interfaces"
The docker bridges are no special -- just regular externally created
bridges.

This reverts commit 0ce7327550.
2019-05-21 09:40:53 +02:00
Lubomir Rintel
f3f8e21bd3 contrib/checkpatch: properly determine the commit id boundary
It doesn't have to be at the end of line, there may be more words
following.

Fixes: d66a1ace23 ('contrib/checkpatch: avoid command injection in checkpatch.pl script')
2019-05-20 16:31:52 +02:00
Beniamino Galvani
008a4b4215 team: don't kill teamd for external devices
The teamd instance must not be killed if the device was externally
activated.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/158
https://bugzilla.redhat.com/show_bug.cgi?id=1693142
2019-05-20 14:54:07 +02:00
Beniamino Galvani
95cc384377 core: merge branch 'bg/add-activate-fail-rh1667874'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/144
https://bugzilla.redhat.com/show_bug.cgi?id=1667874
2019-05-20 14:50:47 +02:00
Beniamino Galvani
58db61545d device: don't wait udev for devices created by us
If we created a software interface it is because we already decided
that it should be managed, and so there is no point in waiting udev to
check that the interface is not udev-unmanaged.

We still wait udev for software interfaces created externally.
2019-05-20 14:49:59 +02:00
Beniamino Galvani
d33c995d45 manager: relax condition when checking for duplicate ACs
An active connection started by user could be queued in state UNKNOWN
which means the device hasn't started activating yet. Eventually it
will, and we don't want to cancel the user activation because of an
internal autoconnection attempt.
2019-05-20 13:57:35 +02:00
Beniamino Galvani
831f079e55 device: use variable for platform in realize_start_setup() 2019-05-20 13:57:35 +02:00
Lubomir Rintel
ff2d0f5add manager: don't allow femoving a device without traversing proper states
There was a special case for ensuring that the device's configuration
doesn't disappear when some factory is too late at recognizing the
device is just a component of another one.

It was always a bad idea. If the device already had an active
connection (such as for a generated default wired connection), it would
remain around, with a dangling reference to the device.

This effectively reverts commit 5ad69cb29b ('core: remove child devices
without deconfiguring them (bgo #738479)'). It's okay to do so, because
we now wouldn't deconfigure the device upon its removal anyway.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/151/
2019-05-20 12:50:01 +02:00
Thomas Haller
eebcbfae75 dhcp: store dhclient's pid file in "/var/run/NetworkManager" instead of "/var/run"
The pid-file is private to NetworkManager. It should reside in NetworkManager's
run directory instead of "/var/run".

I don't think that changing this location can break existing uses. Why
would somebody outside of NetworkManager care about this file?

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/157
2019-05-20 11:52:31 +02:00
Thomas Haller
b18cda2671 all: merge branch 'th/rename-tests'
Rename tests so that they have unique names.

meson requires that the build executables have unique names (at least,
older versions). Hence, we used to name the test binary different from
the source file ("libnm-test-general" vs. "test-general.c").

The tests should be named "*/tests/test-*", and the source file should
have the same name as the test executable.

Rename the sources so that the names are unique.
2019-05-19 15:55:41 +02:00
Thomas Haller
1da7dfc408 gitignore: merge gitignore files
For the most part, we only have one main .gitignore file.

There were a few nested files, merge them into the main file.

I find it better to have only one gitignore file, otherwise the
list of ignored files is spread out through the working directory.
2019-05-19 14:41:21 +02:00
Thomas Haller
5c0dd32622 src/tests: rename core's "test-general*" to "test-core*" 2019-05-19 14:41:00 +02:00
Thomas Haller
fbe2fdd167 libnm/tests: rename libnm's "test-general" to "test-libnm" 2019-05-19 14:41:00 +02:00
Thomas Haller
0c7bc1a5d9 clients/tests: rename clients/common's "test-general" to "test-clients-common" 2019-05-19 14:00:16 +02:00
Thomas Haller
c99bbc99b0 wifi/tests: rename Wi-Fi's "test-general" to "test-devices-wifi"
We already have 4 other tests that are named "test-general". Rename.
2019-05-19 11:28:53 +02:00
Thomas Haller
d27f6b9d0a keyfile/tests: rename core's "test-keyfile" to "test-keyfile-settings"
We already have "libnm-core/tests/test-keyfile.c" from which we build
"test-keyfile".

Our test binaries should be named the following:

- "*/tests/test-*"

- the test binary "*/tests/test-*" should be build from a source file
  "*/tests/test-*.c". Meaning: the source's and executable's name should
  correspond.

- test binaries should be named uniquely. Also, because older meson
  versions don't like having the same binary name more than once.

Rename to avoid the duplicate name.
2019-05-19 11:25:59 +02:00
Thomas Haller
a80c199e9e gitignore: move ignored libnm-glib/libnm-util files to the bottom of the .gitignore
The bottom contains the tombstones for files that we ignored in
the past, but no longer actually have. Move the lines.
2019-05-19 11:23:23 +02:00
Patrick J. Volkerding
e1df17e0ac hostname-manager: use fqdn for persistent hostname on Slackware
This will be the default for Slackware 15.0 and on.

This should be safe for both master and 1.12.x stable branch, as
no existing Slackware releases are expected to run NM-1.12.x or
later.

Signed-off-by: Robby Workman <rworkman@slackware.com>

https://mail.gnome.org/archives/networkmanager-list/2019-May/msg00011.html
2019-05-19 10:45:07 +02:00
Thomas Haller
041aa3d605 platform/tests: rename platform's "test-general.c"
Older versions of meson don't like building multiple artifacts
with the same name (even if they are in different directories). We
have multiple tests called "test-general.c", and it would be natural
to compile a test binary of the same name.

  Meson encountered an error in file src/tests/meson.build, line 14, column 2:
  Tried to create target "test-general", but a target of that name already exists.

It's generally a bad idea to have in our source tree multiple files with the
same name. Rename the test.

Fixes: 16cd84d346 ('build/meson: rename platform tests to use same name as autotools'):
2019-05-18 11:37:47 +02:00