Commit Graph

55 Commits

Author SHA1 Message Date
Jan Vaclav
e42ef92bfa meson: add runtime_dir option
Adds a runtime_dir option to the meson options, which allows the user to
specify the run directory when building. This commit also changes it so
that `/run` is set as the default run directory if building with /usr prefix.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1919
2024-04-15 15:03:35 +02:00
Íñigo Huguet
f57513097f meson: autodetect Qt dependencies
Configuring the build directory with meson often fails if you don't have
the right Qt dependencies. As they are used only to build some examples,
it is better to autodetect them and, if present, then build the
examples but skip them otherwise.

Still accept forcing qt=true or qt=false as before.

Note that there is a option type called "feature" whose purpose is to
support exactly this: features with enable/disable/auto possible values:
https://mesonbuild.com/Build-options.html#features.  However, they don't
accept true/false values so scripts using qt=true/false would start
failing. Since meson 0.60 the "deprecated" argument can be used for
options (https://mesonbuild.com/Build-options.html#deprecated-options),
but that's a too new version of meson.

Also, this fixes some Gitlab-CI failures that happen when generating the
tarball with make distcheck or meson dist. This is because it tries to
check that the tarball content can be configured and built, but it uses
the default configurations so it was using qt=yes. Now it will use
qt=auto, avoiding the failure.

Fixes: 61f0531509 ('gitlab-ci: test re-buildability of distribution tarballs')
2024-04-02 12:58:26 +00:00
Fernando Fernandez Mancera
05ef682bb5 power: remove monitoring of upower signals
UPower "Sleeping" and "Resuming" signals were dropped long ago [1].
Therefore we are also dropping the support of it.

[1] https://lists.freedesktop.org/archives/devkit-devel/2014-March/001575.html
2024-03-04 18:29:07 +01:00
Beniamino Galvani
52cca91dd2 build,core: add a "main.migrate-ifcfg-rh" configuration option
The option enables automatic migration of ifcfg-rh connection profiles
to keyfile. The default value can be configured at build time.
2023-07-25 15:39:06 +02:00
Jan Vaclav
9a5c7c7228 build: make modprobe path configurable
Extracts the hardcoded modprobe path used in `src/libnm-platform/nm-platform-utils.c` to the configurable MODPROBE_PATH macro
Merge request: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1689
Closes: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1257
2023-07-11 17:06:19 +02:00
Beniamino Galvani
9c90503ffe build: don't enable ifcfg-rh by default on RH distros
Now that the plugin is deprecated, it should be enabled only by
explicit user configuration.
2023-06-29 10:15:48 +02:00
Beniamino Galvani
3ad7e4b7e6 build,man: document ifcfg-rh as deprecated
Document the ifcfg-rh settings plugin as deprecated, as announced in:

https://lists.freedesktop.org/archives/networkmanager/2023-May/000103.html
2023-06-29 10:15:48 +02:00
Thomas Haller
611db44974
build/meson: enable -Dnm_cloud_setup=true by default
That is also what autotools does. Keep the behvior in sync.
Also, "contrib/scripts/nm-ci-run.sh" does not explicitly enable
nm-cloud-setup, so we ended up not building it in test. This
solves that, by enabling it by default.
2023-05-18 09:16:41 +02:00
Thomas Haller
701171d99a
build: don't mark nm-cloud-setup as EXPERIMENTAL in build script 2023-05-18 09:16:31 +02:00
Heiko Thiery
03ba04d478
build: meson: add option to set the mobile-broadband-provider-info database
When building network-manager in cross-compile environment meson is not able
to detect the right location of the mobile-broadband-provider-info
database by using the pkg-config module.

By adding the option 'mobile_broadband_provider_info_database' to set the
correct path to the datafile this can be solved.

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1519
2023-02-13 11:02:50 +01:00
Thomas Haller
b38d180bc6
build/meson: fix autodetecting ifcfg_rh/ifupdown plugins
"-Difcfg_rh=false" did not work, we would always fallback to
autodetection. That is wrong, an explicit "false" should be honored.
It's also not what autotools does. Fix this.

While at it, drop "distro" variable. It's not a clear concept
that can be reused and it's unused otherwise.

Also, no longer let the autodetection be based on cross compilation.
When cross-compiling, it seems not entirely unreasonable that you cross
compile to a comparable distro, so let the autodetection be based on
what we detect on the host. In any case, a user can and is encouraged
to explicitly enable/disable the plugins via "-Difcfg_rh=" or
"-Difupdown=".

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1310
2022-07-25 10:32:10 +02:00
Thomas Haller
5da17c689b
dns/unbound: drop deprecated "unbound" DNS plugin
The "unbound" DNS plugin was very rudimentary and is deprecated since
commit 4a2fe09853 ('man: mark [main].dns=unbound as deprecated') (Jun
2021).

It is part of dnssec-trigger tool, but the dnssec-trigger tool doesn't
actually use it. Instead it installs a dispatcher script
"/usr/lib/NetworkManager/dispatcher.d/01-dnssec-trigger".

Especially, since the plugin requires "/usr/libexec/dnssec-trigger-script",
which is provided by "dnssec-trigger" package on Fedora. At the same
time, the package provides the dispatcher script. So I don't this works
or anybody is using this.

https://mail.gnome.org/archives/networkmanager-list/2022-April/msg00002.html
2022-04-15 09:04:30 +02:00
Christian Eggers
b26c9723d9
libnm-crypto: add new option for no cryptography
For some embedded systems, no cryptography is required at all (e.g when
only using Ethernet).

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1108
2022-02-21 19:12:27 +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
Lukasz Majewski
85f3030e4b
cli: meson: Support building nmcli with libedit
After this change the nmcli program built with meson will have the
possibility to use libedit (BSD license) instead of libreadline
(GPLv3).

Meson configuration line:
meson configure -Dreadline=libedit -C ../nm-build/

or

meson --reconfigure -Dreadline=libedit ../nm-build/
ninja -C ../nm-build/

The new 'readline' option is set to 'auto' by default, so
the current behavior shall be preserved (and the libreadline is
used).

Two new config.h flags (always defined) have been introduced -
HAVE_EDITLINE_READLINE and HAVE_READLINE_HISTORY.
2021-07-14 17:16:45 +02:00
Thomas Haller
1da1ad9c99
firewall: make firewall-backend configurable via "NetworkManager.conf"
"iptables" and "nftables" will be supported. Currently, the code is
unused and only "iptables" is supported.
2021-05-14 11:41:32 +02:00
Thomas Haller
ea198096eb
build: rename build option "--with-polkit-agent-helper-1{-path,}"
Suggested-by: Michael Biebl <biebl@debian.org>
(cherry picked from commit d9968b133b)
2021-02-16 21:55:34 +01:00
Thomas Haller
8f2ca652d9
build: make path to polkit-agent-helper-1 binary configurable
Add new configure option to set the path to "polkit-agent-helper-1".

The path cannot be obtained from pkg-config and `pkg-config
--variable=prefix polkit-agent-1` is not good enough.

On Fedora, the path is "/usr/lib/polkit-1/polkit-agent-helper-1".
On Debian Buster, the path is "/usr/lib/policykit-1/polkit-agent-helper-1"
On Debian Sid, the path is "/usr/libexec/polkit-agent-helper-1" (but
currently it is also symlinked from "/usr/lib/policykit-1/polkit-agent-helper-1".

(cherry picked from commit 801c41a11c)
2021-02-12 11:36:36 +01:00
Thomas Haller
b867ac56a4 build/meson: enable "more_asserts" only for devel builds
more_asserts are our NetworkManager specific assertions, and the only
point of having them at all (beside g_assert(), assert() and g_return*()),
is that these assertions are disabled by default in production.

meson always enabled them by default. That is definitely wrong.

autotools enables more_asserts by default if we build a devel version
from master. I think that is bad too, because (again) having these assertions
disabled by default is the only point of having them. Anyway, mimic
the behavior of autotools, to at least disable them in release builds.
2020-09-08 18:40:57 +02:00
Jordan Petridis
391820da76
meson_options: fix suggested values for more_asserts
meson.build atm only handles, `no/all/int`

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/621
2020-09-08 18:37:45 +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
bbb1f5df2f
libnm: always build libnm with JSON validation
We anyway load libjansson with dlopen(), and already before it could
happen that libjansson is not available. In that case, we would not
crash, but simply proceed without json validation.

Since libnm-core no longer uses libjansson directly, but only via
"nm-glib-aux/nm-json.h", we can just always compile with that, and use
it at runtime. That means, libjansson is not a build dependency for
libnm anymore, so we don't need a compile time check.

Note that if you build without libjansson, then JANSSON_SONAME is
undefined, and loading it will still fail at runtime. So, even if
we now always build with all our code enabled, it only works if you
actually build with libjansson. Still, it's simpler to drop the
conditional build, as the only benefit is a (minimally) smaller
build.
2020-07-09 11:47:06 +02:00
Beniamino Galvani
c8b5bf402d build: install a firewalld zone for shared mode
Install a NM-specific firewalld zone to be used for interfaces that
are used for connection sharing. The zone blocks all traffic to the
local machine except some protocols (DHCP, DNS and ICMP) and allows
all forwarded traffic.
2020-05-15 19:06:24 +02:00
Thomas Haller
a0a5b0b2f5 core: add main.auth-polkit option "root-only"
We always build with PolicyKit support enabled, because it has no
additional dependencies, beside some D-Bus calls.

However, in NetworkManager.conf the user could configure
"main.auth-polkit" to disable PolicyKit. However, previously it would
only allow to disable PolicyKit while granting access to all users.

I think it's useful to have an option that disables PolicyKit and grants
access only to root. I think we should not go too far in implementing
our own authorization mechanisms beside PolicyKit (e.g. you cannot
disable PolicyKit and grant access based on group membership of the
user). However, disabling PolicyKit can be useful sometimes, and it's
simple to implement a "root-only" setup.

Note one change is that when NetworkManager now runs without a D-Bus
connection (in initrd), it would deny all non-root requests. Previously
it would grant access. I think there should be little difference in
practice, because if we have no D-Bus we also don't have any requests to
authenticate.

(cherry picked from commit 6d7446e52f)
2019-12-11 13:13:05 +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
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
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
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
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
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
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
Iñigo Martínez
b00e004890 build: meson: Use variables present in pkg-config files
Although some paths related to DBus and PolicyKit are present in
their pkg-config files, those paths might not be writable for the
user. To solve this issue, some build options are present that can
be used to choose a different location.

However, usually these paths are relative to some other variables
such as `prefix`, `datadir`, etc. Using the `define_variable`
option the relative path can be change to point to a directory
under prefix.

These paths are now using relative paths based on the installation
`prefix` and their related options have been removed as they are
unnecessary now. Only `dbus_conf_dir` option has been left because
it must be modified depending on the distribution[0].

[0] contrib/fedora/rpm/NetworkManager.spec
2018-12-20 13:50:34 +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
Beniamino Galvani
81bc218e6d meson: add check on settings docs
Move the autotools check on settings docs to a shell script and call
it from meson too.
2018-12-12 14:38:18 +01:00
Thomas Haller
de3f6cfb98 doc,all: fix spelling of Open vSwitch (instead of OpenVSwitch)
Also affects documentation and translated strings.

Reported-by: Flavio Leitner <fbl@redhat.com>
2018-11-28 14:26:42 +01:00
Beniamino Galvani
81a565ebe5 build: autodetect ebpf support 2018-09-19 17:23:11 +02:00
Beniamino Galvani
37954c91bd build: meson: check vapi prerequisites and allow autodetection
Turn the vapi option into a combo that allows autodetection and check
whether all prerequisites are satisfied (including introspection
support) when vapi is explicitly enabled.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/28
2018-09-19 16:03:32 +02:00
Beniamino Galvani
691c71a7f2 build: allow disabling eBPF support in n-acd
Add a configure option to disable eBPF support in n-acd.

Note that, even if eBPF is not supported, n-acd requires a kernel >
3.19, which means that the setsockopt(..., SO_ATTACH_BPF) option must
be defined. To allow building on older kernels without modifying the
n-acd code, we inject the SO_ATTACH_BPF value as a preprocessor define
in the compiler the command line.
2018-09-18 15:32:36 +02:00
Beniamino Galvani
5a0cef2f36 build: meson: uniform handling of rc managers
Handle all rc managers paths through the same code.

(cherry picked from commit 2fd7559819)
2018-09-13 14:35:19 +02:00
Beniamino Galvani
73249e2ef7 build: meson: uniform handling of dhcp client paths
Handle all dhcp client paths through the same code.

(cherry picked from commit 36b0e46146)
2018-09-13 14:35:18 +02:00
Beniamino Galvani
b66607af95 build: remove check on dhcpcd version number
dhcpcd version 6, the first supporting IPv6, was released more than 5
years ago. Remove all checks on version number and IPv6 support.

(cherry picked from commit e0c49d7341)
2018-09-13 14:35:14 +02:00
Beniamino Galvani
365482bf5e build: remove check on dhclient version
dhclient 4.0 was released more than 10 years ago. I think it is
reasonable to expect that nobody is using an older version today.

https://source.isc.org/cgi-bin/gitweb.cgi?p=dhcp.git;a=shortlog;h=refs/tags/v4_0_0
(cherry picked from commit 9e61ea7040)
2018-09-13 14:35:13 +02:00
Beniamino Galvani
bda3bb931b build: meson: fix pppd path
Allow specifying a non-existent path.

(cherry picked from commit 794e499ab8)
2018-09-13 14:35:12 +02:00
Beniamino Galvani
e860a2e09c build: meson: fix setting iptables/dnsmasq/dnssec-trigger paths
Handle the iptables, dnsmasq and dnssec-trigger paths in the same way
through common code.

The path set by user must be accepted as is, even if does not exist,
because this is a requirement for cross-compilation. When user does
not specify a path, search a predefined set of paths and fall back to
an hardcoded one.

(cherry picked from commit 220dea0948)
2018-09-13 14:35:10 +02:00
Thomas Haller
1dd63580df build/meson: fix build options for suspend-resume
suspend-resume must be selectable, out of for possible options.
We can do auto-detection based on present libraries, but it
shall be selectable. Like it is with autotools.
2018-08-27 17:49:29 +02:00
Thomas Haller
1a9bc22460 build: cleanup build defines for session-tracking
- always define the SESSION_TRACKING_* defines to replace
  "#ifdef" with "#if".

- drop defining the consolekit database path CKDB_PATH in
  config.h. The path was not customizable via configure/meson.

- fix meson build to enable consolekit support for session tracking
  without also enabling logind/elogind session tracking.
  logind/elogind is mutually exclusive, but consolekit session tracking
  goes together just fine.
2018-08-27 17:49:29 +02:00
Thomas Haller
dbd48f260e logging: warn about invalid logging backends and drop "debug" backend
"debug" was documentation in `man NetworkManager.conf` as a valid
logging backend. However, it was completely ignored by
nm_logging_syslog_openlog().
In fact, it makes not sense. Passing debug = TRUE to
nm_logging_syslog_openlog(), means that all messages will be
printed to stderr in addition to syslog/journal. However, when
NetworkManager is daemonizing, stderr is closed.
Whether NetworkManager is daemonizing depends entirely on command
line options --no-daemon and --debug. Hence, the logging backend "debug"
from the configuration file either conflicts or is redundant.

Also, adjust logging backend description in `man NetworkManager.conf`.

Also, log a warning about invalid/unsupported logging backend.

(cherry picked from commit 2ccf6168dc)
2018-06-27 09:21:33 +02:00
Lubomir Rintel
df58895fb3 build: disable libnm-glib by default
It's deprecated and has been replaced by libnm for 6 major releases now.

Its use in modern distributions has faded to the point it can probably
be safely removed.
2018-06-15 13:07:53 +02:00
Iñigo Martínez
7b34c3cf3e build: Rename settings-docs.c file
The `settings-docs.c` file is generated by processing the
`nm-property-docs.xml` file. Although this works in autotools,
the `.c` extension makes meson not to handle it properly.

Given the fact that it only contains a number of defines it
makes sense to change its extension to `.h` an use it as a header.
This also makes meson to handle it properly and build it before
its used.

https://mail.gnome.org/archives/networkmanager-list/2018-January/msg00057.html
2018-01-12 09:39:06 +01:00