Commit graph

27090 commits

Author SHA1 Message Date
Thomas Haller
7d5ec103df
format: mark json_{object,array}_foreach() macors as ForEachMacros for clang-format 2020-11-09 17:53:15 +01:00
Thomas Haller
7e39e23f64
examples: add "ovs-external-ids.py" example script
And example script for getting and setting OVS external-ids.

Since currently there is no nmcli support for these properties yet,
the script becomes more interesting.

This "example" is rather long, and it showcases less the usage of
libnm (which is rather trivial, with respect to configuring
NMSettingOvsExternalIDs). Instead, it aims to provide a useful
command line tool for debugging. Hence, it's mostly concerned with
an elaborate command line syntax and useful print output.
2020-11-09 17:53:15 +01:00
Thomas Haller
6100b52e5c
libnm: add NMSettingOvsExternalIDs 2020-11-09 17:53:15 +01:00
Thomas Haller
0d083f5dab
libnm: add nm_utils_print() function
libnm supports verbose debug logging by setting "LIBNM_CLIENT_DEBUG"
environment variable. That mechanism uses g_printerr() (or g_print()).

When testing an application it's useful to combine printf debugging
with this debug logging. However, python's print() statement is
additionally buffered and not in sync with the logging functions that
libnm uses.

As far as I see, g_print() and g_printerr() is not accessible via
introspections/pygobject, probably because these are variadic functions.

Add nm_utils_print() to libnm. This ensures to use the same logging
mechanism as libnm.
2020-11-09 17:25:25 +01:00
Thomas Haller
336270edd5
shared/strbuf: add nm_str_buf_get_char() and nm_str_buf_get_str_at_unsafe() helpers 2020-11-09 17:25:25 +01:00
Thomas Haller
a3aa3725e5
shared,all: cleanup nm_utils_hashtable_equal*() functions
We have:

- nm_utils_hashtable_cmp(): this does a full cmp of two hash
  tables, with the intent to provide a stable sort order.
  It thus takes a GCompareDataFunc() argument.

- nm_utils_hashtable_cmp_equal(): this is like nm_utils_hashtable_cmp(),
  except that the caller won't get a compare value, only a boolean
  value that indicates equality.
  This was previously called nm_utils_hashtable_equal().

- nm_utils_hashtable_equal(): this takes a GEqualFunc function
  for comparing the values for equality. It takes thus
  a different kind of predicate, but otherwise is similar to
  nm_utils_hashtable_cmp_equal().
  This was previously called nm_utils_hash_table_equal().

Unify the naming of these functions.
2020-11-09 17:25:25 +01:00
Thomas Haller
d52c3b3c94
shared: use GEqualFunc instead of NMUtilsHashTableEqualFunc typedef 2020-11-09 17:25:25 +01:00
Thomas Haller
f4d472beab
shared: add nm_g_array_unref() helper 2020-11-09 17:25:24 +01:00
Thomas Haller
0cf4250021
shared: add nm_utils_strdict_clone() helper 2020-11-09 17:25:24 +01:00
Thomas Haller
571aeec933
shared: add nm_utils_named_value_clear_with_g_free() helper 2020-11-09 17:25:24 +01:00
Thomas Haller
c4d981959e
shared: add nm_utils_strdup_reset_take() helper 2020-11-09 17:25:24 +01:00
Thomas Haller
ac626c6892
libnm: fix assertion in nm_setting_user_set_data() to check input argument 2020-11-09 17:25:24 +01:00
Thomas Haller
9c3cfebe14
contrib: fix failure for "fedora/REQUIRED_PACKAGES" on CentOS 8 for "black"
Fixes: 86d3022ef5 ('contrib: add xargs/black/clang packages to fedora/REQUIRED_PACKAGES')
2020-11-09 15:48:29 +01:00
Yuri Chornoivan
d98bb16a65
po: update Ukrainian (uk) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/674
2020-11-09 12:55:33 +01:00
Thomas Haller
aab7cf2065
gitlab-ci: don't explicitly install black/clang/gettext during checkpatch stage
"checkpatch" is based on the default image (currently fedora:33). It
already has these dependencies installed.
2020-11-09 10:53:55 +01:00
Thomas Haller
86d3022ef5
contrib: add xargs/black/clang packages to fedora/REQUIRED_PACKAGES
These packages are also used during CI tests (in the checkpatch
stage). They are also used for formatting C/python code, and thus
useful for developing.

