Commit graph

795 commits

Author SHA1 Message Date
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
Thomas Haller 39225258d6
build: move "shared/systemd" to "src/libnm-systemd-shared" 2021-02-24 12:48:16 +01:00