Commit graph

793 commits

Author SHA1 Message Date
Thomas Haller 3a39ce6a99
checkpatch: encourage g_snprintf() over snprintf()
The only reason is consistency. The majority of times we
do use g_snprintf(). As there are no strong reasons to
prefer one over the other, prefer the one that use use
most of the time.
2021-08-26 14:59:53 +02:00
Thomas Haller c8d80f332d
contrib/makerepo: fix detection of centpkg for git+ssh:// remotes 2021-08-20 11:43:33 +02:00
Thomas Haller 41937748d8
contrib: add "makerepo.sh" script
"makerepo.sh" script is a helper script for handling dist-git
repositories. It was so far part of "automation" branch. It seems
useful enough to officially add it to "main" branch.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/944
2021-08-02 09:56:44 +02:00
Thomas Haller f137b32d31
sudo: introduce nm-sudo D-Bus service
NetworkManager runs as root and has lots of capabilities.
We want to reduce the attach surface by dropping capabilities,
but there is a genuine need to do certain things.

For example, we currently require dac_override capability, to open
the unix socket of ovsdb. Most users wouldn't use OVS, so we should
find a way to not require that dac_override capability. The solution
is to have a separate, D-Bus activate service (nm-sudo), which
has the capability to open and provide the file descriptor.

For authentication, we only rely on D-Bus. We watch the name owner
of NetworkManager, and only accept requests from that service. We trust
D-Bus to get it right a request from that name owner is really coming
from NetworkManager. If we couldn't trust that, how could PolicyKit
or any authentication via D-Bus work? For testing, the user can set
NM_SUDO_NO_AUTH_FOR_TESTING=1.

https://bugzilla.redhat.com/show_bug.cgi?id=1921826
2021-07-26 15:31:46 +02:00
Thomas Haller a99ac7ccd8
glib-aux: add nm_g_idle_add()
g_idle_add() is discouraged, and the checkpatch.pl script warns
about it.

Sometimes there is a legitimate use of it, when you want to always
schedule an idle action (without intent to cancel or track it). That
makes more sense for g_idle_add() than it does for g_timeout_add(),
because a timeout really should be tracked and cancelled if necessary.

Add a wrapper to rename the legitimate uses. This way, we can avoid the
checkpatch.pl warnings, and can grep for the remaining illegitimate uses.
2021-07-26 15:30:04 +02:00
Beniamino Galvani 1e3bbdfbbb contrib: add script to test IPv6 prefix delegation
Add a script to test IPv6 prefix delegation with NM, in different
modes.
2021-07-13 09:43:04 +02:00
Thomas Haller 62141eb938
contrib/release: print better URL for gitlab-ci pipelines 2021-06-30 17:32:39 +02:00
Thomas Haller e06261471c
release: fix release script for relative paths 2021-06-30 16:27:01 +02:00
Thomas Haller 5388542fc0
checkpatch: discourage use of API that uses numeric source IDs
The numeric source IDs exist from a time before 2000, when there
was only one "GMainContext" singleton instance. Nowadays, the source
ID is only relative to one GMainContext, and you'd have to track
that association yourself. Als, g_source_remove() requires an additional
hash lookup, when you could simply track the GSource instance from the
start.

This API should not be used anymore. Operate on GSouce instances
direclty and use API like

  nm_clear_g_source_inst()
  nm_g_idle_add_source()
  nm_g_idle_souce_new()
  nm_g_source_attach()
  g_source_attach
  g_source_destroy
  g_source_unref
  etc.

Note that if you don't care about to ever remove a source again, like
scheduling an idle action that should not be cancelled, then

  g_idle_add(callback, user_data);

is fine. It is only problematic to do something with those numeric IDs.
checkpatch.pl would also flag those uses, but these are just warnings
and in the few cases where such a warning is emitted wrongly, it's find
to ignore them.
2021-06-28 13:31:33 +02:00
Thomas Haller 26090bafc9
contrib: extend "test-create-many-device-setup.sh" script 2021-06-22 09:47:44 +02:00
Thomas Haller be4b997e4f
examples: add "examples/python/gi/nm-up-many.py"
It's an example for how to use libnm and asynchronous API.
But it's also a script I will use to test activating many
profiles in parallel.

Also add a test script that creates many veth interfaces and connection
profiles. So now you can do:

   sudo NUM_DEVS=100 contrib/scripts/test-create-many-device-setup.sh setup
   ./examples/python/gi/nm-up-many.py c-a{1..100}

and cleanup with

   nmcli connection down c-a{1..100}
   sudo contrib/scripts/test-create-many-device-setup.sh cleanup

Of course, be careful to do this on your production machine.
2021-06-11 22:48:41 +02:00
Beniamino Galvani 6ac21ba916 core: add infrastructure for spawning a helper process 2021-06-11 21:43:12 +02:00
Thomas Haller 39d71ee356
contrib: update NM-log script to highlight "enslaving to master" messages 2021-06-11 10:54:15 +02:00
Thomas Haller e831a67cbc
contrib/rpm: configure defaults for iptables/nftables when generating distribution tarball 2021-06-08 17:40:17 +02:00
Thomas Haller ff922f89f4
contrib/rpm: update comments in default NetworkManager.conf
Changing "NetworkManager.conf" is problematic, because the package management
system will detect if the user modified the file and leave .rpmnew files (or
similar).

Still, we only recently modified the file already to mention Libera.Chat.
So now is the time for more rewording.
2021-06-01 09:35:07 +02:00
Thomas Haller 6439c243e7
systemd: move "src/core/systemd" to "src/libnm-systemd-core"
This follows the recently introduced naming scheme and directory layout.
"libnm-systemd-core" is an independent component, and as such should no
be inside "src/core/".

Move it.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/875
2021-05-30 09:45:05 +02:00
Thomas Haller 6365d8c67a
contrib/scripts: drop unnecessary line in "find-backports" script 2021-05-26 23:38:58 +02:00
Thomas Haller 7e581a0303
Revert "contrib: no longer install libuuid as build dependency"
Ups, we actually still require libuuid. Actually, we only need to
to build the example script `examples/C/glib/add-connection-gdbus.c`.
The proper solution would be to make this an optional dependency.

So far this was not yet done. Also, libuuid is really an ubiquitous
dependency on Linux, so it's not really a problem to have this build
dependency, even if it's just to build the examples.

