Commit graph

793 commits

Author SHA1 Message Date
Thomas Haller f14bb2d7b6
contrib: set fixed MAC address in "nm-env-prepare.sh" script 2022-08-10 15:22:11 +02:00
Thomas Haller 0a26320c09
contrib: update bash history in nm-in-container.sh 2022-08-08 20:45:18 +02:00
Thomas Haller 341c46de84
contrib: improve motd for nm-in-container.sh script
Leave a hint about core-dumps.

Also, now we have `contrib/fedora/rpm/configure-for-system.sh` script,
which can configure the build in a way similar to what we get
when doing an RPM build.

That means, inside "contrib/scripts/nm-in-container.sh" we
can just type `make install`, and it will replace the pre-installed
NetworkManager.

The main advantage is that it becomes convenient to run NetworkManager
as a systemd service. Previously, the suggested was to to install
NetworkManager inside another prefix, and run it in the terminal.

Running NetworkManager as systemd service is also necessary for NM-ci,
which restarts the NetworkManager service, and you couldn't run a test,
if you just started NetworkManager in a terminal.

Previously, you had to build a complete RPM, which takes a lot of time.
2022-08-08 11:54:27 +02:00
Thomas Haller d966c2ac4c
contrib: install "qt-devel" in nm-in-container.sh script
Yes, it's a large dependency. But on your outer host you
probably configured NetworkManager with QT enabled (for the
example scripts). We want to compile the same work tree inside
the container. So install qt-devel.
2022-08-08 11:54:27 +02:00
Thomas Haller f2bd67b386
contrib/rpm: add "configure-for-system.sh" script to configure build
This will use the same option as when we do an RPM build.
The purpose is that you could type `make install` with such
a build, and it would replace the files that you'd get by installing
the NetworkManager RPMs.

Of course, you would not want to do that on your work station, but it
will be useful in a container, where we don't mind messing up the
installation.
2022-08-08 11:54:27 +02:00
Thomas Haller 4e4135842e
contrib/rpm: cleanup spec file to unify version comparisons
- always check fedora||rhel and not rhel||fedora.
- consistently use >= instead of >.
2022-08-08 11:54:27 +02:00
Thomas Haller 1e6e15cd80
contrib/rpm: prefer --with-$OPTION=yes|no over --with/--without and --enable/--disable
autotools accepts both --with-$OPTION/--without-$OPTION and
--with-$OPTION=yes|no. Consistently use the latter.

The advantage is that whether it's enabled becomes an argument, so in a
script you could do

  "--with-$OPTION=$VALUE"

Same for enable/disable option.
2022-08-08 11:54:27 +02:00
Lubomir Rintel 3ce3451040 Revert "contrib/rpm: enable -Werror on --with debug instead of --with test"
This reverts commit cac11c736d.
It went in accidentally.
2022-08-02 18:03:45 +02:00
Lubomir Rintel cac11c736d contrib/rpm: enable -Werror on --with debug instead of --with test
The test bcond is used to make test suite failure terminate the %check
phase. That should generally be done for distro builds.

What the distro builds shouldn't do is terminate the build on compiler
warnings, because they're fairly likely to appear on toolchain updates
without indicating actual bugs.

However, currently that's precisely what do we do now.

Let's use -Werror on debug builds instead. They are intentionally made
more prone to fail (e.g. trip more runtime assertions) because failures
can be more rapidly addressed and don't affect distro builds.
2022-08-02 15:06:13 +02:00
Thomas Haller 05825b0348
contrib: make nm-env-prepare.sh script executable 2022-07-29 17:26:58 +02:00
Thomas Haller 1c389445da
contrib: install /usr/bin/python for "nm-in-container.sh" 2022-07-29 17:23:20 +02:00
Thomas Haller 0f1cc3e954
contrib: show diff of git subtrees in "git-subtree-reimport.sh" script 2022-07-25 10:27:33 +02:00
Thomas Haller 8b20d2a856
contrib: add "git-subtree-reimport.sh" script 2022-07-19 08:53:47 +02:00
Lubomir Rintel 8d12cc8152 contrib/rpm: untangle setting of bcond_{test,debug} defaults
Resolve the defaults in build.sh instead of RPM macros. This looks less
terrible maintaining the same defaults as well as options to override it
upstream.

