Commit graph

612 commits

Author SHA1 Message Date
Thomas Haller 82260cc5c2
contrib: add "contrib/scripts/test-ppp.sh" test script 2021-10-04 15:40:15 +02:00
Thomas Haller 1b488fe34c
contrib: make it easy to test PPPoE in container script
It doesn't actually work inside the root-less container...
Well, it works as far as starting to activate, before it
fails. That is still somewhat useful. So have it there...
2021-10-04 15:40:15 +02:00
Thomas Haller b9ff90c87d
checkpatch: discourage use of g_clear_pointer()
We have nm_clear_pointer() instead, which does not cast the function
argument, and thus the compiler is better at checking the arguments.
2021-09-22 17:26:02 +02:00
Thomas Haller 48691a2101
contrib: improve nm-in-container.sh script (7) 2021-09-21 13:56:37 +02:00
Thomas Haller bf6d5f355e
contrib: improve nm-in-container.sh script (6) 2021-09-21 09:13:44 +02:00
Thomas Haller 6f2c69f484
contrib: improve nm-in-container.sh script (5) 2021-09-16 20:54:49 +02:00
Thomas Haller 3e80b4fa63
contrib: reformat by default from "nm-code-format.sh" script
The majority of times when I call this script, I want it to do the reformatting,
not the check-only mode. This is also because we use git, so I start with a
clean working directory and run the reformatting code. In the best case, there
is nothing to reformat, and all is good. I seldom want to only check.

Change the default of the script.
2021-09-16 09:01:50 +02:00
Thomas Haller 1a56dcd4da
contrib: explicitly pass "-n" to "nm-code-format.sh" in "code-style-git-post-commit-hook"
"nm-code-format.sh" is going to change the default behavior from "-n" to
"-i", that is, from check-only to reformat. Explicitly pass "-n" where
we want it.
2021-09-16 08:47:38 +02:00
Thomas Haller ef7258eafe
contrib: improve nm-in-container.sh script (4) 2021-09-15 22:08:42 +02:00
Thomas Haller a9f6f49c8a
gitignore: fix ignore file for nm-in-container.d 2021-09-15 22:08:41 +02:00
Thomas Haller 4c007c4c27
contrib: fix "nm-code-format.sh" to select files to format
There was always the idea that you could pass paths and filenames
to "nm-code-format.sh" to format only a subset. However, the script
also needs to honor files that should be excluded and don't need
formatting.

Previously, what was implemented via `git ls-files -- ':(exclude)...'`
command, but git-ls-files has a bug ([1]) and might not list all files.

Refactor and do the filtering ourselves.

[1] https://www.spinics.net/lists/git/msg397982.html
2021-09-15 22:08:13 +02:00
Thomas Haller 756757102f
contrib: improve nm-in-container.sh script 2021-09-15 12:31:23 +02:00
Thomas Haller dbcbb45224
contrib: improve nm-in-container.sh script 2021-09-14 22:26:12 +02:00
Thomas Haller 7fea431061
contrib: improve nm-in-container.sh script 2021-09-14 20:23:15 +02:00
Thomas Haller d7c0dcc7b4
contrib: improve nm-in-container.sh script 2021-09-13 22:18:51 +02:00
Thomas Haller 549424273a
contrib: add nm-in-container.sh script to build a (podman) container for testing
Only a first attempt. It needs more improvements.
2021-09-13 16:57:31 +02:00
Thomas Haller 023c8ad88b
code-format: exclude "src/linux-headers" from "nm-code-format.sh" script 2021-09-06 10:00:35 +02:00
Thomas Haller 414d2c1d4b
contrib,gitlab-ci: fix "contrib/fedora/REQUIRED_PACKAGES" to install "vala"
Fixes: 53562b1915 ('contrib: remove "vala-tools" from "contrib/fedora/REQUIRED_PACKAGES"')
2021-08-30 16:45:24 +02:00
Thomas Haller 53562b1915
contrib: remove "vala-tools" from "contrib/fedora/REQUIRED_PACKAGES"
Since Fedora 25, vala-tools was merged with "vala" package. And on
rawhide (f36) it's gone completely and leads to a failure of the script.

Drop it.
2021-08-30 11:39:01 +02:00
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