Commit graph

896 commits

Author SHA1 Message Date
Thomas Haller 8d0b30b243
linux-headers: include "mptcp.h" kernel header
Taken from v5.18, 4b0986a3613c ('Linux 5.18') from 20220522.
2022-07-20 10:23:04 +02:00
Vojtech Bubela 5e4632f021
doc: preserve paraghraphs in nmcli man pages
Improve documentation by preserving paragraphs in the
nm-settings-nmcli man pages.

To do that structure of src/libnm-client-impl/nm-settings-docs-gir.xml
was changed to have "description" as subnode to property node instead
of attribute of property node. Another subnode "description-docbook"
was added - this node is then used when generating man pages.

tools/generate-docs-nm-settings-docs-gir.py and man/nm-settings-dbus.xsl
were also changed to accomodate for changes mentioned above.

Replace xsltproc tool with python script when generating
./src/libnmc-setting/settings-docs.h.

Deleted settings-docs.xsl since it was replaced by python script.

Change src/libnmc-setting/settings-docs.h.in accodring to newly
generated src/libnmc-setting/settings-docs.h

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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1260
2022-07-15 17:25:15 +02:00
Thomas Haller 556bff1767
systemd: merge branch systemd into main
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1291
2022-07-07 00:50:46 +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
Adrian Freihofer cdaa99cd35
ifcfg-rh: add support for ipv4.link-local 2022-05-27 08:24:40 +02:00
Lubomir Rintel 649314ddaa libnm: replace nm-types.h by defining the types in respective headers
The typedefs in nm-types.h confuse gtkdoc-scan. It generates a
libnm-sections.txt file like this:

  <SECTION>
  <FILE>nm-types</FILE>
  <TITLE>NMDeviceOvs</TITLE>
  NMAccessPoint
  NMActiveConnection
  NMCheckpoint
  NMClient
  NMDevice
  ...

Note the wrongly picked title and, more importantly, the object types in
a bogus section. This in turn makes gtkdoc-mkdb fail to include the
property and signal documentation in appropriate sections.

Without nm-types.h, we need to mind the header dependencies. This means
that we need to order the headers that define types before the ones that
use them. Also, we need to break the depencency loops in few palces.
2022-05-06 18:33:27 +02:00
Thomas Haller 747d7dcfe3
systemd: drop "nm-sd-utils-core.h" and nm_sd_utils_id128_get_machine()
This was only for unit testing, to check whether our reader
for "/etc/machine-id" agrees with systemd's.

That unit test was anyway flawed, because it actually accesses
the machine-id on the test system.

Anyway. Drop this. Most likely our parser is good enough, and
if we get a bug report with a defect, we can unit test against
that.
2022-04-20 12:07:04 +02:00
Lubomir Rintel 97857dbacd client/test: add test for --offline behavior
Currently, only "add" and negative cases are tested. Testing "modify"
would require an ability to provide input. Perhaps at some later point.
2022-04-19 14:27:22 +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
Thomas Haller 6150a495c9
dhcp/systemd: drop dhcp4 client (and related files)
This code is now unused.
2022-04-14 14:51:03 +02:00
Thomas Haller 54119d4105
dhcp: drop internal systemd DHCPv4 client
This is long replaced by nettools' n-dhcp4 client.
Drop it.

We still require NMDhcpSystemd for the DHCPv6 client.

Note that "[main].dhcp=systemd" now falls back to the internal client.
But this option was undocumented and internal anyway.
2022-04-14 14:51:02 +02:00
Thomas Haller 1234e5583a
build/autotools: avoid compiler warning generating "NM-1.0.gir"
We passed on the CFLAGS, but they also contain

  "-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_40 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_40"

which causes compiler warnings:

    GISCAN   src/libnm-client-impl/NM-1.0.gir
  /data/src/NetworkManager/tmp-introspect_17ddrdb/NM-1.0.c: In function ‘dump_object_type’:
  /data/src/NetworkManager/tmp-introspect_17ddrdb/NM-1.0.c:251:13: warning: Not available before 2.70
    251 |   if (G_TYPE_IS_FINAL (type))
        |             ^~~~~~~~~~~~~~~~~
  /data/src/NetworkManager/tmp-introspect_17ddrdb/NM-1.0.c: In function ‘dump_fundamental_type’:
  /data/src/NetworkManager/tmp-introspect_17ddrdb/NM-1.0.c:369:13: warning: Not available before 2.70
    369 |   if (G_TYPE_IS_FINAL (type))
        |             ^~~~~~~~~~~~~~~~~