Moving it to the block that downstreams (Fedora, Red Hat) keep
customized makes it possible for them to also maintain customized
defaults here.

In particular, the downstreams should be able to enable bcond_test
at least for their production release (otherwise there's little point in
actually running tests at package build time).

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1286
2022-07-10 20:49:05 +02:00
Thomas Haller b12281089c
gitlab-ci: fix unit tests on centos7 for python-pexpect dependency
Fixes: 9570224e86 ('tests/client: add a pexpect-based test runner')
2022-07-06 18:36:52 +02:00
Thomas Haller d8a4b3bec2
all: reformat with clang-format (clang-tools-extra-14.0.0-1.fc36) and update gitlab-ci to f36 2022-07-06 11:06:53 +02:00
Thomas Haller 30d89a121d
contrib: fix "nm-python-black-format.sh" script to ignore systemd,c-util,nettools files
Otherwise, the path "src/c-stdaux/src/docs/conf.py" matches for
formatting. But this file is imported via git-subtree, we don't
want to format it.

Filter out such paths.
2022-07-06 10:44:18 +02:00
Lubomir Rintel 47d14bced8
contrib/rpm: BR pexpect
Unit tests need this to run.

Fixes: 9570224e86 ('tests/client: add a pexpect-based test runner')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1285
2022-07-04 17:35:59 +02:00
Lubomir Rintel 12fe0ae312 contrib/packages: install pexpect
We'd like to use this for client unit testing.
2022-06-30 10:20:44 +02:00
Lubomir Rintel 9fdb6bea44 ci: drop Ubuntu 16.04
It's sad, old and unsupported. Also its gettext is old and smells of
elderberries.
2022-06-27 13:40:09 +02:00
Martin Blanchard 19a6affd3a build: stop relying on intltool for i18n
Recent gettext version can extract and merge back strings from and to
various file formats, no need for intltool anymore.

https://wiki.gnome.org/Initiatives/GnomeGoals/GettextMigration

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/133

https://github.com/NetworkManager/NetworkManager/pull/303
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/96

Clarification about the use of AM_GNU_GETTEXT_REQUIRE_VERSION:

In configure.ac, specify the minimum gettext version we require, rather
than the exact one. This fixes a situation where the autoconf macros
used for gettext will be the latest available on the system (for
example, 0.20); but the copied-in Makefile.in.in will be for the exact
version specified in configure.ac (in this case, 0.19).

In that situation, the gettext build rules will error out at `make` time
with the message:
   *** error: gettext infrastructure mismatch: using a Makefile.in.in
   from gettext version 0.19 but the autoconf macros are from gettext
   version 0.20

Avoid that by specifying a minimum version dependency rather than an
exact one. This should not cause problems as we haven’t committed any
generated or external gettext files into git, so each developer will end
up regenerating the build system for their system’s version of gettext,
as expected.

See the subsection of
https://www.gnu.org/software/gettext/manual/html_node/Version-Control-Issues.html
for more information.

Note that autoreconf currently doesn’t recognise
AM_GNU_GETTEXT_REQUIRE_VERSION, so we must continue also using
AM_GNU_GETTEXT_VERSION. autopoint will ignore the latter if the former
is present. See
https://lists.gnu.org/archive/html/autoconf-patches/2015-10/msg00000.html.