Install them as part of REQUIRED_PACKAGES script.
2020-11-09 10:51:26 +01:00
Thomas Haller
f19f3f74c6
gitlab-ci: add ubuntu:20.04 test and reorder versions 2020-11-09 10:48:05 +01:00
Thomas Haller
cfc7688ec2
gitlab-ci: let Fedora 33 test always run
That is now the one that generates the pages and runs checkpatch stage.
2020-11-09 10:46:19 +01:00
Thomas Haller
b780f9315c
gitlab-ci: generate pages on Fedora 33 image
On one image we do extra work, like generating documentation (gitlab-pages).
The same image is currently also used for the "checkpatch" step. That step
checks code formatting using clang-format. The formatting depends on the
clang version, and we currently choose Fedora 33 as the desired version
for formatting.

It means, the "checkpatch" step requires Fedora 33. We could choose a
different image for generating pages and run check patch. However, that
might not be best. Just also generate the pages using Fedora 33.
2020-11-09 10:34:19 +01:00
Thomas Haller
52c6891534
gitlab-ci: reorder jobs for checkpatch test
All the steps of "checkpatch" test (except the last) check
the current tree for consistency. Those checks must always
pass.

Only the last step calls the "checkpatch-feature-branch.sh".
That script checks for common patterns, like avoiding g_assert()
(in favor of other assertion types). That last check only checks
the current patch, and there are many cases where the test is
known to fail (because these are just heuristics). As such, the
step that may fail should be called as last.
2020-11-09 09:35:59 +01:00
Peter Hutterer
35334f478b
gitlab CI: switch to using ci-templates
ci-templates encourages building specific containers that can be re-used:
- containers are re-used across pipelines, producing consistent results
- containers are re-used by contributors since they will use the upstream
  containers for their MR, thus guaranteeing the same results.

Containers are automatically rebuild whenever the respective
FDO_DISTRIBUTION_TAG changes. This is particularly interesting now that
Docker Hub will introduce pull limits.

This CI script consists of a config file and a jinja2 template, simply
running 'ci-fairy generate-template' produces the .gitlab-ci.yml.
ci-fairy is part of the freedesktop.org ci-templates and can be pip
installed, see the check-ci-script job.

Functional changes to the previous script:
- new job: check-ci-script, verifies that our gitlab-ci.yml is the one
  generated by the sources
- Added distributions:
  - Fedora 33
- The actual work is now down by a set of scripts in .gitlab-ci/,
  specifically:
  - .gitlab-ci/build.sh is the previous do_build job
  - .gitlab-ci/{fedora|debian}-install.sh are the previous {fedora|debian}_install jobs
  symlinks are in place for centos and ubuntu

Why the scripts instead of steps in the CI? Easer to reading and
reproduce. With the containers being static, it's easy to pull one
locally and re-run the CI job to reproduce an issue. Having everything in a
single script makes that trivial.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/664
2020-11-09 09:28:11 +01:00
Beniamino Galvani
d6457902d1 dns: sd-resolved: fix hash table initialization
The hash table was not initialized if there was no D-Bus connection at
the time of object creation.

Fixes: f70ee67058 ('dns: sd-resolved: reset interface configuration on deactivation')

https://bugzilla.redhat.com/show_bug.cgi?id=1894839
2020-11-06 23:39:46 +01:00
Thomas Haller
e814b59635
build: merge branch 'th/build-generate-docs'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/501

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/666
2020-11-03 15:42:27 +01:00
Thomas Haller
62411390e2
build: rename "tools/check-settings-docs.sh" to "check-compare-generated.sh"
It's a better name, because the script merely compiles files and
is not specific to "settings-docs.h".
2020-11-03 15:41:39 +01:00
Thomas Haller
82ebd73bec
build: cleanup "tools/check-settings-docs.sh" script 2020-11-03 15:41:39 +01:00
Thomas Haller
ab8fdb73e6
build: commit pre-generated "generate-docs-nm-settings-nmcli.xml" to git
We can generate "generate-docs-nm-settings-nmcli.xml" by running "clients/cli/generate-docs-nm-settings-nmcli".
However, during cross compilation, that binary gets build in the target architecture,
it can thus not run to generate the XML.
2020-11-03 15:41:39 +01:00
Thomas Haller
a208da4139
build: only generate "settings-docs.h" with "--enable-gtk-doc"
Note that "--enable-gtk-doc" requires "--enable-introspection".