Filter them out.

See-also: https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/331
2022-04-07 11:55:34 +02:00
Thomas Haller 261d74d881
systemd: merge branch systemd into main
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1178
2022-04-05 15:04:07 +02:00
Thomas Haller 12299ee91e
build: drop "check-python-black" check from autotools
Previously, autotools would detect whether we have "black"
in the path. And if so, it would check formatting during `make check`.

That's problematic. When I run `./contrib/fedora/rpm/build_clean.sh -w test`
in certain cases, it would pick up black, but then fail with

  Traceback (most recent call last):
    File "/usr/bin/black", line 5, in <module>
      from black import patched_main
    File "/usr/lib/python3.6/site-packages/black.py", line 42, in <module>
      from attr import dataclass, evolve, Factory
  ModuleNotFoundError: No module named 'attr'
  make[3]: *** [Makefile:21658: check-python-black] Error 1

That's an installation error of black, but still, during package build
there is no need to check the formatting. We could export
`NMTST_SKIP_PYTHON_BLACK=1` to prevent it, but it's still unnecessary.

We check proper formatting in gitlab-ci. That is enough, it doesn't
need to run during `make check`. In particular, because `black .`
takes 1.5 seconds on my machine.
2022-04-01 14:01:45 +02:00
Thomas Haller 901787e06f
build: move nm-crypto to separate directory "src/libnm-crypto"
libnm-core currently has a dependency on crypto libraries (either
"gnutls", "nss" or "null"). We need this huge dependency for few cases.

Move the crypto code to a separate static library"src/libnm-crypto/libnm-crypto.la".
The reasoning is that it becomes clearer where we have this dependency,
to use it more consciously, and to be better see how it's used.

We clearly need the crypto functionality in libnm. But do we also need
it in the daemon? Could we ever link the daemon without crypto libraries?

The goal of splitting the crypto part out, to better understand the
crypto dependency.
2022-03-29 11:56:04 +02:00
Thomas Haller 89bba8fa84
libnm-base: add "nm-base.c" for implementing stuff from "nm-base.h" 2022-03-29 11:56:03 +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
Emmanuel Grumbach 721008f1c3 linux-headers: add nl80211-vnd-intel.h kernel header
Take from include/uapi/linux/nl80211-vnd-intel.h

Linux 5.17-rc5, cfb92440ee71adcc2105b0890bb01ac3cddb8507
March 1, 2022
2022-03-07 10:55:33 +02: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
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
Thomas Haller 3996933c57
platform: rename "nmp-route-manager.h" to "nmp-rules-manager.h" 2022-02-09 19:13:03 +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
Thomas Haller 18cb8205b3
systemd: merge branch systemd into main
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1068
2022-02-03 18:50:26 +01:00
Andrew Zaborowski 51ef157096
iwd: Add basic P2P device class for IWD
Similarly as with wpa_supplicant, create NMDeviceIwdP2P objects for P2P
devices based on data from IWD -- not in NMWifiFactory::create_device
because that is only triggered for system netdevs and a P2P-Device
virtual interface has no netdev.  Unlike NMDeviceWifiP2P,
NMDeviceIwdP2P's iface property is a unique string that likely doesn't
match any system interface name -- in theory there doesn't need to be
any related netdev on the system (such as an Infrastructure-mode
interface) before a P2P-Device is added.