[lkundrak@v3.sk: Fixed the meson build, adjusted autogen.sh:
droped "|| exit 1", dropped call to aclocal,
dropped --copy from gtkdocize.]
2022-06-27 13:40:09 +02:00
Lubomir Rintel be341d3e10 contrib/debian: rework package install
Apt is run for each package separately and errors are ignored. This is
not great -- it's slow and ignores errors. Therefore we sometimes end
up without packages we need.

Let's tolerate errors only for packages that we are know can fail to
install safely.
2022-06-27 09:09:40 +02:00
Thomas Haller d15f5420c7
contrib: use less -f in NM-log to avoid prompt for non-text input 2022-06-10 08:24:58 +02:00
Thomas Haller c6228a5815
contrib: install iproute-tc in "nm-in-container.sh" 2022-06-09 21:11:08 +02:00
Thomas Haller 058af5fd07
contrib: enable DHCPv6 in "m-in-container.sh"'s "nm-env-prepare.sh" 2022-06-09 12:08:18 +02:00
Thomas Haller b93750d4c5
contrib: set git-blame options in "nm-setup-git.sh" 2022-06-08 21:27:57 +02:00
Thomas Haller 12ea3bb425
contrib: don't use :Z for bind mounts in "nm-in-container.sh"
I am not sure why I added this. I think it's not necessary or
useful. Drop it.
2022-06-03 15:03:13 +02:00
Thomas Haller 65992349d0
contrib: install black/clang-format in nm-in-container.sh
It's just convenient to have some tools around, not only
for testing, but also for (some limited) development.

In particular, because we bind-mount .vimrc inside the container, and
if I use vim, black/clang-format is just one key binding away.
2022-05-31 18:32:33 +02:00
Thomas Haller a6b8f050a0
contrib: add "journal" command to "nm-in-container.sh" for showing logs 2022-05-31 18:32:33 +02:00
Thomas Haller a55d2a5035
contrib: improve bashrc for nm-in-container.sh 2022-05-31 18:13:29 +02:00
Thomas Haller 3a478b3ec1
contrib: add script "nm-setup-git.sh" for setting up NetworkManager git repository
You can of course just clone NetworkManager repository and start hacking
as you like. However, there are a few things like git-notest which are
interesting to setup.

Add a script to do this.

The script is supposed to be idempotent and do nothing, unless
necessary. By default it also only prints what it would do.
2022-05-31 18:04:03 +02:00
Ana Cabral 41b5831331 rpm: make the ifcfg informational message available from RHEL 9 2022-05-30 10:11:00 +02:00
Ana Cabral 96d7362613 rpm: include a warning message for network configuration on /etc/sysconfig/network-scripts directory
NetworkManager now does not support network configuration through
ifcfg files by default anymore, it is provided in a separated
package:
https://fedoramagazine.org/converting-networkmanager-from-ifcfg-to-keyfiles/

This commits include a file in rpm packages located in ifcfg scripts
directory, /etc/sysconfig/network-scripts/, to inform the user of
the new location of network configuration files.