For generating "settings-docs.h" we (only) need introspection/pygobject.
We also have a pre-generated .in file that we can use if introspection
is not available. Since we have a pre-generated variant, it would be fine
to always use that one. However, we want to use generate the file if we
have the necessary dependencies, because thereby we can check whether
the pre-generated file is identical to what would be generated.

We have a similar problem with "generate-docs-nm-settings-nmcli.xml".
However there we don't need introspection, but merely being able to
execute a binary that we build. That does not work during cross
compilation, so we will honor "--enable-gtk-doc" flag to decide when
to generate the file.

For consistency, also adjust the condition for "settings-docs.h" to only
generate the file if we have "--enable-gtk-doc" (but not it we build
with "--enable-introspection" alone).
2020-11-03 15:41:38 +01:00
Thomas Haller
6968c4141c
build/meson: move enable_docs variable
It will be used in subdirectories. Move it.
2020-11-03 15:41:38 +01:00
Thomas Haller
b57198a7bc
build: merge branch 'th/workaround-glib-atomic-pointer-get'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/667
2020-11-03 15:40:15 +01:00
Thomas Haller
fd57e9665c
libnm: with meson include "nm-default.h" for glib-mkenums sources
We also do that for the autotools implementation.
2020-11-03 15:39:01 +01:00
Thomas Haller
755d97d38c
libnm/tests: include "nm-default.h" for "libnm-core/tests/nm-core-tests-enum-types.c"
With glib2-2.67.0-1.fc34.x86_64.rpm, clang-11.0.0-2.fc34.x86_64.rpm, the
generated code emits a compiler warning:

    libnm-core/tests/nm-core-tests-enum-types.c:17:7: error: passing 'typeof (*(&g_define_type_id__volatile)) *' (aka 'volatile unsigned long *') to parameter of type 'gsize *' (aka 'unsigned long *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
      if (g_once_init_enter (&g_define_type_id__volatile))
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/glib/gthread.h:260:7: note: expanded from macro 'g_once_init_enter'
        (!g_atomic_pointer_get (location) &&                             \
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/glib/gatomic.h:112:38: note: expanded from macro 'g_atomic_pointer_get'
        __atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \
                                         ^~~~~~~~~~~~~~~~~
    libnm-core/tests/nm-core-tests-enum-types.c:40:7: error: passing 'typeof (*(&g_define_type_id__volatile)) *' (aka 'volatile unsigned long *') to parameter of type 'gsize *' (aka 'unsigned long *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
      if (g_once_init_enter (&g_define_type_id__volatile))
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/glib/gthread.h:260:7: note: expanded from macro 'g_once_init_enter'
        (!g_atomic_pointer_get (location) &&                             \
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/glib/gatomic.h:112:38: note: expanded from macro 'g_atomic_pointer_get'
        __atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \
                                         ^~~~~~~~~~~~~~~~~
    libnm-core/tests/nm-core-tests-enum-types.c:63:7: error: passing 'typeof (*(&g_define_type_id__volatile)) *' (aka 'volatile unsigned long *') to parameter of type 'gsize *' (aka 'unsigned long *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
      if (g_once_init_enter (&g_define_type_id__volatile))
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/glib/gthread.h:260:7: note: expanded from macro 'g_once_init_enter'
        (!g_atomic_pointer_get (location) &&                             \
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/glib/gatomic.h:112:38: note: expanded from macro 'g_atomic_pointer_get'
        __atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \
                                         ^~~~~~~~~~~~~~~~~

We could pass "-Wincompatible-pointer-types-discards-qualifiers" as CFLAGS
when building this file. However, we have a workaround in our "nm-glib-aux/nm-glib.h",
so we can instead include "nm-default.h". At first glance, that might look like
the less preferable solution. However, this file is only there for unit tests,
and we also include "nm-default.h" for other sources that are generated with
"glib-mkenums". So, doing it also for our tests becomes the preferable solution.
2020-11-03 15:39:01 +01:00
Thomas Haller
42fa8f3d27
shared: don't enforce unset G_LOG_DOMAIN in "nm-default.h"
When including <glib.h>, it will always define G_LOG_DOMAIN if it
is not yet defined.

Usually we want to include "nm-default.h" as very first header. In that
case, <glib.h> is not yet included. Then the previous check #error works
well.

However, if we include "nm-default.h" in sources generated by
glib-mkenums, then the generator first already includes <glib.h>,
and thus defines G_LOG_DOMAIN. It does so for "libnm-core/nm-core-enum-types.c"
and "libnm/nm-enum-types.c", where the #error would not trigger.
But we will also include "nm-default.h" for "libnm-core/tests/nm-core-tests-enum-types.c".
That will start triggering this #error.

While in general we want to include "nm-default.h" first, we also need
to support cases where <glib.h> gets included first. Thus this error is
not useful. Remove it.
2020-11-03 15:39:01 +01:00
Thomas Haller
7c60e984b6
shared: also reimplement g_atomic_pointer_set() macro
It's not strictly necessary, because contrary to g_atomic_pointer_get()
and g_atomic_pointer_compare_and_exchange(), glib's variant for the
setter is mostly fine.

Still, reimplement it, because we use typeof() eagerly and can thus add
more static checks than glib.
2020-11-03 15:39:00 +01:00
Thomas Haller
5e57ea37f0
shared: add a compat implementation for g_atomic_pointer_get()
With glib2-2.67.0-1.fc34.x86_64.rpm, clang-11.0.0-2.fc34.x86_64.rpm, we
get a failure for g_atomic_pointer_get():

    ../shared/nm-glib-aux/nm-hash-utils.c:38:9: error: passing 'typeof (*(&global_seed)) *' (aka 'const unsigned char *volatile *') to parameter of type 'const guint8 **' (aka 'const unsigned char **') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
        g = g_atomic_pointer_get(&global_seed);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/glib/gatomic.h:112:38: note: expanded from macro 'g_atomic_pointer_get'
        __atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \
                                         ^~~~~~~~~~~~~~~~~
    ../shared/nm-glib-aux/nm-hash-utils.c:109:32: error: passing 'typeof (*(&global_seed)) *' (aka 'const unsigned char *volatile *') to parameter of type 'const guint8 **' (aka 'const unsigned char **') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
        return ((*((const guint *) _get_hash_key())) ^ static_seed) ?: 3679500967u;
                                   ^~~~~~~~~~~~~~~
    ../shared/nm-glib-aux/nm-hash-utils.c:84:14: note: expanded from macro '_get_hash_key'
            _g = g_atomic_pointer_get(&global_seed); \
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/glib/gatomic.h:112:38: note: expanded from macro 'g_atomic_pointer_get'
        __atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \
                                         ^~~~~~~~~~~~~~~~~
    ../shared/nm-glib-aux/nm-hash-utils.c:123:9: error: passing 'typeof (*(&global_seed)) *' (aka 'const unsigned char *volatile *') to parameter of type 'const guint8 **' (aka 'const unsigned char **') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
        g = _get_hash_key();
            ^~~~~~~~~~~~~~~
    ../shared/nm-glib-aux/nm-hash-utils.c:84:14: note: expanded from macro '_get_hash_key'
            _g = g_atomic_pointer_get(&global_seed); \
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/glib/gatomic.h:112:38: note: expanded from macro 'g_atomic_pointer_get'
        __atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \
                                         ^~~~~~~~~~~~~~~~~
2020-11-03 15:39:00 +01:00
Thomas Haller
03d9ec27fa
introspection: avoid compiler warning in generated introspection files
Disable "-Wincompatible-pointer-types-discards-qualifiers" warning, as
this breaks build of the gdbus-codegen files.

With glib2-2.67.0-1.fc34.x86_64.rpm, clang-11.0.0-2.fc34.x86_64.rpm, we
get a failure to build generated code:

    introspection/org.freedesktop.NetworkManager.AccessPoint.c:438:1: error: passing 'typeof (*(&g_define_type_id__volatile)) *' (aka 'volatile unsigned long *') to parameter of type 'gsize *' (aka 'unsigned long *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
    G_DEFINE_INTERFACE (NMDBusAccessPoint, nmdbus_access_point, G_TYPE_OBJECT)
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/gobject/gtype.h:1784:47: note: expanded from macro 'G_DEFINE_INTERFACE'
    #define G_DEFINE_INTERFACE(TN, t_n, T_P)                    G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, ;)
                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/gobject/gtype.h:1803:61: note: expanded from macro 'G_DEFINE_INTERFACE_WITH_CODE'
    #define G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, _C_)     _G_DEFINE_INTERFACE_EXTENDED_BEGIN(TN, t_n, T_P) {_C_;} _G_DEFINE_INTERFACE_EXTENDED_END()
                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/gobject/gtype.h:2042:7: note: expanded from macro '_G_DEFINE_INTERFACE_EXTENDED_BEGIN'
      if (g_once_init_enter (&g_define_type_id__volatile))  \
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/glib/gthread.h:260:7: note: expanded from macro 'g_once_init_enter'
        (!g_atomic_pointer_get (location) &&                             \
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/glib/gatomic.h:112:38: note: expanded from macro 'g_atomic_pointer_get'
        __atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \
                                         ^~~~~~~~~~~~~~~~~
    introspection/org.freedesktop.NetworkManager.AccessPoint.c:944:1: error: passing 'typeof (*(&g_define_type_id__volatile)) *' (aka 'volatile unsigned long *') to parameter of type 'gsize *' (aka 'unsigned long *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
    G_DEFINE_TYPE_WITH_CODE (NMDBusAccessPointProxy, nmdbus_access_point_proxy, G_TYPE_DBUS_PROXY,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/gobject/gtype.h:1615:56: note: expanded from macro 'G_DEFINE_TYPE_WITH_CODE'
    #define G_DEFINE_TYPE_WITH_CODE(TN, t_n, T_P, _C_)          _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, 0) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/gobject/gtype.h:2032:3: note: expanded from macro '_G_DEFINE_TYPE_EXTENDED_BEGIN'
      _G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER(TypeName, type_name, TYPE_PARENT, flags) \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/gobject/gtype.h:2000:7: note: expanded from macro '_G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER'
      if (g_once_init_enter (&g_define_type_id__volatile))  \
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/glib/gthread.h:260:7: note: expanded from macro 'g_once_init_enter'
        (!g_atomic_pointer_get (location) &&                             \
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/glib/gatomic.h:112:38: note: expanded from macro 'g_atomic_pointer_get'
        __atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \
                                         ^~~~~~~~~~~~~~~~~
    introspection/org.freedesktop.NetworkManager.AccessPoint.c:1729:1: error: passing 'typeof (*(&g_define_type_id__volatile)) *' (aka 'volatile unsigned long *') to parameter of type 'gsize *' (aka 'unsigned long *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
    G_DEFINE_TYPE_WITH_CODE (NMDBusAccessPointSkeleton, nmdbus_access_point_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/gobject/gtype.h:1615:56: note: expanded from macro 'G_DEFINE_TYPE_WITH_CODE'
    #define G_DEFINE_TYPE_WITH_CODE(TN, t_n, T_P, _C_)          _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, 0) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/gobject/gtype.h:2032:3: note: expanded from macro '_G_DEFINE_TYPE_EXTENDED_BEGIN'
      _G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER(TypeName, type_name, TYPE_PARENT, flags) \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/gobject/gtype.h:2000:7: note: expanded from macro '_G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER'
      if (g_once_init_enter (&g_define_type_id__volatile))  \
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/glib/gthread.h:260:7: note: expanded from macro 'g_once_init_enter'
        (!g_atomic_pointer_get (location) &&                             \
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/glib/gatomic.h:112:38: note: expanded from macro 'g_atomic_pointer_get'
        __atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \
                                         ^~~~~~~~~~~~~~~~~
2020-11-03 15:39:00 +01:00
Thomas Haller
e0a3a5e2f8
build: don't depend dispatcher code on introspection sources
The dispatcher code does not use the generated introspection sources
(anymore). Don't add a dependency.
2020-11-03 15:38:25 +01:00
Thomas Haller
1b8ccacc5d
tests: avoid race condition in nmtstc_service_cleanup()
It seems it can happen that the service is not yet unregistered from the
D-Bus broker, even if we already reaped the PID.

    /builds/NetworkManager/NetworkManager/tools/run-nm-test.sh --called-from-make /builds/NetworkManager/NetworkManager/build    --launch-dbus=auto /builds/NetworkManager/NetworkManager/build/libnm/tests/test-nm-client
    --- stdout ---
    /libnm/device-added:
    nmtst: initialize nmtst_get_rand() with NMTST_SEED_RAND=0
    --- stderr ---
    **
    test:ERROR:../shared/nm-test-utils-impl.c:216:nmtstc_service_cleanup: assertion failed: (!name_exists(info->bus, "org.freedesktop.NetworkManager"))

Workaround by waiting a bit.

We now iterate the main GMainContext, unlike before. But that
should not cause any problems for the test.
2020-11-03 14:31:20 +01:00
Thomas Haller
230250e629
shared/tests: add nmtst_main_context_iterate_until_full() helper 2020-11-03 14:31:20 +01:00
Thomas Haller
ca2b79d9aa
shared/tests: add nmtst_g_source_nop() helper 2020-11-03 14:31:19 +01:00
Thomas Haller
11068cf936
device: fix crash in nm_device_reactivate_ip_config()
Fixes: 87f69f0050 ('device: merge nm_device_reactivate_ip_config() implementations for IPv4/IPv6')
2020-11-03 12:32:54 +01:00
Thomas Haller
affff881e2
contrib/release: check whether access to master.gnome.org works before publishing release 2020-11-02 18:51:45 +01:00
Antonio Cardace
1df683587a
release: bump version to 1.29.1 (development) 2020-11-02 18:16:45 +01:00
Antonio Cardace
c4b6962ed2
merge branch 'ac/bridge_mtu_autoadjust' into master
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/656
2020-11-02 17:28:19 +01:00
Antonio Cardace
e23798a5e5
bridge: force (hack)-set of the MTU when explicitly set in the profile
Kernel does a auto-mtu adjusting process whenever a port is added/removed from
the bridge, this can cause issues when NM wants to explicitly set an MTU which is
equal to the bridge default one (1500) because if later a port is added with a
different MTU the kernel will assign the bridge that port's MTU resulting in the bridge
runtime configuration differing from the bridge's NM connection profile.

What we can do is to always apply the MTU manually for the bridge (if explicitly
set by the profile), after doing so the kernel won't modify the MTU anymore,
which is what we want, problem is that kernel won't actually apply the MTU
to the netdev if it's not actually changing so we first apply it to
MTU-1 and then to the desired value.

https://bugzilla.redhat.com/show_bug.cgi?id=1778590

Signed-off-by: Antonio Cardace <acardace@redhat.com>
2020-11-02 17:23:22 +01:00
Antonio Cardace
516c623618
bridge: set MTU at link creation time
https://bugzilla.redhat.com/show_bug.cgi?id=1778590

Signed-off-by: Antonio Cardace <acardace@redhat.com>
2020-11-02 17:23:16 +01:00
Antonio Cardace
ba2ee46254
platform: allow setting the MTU at link creation time
Add a parameter to the 'link_add()' virtual function so that
the MTU will be configured (via netlink) by the kernel when
creating the link.

https://bugzilla.redhat.com/show_bug.cgi?id=1778590

Signed-off-by: Antonio Cardace <acardace@redhat.com>
2020-11-02 17:23:05 +01:00
Thomas Haller
0829dbcd3d
device: merge branch 'th/device-cleanup-addr-family'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/665
2020-11-01 16:47:14 +01:00
Thomas Haller
6c9a289451
core: cleanup IPv4/IPv6 checks using NM_IS_IPv4()
- we commonly use "int addr_family" as parameters to functions.
  But then inside the function, we often need to do something for
  IPv4 or IPv6 specifically. Instead of having lots of redundant
  "if (addr_family == AF_INET)" checks, prefer to have a variable
  IS_IPv4 and/or use NM_IS_IPv4() macro.

- don't make the "IS_IPv4" variable a gboolean but an int. gboolean
  is a typedef for int, so it's in practice exactly the same. However,
  we use "IS_IPv4" as index to arrays of length 2, where at position
  "1" we have the value related to IPv4. Using a gboolean to index
  an array is a bit odd. Maybe a "int" is preferable here.
  This is more about doing consistently one or the other. There are
  no strong reasons to prefer gboolean or int.
2020-10-30 16:52:59 +01:00
Thomas Haller
6767ba1205
device: allow AF_UNSPEC for nm_device_get_connectivity_state()
Apparently it is not actually used, but the function implements
a return value for AF_UNSPEC, while also asserting that the addr_family
is AF_INET/AF_INET6. Drop the assertions.
2020-10-30 16:52:58 +01:00
Thomas Haller
f20d0d6984
device: merge activate_stage5_ip_config_result_[46]() 2020-10-30 16:52:57 +01:00