[thaller@redhat.com: modified original patch]
2022-01-21 11:16:14 +01:00
Thomas Haller f21340ab5c
build/autotools: fix linking libnm-log-null into various executables
Interestingly, on RHEL9 I suddenly get a linker error:

  libtool: link: gcc -Wall -Werror -Wextra -Wdeclaration-after-statement -Wfloat-equal -Wformat-nonliteral -Wformat-security -Wimplicit-function-declaration -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wmissing-prototypes -Wpointer-arith -Wshadow -Wshift-negative-value -Wstrict-prototypes -Wundef -Wvla -Wno-duplicate-decl-specifier -Wno-format-truncation -Wno-format-y2k -Wno-missing-field-initializers -Wno-pragmas -Wno-sign-compare -Wno-unknown-pragmas -Wno-unused-parameter -Wno-array-bounds -Wunused-value -Wcast-function-type -Wimplicit-fallthrough -fno-strict-aliasing -fdata-sections -ffunction-sections -Wl,--gc-sections -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wl,--version-script=./linker-script-binary.ver -Wl,-z -Wl,relro -Wl,--as-needed -Wl,-z -Wl,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -o src/nm-online/.libs/nm-online src/nm-online/nm_online-nm-online.o -Wl,--export-dynamic -pthread  src/libnm-client-impl/.libs/libnm.so src/libnm-client-aux-extern/.libs/libnm-client-aux-extern.a /root/NetworkManager/contrib/fedora/rpm/NetworkManager.20220111-121006.2X0NXg/BUILD/NetworkManager-1.35.3/src/libnm-client-impl/.libs/libnm.so -lgnutls -ludev src/libnm-glib-aux/.libs/libnm-glib-aux.a src/libnm-std-aux/.libs/libnm-std-aux.a src/c-siphash/.libs/libc-siphash.a -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -pthread
  /usr/bin/ld: src/libnm-glib-aux/.libs/libnm-glib-aux.a(libnm_glib_aux_la-nm-time-utils.o): in function `_t_init_global_state':
  /root/NetworkManager/contrib/fedora/rpm/NetworkManager.20220111-121006.2X0NXg/BUILD/NetworkManager-1.35.3/src/libnm-glib-aux/nm-time-utils.c:73: undefined reference to `_nm_utils_monotonic_timestamp_initialized'
  collect2: error: ld returned 1 exit status
  make[2]: *** [Makefile:11437: src/nm-online/nm-online] Error 1

The linker is right. Fix it.
2022-01-11 22:11:18 +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
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 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
Lubomir Rintel e37b8456ac build: remove NetworkManager.pc
It's not installed at least since libnm-glib was dropped.
2021-11-03 12:19:36 +01:00
Thomas Haller 06d448245b
systemd: merge branch systemd into main 2021-10-08 18:04:37 +02:00
Beniamino Galvani c896973deb platform: drop test-tc-fake
It doesn't seem useful to have a copy of the test which does nothing.
2021-09-20 13:27:15 +02:00
Thomas Haller aa070fb821
core: add NML3IPv6LL helper
This helper class is supposed to encapsulate most logic about
configuring IPv6 link local addresses and exposes a simpler API in order
to simplify NMDevice. Currently this logic is spread out in NMDevice.

Also, NML3IPv6LL directly uses NML3Cfg, thereby freeing NMDevice to care
about that too much.

For several reasons, NML3IPv6LL works different than NML3IPv4LL.
For one, with IPv6 we need to configure the address in kernel, which does
DAD for us. So, NML3IPv6LL will tell NML3Cfg to configure those
addresses that it wants to probe. For IPv4, it only tells NML3Cfg to do
ACD, without configuring anything yet. That is left to the caller.
2021-09-10 13:26:52 +02:00
Thomas Haller 2a07043489
std-aux: add "libnm-std-aux/nm-linux-compat.h" header to avoid build errors
We have a copy of a few linux user space headers in `src/linux-headers`.
The idea is that we want to use recent kernel API, and not depend on the
kernel UAPI headers installed on the build system (and not need to
workaround that).

However, we may not be able to simply compile them, because they too
have dependencies. For example,

  ../src/linux-headers/ethtool.h:1389:2: error: implicit declaration of function '__KERNEL_DIV_ROUND_UP' [-Werror=implicit-function-declaration]
    __u32 queue_mask[__KERNEL_DIV_ROUND_UP(MAX_NUM_QUEUE, 32)];
    ^

As workaround, don't include headers from "linux-headers" directly,
but only include the new "libnm-std-aux/nm-linux-compat.h" adapter
header, which tries to solve these incompatibilities.