https://bugzilla.redhat.com/show_bug.cgi?id=2074020
2022-05-27 14:04:20 +00:00
Ana Cabral 0415d904cb rpm: move ifcfg scripts directory to the NetworkManager package
NetworkManager does not support by default legacy ifcfg configuration
files anymore, this support is now provided in a separate package
(https://fedoramagazine.org/converting-networkmanager-from-ifcfg-to-keyfiles/).

ifcfg directory (/etc/sysconfig/network-scripts/) should always be present,
regardless of NetworkManager support for network scripts. This change makes the
directory always present, not only when the recently splitted ifcfg subpackage
is installed, and also make it persistent after the package removal.

Fixes: 50a6627fd7 ('rpm: split ifcfg-rh settings plugin into a separate package')
2022-05-27 14:04:20 +00:00
Thomas Haller a859cee560
contrib: fix /etc/motd for "nm-in-container.sh" 2022-05-16 16:32:21 +02:00
Thomas Haller 0ca6aaab32
contrib: don't use "Z" specifier for mounting base directory in "nm-in-container.sh"
It seems unnecessary, and can cause failure.
2022-05-16 16:32:21 +02:00
Thomas Haller 56e1f0d290
contrib: ignore error installing behave_html_formatter in container
Yes, this is currently broken. *sigh*. Ignore any failure.
2022-05-16 16:32:08 +02:00
Thomas Haller e766ca4e7c
contrib: improve nm-in-container.d scripts
Get `ip netns exec` to work. Now we can start stuff in their
own namespace, which is much cleaner.
2022-04-28 19:33:14 +02:00
Thomas Haller a1ff31db3b
contrib: install nmstate+nispor in "nm-in-container.sh" 2022-04-19 11:15:08 +02:00
Thomas Haller 4d53df2911
contrib/makerepo.sh: fix name for local cache of git repository
The $URL might already contain a ".git" suffix. Then $FULLNAME would
end up having two ".git" extensions. Fix that.
2022-04-15 11:24:19 +02:00
Thomas Haller 135bc5dd1f
contrib/makerepo.sh: don't use unauthenticated github URL
It doesn't work anymore:

  $ git clone git://github.com/thom311/libnl.git
  Cloning into 'libnl'...
  fatal: remote error:
    The unauthenticated git protocol on port 9418 is no longer supported.
  Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
2022-04-15 11:11:17 +02:00
Thomas Haller 6bada7fb9e
contrib/rpm: reorder variable in spec file and set rpm_version
On recent Fedora and RHEL we no longer have differing "rpm_version"
and "real_version". So usually "rpm_version" is just the same as
"real_version".

Update the template spec file to reflect that. For the "build_clean.sh"
script, we anyway always set them both to "__VERSION__".
2022-04-14 12:47:07 +02:00
Thomas Haller 7003b5eb70
contrib: don't abort on first error during ftpadmin install
With "rc1" mode, we install more than one tarballs (the one for 1.37.90
and 1.39.0). If we reach this point, we already pushed the git tags.
There is no way back.

Ignore errors at first and try to release all tarballs. Only signal the error
at the end.
2022-04-06 19:17:58 +02:00
Thomas Haller e9340c792c
contrib: fail "find-backports" script if we have no "refs/notes/bugs" notes
"find-backports" script parses the commit messages to figure out which
patches to backport. We use "refs/notes/bugs" notes to extend the
meta data after the commit was merged. If you don't setup the
notes, the output is likely incomplete or wrong.

Yes, this is annoying. It requires you to setup the notes as described
in "CONTRIBUTING.md". Also because the "release.sh" script runs "find-backports",
so that means you cannot do releases without setting up the notes
(unless you manually disable running "find-backports"). But you really shouldn't
make a release based on incomplete information.
2022-04-06 13:23:37 +02:00
Thomas Haller a4da2eb5e5
contrib: improve detection of fedpkg repository in "makerepo.sh" 2022-04-06 09:46:14 +02:00
Thomas Haller f3be419719
contrib: better autotect python files to format for "nm-python-black-format.sh" script 2022-04-05 09:45:20 +02:00
Thomas Haller 4e28bd5a94
find-backports: support "Ignore-Fixes:" tag to ignore "Fixes:" commit
"Ignore-Backport:" is already in use. For the find-backports script it
has the same meaning as a "cherry picked from" line, that means, we
assume that the referenced patch was backported already and the fix
applied.

This is of course useful to make the script shut up about backports that
we don't want to do. However, it requires us to tag the old branch
with this, so that the script thinks that the patch is already there.

Imaging we have a wrong commit on "next" branch with a Fixes line. We
don't want to backport it, so we would have to tag the "old" branch with
"Ignore-Backport:". That is cumbersome.

Instead, now also support that if a commit contains a "Fixes:" line any
an "Ignore-Fixes:" for the same fixed commit, then this let's the
"Fixes:" line be ignored.
2022-04-05 09:18:22 +02:00
Thomas Haller 49b0a92b5a
contrib: add "nm-python-black-format.sh" script
This is more for completeness, to go along "nm-code-format.sh"
script.

Usually it's very simple to run black directly (you may still do that).
However, black by default only reformats files with ".py" extension.
So to get all our python files, you'd need to know and explicitly
select them... or use this script.

Also, `black .` scans the entire source tree, and is rather slow.
This script knows which files to select and is thus faster.
2022-04-01 14:00:30 +02:00
Thomas Haller 670894b667
contrib: fix wrong usage text for "nm-code-format.sh" 2022-04-01 13:51:56 +02:00
Thomas Haller 1c76c11b42
doc: rename "README" to "README.md"
By having a ".md" extension, gitlab renders a nice page instead of
showing as plain text.

Currently our README is pretty bad. Partly, because it doesn't get
shown nicely.

Rename. The file effectively was already markdown. The old file is
gone.

For this we also need to change the automake flavor to "foreign"
(See [1]).

[1] https://autotools.info/automake/options.html#automake.options.flavors
2022-03-21 17:19:47 +01:00
Thomas Haller 85ceffceb9
contrib/rpm: don't package TODO file
Our TODO file is not well maintained. Don't package it.
2022-03-21 17:19:47 +01:00
Thomas Haller c19b5d76c2
contrib: install "policykit-1" package on Debian
This is needed to get "/usr/share/gettext/its/polkit.its",
otherwise msgfmt will fail on Debian:

  /usr/bin/msgfmt: cannot locate ITS rules for data/org.freedesktop.NetworkManager.policy.in
2022-03-16 00:58:28 +01:00
Thomas Haller a628a35e80
contrib/checkpatch: try to warn about uninitialized GError variables
When we have a GError* variable on the stack, we usually want to pass
it on to function that can fail. In that case, the variable MUST be
initialized to NULL. This is an easy mistake to make.

Note that this check still can have lots of false positives, for
example, if you have a struct with an GError field. In that case, you
would need to ensure that the entire struct is initialized. Ignore the
warning then.

Also, the check misses if you declare multiple variables on one line.
But that is already discouraged by our style.
2022-03-09 23:14:37 +01:00
Beniamino Galvani b580741ef4 rpm: fix autotools build options for default plugins
Fixes: bb832641eb ('rpm: remove build-time default for plugins on newer distros')
2022-03-09 10:14:04 +01:00
Beniamino Galvani 50a6627fd7 rpm: split ifcfg-rh settings plugin into a separate package
Split the ifcfg-rh settings plugin into a separate package, so that it
will not be in new installations.

https://bugzilla.redhat.com/show_bug.cgi?id=2045875
2022-03-06 09:12:07 +01:00
Beniamino Galvani bb832641eb rpm: remove build-time default for plugins on newer distros
On newer distros, remove the build-time default for settings
plugins. All plugins found in the plugin directory will be used.
2022-03-06 09:12:06 +01:00
Thomas Haller df94cb2116
man: add NetworkManager-wait-online.service.8 manual
NetworkManager-wait-online is a constant source of confusion,
as it seems to delay the boot (when it's often just the messenger
or either a network problem, a NetworkManager misconfiguration
or a misconfiguration of other systemd services).

Try to clear that up with a manual page.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1130
2022-03-02 16:09:16 +01:00
Thomas Haller 5a5d9573e1
contrib: colorize releasing slave in NM-log 2022-02-23 17:07:16 +01:00
Lubomir Rintel 1cb4910841 rpm: drop %systemd_dir
There's a standard %_unitdir macro for this purpose, shipped with
systemd-rpm-macros.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1098
2022-02-22 16:38:54 +01:00
Lubomir Rintel a7011be3d8 rpm: drop %sysctldir
It's not used anywhere.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1098
2022-02-22 16:38:54 +01:00
Thomas Haller c87fbc9f6d
contrib/rpm: fix meson build to drop removed "json_validation" option
Recent meson versions treat unknown options as error and break now the
build. Good from them. This was an oversight.

Fixes: bbb1f5df2f ('libnm: always build libnm with JSON validation')
2022-02-21 19:49:29 +01:00
Thomas Haller 16a45d07ed
priv-helper: fix D-Bus patch to not contain forbidden character '-'
"-" is not allowed as D-Bus path and interface name, and discouraged as
bus name. This cause nm-priv-helper to crash, because GDBus asserts the
the object path is valid.

Replace the '-' with '_'. This way, it's consistent with
"nm_dispatcher".

Fixes: d68ab6b8f0 ('nm-sudo: rename to nm-priv-helper')
2022-02-09 18:47:14 +01:00
Lubomir Rintel f15fb5ecaa contrib/modemu: extend PDP support
Improve it just a bit to make ModemManager 1.18 happy.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1087
2022-02-04 15:54:15 +01:00
Lubomir Rintel ea37c42b16 contrib/modemu: respond to AT+COPS?
This queries the operator code. If NetworkManager got one, it can
connect the modem device automatically without setting the APN.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1086
2022-02-04 15:54:15 +01:00
Thomas Haller c6223c5a41
contrib/rpm: fix spec file for CentOS7/RHEL7 for "Suggests:"
Seems "Suggests:" is not supported.
2022-01-25 16:12:24 +01:00
Thomas Haller 3f0ec85634
contrib/rpm: split ifup/ifdown compat scripts to new package NetworkManager-initscripts-updown
Previously (on RHEL<=8 and Fedora<=35), NetworkManager package contains
the compat scripts nm-ifup/nm-ifdown.

If initscripts package (not network-scripts!) is installed, then a RPM
trigger links them as alternatives for the ifup/ifdown commands.

One problem is that `dnf provides /usr/sbin/ifup` lists the
NetworkManager package. Which is technically true, but on RHEL9 where
initscripts is not installed by default, `dnf install NetworkManager`
does not actually create those scripts.

Solve that by moving those scripts to a new subpackage
NetworkManager-initscripts-updown. The %post script now always creates the
alternatives links, regardless whether initscripts package is installed.

Note that on RHEL8, NetworkManager package not only Obsoletes: but also
Suggests: the new package.

The name "initscripts-updown" is chosen because in the future we might
have additonal initscripts/ifcfg related subpackages to contain the
ifcfg-rh plugin (NetworkManager-initscripts-ifcfg) or ifcfg-rh migration
tools (NetworkManager-initscripts-tools).

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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1061
2022-01-24 17:40:17 +01:00
Thomas Haller b2f507cab6
contrib/scripts: fix package list for Fedora 35 in "nm-in-container.sh" script
"grc" got removed/orphaned in Fedora 35.

Also, "vala-tool" is gone and (for a long time) replaced by "vala".
2022-01-13 20:05:14 +01:00
Beniamino Galvani d68ab6b8f0 nm-sudo: rename to nm-priv-helper
The name "nm-sudo" reminds of the "sudo" tool, and this is a bit
confusing because it's not related. Rename the service to
"nm-priv-helper", which stands for "NM privileged helper".

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/938
2022-01-11 21:46:55 +01:00
Thomas Haller 2b449694e5
checkpatch: complain about tabs in source file
There are very few places left where we would accept tabs in a source
file. Warn about that, even if it might cause some false positives.

I think this line was commented out due to a mistake.
2022-01-07 07:32:04 +01:00
Thomas Haller 866e3a2b51
contrib/scripts: update "nm-copr-build.sh" script to use new nm-git-bundle 2022-01-06 10:03:57 +01:00
Thomas Haller 34c59c96c5
contrib/scripts: better explain the purpose of nm-git-bundle 2022-01-06 10:01:51 +01:00
Thomas Haller 99f82b4b84
contrib: fix "find-backports" script to properly handle "Ignore-Backport" tag
The "Ignore-Backport" tag can be used to mark a commit that should not
be backported. Similar to the "cherry picked from" line, which indicates
that the patch was backported.

Anyway, this didn't work correctly, because we first pre-filter the
commits we search (as a performance optimization) by using `git-log` to
get a subset of the commits we want to investigate.

So if you had a commit with an "Ignore-Backport" tag, but without "cherry
picked from" line, then it wasn't found.

Fix that.
2022-01-05 09:30:16 +01:00
Thomas Haller a6ff5ee448
contrib/scripts: add Fedora version to podmain container name for "nm-code-format-container.sh"
Older branches, like "nm-1-32" will always be formatted with a
different, older clang-format version. Luckily we also have on "nm-1-32"
branch the "nm-code-format-container.sh" script, so we can still
reformat the sources using the container.

However, as the name of the container was always "nm-code-format",
we would have to re-generate the container when we switch between
branches. As the container really only depends on the Fedora version
(as the clang-format version is tied to the corresponding Fedora
version), let's include the Fedora version in the name of the container.
2022-01-04 21:17:19 +01:00
James Hilliard edc37b3adf
build: allow configuring default for wifi.backend setting
Distributions may want to change the default wifi.backend, if for
example they are building without wpa_supplicant support.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/869

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1040
2022-01-04 06:41:37 +01:00
Thomas Haller 081510ed94 gitlab-ci: use Fedora 35 as default build target 2021-11-29 09:31:09 +00:00
Thomas Haller 58287cbcc0 core: rework IP configuration in NetworkManager using layer 3 configuration
Completely rework IP configuration in the daemon. Use NML3Cfg as layer 3
manager for the IP configuration of an interface. Use NML3ConfigData as
pieces of configuration that the various components collect and
configure. NMDevice is managing most of the IP configuration at a higher
level, that is, it starts DHCP and other IP methods. Rework the state
handling there.

This is a huge rework of how NetworkManager daemon handles IP
configuration. Some fallout is to be expected.

It appears the patch deletes many lines of code. That is not accurate, because
you also have to count the files `src/core/nm-l3*`, which were unused previously.

Co-authored-by: Beniamino Galvani <bgalvani@redhat.com>
2021-11-18 16:21:29 +01:00
Ana Cabral 8b697c2e36 spec: Update for backwards compatibility 2021-11-15 09:44:06 +00:00
Thomas Haller 3e6c18e9af
checkpatch: suggest to use _nm_setting_property_define_direct_*() for setting properties
We have multiple ways to define properties (like, GVariant based
nm_setting_option_*() or GObject based properties). For the latter,
they nowadays should all be implemented via _nm_setting_property_define_direct_*()
API.
2021-11-04 20:25:19 +01:00
Ana Cabral 76fb08b1bd spec file: Update NetworkManager post scriptlet
There is a mix of new /usr/lib/systemd/libsystemd-shared-239.so
(systemd-libs rpm) and old /usr/bin/udevadm (systemd-udev rpm) on
the system at the point NetworkManager's post scriptlet is run,
what causes warning messages when updating NetworkManager's version.
This commit fixes this.

https://bugzilla.redhat.com/show_bug.cgi?id=2012123
2021-11-02 12:47:33 +01:00
Lubomir Rintel ae4412b2fc contrib/checkpatch: recognize git subtree merges
Make checkpatch.pl identify subtree merges in "git am"-formatted
patches and reconstruct the full path names based in the subtree root.

This fixes some spurious warnings for parts of the tree that use
different coding style from what we usually do.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/989
2021-10-12 15:13:44 +02:00
Thomas Haller 34410c9c3e
contrib: fix motd comment in "nm-in-container.sh" 2021-10-08 12:35:15 +02:00
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
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