This reverts commit c0a3947ff9.
2021-05-26 22:16:35 +02:00
Thomas Haller c0a3947ff9
contrib: no longer install libuuid as build dependency
We no longer need it. Only for build.sh script we require `uuidgen`
from util-linux package.
2021-05-26 19:25:41 +02:00
Thomas Haller 95085acec3
update references from "freenode" to "Libera.Chat" 2021-05-25 11:09:37 +02:00
Thomas Haller 847d6b31d4
contrib/rpm: remove "Obsoletes: NetworkManager-{atm,bt}"
These subpackages existed before commit 886366d0fd ('contrib/rpm:
update spec file after renaming NM plugins') (2014, before 0.9.9.95).

rpm warns about unversioned obsoletes like:

  It's not recommended to have unversioned Obsoletes: Obsoletes: NetworkManager-atm
  It's not recommended to have unversioned Obsoletes: Obsoletes: NetworkManager-bt

These packages are so long gone by now, let's just drop the Obsoletes.
2021-05-21 09:58:16 +02:00
Thomas Haller 871faa3ba7
contrib/rpm: remove "Obsoletes: dhcdbd"
"dhcdbd" is gone since 2007. Drop it. Also, rpm doesn't really like
unversioned obsoletes and warns:

    It's not recommended to have unversioned Obsoletes: Obsoletes: dhcdbd
2021-05-21 09:34:47 +02:00
Thomas Haller f215c9a7fa
contrib/rpm: don't have build dependency for iptables
We really only require "iptables" as build dependency to autodetect the
path where iptables is installed. On Fedora/RHEL, this is always /usr/sbin,
so we can just as well hard code this.

Alternatively, if the autodetection is really necessary, we would also require
a build dependency on /usr/sbin/nft. That seems a waste.
2021-05-21 09:34:46 +02:00
Thomas Haller 199807b2ec
contrib/rpm: add rhel-8 specific libndp dependeny 2021-05-21 09:34:46 +02:00
Thomas Haller af40a14556
contrib/rpm: %ghost "/etc/NetworkManager/VPN"
"/etc/NetworkManager/VPN" was historically the place for .name files for
VPN plugins. In the meantime, those should be under "/usr/lib/NetworkManager/VPN".

Still, NetworkManager honors (and possibly watches) the directory in
/etc. Mark the directory as %ghost.

The exact effect of this is not clear to me. It seems however right to
do, and works for my testing.
2021-05-12 13:36:19 +02:00
Thomas Haller 40c78fe699
contrib/rpm: obsolete "config-routing-rules" package with fixed version
Since commit a447942fc0 ('contrib/rpm: rename package
"NetworkManager-config-routing-rules" to
"NetworkManager-dispatcher-routing-rules"'), the config-routing-rules
subpackage is gone.

This way to specify the version number with a variable parameter, causes
repeated messages in rpmdiff:

    INFO  NetworkManager-dispatcher-routing-rules  changed from Obsoletes: NetworkManager-config-routing-rules < 1:1.32.0-0.2.el8 to Obsoletes: NetworkManager-config-routing-rules < 1:1.32.0-0.3.el8 on noarch

Avoid this by hard coding the obsoleted version.
2021-05-12 13:35:37 +02:00
Thomas Haller 9e3b7b2e99
contrib/rpm: let NetworkManager-libnm package conflict with exact NetworkManager-glib version
This "Conflicts" is since commit b85b8ed6fa ('contrib/rpm: let
NetworkManager-libnm and NetworkManager-glib of differing version
conflict'). This was probably fine back then, but NetworkManager-glib is
long gone.

Also, not hard coding the version number leads to rpmdiff messages like:

  NEEDS INSPECTION  NetworkManager-libnm  changed from Conflicts: NetworkManager-glib < 1:1.32.0-0.2.el8 to Conflicts: NetworkManager-glib < 1:1.32.0-0.3.el8 on all architectures

As NetworkManager-glib is long gone, hard code the version with which
we conflict.
2021-05-12 13:35:28 +02:00
Thomas Haller fb2ea999ea
clang-format: update "nm-code-format-container.sh" script to use Fedora 34 container 2021-05-04 13:56:27 +02:00
Thomas Haller 94ba38962f
contrib: install clang-format via REQUIRED_PACKAGES
On Fedora 33, we get it automatically because "clang" package
has an indirect (weak) dependency for clang-tools-extra. On
Fedora 34, that is no loger the case.

We need to explicitly install it.
2021-05-04 13:56:19 +02:00
Beniamino Galvani aaed69e5d7 contrib/rpm: install D-Bus service files to /usr in RHEL8
When supported by the D-Bus daemon, it's better to have service files
in /usr rather than in /etc. Change the path for RHEL 8.

See also commit ef8c292881 ('contrib/rpm: install D-Bus service
files to /usr if we can').
2021-04-30 17:00:50 +02:00
Thomas Haller 23a200d19e
checkpatch: warn about uses of strcmp()/g_strcmp0()
Using strcmp()/g_strcmp0() for checking for string equality is hard
to read. We should prefer our streq variants -- unless, you really
mean cmp.
2021-04-26 09:53:11 +02:00
Thomas Haller 74fc279341
contrib: fix URL to nm-git-bundle in "nm-copr-build.sh" 2021-04-01 22:34:06 +02:00
Thomas Haller edd9521fef
contrib/rpm: fix reference to main branch in NetworkManager.spec 2021-04-01 22:29:00 +02:00
Thomas Haller 172dace30d
contrib/scripts: use "main" branch name in "checkpatch-feature-branch.sh" 2021-04-01 22:28:59 +02:00
Thomas Haller f938ec6977
contrib: update nm-git-bundle to use "main" branch 2021-04-01 22:24:49 +02:00
Thomas Haller f0612bd67b
contrib/scripts: update find-backports script to use "main" branch name 2021-04-01 21:40:25 +02:00
Thomas Haller 1db34e4fb1
contrib/release: update release.sh script to use "main" branch name 2021-04-01 21:38:17 +02:00
Thomas Haller 9c0c0ac966
man: split NetworkManager-dispatcher(8) manual page out of NetworkManager(8)
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/784
2021-03-16 17:01:53 +01:00
Thomas Haller fb66bb2bcb
CONTRIBUTING: rename file to have .md extension
We should write our CONTRIBUTING files in markdown syntax, because
it's nice to read a plain text and gets nicely rendered.

However, if the file doesn't have a ".md" extension, gitlab's
web interface shows it as plain text file.

Rename the file.

This possibly breaks links like [1], but referring to a branch name
(and not a commit ID or a tag) is anyway fragile. Hence, I don't try
to fix that by adding a symlink or similar, because I think that just
makes it more confusing.

[1] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/master/CONTRIBUTING
2021-03-16 14:00:01 +01:00
Thomas Haller e643703418
tests/client: run "test-client.py" also for meson 2021-03-15 17:10:56 +01:00
Thomas Haller afd55358a4
contrib/scripts: fix "nm-copr-build.sh" script to use new nm-git-bundle 2021-03-03 11:00:06 +01:00
Thomas Haller 3906cc9cf4
build: move c-util/nettools library from "shared/" to "src/" 2021-02-24 12:48:28 +01:00
Thomas Haller a8c34b9dcf
build: move "shared/nm-std-aux" to "src/libnm-std-aux" 2021-02-24 12:48:24 +01:00
Thomas Haller 39225258d6
build: move "shared/systemd" to "src/libnm-systemd-shared" 2021-02-24 12:48:16 +01:00
Thomas Haller 04290879b7
release: fix pattern in release.sh script for checking branch name 2021-02-18 17:53:15 +01:00
Thomas Haller 8c04f72e36 contrib/rpm: update URL for NetworkManager in RPM package
The previous URL http://www.gnome.org/projects/NetworkManager/
now redirects to https://wiki.gnome.org/Apps, which isn't very
useful.

Instead, link to our NetworkManager page. The page is still sparsely
populated, but we should improve that.
2021-02-16 11:29:24 +01:00
Thomas Haller e23bafe5d5
contrib/rpm: revert building "--with test" for RHEL 9
"--with test" does two things:

(1) it enables "-Werror" compiler option. We always enable all
    compiler warnings we care about, but this option makes all
    warnings fatal.
    Compiler warnings depend on compiler version and build options.
    It's hard to build without any compiler warnings, in particular
    for *future* compiler versions which we don't know yet. It
    is desirable that a SRPM from yesterday can also be build
    tomorrow.

(2) it fails build if any unit tests fail. We always run all
    unit tests, but "--with test" makes it fatal. Again, we
    have many unit tests that interact with the system (that is,
    make system calls, like creating IP addresses or write files).
    It is surprisingly hard to get them pass 100% on all the systems
    we care. For example, on copr a test setup randomly fails during

         ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
         nm_utils_ifname_cpy(ifr.ifr_name, TEST_IFNAME);
         r = ioctl(fd, TUNSETIFF, &ifr);

    It's not clear why, nor is it at all clear that there is a bug
    in NetworkManager. Making tests fatal basically means that a build
    on copr infrastructure fails with a probability from a few percent.
    Enough to be seriously annoying.

Note that on copr we actually build "--with test", because we want to catch these
issues. Likewise for our CI builds we explicitly specify "--with test".

In general, we build with various build configurations (compiler warnings)
and run unit tests on a source package many times. Starting on the
developer machine (`make check`), gitlab-ci, copr builds,
NetworkManager-ci. If you build an SRPM with such sources, a failure
of the unit tests is much more likely a glitch than an actual issue.

This is about changing the default if you build a Fedora/RHEL package.
That is with the Fedora/RHEL packages that are build in koji/brew.

Well, at least usually. In practice, we don't build frequently on non
x64_86 archs, so what I said there is less true. But the package build
is not there to replace CI/testing. The package build is there to get
a (mostly) working binary.

Note that RHEL packages anyway go through rpmdiff too, and rpmdiff
parses the build log and complain if `make check` fails.

This reverts commit e68e5c0a4c.
2021-02-12 13:35:24 +01:00
Thomas Haller d5bf957387
contrib/release: fix release script after moving src directory 2021-02-08 10:26:03 +01:00
Thomas Haller ac1a9e03e4
all: move "src/" directory to "src/core/"
Currently "src/" mostly contains the source code of the daemon.
I say mostly, because that is not true, there are also the device,
settings, wwan, ppp plugins, the initrd generator, the pppd and dhcp
helper, and probably more.

Also we have source code under libnm-core/, libnm/, clients/, and
shared/ directories. That is all confusing.

We should have one "src" directory, that contains subdirectories. Those
subdirectories should contain individual parts (libraries or
applications), that possibly have dependencies on other subdirectories.
There should be a flat hierarchy of directories under src/, which
contains individual modules.

As the name "src/" is already taken, that prevents any sensible
restructuring of the code.

As a first step, move "src/" to "src/core/". This gives space to
reorganize the code better by moving individual components into "src/".

For inspiration, look at systemd's "src/" directory.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/743
2021-02-04 09:45:55 +01:00
Thomas Haller 1ccbae6e4e
contrib/rpm: add "enabled=true" key to "20-connectivity-{fedora,redhat}.conf"
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/649
2021-02-02 14:02:31 +01:00
Thomas Haller 7869aacf61
gitlab-ci: skip valgrind on Debian/sid with glib2.0 (2.66.4-2)
See-also: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1902#note_1018573
2021-01-28 14:50:32 +01:00
Thomas Haller eafa96c06a
contrib/spec: let NetworkManager-wifi depend on wireless-regdb/crda
Based-on-patch-by: Peter Robinson <pbrobinson@gmail.com>

https://src.fedoraproject.org/rpms/NetworkManager/pull-request/7
2021-01-18 12:22:07 +01:00
Thomas Haller a326c30110
contrib/rpm: fix packaging "/usr/share/man/man8/nm-cloud-setup.8.gz" in "NetworkManager"
nm-cloud-setup is provided by sub-package "NetworkManager-cloud-setup",
which also has the manual page. The main package "NetworkManager" should
not also contain the manual page.
2021-01-15 17:51:20 +01:00
Tom Stellard d19a13e4b1
contrib/rpm: use make macros
https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro

https://src.fedoraproject.org/rpms/NetworkManager/pull-request/4

8f93680134
2021-01-15 17:25:19 +01:00
Jonathan Lebon a1d9a79228
contrib/rpm: don't trigger udev if socket doesn't exist
On rpm-ostree systems, we don't want scriptlets to affect the running
system because a major part of the value is "background updates".
Scriptlets are run in a containerized environment where e.g. udev is not
available.

Add a check for the udev socket before triggering it to handle this.
This also helps the container use case.

This doesn't break rpm-ostree strictly, because it uses `|| :`, but it
still spams error messages during the compose. I kept the `|| :` to be
safe, but it's likely fine to remove them now.

See-also: https://bugzilla.redhat.com/show_bug.cgi?id=1352154
See-also: https://src.fedoraproject.org/rpms/udisks2/pull-request/3
See-also: https://github.com/coreos/fedora-coreos-tracker/issues/703

https://src.fedoraproject.org/rpms/NetworkManager/pull-request/6
2021-01-14 22:46:35 +01:00
Thomas Haller 9ba8c32dac
contrib/rpm: add "BuildRequires: make" to SPEC file
https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot
2021-01-14 22:17:34 +01:00
Thomas Haller 8e735a51b8
contrib: handle no files in "nm-code-format.sh"
Calling `clang-format` with no files means to read
stdin, it thus hangs:

   $ ./contrib/scripts/nm-code-format.sh .git

Also, the following does not work:

   $ ./contrib/scripts/nm-code-format.sh src/platform/

hangs. Seems there is a bug in `git ls-files` to not list all files:

   podman run -ti alpine:latest \
      sh -c '
         apk add git &&
         git clone https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git &&
         cd NetworkManager &&
         git checkout -B tmp cd754680a6 &&
         echo ">>>>>>BAD1: $PWD" &&
         git ls-files -- src/platform/ ":(exclude)shared/n-acd"
         echo ">>>>>>GOOD1: $PWD" &&
         git ls-files -- src/platform/ ":(exclude)shared/c-list"
         echo ">>>>>>GOOD2: $PWD" &&
         git ls-files -- src/platform ":(exclude)shared/n-acd"
         echo ">>>>>>GOOD3: $PWD" &&
         git ls-files -- src/vpn/ ":(exclude)shared/n-acd"
      '

Fixes: 9bef4ece92 ('contrib: improve nm-code-format.sh script')
2021-01-13 16:49:09 +01:00
Thomas Haller 9bef4ece92
contrib: improve nm-code-format.sh script
- accept directory names in the command line. In that case,
  still honor the excluded files. That is a major improvement
  for me, because I usually only want to reformat a directory
  that I know has changed and it is fast to only process some
  directories.

- pass all files at once to clang-format. For me that gives
  a significant speed improvement (about 3 times faster), although
  clang-format is only single threaded. Possibly clang-format could
  even be faster by checking files in parallel.
  In case of a style error, the script still falls back to
  iterate over all files to find the first bad file and print
  the full diff. But that is considered an unusual case.

- make it correctly work from calling it from a subdirectory.
  In that case, we only check files inside that directory --
  but still correctly honor the excluded files.
2021-01-13 12:57:48 +01:00
Thomas Haller d26fa1cd52
contrib: fix "contrib/scripts/nm-copr-build.sh" script 2021-01-12 14:53:00 +01:00
Thomas Haller 1277e4c882
contrib: add "contrib/scripts/nm-copr-build.sh" script
This will be the script used by our copr repositories ([1]) for building
the SRPM of NetworkManger from git.

[1] https://copr.fedorainfracloud.org/coprs/networkmanager/
2021-01-12 14:28:23 +01:00
Thomas Haller 55e4b0ea9c
contrib: add "contrib/scripts/nm-copr-build-nm-git-bundle.sh" script 2021-01-12 13:16:17 +01:00
Thomas Haller 344fd187cd
checkpatch: update check for SPDX license identifier tag 2021-01-05 09:46:24 +01:00
Thomas Haller 977ea352a0
all: update deprecated SPDX license identifiers
These SPDX license identifiers are deprecated ([1]). Update them.

[1] https://spdx.org/licenses/

  sed \
     -e '1 s%^/\* SPDX-License-Identifier: \(GPL-2.0\|LGPL-2.1\)+ \*/$%/* SPDX-License-Identifier: \1-or-later */%' \
     -e '1,2 s%^\(--\|#\|//\) SPDX-License-Identifier: \(GPL-2.0\|LGPL-2.1\)+$%\1 SPDX-License-Identifier: \2-or-later%' \
     -i \
     $(git grep -l SPDX-License-Identifier -- \
         ':(exclude)shared/c-*/' \
         ':(exclude)shared/n-*/' \
         ':(exclude)shared/systemd/src' \
         ':(exclude)src/systemd/src')
2021-01-05 09:46:21 +01:00
Thomas Haller d1f8e843d5
shared: don't clang-format "shared/nm-std-aux/unaligned.h"
"shared/nm-std-aux/unaligned.h" is taken from systemd and frequently
re-imported via the "systemd" branch.

It is not our code, and should not be formatted with our clang-format.
2021-01-05 09:37:02 +01:00
Thomas Haller 826f208319
gitlab-ci: skip valgrind tests on Alpine Linux
We don't have debug symbols, so valgrind suppressions don't work.
Skip those checks.
2020-12-23 10:48:27 +01:00
Thomas Haller 81e0837678
gitlab-ci: install missing packages on Alpine Linux
The "contrib/alpine/REQUIRED_PACKAGES" script is also
used by gitlab-ci to setup the test container. These
packages are required for unit tests.
2020-12-23 10:48:26 +01:00
Thomas Haller a1002bd93a
gitlab-ci: enable test build on alpine linux
Alpine is especially interesting because it uses musl as libc.

The build does not yet succeed. There are several issues that
need to be fixed.

However, it will be simpler to fix things, if we have tests
in place -- even if at the moment they are known to be broken.

See-also: https://git.alpinelinux.org/aports/tree/community/networkmanager?h=master
2020-12-11 18:14:10 +01:00
Thomas Haller a4f1fa0893
man: add man 8 nm-cloud-setup
https://bugzilla.redhat.com/show_bug.cgi?id=1867997
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/ ## 600
2020-12-11 17:36:38 +01:00
Thomas Haller d07cd5dbf2
all: avoid GNU "which" from shell scripts
"which" is a separate package and may not be installed.
Also, shell has a built-in command for the same purpose.
Use that.
2020-12-11 16:42:23 +01:00
Thomas Haller ae5ea7fa62
contrib/release: check NEWS file before release 2020-12-06 16:03:34 +01:00
Thomas Haller c9898dc9ae
contrib/rpm: update default for main.plugins setting in NetworkManager.conf
With Fedora 33+ and RHEL 9+, the default plugins are
"plugins=keyfile,ifcfg-rh", instead of "plugins=ifcfg-rh,keyfile".

Update our "NetworkManager.conf" file to reflect that.
2020-12-06 11:23:46 +01:00
Thomas Haller a3f2cee0e6
contrib/rpm: support default options for debug,test in generated spec file
"build_clean.sh" (and "build.sh") scripts can both create a source
tarball (via `make dist`/`make distcheck`), an SRPM (and a spec file),
or build RPMs from the SRPM.

Note that the generated spec file has various options, like

    %bcond_without nmtui
    %bcond_without debug
    %bcond_without test

When building an RPM from the SRPM, you can specify the "--with" or
"--without" option for rpmbuild. This is also what the "-w" / "-W" options
for "build_clean.sh" do.

However, the SRPM still has the intrinsic defaults, and if you later
build an RPM from it, you would have to pass "--with" / "--without"
to rpmbuild.

Often that is not conveniently possible, for example, when you build the
SRPM in koji.

Extend the scripts so that also the defaults for "-w debug" and "-w
test" can be specified when generating the SRPM. You can do that with
the new options "--default-for-{debug,test}" to "build_clean.sh".

Alternatively, it suffices to specify the previously supported
"-w" / "-W" options. That way, we will pass those options to rpmbuild,
but also set them as defaults in the generate spec file. The new
options "--default-for-{debug,test}" are only needed if you want
the default in the spec file to be different then what you use
when creating the SRPM.
2020-12-03 17:38:06 +01:00
Thomas Haller 3bf367594a
contrib/rpm: add "--no-auto-with-test" option for "build_clean.sh" script
By default, "build_clean.sh" script likes to automatically add "-w test"
-- unless the user specified "-w test" or "-W test" on the command line.

That is mostly fine. However, the spec file has an internal default for the
"test" option. So if you want to use the default that gets determined
by the spec file, then we should suppress that automatism.
2020-12-03 17:34:01 +01:00
Thomas Haller a8ead4a4c3
contrib/rpm: drop no longer supported "--enable-json-validation" from configure
Fixes: bbb1f5df2f ('libnm: always build libnm with JSON validation')
2020-12-03 17:31:30 +01:00
Thomas Haller e68e5c0a4c
contrib/rpm: on rhel-9 let a test failure or compiler warning fail the build
We always run the unit tests during package build and also enable all compiler
warnings. However, by default we used to ignore failures. That is, because
rebuilding a package on another, future distro led to frequent, annoying build
failures. Especially compiler warnings appear easily when using a
different compiler version.

The default mostly matters here when you want to build the package in
brew/koji, where you don't have a possibility to explicitly select the
build option.

Note that rpmdiff detects failures in the build log, and thus we usually
would not miss failures for builds we add to errata. Also, all our CI
tests build packages with a manner where they would not allow a failure
of the unit tests. So, we run these unit tests frequently and in a
manner where we notice a failure.

For rhel-9 builds, change the default here and let test failures and
compiler warnings be fatal to the build.
2020-11-26 18:31:46 +01:00
Thomas Haller 87749642e2
scripts: allow marking commits with "Ignore-Backport:" in "find-backports" script
"find-backports" searches commit messages of upstream branches for
"Fixes:" comments. Those will then be highlighted to be backported,
if the script determines that to be necessary.

"find-backports" also honors the "cherry picked from" comments, to detect when
a patch was already backported. That is thus a way to suppress reporting a
commit to be backported.

Add another way to flag commits so they don't need backporting. Via
"Ignore-Backport:" tag.

As "find-backports" also honors "refs/notes/bugs" notes, this can be used
like:

    git notes \
      --ref refs/notes/bugs \
      append \
      -m "Ignore-Backport: e""29f00fa0c69 ('NEWS: fix entry that is targeted for 1.30 instead of 1.28')" \
      2''3364aa8f3bd6b11e2ac9e30117eaabfe1f3a9f2
2020-11-24 12:30:06 +01:00
Thomas Haller 869ff96ad1
contrib/checkpatch: fix shallow repository for checkpatch script
The checkpatch test tests the patches on the merg-request, as they
branch off from master (or one of the stable branches).

It thus need the full git history, but the git repository might be a
shallow clone. Fix it.
2020-11-10 18:23:36 +01:00
Thomas Haller 45cb0ef403
contrib/checkpatch: use random name for git remote and clean up afterwards 2020-11-10 17:14:07 +01:00
Thomas Haller d6cbbbcad3
contrib: install "udev" package with "debian/REQUIRED_PACKAGES"
"debian/REQUIRED_PACKAGES" is used by gitlab-ci to prepare the image. We require
"udev" package, if only to install "/usr/share/pkgconfig/udev.pc" to get the
udev directory.

Otherwise build fails with:

    Run-time dependency udev found: NO (tried pkgconfig)
    meson.build:371:2: ERROR: Dependency "udev" not found, tried pkgconfig
2020-11-10 13:51:29 +01:00
Thomas Haller a51d17cffa
contrib: install "python{3,}-setuptools" package with "debian/REQUIRED_PACKAGES"
Odd, sometimes gitlab CI fails to use pip3 install, because setuptools
module is not installed. But only sometimes...

Explicitly install it.
2020-11-10 13:51:29 +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
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 affff881e2
contrib/release: check whether access to master.gnome.org works before publishing release 2020-11-02 18:51:45 +01:00
Thomas Haller 6677480a2d
checkpatch: ignore warning about g_assert*() also for files like "shared/nm-utils/nm-test-utils.h" 2020-10-22 09:29:28 +02:00
Thomas Haller 53bd66b540
contrib/release: fix parsing version in "release.sh" script 2020-10-19 20:50:35 +02:00
Thomas Haller d7f6fb8378
contrib/release: improve help text for "release.sh" script 2020-10-19 20:43:52 +02:00
Thomas Haller fdeb960087
contrib/release: use "find-backport" scripts from release.sh 2020-10-19 20:35:51 +02:00
Thomas Haller 57cfa5daf9
contrib: add "find-backports" script
This script was previously on the "automation" branch. Add it to
"master".
2020-10-19 20:34:06 +02:00
Thomas Haller 96a3d664cb
contrib/checkpatch: complain about patch format with "Reverts:" tag 2020-10-09 15:55:48 +02:00
Thomas Haller f9517c7fbb
build/release: before release check that all gitlab-ci tests ran successfully 2020-10-06 15:47:29 +02:00
Thomas Haller 53a56a5106
build/travis: remove travis integration
We already build a large variety of configurations in gitlab-ci,
we don't need yet another configuration to run tests on travis-ci.
Also, because the travis-ci setup is outdated and we don't look
at it. Let's focus on gitlab-ci instead.
2020-10-05 23:18:12 +02:00
Thomas Haller 5e83bac5aa
contrib/release: restore original branch in dry-run mode
In dry-run mode, reset the branch to the state where it was before.

Also, in real mode delete the temporary "release-branch" branch on
success.
2020-10-05 19:35:04 +02:00
Thomas Haller 36b761fcaa
contrib: add "nm-code-format-container.sh" to reformat working directory in container
We use clang-format to format our code, and the exact format depends on
the clang version. Currently we use clang-11, as packaged in Fedora 33.

Add a script that runs a Fedora 33 container with podman and reformats
the current working directory.

Usage:

  ./contrib/scripts/nm-code-format-container.sh
2020-09-29 13:37:58 +02:00
Thomas Haller 8435deecfa
contrib: let "nm-code-format.sh" handle files under ./{shared,src}/systemd/
Only the files under ./{shared,src}/systemd/src are copied from systemd.
The other files should be reformatted too.
2020-09-28 20:01:23 +02:00
Thomas Haller 419be5d0e7
checkpatch.pl: adjust checking for indentation/tabs
Our new format gets enforced by clang-format, and we now only use
four space indentation, instead of tabs.

Adjust the checkpatch script to account for that.

Also, now there are probably no cases left where we want to see any
tabs in our sources. Complain about any tabs we find.
2020-09-28 15:08:41 +02:00
Thomas Haller bad4065d67
contrib/release: implement "rc1" release mode 2020-09-23 08:58:47 +02:00
Thomas Haller 991999489a
contrib/build: reword howto for "release.sh" script 2020-09-14 16:11:54 +02:00
Antonio Cardace eebed47257
contrib: add git-hook to verify code-style
Signed-off-by: Antonio Cardace <acardace@redhat.com>
2020-09-02 19:20:40 +02:00
Antonio Cardace 5119d00374
scripts: better error message for nm-code-format.sh
Signed-off-by: Antonio Cardace <acardace@redhat.com>
2020-09-02 19:20:36 +02:00
Antonio Cardace 715392a45e
scripts: add script to format codebase using clang-format
Signed-off-by: Antonio Cardace <acardace@redhat.com>
2020-09-02 17:31:42 +02:00
Thomas Haller 6b63b68a41
contrib: accept missing .sig file for older releases in "release.sh"
On older branches, the build script does not create a GPG signature of
the release tarball. Let the release script be graceful against that.
2020-08-31 13:20:24 +02:00
Thomas Haller 12e8557476
gitlab-ci: fix workarounds for Ubuntu 16.04 in tests
The detection for Ubuntu 16.04 was broken. By now /etc/os-release
contains

    VERSION="16.04.7 LTS (Xenial Xerus)"
2020-08-28 14:24:32 +02:00
Thomas Haller c1f9a0fff1
dns: add new "rc-manager=auto" mode
Add a new `main.rc-manager=auto` setting, that favours to use
systemd-resolved (and not touch "/etc/resolv.conf" but configure
it via D-Bus), or falls back to `resolvconf`/`netconfig` binaries
if they are installed and enabled at compile time.
As final fallback use "symlink", like before.

Note that on Fedora there is no "openresolv" package ([1]). Instead, "systemd"
package provides "/usr/sbin/resolvconf" as a wrapper for systemd-resolved's
"resolvectl". On such a system the fallback to resolvconf is always
wrong, because NetworkManager should either talk to systemd-resolved
directly or not but never call "/usr/sbin/resolvconf". So, the special handling
for resolvconf and netconfig is only done if NetworkManager was build with these
applications explicitly enabled.

Note that SUSE builds NetworkManager with

    --with-netconfig=yes
    --with-config-dns-rc-manager-default=netconfig

and the new option won't be used there either. But of course, netconfig
already does all the right things on SUSE.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=668153

Suggested-by: Jason A. Donenfeld <Jason@zx2c4.com>
2020-08-24 21:13:21 +02:00
Thomas Haller 2c12786e3d
contrib/rpm: enable LTO by default on RHEL-9 and newer 2020-08-18 23:00:20 +02:00
Thomas Haller 839ba57c7f
contrib/rpm: enable LTO by default on Fedora 33
With Fedora 33, LTO will be enabled by default via CFLAGS in
redhat-rpm-config ([1]).

That basically sets "CFLAGS=-flto -ffat-lto-objects".

Note that we have our own configure/meson option to enable LTO.
With "--with-lto" we set CFLAGS="-flto -flto-partition=none". This
is necessary due ([2], [3]).

So, disable Fedora's automatism, but turn on the suitable configure
option to get working LTO.

[1] 5baaf4a99c?branch=master
[2] e6cf4213a7 ('build: fix building with LTO')
[3] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48200#c28
2020-08-17 15:20:08 +02:00
Thomas Haller 67cc4544f7
scripts: use "/bin/cat" in NM-log
Ubuntu 16.04 doesn't have merged /usr directories and cat is in
/bin/cat.
2020-08-17 10:58:19 +02:00
Thomas Haller 6c6a00eae5
contrib: use new "find-backports" script in "release.sh" 2020-08-05 00:24:40 +02:00
Thomas Haller 3e475e5cd1
contrib/rpm: prefer keyfile settings plugin from Fedora 33 and newer
This change is for Fedora 33 and newer. For now, also enable it for RHEL
9 and newer, but it must still be decided whether that will be done
there as well.

https://mail.gnome.org/archives/networkmanager-list/2020-May/msg00002.html
https://fedoraproject.org/wiki/Changes/NetworkManager_keyfile_instead_of_ifcfg_rh
https://lists.fedoraproject.org/archives/list/devel-announce@lists.fedoraproject.org/thread/OLOU27DAON2TYGTAVZ35GZE2BEIN42U3/
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/OLOU27DAON2TYGTAVZ35GZE2BEIN42U3/
https://pagure.io/fesco/issue/2432

https://bugzilla.redhat.com/show_bug.cgi?id=1857391
2020-07-16 12:28:03 +02:00
Thomas Haller aa4cb0e5eb
contrib: improve code comments to release.sh scripts 2020-07-13 23:54:34 +02:00
Thomas Haller 5542275672
contrib: add "major-post" step for release.sh script 2020-07-13 23:28:05 +02:00
Thomas Haller c3b04c4fd9
contrib: support "major" release in release.sh script 2020-07-13 18:05:32 +02:00
Thomas Haller ae626ade0f
contrib: consistency check meson.build in release script 2020-06-30 13:57:15 +02:00
Thomas Haller 66651d5660
contrib: improve release script with howto comments and help option 2020-06-30 13:36:42 +02:00
Thomas Haller 53bb23b403
build: for signing use key from git's user.signingkey 2020-06-29 09:08:04 +02:00
Thomas Haller 0748bd989d
release: cleanup temporary release-branch and avoid prompt for ftpadmin install 2020-06-28 19:16:20 +02:00
Thomas Haller 99f834842a
release: fix "rc" release build and add option to suppress check for local branches 2020-06-28 19:02:07 +02:00
Thomas Haller 7f93fd8e7b
release: fix RC_VERSION for release script
The release candidate -rc1 has version "1.y.90", -rc2 has "1.y.91", and so
on. Fix the script.
2020-06-28 18:35:03 +02:00
Thomas Haller 8e9e6fd024
release: fix release script for "rc" 2020-06-28 18:06:17 +02:00
Thomas Haller ccac506a8a
build: print deleted references in release.sh script 2020-06-04 13:17:57 +02:00
Thomas Haller 61b9201898
build: print commands in color for release.sh script 2020-06-04 12:31:39 +02:00
Thomas Haller 207fd8dfb1
build: implement release mode "rc" in release.sh script
Still not implemented are the first release candidate (rc1)
and the major release.
2020-06-04 11:54:31 +02:00
Thomas Haller bbb95c979e
build: optionally sign source tarball in build.sh script
This defaults to $DO_RELEASE. In that case, the script will also GPG sign
the source tarball.

The purpose is that when we do a release we want to ensure that the
published tarball is really the one that we generated. In that case,
the SHA sum would suffice, however that requires you to manually note
it down and compare the result. With the gpg signature, that
verification can be better automated.
2020-06-04 11:33:00 +02:00
Thomas Haller 0ac05a3faa
build: add "release.sh" script
Currently only "minor" and "devel" releases are implement. It's also not yet
tested with --no-dry-run, because that would actually create a release.

Test it when using it the next time.
2020-06-04 10:51:12 +02:00
Thomas Haller b4fb2a4f94
contrib/rpm: remove trailing whitespaces from spec file 2020-05-29 17:06:59 +02:00
Beniamino Galvani 53aa5bd207 platform: add tc tests 2020-05-28 17:25:31 +02:00
Beniamino Galvani 016a82e6dd contrib/rpm: enable the firewalld zone in F32 and RHEL8 2020-05-15 19:06:24 +02:00
Thomas Haller 8d2f6dfe38
contrib/rpm: no longer mention that libnm is "new API"
libnm was introduced in version 1.0, December 2014. It's
no longer new, and libnm-glib is forgotten.
2020-05-14 17:21:12 +02:00
Thomas Haller 350681e7f1
contrib/rpm: enable undefined-sanitizer libubsan on RHEL-8 2020-05-14 12:19:34 +02:00
Thomas Haller b846f9aba3
gitlab-ci: optionally install libasan,libubsan via REQUIRED_PACKAGES script 2020-05-14 12:03:24 +02:00
Thomas Haller 1473f00d74
gitlab-ci: accept failure in REQUIRED_PACKAGES script for non-existing qt-devel
On CentOS 8, many devel packages are not available. Even after

  # dnf config-manager --set-enabled PowerTools

certain devel packages are missing. Some of these (libndp-devel,
mobile-broadband-provider-info-devel, teamd-devel) we build in copr
([1]), but libpsl-devel and qt-devel are still missing.

Only install them optionally and allow failure for them not being
present.

[1] https://copr.fedorainfracloud.org/coprs/nmstate/nm-build-deps/repo/epel-8/nmstate-nm-build-deps-epel-8.repo
2020-05-14 12:03:24 +02:00
Thomas Haller 3f6f7b06c6
contrib/rpm: log MD5/SHA sums of release tarball during build_clean.sh
When doing a release, we should care about the checksum of the tarball.
Log all of them... also, because fedpkg uses sha512, ftpadmin@gnome uses
sha256, etc.
2020-05-08 14:54:37 +02:00
Thomas Haller ed94ab6e23 contrib/rpm: fix spec file using bare words
error: bare words are no longer supported, please use "...":  no != "yes"
  error:                                                        ^
  error: /builds/NetworkManager/NetworkManager/contrib/fedora/rpm/NetworkManager.20200418-170120.dp5cp5/SPECS/NetworkManager.spec:596: bad %if condition:  no != "yes"
2020-04-18 19:10:46 +02:00
Thomas Haller be78a12012 contrib/rpm: fix spec file using bare words
error: bare words are no longer supported, please use "...":  no != yes
  error: /builds/NetworkManager/NetworkManager/contrib/fedora/rpm/NetworkManager.20200418-163008.VM582H/SPECS/NetworkManager.spec:596: bad %if condition:  no != yes
2020-04-18 18:33:55 +02:00
Thomas Haller 68b38a09d1 contrib/rpm: avoid bare words in spec file
error: bare words are no longer supported, please use "...":  "x" != x
   error:                                                               ^
   error: /root/nm-build/NetworkManager/contrib/fedora/rpm/NetworkManager.20200402-030113.Hk7EGs/SPECS/NetworkManager.spec:32: bad %if condition:  "x" != x
   ERROR: rpmbuild FAILED
2020-04-02 09:36:37 +02:00
Thomas Haller 1bc5a7c778 contrib/scripts: add "checkpatch-git-post-commit-hook" script to contrib/
This can be used as git post-commit hook.
2020-02-21 07:40:10 +01:00
Thomas Haller 5cc8ca4038 contrib/REQUIRED_PACKAGES: fix script to work without GNU which installed
`which` is convenient, but not installed in Fedora container images.
Fix detection of whether to use `dnf` or `yum`.
2020-02-10 11:26:59 +01:00
Thomas Haller bdd45e6afa contrib/REQUIRED_PACKAGES: ignore for non-existing packages "dbus-python", "pygobject3-base" on Fedora 32
These packages no longer exist on Fedora 32 and dnf fails due to
that. Ignore such errors.
2020-02-10 11:18:51 +01:00
Antonio Cardace df1d214b2e clients: polkit-agent: implement polkit agent without using libpolkit 2019-12-24 10:13:51 +01:00
Thomas Haller 2fa4827eb9 checkpatch: catch "gs_free GError *" declations
(cherry picked from commit ec0adbfaf0)
2019-12-16 17:45:16 +01:00
Thomas Haller d27fcd0754 build/meson: allow configuring default for main.auth-polkit setting
We always build PolicyKit support, because it merely depends on some
D-Bus calls. However, there are two things to configure:

 - the default value for main.auth-polkit in NetworkManager.conf. This
   is now called "-Dconfig_auth_polkit_default=$VAL".

 - whether to install the policy file. This is called "-Dpolkit=$VAL".

These settings are mostly independent, so add "config_auth_polkit_default" to
make the default explicitly configurable.

(cherry picked from commit c21c6bc0be)
2019-12-11 13:13:05 +01:00
Thomas Haller 7302be3b32 cloud-setup: add comment that the tool is still experimental
(cherry picked from commit 16223cff91)
2019-12-02 15:24:17 +01:00
Thomas Haller 7ff866e679 contrib/rpm: explicitly enable/disable bluetooth support
The bluetooth plugin (with BlueZ5/NAP support) always gets
build, but DUN support requires a library.

When enabling build of the bluetooth subpackage, then always
enable DUN support. And enable it explicitly, especially meson
would not autodetect support and disable it by default.

(cherry picked from commit 30f6a5dd21)
2019-12-02 15:16:52 +01:00
Thomas Haller 69f048bf0c cloud-setup: add tool for automatic IP configuration in cloud
This is a tool for automatically configuring networking in a cloud
environment.

Currently it only supports IPv4 on EC2, but it's intended for extending
to other cloud providers (Azure). See [1] and [2] for how to configure
secondary IP addresses on EC2. This is what the tool currently aims to
do (but in the future it might do more).

[1] https://aws.amazon.com/premiumsupport/knowledge-center/ec2-ubuntu-secondary-network-interface/

It is inspired by SuSE's cloud-netconfig ([1], [2]) and ec2-net-utils
package on Amazon Linux ([3], [4]).

[1] https://www.suse.com/c/multi-nic-cloud-netconfig-ec2-azure/
[2] https://github.com/SUSE-Enceladus/cloud-netconfig
[3] https://github.com/aws/ec2-net-utils
[4] https://github.com/lorengordon/ec2-net-utils.git

It is also intended to work without configuration. The main point is
that you boot an image with NetworkManager and nm-cloud-setup enabled,
and it just works.
2019-11-28 19:52:18 +01:00
Thomas Haller 5996b4f166 contrib/rpm: fix comment in "NetworkManager.conf" about default [main].plugins
The "ibft" plugin is no more. The default on RHEL/Fedora is now "ifcfg-rh[,keyfile]".
Adjust the configuration, because a wrong comment is confusing here.

Modifying configuration snippets is potentially annoying, because the user might
have edited the file, so on upgrade a "NetworkManager.conf.rpmnew" file
will be created. Still do it.
2019-11-28 18:33:35 +01:00
Thomas Haller 0521e06ff1 contrib/rpm: avoid warning in specfile about tokens after %endif
warning: extra tokens at the end of %endif directive in line 717:  %endif # end autotools
warning: extra tokens at the end of %endif directive in line 775:  %endif # end autotools
2019-11-23 17:01:41 +01:00
Thomas Haller 0f4819ab36 contrib/rpm: use proper check for nmtui conditional build 2019-11-22 15:32:52 +01:00
Thomas Haller 0bff8d7710 contrib: fix detection of whether being sourced in NM-log script 2019-10-26 14:22:44 +02:00
Lubomir Rintel f222dad838 contrib: move scripts from test/ to scripts/
There's no reason to have them separate. Also add the missing executable
bit to btmodem.pl.

https://github.com/NetworkManager/NetworkManager/pull/355
2019-10-09 11:38:22 +02:00
Thomas Haller 3019648b4b checkpatch,gitlab-ci: let checkpatch script compare against latest upstream master
When opening a merge request from a fork of NetworkManager, then the
pipeline runs with the a checkout of the fork. That means, checkpatch
would compare the branch against "master" (or "nm-x-y" stable branches)
of the fork, instead of upstream.

That doesn't seem too useful. Instead, also add upstream NetworkManager
as git remote, fetch the branches, and use the branches from there as
base for checkpatch.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/255
2019-10-02 18:46:36 +02:00
Thomas Haller 3b69f02164 all: unify format of our Copyright source code comments
```bash

readarray -d '' FILES < <(
  git ls-files -z \
    ':(exclude)po' \
    ':(exclude)shared/c-rbtree' \
    ':(exclude)shared/c-list' \
    ':(exclude)shared/c-siphash' \
    ':(exclude)shared/c-stdaux' \
    ':(exclude)shared/n-acd' \
    ':(exclude)shared/n-dhcp4' \
    ':(exclude)src/systemd/src' \
    ':(exclude)shared/systemd/src' \
    ':(exclude)m4' \
    ':(exclude)COPYING*'
  )

sed \
  -e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) *[-–] *\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C1pyright#\5 - \7#\9/' \
  -e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) *[,] *\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C2pyright#\5, \7#\9/' \
  -e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C3pyright#\5#\7/' \
  -e 's/^Copyright \(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/C4pyright#\1#\3/' \
  -i \
  "${FILES[@]}"

echo ">>> untouched Copyright lines"
git grep Copyright "${FILES[@]}"

echo ">>> Copyright lines with unusual extra"
git grep '\<C[0-9]pyright#' "${FILES[@]}" | grep -i reserved

sed \
  -e 's/\<C[0-9]pyright#\([^#]*\)#\(.*\)$/Copyright (C) \1 \2/' \
  -i \
  "${FILES[@]}"

```

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/298
2019-10-02 17:03:52 +02:00
Lubomir Rintel 8d352b5a47 contrib: add a Bluetooth DUN modem emulator
Useful for quickly testing Bluetooth DUN support. Duplicates some
modemu.pl logic, but hey...

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/297
2019-10-02 11:29:53 +02:00
Thomas Haller abff46cacf all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
Francesco Giudici e150307ab5 artwork: introduce NetworkManager stickers 2019-09-30 17:36:59 +02:00
Francesco Giudici d5dbea05be artwork: fix the reversed NetworkManager logo
Slightly changed the size to have a perfect square.
2019-09-30 17:27:16 +02:00
Francesco Giudici dce1aa87c2 artwork: introduce the new NetworkManager logo and logotype
The preferred logo and logotype are the ones in the main "logo" folder.
There are also few variants available in the "alternate" folder that are
allowed.

Main color for the logo is blue #32557dff.
The alternatei logo red is #cc0000ff.
The font is Montserrat.

Thanks to Máirín Duffy for all the help and support!
2019-09-27 16:15:39 +02:00
Thomas Haller 9fc4490513 contrib/rpm: drop BuildRequires to deprecated "wireless-tools-devel"
"wireless-tools-devel" is long depreacted and not used by
NetworkManager, not even for WEXT.

Drop it from the build dependencies.
2019-09-25 15:47:39 +02:00
Thomas Haller 3a1b2b9885 tests: don't install bzip2 as REQUIRED_PACKAGES on Fedora/RHEL 2019-09-25 15:47:39 +02:00
Thomas Haller 1a2a5b37b4 tests: don't install unnecessary package in gitlab-ci tests
REQUIRED_PACKAGES has two uses:

 - to setup a system for developing NetworkManager. This installs
   convenience packages like "cscope".

 - to install the packages required for unit testing in gitlab-ci.

For gitlab-ci we should only install the packages that we actually
need.
2019-09-25 15:47:39 +02:00
Thomas Haller 185567559c tests: fix failure installing non-existing packages in REQUIRED_PACKAGES
Previously, dnf/yum used to ignore packages that didn't exist.
In Fedora 32, dnf starts to fail the entire command:

  No match for argument: python-gobject-base
  Error: Unable to find a match: python-gobject-base

Since this script is supposed to work with different RHEL/Fedora
versions, it's expected that not all packages are available everywhere.

Fix that, by installing packages that we know that they might be missing
one by one (and ignore the error).
2019-09-25 15:47:39 +02:00
Thomas Haller 4b1cb404fd contrib/rpm: "Suggest" wpa_supplicant for NetworkManager-wifi package
"NetworkManager-wifi" package requires either wpa_supplicant or iwd.
When installing the package without explicitly installing supplicant
or iwd (and not having it installed yet), then we want to drag in
wpa_supplicant by default. That is accomplished by suggesting wpa_supplicant
package.

Otherwise, the user installing NetworkManager-wifi might get iwd,
which is only functioning if the user explicitly enables the backend
in "NetworkManager.conf".

https://bugzilla.redhat.com/show_bug.cgi?id=1743585
2019-09-23 13:29:12 +02:00
Lubomir Rintel 455f6dcbdc build/debian: install mobile-broadband-provider-info 2019-09-11 14:54:34 +02:00
Lubomir Rintel 7c53930ceb wwan/modem-broadband: add capability to look up default APN/username/password
This allows the GSM connection to Just Work most of the time, as in:
"nmcli d connect ttyUSB0".
2019-09-11 14:32:05 +02:00
Lubomir Rintel b1f7f431e6 contrib/modemu: also clean up on SIGTERM 2019-09-10 14:33:38 +02:00
Lubomir Rintel ae6668ae85 contrib/checkpatch: fix the systemd code path 2019-09-10 11:20:03 +02:00
Lubomir Rintel 1b0ee8756b contrib/checkpatch: check for SPDX tags 2019-09-10 11:20:03 +02:00
Lubomir Rintel 24028a2246 all: SPDX header conversion
$ find * -type f |xargs perl contrib/scripts/spdx.pl
  $ git rm contrib/scripts/spdx.pl
2019-09-10 11:19:56 +02:00
Lubomir Rintel e4784327c0 contrib/spdx: add a tool that determines SPDX licensing headers
This is a one-off hacky tool that we'll use to convert the long license
boilerplates to SPDX headers that are more friendly to automated tools.

Then we can drop it and forget it existed.
2019-09-10 11:18:49 +02:00
Lubomir Rintel e9f2ea6c22 COPYING: make sure we ship the relevant license texts
This adds LGPL and GFDL texts from the GNU web site and updates the GPL
one:

  COPYING: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
  COPYING.LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
  COPYING.GFDL: https://www.gnu.org/licenses/old-licenses/fdl-1.1.txt

The update to the GPL text is purely cosmetic. However, shipping the
exact same file as GNU publishes may help distros that deduplicate the
license texts or hardlink duplicates.
2019-09-10 11:10:52 +02:00
Thomas Haller 081b16cdb8 contrib/rpm: explicitly set runstatedir to "/run" when building release tarball
Nowadays, we should prefer "/run" over "/var/run". When not specifying
during ./configure, autotools however still defaults to "/var/run".

This default is also visible in the pre-generated documenation, for
example `man NetworkManager.conf` says

  Unless the symlink points to the internal file /run/NetworkManager/resolv.conf,
  in which case the ...
2019-08-27 16:31:55 +02:00
Lubomir Rintel 36fec3be75 contrib/modemu: ensure the udev messages specify SEQNUM
Newer systemd rejects messages without one.
2019-08-26 12:58:55 +02:00
Lubomir Rintel 505208a448 contrib/rpm: install our dispatcher scripts into /usr/lib/NetworkManager
That's where they always should have been.
2019-08-23 08:52:13 +02:00
Lubomir Rintel b171f20141 contrib/rpm: enable IWD (outside RHEL)
Let's enable the option to use IWD as an alternative to wpa_supplicant
for Wi-Fi support. People have been asking for this, it works, and is well
maintained.
2019-08-15 23:07:02 +02:00
Lubomir Rintel 20f735972f contrib/rpm: fix libnm License tag
https://bugzilla.redhat.com/show_bug.cgi?id=1723395
(cherry picked from commit 2752e3a774)
2019-07-31 11:30:21 +02:00
Thomas Haller 0a0084e133 contrib/rpm: use --with-runstatedir=%{_rundir} instead of hard-coding /run
(cherry picked from commit ea5e96cb06)
2019-07-29 23:54:20 +02:00
Thomas Haller d734a4766c contrib/rpm: fix parsing of %real_version_major for ".0" versions
(cherry picked from commit 6c9880f8ca)
2019-07-29 23:54:19 +02:00
Lubomir Rintel 3c6644db32 all: codespell fixes
Codespel run with the same arguments as described in
commit 58510ed566 ('docs: misc. typos pt2').
2019-07-24 11:30:19 +02:00
Thomas Haller d35d3c468a settings: rework tracking settings connections and settings plugins
Completely rework how settings plugin handle connections and how
NMSettings tracks the list of connections.

Previously, settings plugins would return objects of (a subtype of) type
NMSettingsConnection. The NMSettingsConnection was tightly coupled with
the settings plugin. That has a lot of downsides.

Change that. When changing this basic relation how settings connections
are tracked, everything falls appart. That's why this is a huge change.
Also, since I have to largely rewrite the settings plugins, I also
added support for multiple keyfile directories, handle in-memory
connections only by keyfile plugin and (partly) use copy-on-write NMConnection
instances. I don't want to spend effort rewriting large parts while
preserving the old way, that anyway should change. E.g. while rewriting ifcfg-rh,
I don't want to let it handle in-memory connections because that's not right
long-term.

--

If the settings plugins themself create subtypes of NMSettingsConnection
instances, then a lot of knowledge about tracking connections moves
to the plugins.
Just try to follow the code what happend during nm_settings_add_connection().
Note how the logic is spread out:
 - nm_settings_add_connection() calls plugin's add_connection()
 - add_connection() creates a NMSettingsConnection subtype
 - the plugin has to know that it's called during add-connection and
   not emit NM_SETTINGS_PLUGIN_CONNECTION_ADDED signal
 - NMSettings calls claim_connection() which hocks up the new
   NMSettingsConnection instance and configures the instance
   (like calling nm_settings_connection_added()).
This summary does not sound like a lot, but try to follow that code. The logic
is all over the place.

Instead, settings plugins should have a very simple API for adding, modifying,
deleting, loading and reloading connections. All the plugin does is to return a
NMSettingsStorage handle. The storage instance is a handle to identify a profile
in storage (e.g. a particular file). The settings plugin is free to subtype
NMSettingsStorage, but it's not necessary.
There are no more events raised, and the settings plugin implements the small
API in a straightforward manner.
NMSettings now drives all of this. Even NMSettingsConnection has now
very little concern about how it's tracked and delegates only to NMSettings.

This should make settings plugins simpler. Currently settings plugins
are so cumbersome to implement, that we avoid having them. It should not be
like that and it should be easy, beneficial and lightweight to create a new
settings plugin.

Note also how the settings plugins no longer care about duplicate UUIDs.
Duplicated UUIDs are a fact of life and NMSettings must handle them. No
need to overly concern settings plugins with that.

--

NMSettingsConnection is exposed directly on D-Bus (being a subtype of
NMDBusObject) but it was also a GObject type provided by the settings
plugin. Hence, it was not possible to migrate a profile from one plugin to
another.
However that would be useful when one profile does not support a
connection type (like ifcfg-rh not supporting VPN). Currently such
migration is not implemented except for migrating them to/from keyfile's
run directory. The problem is that migrating profiles in general is
complicated but in some cases it is important to do.

For example checkpoint rollback should recreate the profile in the right
settings plugin, not just add it to persistent storage. This is not yet
properly implemented.

--

Previously, both keyfile and ifcfg-rh plugin implemented in-memory (unsaved)
profiles, while ifupdown plugin cannot handle them. That meant duplication of code
and a ifupdown profile could not be modified or made unsaved.
This is now unified and only keyfile plugin handles in-memory profiles (bgo #744711).
Also, NMSettings is aware of such profiles and treats them specially.
In particular, NMSettings drives the migration between persistent and non-persistent
storage.

Note that a settings plugins may create truly generated, in-memory profiles.
The settings plugin is free to generate and persist the profiles in any way it
wishes. But the concept of "unsaved" profiles is now something explicitly handled
by keyfile plugin. Also, these "unsaved" keyfile profiles are persisted to file system
too, to the /run directory. This is great for two reasons: first of all, all
profiles from keyfile storage in fact have a backing file -- even the
unsaved ones. It also means you can create "unsaved" profiles in /run
and load them with `nmcli connection load`, meaning there is a file
based API for creating unsaved profiles.
The other advantage is that these profiles now survive restarting
NetworkManager. It's paramount that restarting the daemon is as
non-disruptive as possible. Persisting unsaved files to /run improves
here significantly.

--

In the past, NMSettingsConnection also implemented NMConnection interface.
That was already changed a while ago and instead users call now
nm_settings_connection_get_connection() to delegate to a
NMSimpleConnection. What however still happened was that the NMConnection
instance gets never swapped but instead the instance was modified with
nm_connection_replace_settings_from_connection(), clear-secrets, etc.
Change that and treat the NMConnection instance immutable. Instead of modifying
it, reference/clone a new instance. This changes that previously when somebody
wanted to keep a reference to an NMConnection, then the profile would be cloned.
Now, it is supposed to be safe to reference the instance directly and everybody
must ensure not to modify the instance. nmtst_connection_assert_unchanging()
should help with that.
The point is that the settings plugins may keep references to the
NMConnection instance, and so does the NMSettingsConnection. We want
to avoid cloning the instances as long as they are the same.
Likewise, the device's applied connection can now also be referenced
instead of cloning it. This is not yet done, and possibly there are
further improvements possible.

--

Also implement multiple keyfile directores /usr/lib, /etc, /run (rh #1674545,
bgo #772414).

It was always the case that multiple files could provide the same UUID
(both in case of keyfile and ifcfg-rh). For keyfile plugin, if a profile in
read-only storage in /usr/lib gets modified, then it gets actually stored in
/etc (or /run, if the profile is unsaved).

--

While at it, make /etc/network/interfaces profiles for ifupdown plugin reloadable.

--

https://bugzilla.gnome.org/show_bug.cgi?id=772414
https://bugzilla.gnome.org/show_bug.cgi?id=744711
https://bugzilla.redhat.com/show_bug.cgi?id=1674545
2019-07-16 19:09:08 +02:00
Lubomir Rintel 07fdc1828d contrib/rpm: disable rp_filter in config-connectivity-redhat
RHEL ships with a rp_filter and can't change that for historic reasons.
That's unfortunate, because it breaks the connectivity checking. Let's
override it if the connectivity checking package is installed.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/185
2019-07-15 20:16:31 +02:00
Tom Gundersen 6adade6f21 dhcp: add nettools dhcp4 client
This is inspired by the existing systemd integration, with a few differences:

* This parses the WPAD option, which systemd requested, but did not use.
* We hook into the DAD handling, only making use of the configured address
  once DAD has completed successfully, and declining the lease if it fails.

There are still many areas of possible improvement. In particular, we need
to ensure the parsing of all options are compliant, as n-dhcp4 treats all
options as opaque, unlike sd-dhcp4. We probably also need to look at how
to handle failures and retries (in particular if we decline a lease).

We need to query the current MTU at client startu, as well as the hardware
broadcast address. Both these are provided by the kernel over netlink, so
it should simply be a matter of hooking that up with NM's netlink layer.

Contribution under LGPL2.0+, in addition to stated licenses.
2019-07-05 11:04:32 +02:00
Lubomir Rintel a5dd31afeb contrib/checkpatch: allow empty lines within continuations
This chunk from nm-device.c is, in fact, okay:

               |<-tab->nm_assert (   !new_config
               |<-tab->           || (   new_config
               |<-tab->               && ({
               |<-tab->                    int ip_ifindex = ...
 empty line -> |
               |<-tab->                    (   ip_ifindex > 0
               |<-tab->                     && ip_ifindex == ...
               |<-tab->                  })));
2019-06-25 20:27:39 +02:00
Lubomir Rintel da312e6220 contrib/checkpatch: be a bit stricter about whitespace
In continations (that use spaces for alignment), don't allow the number
of leading tabs to change. Previously only removal of tabs was
disallowed, but addition doesn't make sense either, as only spaces
should be used for further alignemnt.

This catches situations like this:

  |<-tab->all_work_and_no_play (makes,
  |<-tab->                      jack,
  |<-tab-><-tab->               a dull boy);
2019-06-25 20:27:39 +02:00
Lubomir Rintel 5ff19ea8d2 contrib/checkpatch: discourage g_assert*() 2019-06-25 20:27:39 +02:00
Thomas Haller 74641be816 settings: drop ibft settings plugin
The functionality of the ibft settings plugin is now handled by
nm-initrd-generator. There is no need for it anymore, drop it.

Note that ibft called iscsiadm, which requires CAP_SYS_ADMIN to work
([1]). We really want to drop this capability, so the current solution
of a settings plugin (as it is implemented) is wrong. The solution
instead is nm-initrd-generator.

Also, on Fedora the ibft was disabled and probably on most other
distributions as well. This was only used on RHEL.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1371201#c7
2019-06-20 16:06:44 +02:00
Thomas Haller 3c47285f4a all: drop vim file variables from source files
sed '1,3 { /^\(#\|--\) *vim:/d }; 1 { /^\/\* *vim:.*\*\/$/ d}' -i $(git grep -l 'vim:')
2019-06-11 10:08:07 +02:00
Thomas Haller c0e075c902 all: drop emacs file variables from source files
We no longer add these. If you use Emacs, configure it yourself.

Also, due to our "smart-tab" usage the editor anyway does a subpar
job handling our tabs. However, on the upside every user can choose
whatever tab-width he/she prefers. If "smart-tabs" are used properly
(like we do), every tab-width will work.

No manual changes, just ran commands:

    F=($(git grep -l -e '-\*-'))
    sed '1 { /\/\* *-\*-  *[mM]ode.*\*\/$/d }'     -i "${F[@]}"
    sed '1,4 { /^\(#\|--\|dnl\) *-\*- [mM]ode/d }' -i "${F[@]}"

Check remaining lines with:

    git grep -e '-\*-'

The ultimate purpose of this is to cleanup our files and eventually use
SPDX license identifiers. For that, first get rid of the boilerplate lines.
2019-06-11 10:04:00 +02:00
Thomas Haller 896dc7d4d9 gitlab-ci: also build on CentOS 7.5 and 7.6 2019-05-29 09:42:40 +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
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 5e11d4bf1f gitlab-ci: disable valgrind on Fedora 30 and Fedora 31 depending on glib2 package
Valgrind is known to report many false positives with certain glib2
versions. Workaround that by disabling it based on the installed
package version.

See-also: https://bugzilla.redhat.com/show_bug.cgi?id=1710417
See-also: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/155
2019-05-18 11:37:35 +02:00
Thomas Haller 6d76a0974e gitlab-ci: run unit tests under valgrind in gitlab-ci
On Ubuntu 16.04 (trusty) valgrind fails due to rdrand being advertised
but not implemented.

Work around that by installing valgrind from Ubuntu 18.04 (bionic) via
the "contrib/scripts/nm-ci-install-valgrind-in-ubuntu1604.sh" script.
2019-05-18 09:58:52 +02:00
Thomas Haller 0cbef232c9 contrib/rpm: set runstatedir to "/run" instead of "/var/run"
Do so on all RHEL/Fedora releases. They all use systemd, and it's the right
choice for all of them.
2019-05-17 21:33:36 +02:00
Thomas Haller 10688e3d88 tests: use "/run" instead of "/var/run" 2019-05-17 21:24:18 +02:00
Thomas Haller 80c0dab9c7 contrib/rpm: reword comment in NetworkManager.conf
This change is a bit annoying, because we package "NetworkManager.conf" file in
our RPM. So, upon package upgrade, rpm will note that a new config file should
be installed and thus will leave ".rpmnew" files.

Also, don't mention "/var/run". It should really be just "/run" because
"/var" might not be mounted in early boot/initrd or in rescue environment.
2019-05-17 21:24:18 +02:00
Thomas Haller 70487d9ff8 ci: randomize tests during our CI
This affects gitlab-ci and travis-ci, which both run this script.
2019-05-17 13:30:14 +02:00
Thomas Haller c307f07207 contrib/rpm: fix comment in ./build_clean.sh -h output 2019-05-16 14:57:39 +02:00
Lubomir Rintel 14eaf6a40b contrib/rpm: provide NetworkManager-dispatcher
This is a provide packages that install dispatcher scripts should depend
on. It will make it easier to keep track of them and possibly split out
the dispatcher into an optional package if not needed.
2019-04-29 16:57:07 +02:00
Lubomir Rintel c4f1fac35d contrib/rpm: (trivial) move some %files around, remove a duplicate
Just a cosmetic thing.
2019-04-29 16:57:07 +02:00
Thomas Haller a0f31e4038 gitlab-ci: install glib2-doc via "contrib/fedora/REQUIRED_PACKAGES"
We also generate a source tarball and artifact it.

Hence, we need proper gtk-doc links. This requires files in
/usr/share/gtk-doc/html for adding cross links. Install glib2-doc
package.

Note that in containers dnf is configured to not install documentation
files. We need to override that.
2019-04-20 19:36:39 +02:00
Thomas Haller 1ca380f69f gitlab-ci: build on Ubuntu 16.04, 18.04 and Debian stretch (9), testing, sid
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/119
2019-04-19 08:20:12 +02:00
Till Maas 7d62f81e2e contrib/rpm: Provide list of units to %systemd_postun
%systemd_postun is meant to be run with arguments and Fedora Rawhide
seems to enforce this now. Therefore provide the units there, too.

https://github.com/NetworkManager/NetworkManager/pull/348
2019-04-18 21:51:10 +02:00
Lubomir Rintel 5801f89f4d all: goodbye libnm-glib
This removes libnm-glib, libnm-glib-vpn, and libnm-util for good.
The it has been replaced with libnm since NetworkManager 1.0, disabled
by default since 1.12 and no up-to-date distributions ship it for years
now.

Removing the libraries allows us to:

* Remove the horrible hacks that were in place to deal with accidental use
  of both the new and old library in a single process.
* Relief the translators of maintenance burden of similar yet different
  strings.
* Get rid of known bad code without chances of ever getting fixed
  (libnm-glib/nm-object.c and libnm-glib/nm-object-cache.c)
* Generally lower the footprint of the releases and our workspace

If there are some really really legacy users; they can just build
libnm-glib and friends from the NetworkManager-1.16 distribution. The
D-Bus API is stable and old libnm-glib will keep working forever.

https://github.com/NetworkManager/NetworkManager/pull/308
2019-04-16 15:52:27 +02:00
Thomas Haller c210ad9d26 Revert "contrib/rpm: drop --with-libnm-glib from build_clean"
Since we restored libnm-glib in commit b027723e00,
also revert this commit.

This reverts commit 0750ff1f81.
2019-04-11 11:40:20 +02:00
Thomas Haller 0d16b037f5 contrib/rpm: disable eBPF for package builds on Fedora
We have random failures to build on gitlab-ci. Something is wrong,
at least, eBPF is not working reliably. Disable it for now.
2019-04-09 16:01:30 +02:00
Thomas Haller b3997312bf contrib/rpm: make spec file more similar to rhel-7's 2019-04-09 15:41:21 +02:00
Thomas Haller b1f556bae2 contrib/rpm: from Fedora 31 onwards use internal DHCP client by default
In RHEL-8.0 we already switched the default DHCP plugin.
It's past time that we do the same for Fedora.
2019-04-09 13:56:38 +02:00
Thomas Haller a5869d1b35 gitlab-ci: run unit tests for n-acd with eBPF disabled
Enabling eBPF causes src/devices/tests/test-acd to fail:

    strace: bpf(BPF_MAP_CREATE, {map_type=BPF_MAP_TYPE_HASH, key_size=4, value_size=1, max_entries=8, map_flags=0, inner_map_fd=0, map_name="", map_ifindex=0, btf_fd=0, btf_key_type_id=0, btf_value_type_id=0}, 112) = -1 EPERM (Operation not permitted)

    NetworkManager-Message: 10:07:04.404: <warn>  [1554631624.4046] acd[0xa2b400,10]: couldn't init ACD for announcing addresses on interface 'nm-test-veth0': Operation not permitted

Interestingly it does not always fail. Seems to depend on the kernel
which is used in the containerized test environments of gitlab-ci.

For now, just disable eBPF and use the fallback implementation.
2019-04-07 12:58:08 +02:00
Thomas Haller ef338667f8 contrib/rpm: disable NDEBUG for meson builds
For better or worse, our release builds commonly do not disable assertions.
That means,

 - NDEBUG is not set, and assert() is in effect
 - G_DISABLE_ASSERT is not set, and g_assert() is in effect
 - G_DISABLE_CHECKS is not set, and g_return*() is in effect.

On the other hand, NM_MORE_ASSERTS is not enabled by default and nm_assert()
is stripped away. That is the actual purpose of nm_assert(): it is
commonly disabled on release builds, while all other assertions are
enabled.

Note that it is fully supported to build NetworkManager with all kind of
assertions disabled. However, such a configuration is not much tested
and I would not recommend it for that reason.

%meson expands to

  $ /usr/bin/meson --buildtype=plain --prefix=/usr --libdir=/usr/lib64 --libexecdir=/usr/libexec --bindir=/usr/bin --sbindir=/usr/sbin --includedir=/usr/include --datadir=/usr/share --mandir=/usr/share/man --infodir=/usr/share/info --localedir=/usr/share/locale --sysconfdir=/etc --localstatedir=/var --sharedstatedir=/var/lib --wrap-mode=nodownload --auto-features=enabled -Db_ndebug=true . x86_64-redhat-linux-gnu $OTHER_ARGS

thus passing -DNDEBUG to the meson build. Override that.
2019-04-04 09:56:19 +02:00
Lubomir Rintel b027723e00 Revert "all: goodbye libnm-glib"
We need this for a little little longer :(

This reverts commit 1de8383ad9.
2019-04-03 08:52:38 +02:00
Lubomir Rintel 0750ff1f81 contrib/rpm: drop --with-libnm-glib from build_clean
It does nothing now.
2019-03-20 08:47:51 +01:00
Lubomir Rintel 1de8383ad9 all: goodbye libnm-glib
This removes libnm-glib, libnm-glib-vpn, and libnm-util for good.
The it has been replaced with libnm since NetworkManager 1.0, disabled
by default since 1.12 and no up-to-date distributions ship it for years
now.

Removing the libraries allows us to:

* Remove the horrible hacks that were in place to deal with accidental use
  of both the new and old library in a single process.
* Relief the translators of maintenance burden of similar yet different
  strings.
* Get rid of known bad code without chances of ever getting fixed
  (libnm-glib/nm-object.c and libnm-glib/nm-object-cache.c)
* Generally lower the footprint of the releases and our workspace

If there are some really really legacy users; they can just build
libnm-glib and friends from the NetworkManager-1.16 distribution. The
D-Bus API is stable and old libnm-glib will keep working forever.

https://github.com/NetworkManager/NetworkManager/pull/308
2019-03-19 17:15:15 +01:00
Thomas Haller d66a1ace23 contrib/checkpatch: avoid command injection in checkpatch.pl script
The capture variables, $1, etc, are not valid unless the match
succeeded, and they're not cleared, either.

    $ git checkout -B C origin/master && \
        echo XXXXX > f.txt && \
        git add f.txt && \
        git commit -m 'this commit does something()'
    Branch 'C' set up to track remote branch 'master' from 'origin'.
    Reset branch 'C'
    Your branch is up to date with 'origin/master'.
    sh: -c: line 0: syntax error near unexpected token `('
    sh: -c: line 0: `git log --abbrev=12 --pretty=format:"%h ('%s')" -1 does something() 2>/dev/null'

    >>> VALIDATE "a169a98e14 this commit does something()"
    (commit message):4: Commit 'does something()' does not seem to exist:
    > Subject: [PATCH] this commit does something()

    (commit message):4: Refer to the commit id properly: :
    > Subject: [PATCH] this commit does something()

    The patch does not validate.
2019-03-18 11:57:04 +01:00
Thomas Haller 9992ac1cf8 platform: add routing-rule add/delete netlink functions 2019-03-13 09:03:59 +01:00
Thomas Haller bfd6d608e2 contrib: set shift for less in NM-log 2019-03-13 09:03:58 +01:00
Lubomir Rintel a1e6afc0b2 contrib/rpm: drop ldconfig scriptlets from Fedora 28+
In newer RPM file triggers in glibc package take care of this. While
these scriptlets whould do no harm there, removing them yields a tiny
theoretical performance improvement.
2019-03-07 15:28:56 +01:00
Lubomir Rintel 3326a87953 Revert "contrib/rpm: use "%ldconfig_scriptlets" for Fedora 30+"
This is utterly pointless. %ldconfig_scriptlets expand to an empty
string on Fedora 28+.

This reverts commit ad836541cb.
2019-03-07 15:28:56 +01:00
Lubomir Rintel c10e61e21d contrib/rpm: drag in vala tools by the binary
The package's called either "vala" or "vala-tools". Sigh.
2019-03-07 15:28:56 +01:00
Lubomir Rintel f8dde7014b Revert "contrib/rpm: require "vala" instead of "vala-tools" for Fedora 30+"
This is just plain ugly.

This reverts commit 0024485b5a.
2019-03-07 15:28:56 +01:00
Lubomir Rintel 27418b1851 Revert "contrib/rpm: remove Group tag for Fedora 30+"
Group tag is not required, though is harmless. We could either remove it,
or keep it, but there's absolutely no excuse for conditionalizing it.

Let's keep it for now, because rpm -i still prints it.

This reverts commit 1feeba6f1a.
2019-03-07 15:28:56 +01:00
Lubomir Rintel f8578ddc2e contrib/checkpatch: check that we refer to commits properly 2019-03-07 10:55:30 +01:00
Thomas Haller 1feeba6f1a contrib/rpm: remove Group tag for Fedora 30+
https://fedoraproject.org/wiki/Changes/Remove_Group_Tag

62adcbc888
2019-03-07 09:53:50 +01:00
Thomas Haller ad836541cb contrib/rpm: use "%ldconfig_scriptlets" for Fedora 30+
https://fedoraproject.org/wiki/Changes/RemoveObsoleteScriptlets

5c6421bc88
2019-03-07 09:53:50 +01:00
Thomas Haller 0024485b5a contrib/rpm: require "vala" instead of "vala-tools" for Fedora 30+
The "vala-tools" package was merged into "vala" [1]. While "vala"
now "Provides: vala-tools", update the build requirements for
Fedora 30 and newer.

[1] 82b21cc302

f6c878a04a
2019-03-07 09:53:50 +01:00
Thomas Haller 53aac0233c build/ci: enable --werror for meson builds
This enables -Werror for meson builds on gitlab-ci and semaphore.
Not on Travis, the compiler there is too old, giving too many bogus
warnings.

This reverts commit 928d68d04a ("m4:
disable -Wmissing-braces for newer clang").
2019-02-08 20:14:50 +01:00
Thomas Haller ff5944ce03 contrib/rpm: enable warnings and fatal-warnings with meson build 2019-02-08 20:14:50 +01:00
Thomas Haller 45f4f573ca contrib/rpm: add comment to "20-connectivity-{fedora,redhat}.conf" about rp_filter 2019-02-08 16:24:25 +01:00
Thomas Haller bdac03fe9a gitlab-ci: build with clang and do multiple builds in one test-step
Also, let one docker image do multiple builds. We fetch a fedora docker
image, and then install 250 MB of packages. That alone takes a lot of
time and resources. Instead of running a large number of docker images
that only do one build, let one image do several builds.

Also, install ccache. Hopefully this way we can benefit from
building the same sources multiple times.

Also note that building docs does not work currently with clang,
due to g-ir-scanner. See commit 05568860cce5332977d92b85f7c25b8ed646cd58.
2019-02-07 17:31:37 +01:00
Thomas Haller 389197fa81 gitlab-ci: allow enabling/disabling building documentation in "nm-ci-run.sh"
g-ir-scanner does not support building with clang, due to [1], [2], [3].

It triggers

    checking if /usr/bin/g-ir-scanner works... no (compiler failure -- check config.log)
    configure: error: introspection enabled but can't be used

with

    clang-7: error: unknown argument: '-fstack-clash-protection'

See also commit 99b92fd992, which adds this configure
check.

Honor the environment variable WITH_DOCS to allow the caller to overwrite
the automatic detection that the script does.

[1] https://bugzilla.gnome.org/show_bug.cgi?id=757934
[2] https://gitlab.gnome.org/GNOME/gobject-introspection/issues/150
[3] c14d037228
2019-02-07 17:31:31 +01:00
Thomas Haller 6505a781cf contrib: install python3-gobject as REQUIRED_PACKAGES
To run the tests with python3, we need python3-gobject.

Note that "contrib/fedora/REQUIRED_PACKAGES" is called by
"contrib/scripts/nm-ci-run.sh" script to install the packages
in Fedora.
2019-02-07 17:31:05 +01:00
Thomas Haller a0b976ac8b contrib/rpm: quote snapshot/git_sha variables in spec-file
Otherwise the following fails:

    $ ./contrib/fedora/rpm/build_clean.sh -g -s x.1
    ...
    error: parse error in expression
    error: /data/src/_NetworkManager/contrib/fedora/rpm/NetworkManager.20190207-165257.XOkW4i/SPECS/NetworkManager.spec:35: bad %if condition
    ERROR: rpmbuild FAILED

Even with the fix, not all characters are allowed:

    $ ./contrib/fedora/rpm/build_clean.sh -g -s x-1
    ...
    error: line 112: Illegal char '-' (0x2d) in: Release: 22165.x-1.25b13e2053.fc29
    ERROR: rpmbuild FAILED
2019-02-07 16:55:31 +01:00
Thomas Haller f1714b485d gitlab-ci: minor cleanup of "contrib/scripts/nm-ci-run.sh" script 2019-02-05 13:49:20 +01:00
Thomas Haller 9891217a78 contrib/rpm: add option to enable LTO for RPM build 2019-02-04 10:55:25 +01:00
Rafael Fontenelle d81e10942f all: fix misspellings
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/64
2019-01-24 17:19:44 +01:00
Thomas Haller 1ffa40872f contrib/rpm: remove unused 00-server-dhcp-client-id.conf configuration snippet
Now that the default for the internal client is "mac", we don't need
this snippet anymore. Drop it.

Don't renumber the source files but leave the gap at Source3. Everytime
we add config snippets the numbers need to be shuffled, so don't fill
the gap and maybe use it in the future.

https://bugzilla.redhat.com/show_bug.cgi?id=1661165
2019-01-07 17:13:23 +01:00
Thomas Haller cce3c0c63d contrib: adjust NM-log for changes to platform logging
Fixes: 8f107f5c00
2018-12-30 15:17:11 +01:00
Thomas Haller e498f594bb checkpatch: warn if there is a file "TODO.txt"
This allows us to add a file "TODO.txt" in the top level directory.
This file is not intended to be merged to master, but keep track of
stuff that is still to do before merging a branch.

Let checkpatch.pl warn about the presence of such a file.
2018-12-30 15:17:11 +01:00
Thomas Haller fc052494d1 checkpatch: warn about suspicious gtk-doc annotations
It's

    (allow-none):

and

    (transfer none):

That's confusing enough. Add a check.
2018-12-30 15:17:11 +01:00
Iñigo Martínez 4b32bbc820 build: meson: Remove polkit_dir option
meson is able to get variables defined in pkg-config files such as
directory paths. PolicyKit defines in its pkg-config file the path to
the directory where `policy` files are present.

This removes the `polkit_dir` option to ease the move to start using
those variables. The `polkit` variable has also been converted to
boolean.

Fedora spec script has also been updated accordingly.
2018-12-20 13:50:34 +01:00
Thomas Haller 3627601bde contrib/rpm: adjust match-device spec for 00-server-dhcp-client-id.conf
For older NetworkManager versions, a match spec that only contained except:
specifiers could never yield a positive match. That is not very useful and
got fixed by commit 242de347adbf653a709607979d36a0da1ca3ff0b (core: fix
device spec matching for a list of "except:").

Still, adjust the configuration snippet so that it also works with
configurations that predate the fix.
2018-12-11 14:01:41 +01:00
Thomas Haller 122aa550d2 gitlab-ci: patch gtk-doc to generate valid documentation
We generate documentation for pages ([1], [2]), hence, we need to patch
gtk-doc [3].

[1] https://networkmanager.pages.freedesktop.org/NetworkManager/NetworkManager/
[2] https://networkmanager.pages.freedesktop.org/NetworkManager/libnm/
[3] https://gitlab.gnome.org/GNOME/gtk-doc/merge_requests/2
2018-12-01 08:55:44 +01:00
Thomas Haller 763cb8d486 ci: use common script for tests on travis and gitlab
For one, it's not unreasonable that we want to run the same
tests both for gitlab and travis.

Move the actual tests into a script, which is called by both
CI environments.

We still can do something different, based on the environment.
The advantage here is, that the common part will be shared, and
the places where we differ can easily be spot.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/44
2018-11-12 11:29:37 +01:00
Beniamino Galvani 570c41aae4 rpm: disable ebpf support on RHEL
The ebpf syscall doesn't work on RHEL even if the linux/bpf.h header
is available: let's explicitly disable it.

On Fedora explicitly enable eBPF instead of autodetecting it.
2018-11-09 11:36:25 +01:00
Lubomir Rintel 32857a093b modemu: fall back to a virtual bus
This allows us to somehow work with no PCI (or USB for that matter), such
as some virtual machines. Old ModemManager doesn't like this though, but
there doesn't seem to be a way around it.

https://github.com/NetworkManager/NetworkManager/pull/246
2018-11-07 14:50:21 +01:00
Lubomir Rintel bbb1a36020 modemu: fix subsystem hash endianness
Tested on a really really big endian IBM POWER. Also turn an accompanying
comment into a slightly more sensible one.

https://github.com/NetworkManager/NetworkManager/pull/246
2018-11-07 14:50:18 +01:00
Lubomir Rintel adc0150e7f rpm: add a bundled(systemd) provide
Required by Fedora Packaging Standards [1] and also really useful.

[1] https://fedoraproject.org/wiki/Bundled_Libraries?rd=Packaging:Bundled_Libraries#Requirement_if_you_bundle

https://github.com/NetworkManager/NetworkManager/pull/247
2018-11-07 14:46:11 +01:00
Thomas Haller 7a46ccff00 contrib/rpm: add "00-server-dhcp-client-id.conf"
While this is packaged in "NetworkManager-config-server.rpm"
sub-package, it's not in "00-server.conf" file. The reason
is that a convenient way to disable configuration from
"/usr/lib/NetworkManager/conf.d", is by putting a (possibly empty)
file into /etc directory with the same name. If the sub-package
only provides one large "00-server.conf" file, this is no longer
possible at a granular level.
2018-11-01 11:17:12 +01:00
Thomas Haller f8fed7dd52 checkpatch: complain about XXX markers in code
We have a few source code tags like "TODO" and "FIXME".
"XXX" is not intended to be merged, it is for marking
places in code while still working on it.
2018-10-25 11:20:10 +02:00
Thomas Haller b660a41c7c build: fix build_clean.sh script to enable ibft
autotools build has/had a bug, where ibft test files would only be disted
if the ibft plugin was enabled.

Regardless of that, `build_clean.sh --release` is our suggested way to
create a release tarball. It should always enable the ibft plugin.

It didn't do so, due to a bug.
2018-10-24 21:43:17 +02:00
Thomas Haller 6978558e8c contrib: adjust NM-log for changes to platform logging
Fixes: 8f107f5c00
2018-10-23 12:03:59 +02:00
Thomas Haller 301d703bc3 checkpatch: quote variable in "checkpatch-feature-branch.sh" 2018-10-22 18:21:41 +02:00
Thomas Haller 669bd33022 contrib/rpm: don't depend NetworkManager-ovs package on openvswitch on RHEL
On RHEL, openvswitch package is not in the base set of packages. Hence,
we cannot depend NetworkManager-ovs package on openvswitch.

This isn't really a problem, because NetworkManager's OVS plugin must
anyway behave graceful when openvswich service is not running or not
available. It only means, that a user who wants to use the OVS plugin
needs to explicitly install the openvswitch package.

https://bugzilla.redhat.com/show_bug.cgi?id=1629178
https://bugzilla.redhat.com/show_bug.cgi?id=1633190
2018-10-22 16:34:51 +02:00