Fixes: 34d48d2596 ('platform: clear all BASE types when setting advertised modes for ethernet autoneg')
2021-09-08 15:27:17 +02:00
Thomas Haller f992b2bc25
platform/build: fix linking "test-nm-platform" test
libnm-platform.la depends on libnm-udev-aux and libnm-base.
Only by accident this was working, because we happened to use
no symbol in the test that required any of these dependencies.

A small change to the test can (and will soon) change that. Fix the
build to link the right library.
2021-09-06 10:06:13 +02:00
Thomas Haller aadcd0935e
linux-headers: add ethtool.h kernel header
Taken from Linux 5.14, 7d2a07b769330c34b4deabeed939325c77a7ec2f,
Aug 30, 2021.
2021-09-06 10:00:36 +02:00
Thomas Haller a8929bbfc3
Revert "build: add way to keep unused symbols when linking NetworkManager"
This approach does not seem to work with clang 3.4 (rhel-7). Instead,
make sure we actually use the symbol in NetworkManager so that it gets
preserved for the OVS device plugin.

This reverts commit 684f2acffe.
2021-08-31 13:31:42 +02:00
Thomas Haller 3b78c1eb86
build: sort filename alphabetically in Makefile.am and similar
The question is what "alphabetically" means (as it depends on
collation). To me, it means ":sort" in `LANG=en_US.UTF-8 vim`.
2021-08-26 23:05:21 +02:00
Gris Ge 9958510f28
bond: add support of queue_id of bond port
Introduced `NMSettingBondPort` to hold the new setting class with single
property `NM_SETTING_BOND_PORT_QUEUE_ID`.

For dbus interface, please use `bond-port` as setting name and
`queue-id` as property name.

Unit test cases for ifcfg reader and writer included.

Signed-off-by: Gris Ge <fge@redhat.com>

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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/952
2021-08-26 23:04:31 +02:00
Javier Sánchez Parra b0f5b1d97a
tui: add WireGuard support to nmtui
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/736
2021-08-17 14:10:12 +02:00
Thomas Haller de5dddccbe
core: get file descriptor to ovsdb unix socket from nm-sudo
To talk to ovsdb, we use the unix socket at
/var/run/openvswitch/db.sock. But that socket is owned by another user
and NetworkManager would need dac_override capability to open it.

We want to drop dac_override, but we still need to talk to ovsdb. Add a
GetFD() method to nm-sudo.

We still first try to open the socket directly. Maybe it just works.

Note that SELinux may block passing file descriptors from nm-sudo. If it
doesn't work for you, test with SELinux permissive mode and wait for an
SELinux update.
2021-07-26 15:31:46 +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 684f2acffe
build: add way to keep unused symbols when linking NetworkManager
NetworkManager (and NetworkManager-all-sym) must not only contain symbols
that are used by itself. Also the device and settings plugin are dlopen'd
by NetworkManager and use symobls form the binary.

That means, if a symbols is only used by a plugin, then we must make sure
that the linker keeps it in the binary. Add a mechanism for that.
2021-07-26 15:30:10 +02:00
Thomas Haller 641f4473b7
build: fix calling test "check-local-devices-ovs" to check OVS device plugin 2021-07-26 15:30:10 +02:00
Thomas Haller 32b2d15021
cloud-setup: link with libnm-log-null 2021-07-23 16:43:36 +02:00
Wen Liang f3404435a9
cloud-setup: configure secondary ip in Aliyun cloud
This is a tool for automatically configuring networking in Aliyun
cloud environment.

This add a provider implementation for Aliyun that when detected fetches
the private ip addressess and the subnet prefix of IPv4 CIDR block.

Once this information is fetched from the metadata server, it instructs
NetworkManager to add private ip addressess and subnet prefix for each
interface detected.

It is inspired by SuSE's cloud-netconfig ([1], [2]) and Aliyun Instance Metadata [3].

[1] https://www.suse.com/c/multi-nic-cloud-netconfig-ec2-azure/
[2] https://github.com/SUSE-Enceladus/cloud-netconfig
[3] https://www.alibabacloud.com/help/doc-detail/49122.htm

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.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/885

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
2021-07-19 17:41:52 +02:00
Thomas Haller 0c4a65929c
glib-aux: use nm_utils_gettid() instead of gettid()
I missed that we already have a gettid() wrapper. Drop the duplicated
again and use nm_utils_gettid().

Fixes: e874c5bf6b ('random: Provide missing gettid() declaration')
2021-07-08 08:31:47 +02:00
Thomas Haller 09fb7877a9
build: fix linking libnm-log-null into different test programs
We require these, otherwise we can get a linker error about
_nm_utils_monotonic_timestamp_initialized symbol being undefined.
2021-07-05 14:51:27 +02:00
Thomas Haller ef0f9b871b
ifcfg-rh/tests: add unit test for persisting NMSettingEthtool
In particular the case with an all-default NMSettingEthtool is
currently broken. The test is checking the wrong behavior, which
will be fixed next.
2021-06-25 15:45:56 +02:00
Beniamino Galvani 00126e57b4 core: add infrastructure for spawning a helper process
(cherry picked from commit 6ac21ba916)
2021-06-11 21:59:11 +02:00
Beniamino Galvani 6a88d4e55c ifcfg-rh: preserve an empty tc configuration
If the TC setting contains no qdiscs and filters, it is lost after a
write-read cycle. Fix this by adding a new property to indicate the
presence of the (empty) setting.
2021-06-03 09:02: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 e9c1d2a9dd
firewall: add new "nm-firewall-utils.[ch]" module 2021-05-07 11:42:50 +02:00
Thomas Haller 8483c47d70
firewall: rename "nm-firewall-manager.[ch]" to "nm-firewalld-manager.[ch]"
We will add a general "firewall-manager", so rename the firewalld related
file. This commit only renames the file. The next commit will change the
symbol naming.
2021-05-06 12:22:37 +02:00
Thomas Haller 0bc5a2c76f
core: add "nm-device-utils.[ch]" with simple helper functions
"nm-device.c" is huge, and it does complicated things like handling the
state of the device and IP configuration.

It also contains simpler, individual functions, like converting enums to
strings. Let's move those trivial functions to a new module, so that the
remaining part is smaller.

"nm-device-utils.[ch]" should only contain simpler functions that have
no complex behavior or state.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/840
2021-05-06 12:19:44 +02:00
Wen Liang 86dcb31ab3
build: replace ./tools/generate-docs-nm-property-infos.pl with python script
In order to have more structured settings in man page and make it more
manageable to generate the docbook, it is recommended to use python
script to replace `./tools/generate-docs-nm-property-infos.pl` (this
tool is used to parse the comment section starting with `---nmcli---`,
`---dbus---`, `---keyfile---`, `---ifcfg-rh---`).

Signed-off-by: Wen Liang <liangwen12year@gmail.com>

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/824
2021-05-05 15:28:17 +02:00
Thomas Haller 73b9883c6f
build: don't link libnm/libnm-core against libuuid
We use util-linux's libuuid for handling UUIDs. But UUIDs are
really a trivial thing, at least the portion that we use.

Reimplement the parse/unparse/generate_random() methods and drop
the dependency. Note that no other libraries from our dependency chain
was dragging in libuuid, so thereby we really get rid of the dependency.

We still require libuuid for building, because it is used by an example
program. Maybe that should be changed, to avoid the build dependency.
But that can be done at a later time.
2021-05-04 15:51:44 +02:00
Thomas Haller 50add1c75a
glib-aux: add "nm-uuid.[ch]" sources 2021-05-04 15:51:41 +02:00
Thomas Haller e706769ee7
build: fix build dependency for systemd's fundamental for "config-extra.h"
$ make src/libnm-systemd-shared/src/fundamental/libnm_systemd_shared_la-string-util-fundamental.lo
    CC       src/libnm-systemd-shared/src/fundamental/libnm_systemd_shared_la-string-util-fundamental.lo
  In file included from ./src/libnm-glib-aux/nm-default-glib.h:11,
                   from ./src/libnm-systemd-shared/nm-default-systemd-shared.h:11,
                   from ./src/libnm-systemd-shared/sd-adapt-shared/nm-sd-adapt-shared.h:9,
                   from src/libnm-systemd-shared/src/fundamental/string-util-fundamental.c:3:
  ./src/libnm-std-aux/nm-default-std.h:32:10: fatal error: config-extra.h: No such file or directory
     32 | #include "config-extra.h"
        |          ^~~~~~~~~~~~~~~~
  compilation terminated.
  make: *** [Makefile:15660: src/libnm-systemd-shared/src/fundamental/libnm_systemd_shared_la-string-util-fundamental.lo] Error 1

Fixes: 2a88de2280 ('systemd: merge branch systemd into master')
2021-04-12 15:47:34 +02:00
orbea 3affccf29b
tests: fix undefined references to pthread
When building NetworkManger with --enable-tests or using 'make check'
and slibtool the build will fail in many places with undefined references
to pthreads.

This is because -lpthread is never explicitly added to the appropriate
variable, src_core_libNetworkManagerTest_la_LIBADD. When analyzing the
build log with GNU libtool it can be seen that it silently adds -pthread
on its own which hides the issue.

To solve this ax_pthread.m4 from the autoconf-archives project can be
used which provides the $(PTHREAD_LIBS) linker flag.

Source: https://github.com/autoconf-archive/autoconf-archive/blob/master/m4/ax_pthread.m4
See-also: https://www.gnu.org/software/autoconf-archive/ax_pthread.html

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/804
2021-04-07 08:29:50 +02:00
Thomas Haller 2a88de2280
systemd: merge branch systemd into master
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/808
2021-04-06 19:48:51 +02:00
orbea 68913466af
tools: use libtool --mode=execute
Better fix for https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/732

The original issue was that when compiling NetworkManager with slibtool
the create-exports-NetworkManager.sh script gave the NetworkManager-all-sym
slibtool wrapper script to nm(1) instead of the actual binary. This is
because slibtool and GNU libtool do not place the compiled programs in
the same location. The original fix was to test both locations, but this
is bit of a hack especially since the build system should not be using the
.libs directory directly. However with $(LIBTOOL) --mode=execute this is
not a problem since both implementations can figure out where the correct
binary is.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/805
2021-04-04 09:27:35 +02:00
Thomas Haller 24bcb8e3e4
systemd: fix borked merge
Fixes: 5f7f81a6a0 ('systemd: merge branch systemd into master')
2021-04-01 21:05:53 +02:00
Thomas Haller 5d6532f2d7
ifcfg-rh: always honor "$VLAN_ID" in ifcfg files
initscripts don't support "$VLAN_ID". They actually support "$VID",
which NetworkManager doesn't.

"$VLAN_ID" was introduced by commit 10b32be37b ('ifcfg-rh: various VLAN
cleanups'). It has a comment about "backward compatibility" for the case
where the reader would ignore "$VLAN_ID" if "$DEVICE"'s name contains
a suffix that is parsable as VLAN ID.

That is wrong. If a new feature gets introduce (like NetworkManager
supporting "$VLAN_ID"), then there is no way that an older version of the
tool -- which doesn't know the new feature yet (initscripts) -- supports it.
This is not what backward compatibility means. Backward compatibility
means that if a user has an old ifcfg-file without "$VLAN_ID", then we
continue parsing it as before.

Consider, when a user (or NetworkManager) writes a configuration

  DEVICE=vlan9
  PHYSDEV=eth0
  VLAN_ID=10

then it makes no sense to ignore VLAN_ID=10 and use "9" instead.
Otherwise the user (or NetworkManager) should not have written the
file this way.

Also, NetworkManager profiles support "connection.interface-name=vlan9"
together with "vlan.id=10". Such a configuration is valid and must be
expressible in ifcfg-rh format. The ifcfg-rh writer code did not somehow
restrict the setting of "$VLAN_ID" to account for this odd behavior. Whenever
NetworkManager in the past wrote VLAN_ID variable to file, it really meant
it.

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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/794
2021-03-29 21:12:47 +02:00
Beniamino Galvani 7adac95fc8 build: dist other missing meson.build files
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/690

Fixes: 54976f23cd ('build: move "clients/common/" to "src/libnmc-{base,setting}/"')
2021-03-25 11:41:37 +01:00
Thomas Haller ddc922bbdf
build: dist "src/libnm-systemd-shared/meson.build"
Fixes: 39225258d6 ('build: move "shared/systemd" to "src/libnm-systemd-shared"')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/690
2021-03-25 11:19:14 +01:00
Thomas Haller 5852cd2252
base: add "nm-net-aux.c" helper 2021-03-23 14:19:37 +01:00
Thomas Haller fd17c874eb
build: fix race due to missing dependency for libnm-core-null to "config-extra.h"
In file included from ./src/libnm-glib-aux/nm-default-glib.h:11:0,
                   from ./src/libnm-glib-aux/nm-default-glib-i18n-lib.h:13,
                   from src/libnm-log-null/nm-logging-null.c:6:
  ./src/libnm-std-aux/nm-default-std.h:32:26: fatal error: config-extra.h: No such file or directory
   #include "config-extra.h"
                            ^
  compilation terminated.
  make[1]: *** [src/libnm-log-null/src_libnm_log_null_libnm_log_null_la-nm-logging-null.lo] Error 1
2021-03-22 17:35:35 +01: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 60c90f4410
build: fix dependencies for building src/libnm-platform/wifi/*
CC       src/libnm-platform/wifi/libnm_platform_la-nm-wifi-utils-wext.lo
    In file included from ../src/libnm-platform/wifi/nm-wifi-utils-wext.c:7:
    In file included from ../src/libnm-glib-aux/nm-default-glib-i18n-lib.h:13:
    In file included from ../src/libnm-glib-aux/nm-default-glib.h:11:
    ../src/libnm-std-aux/nm-default-std.h:30:10: fatal error: config-extra.h file not found
    #include "config-extra.h"
             ^~~~~~~~~~~~~~~~
      ...
      GEN      config-extra.h
2021-03-15 17:10:57 +01:00
Thomas Haller e643703418
tests/client: run "test-client.py" also for meson 2021-03-15 17:10:56 +01:00
Thomas Haller 019bc3233a
client/tests: move "clients/tests/test-client.py" to "src/tests/client/"
Note that "test-client.py" currently only tests nmcli. But what it does
is to spawn test-networkmanager-service.py and run nmcli against it.

As such, it could really be used to test any NetworkManager client
against the stub service. Hence this test is not under
"src/nmcli/tests", but under "src/tests/client/" where it is more
general.
2021-03-15 17:10:55 +01:00
Thomas Haller d8dd6e94e6
tui: move from "clients/tui/" to "src/nmtui/" 2021-03-15 17:10:54 +01:00
Thomas Haller 61f99307c6
cli: move from "clients/cli/" to "src/nmcli/" 2021-03-15 17:10:54 +01:00
Thomas Haller 71f0511b1f
cloud-setup: move from "clients/cloud-setup/" to "src/nm-cloud-setup/" 2021-03-15 17:10:53 +01:00
Thomas Haller 9fc1bf90fa
initrd: move "src/core/initrd/" to "src/nm-initrd-generator/" 2021-03-15 17:10:53 +01:00
Thomas Haller 0033da8f61
config: add "nm-base/nm-config-base.h"
Note that we take defines from "src/core/nm-config.h" which
are GPL-2.0-or-later licensed.

libnm-base we want to include in other LGPL licensed sources,
we it must also be LGPL.

"relicense" the code that I take. I don't think it's a problem, because:

- these are only plain defines. To which extend is that even
  copyrightable?

- as far as I see, all the code was contributed by people who agreed
  to such relicensing. See RELICENSE.md file.
2021-03-15 17:10:52 +01:00
Thomas Haller 10b4d10c9b
build: fix setting CFLAGS when building "libnm-vpn-plugin-utils-test.la"
Internally we set CPPFLAGS, because setting CFLAGS disables inheriting AM_CFLAGS --
which we use for example for "-Wno-pragmas" from the configure script.
2021-03-15 17:10:52 +01:00
Thomas Haller 604b1d0331
platform: move more platform code to src/libnm-platform/ 2021-03-05 11:27:16 +01:00
Thomas Haller 3b6e57961d
platform: move "platform/{wifi,wpan}/" to "src/libnm-platform/" 2021-03-05 11:27:15 +01:00
Thomas Haller f435454615
platform: move "linux/nl802154.h" to "src/linux-headers/" 2021-03-05 11:27:15 +01:00
Thomas Haller 398b509931
base: move "libnm-core-intern/nm-core-types-internal.h" to libnm-base
"libnm-platform" has no dependency on libnm-core. To have the symbols
accessible, move them to libnm-base.
2021-03-05 11:27:02 +01:00
Thomas Haller 7767aaaee2
build: move "clients/nm-online.c" to "src/nm-online/" 2021-03-02 08:38:26 +01:00
Thomas Haller 7e81f4478d
build: move "clients/tui/newt/" to "src/libnmt-newt/" 2021-03-02 08:38:26 +01:00
Thomas Haller 54976f23cd
build: move "clients/common/" to "src/libnmc-{base,setting}/" 2021-03-02 08:38:25 +01:00
Thomas Haller 107861ff57
build: move "dispatcher/" to "src/nm-dispatcher/" 2021-02-28 18:56:09 +01:00
Thomas Haller 7b48d6bd31
build: remove shared/ directory 2021-02-24 12:49:13 +01:00
Thomas Haller 635d84b896
build: remove "shared/" from include search path
There is nothing left there.
2021-02-24 12:49:06 +01:00
Thomas Haller d6681a0429
shared: move "nm-compat.[hc]" to "src/contrib/"
"nm-compat.h" is not intended to be used by NetworkManager itself.
Instead, it's intended to be copied into the source tree of VPN plugins,
as adapter for different libnm versions.

Move it to "src/contrib/".
2021-02-24 12:49:01 +01:00
Thomas Haller 63622a147a
shared: split and move "nm-vpn-plugin-macros.h"
This file was intended to be used by VPN plugins (by copying it).
However, it was also used internally.

Split the file, and move the internally used part to libnm-glib-aux.
The part that is only there for out of tree users, moves to
"nm-compat.h".
2021-02-24 12:48:56 +01:00
Thomas Haller ad91579bb8
shared: move "nm-vpn-editor-plugin-call.h" to "src/contrib/" 2021-02-24 12:48:51 +01:00
Thomas Haller fa288f65f6
shared: move "nm-vpn-plugin-utils.c" to "src/contrib/"
This file is not actually to be used by NetworkManager itself.
Instead, every (glib based) VPN plugin will want something like this,
hence we have a copy here.

Move it to a new directory "src/contrib/".
2021-02-24 12:48:46 +01:00
Thomas Haller a03a03fbe9
libnm/tests: add static helper library "src/libnm-client-test/"
This helper code is already used by several of our unit tests.
Compile it as a separate library.

Previously, the source code lingered unmotivated under "shared/",
which is confusing.
2021-02-24 12:48:42 +01:00
Thomas Haller 9bba4871f3
build: move "libnm/" to "src/" and split it
Like with "libnm-core/", split "libnm/" into different directories for
the public headers, for the implementation and for the helper "aux"
library.
2021-02-24 12:48:37 +01:00
Thomas Haller b53c50e778
shared: move "nm-test-utils.h" to "src/libnm-glib-aux/"
"nm-test-utils.h" is a header-only, helper library for our unit tests.
It was somewhat unmotivated in "shared/nm-utils", because all tests use
it, but it was not part of a "module".

Move it to "src/libnm-glib-aux/". It fits there very well. They both
have (only) a dependency on glib.
2021-02-24 12:48:33 +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 9dc84b32b0
build: move "shared/nm-{glib-aux,log-null,log-core}" to "src/libnm-{glib-aux,log-null,log-core}" 2021-02-24 12:48:20 +01:00
Thomas Haller 4d12a6ac3d
build: move "shared/nm-{base,udev-aux}" to "src/libnm-{base,udev-aux}" 2021-02-24 12:48:19 +01:00
Thomas Haller 2439374457
build: move "shared/nm-platform" to "src/libnm-platform" 2021-02-24 12:48:17 +01:00