Commit Graph

26105 Commits

Author SHA1 Message Date
Thomas Haller
ee9e1ceefc shared: avoid allocating temporary buffer for nm_utils_named_values_from_strdict()
Iterating hash tables gives an undefined order. Often we want to have
a stable order, for example when printing the content of a hash or
when converting it to a "a{sv}" variant.

How to achieve that best? I think we should only iterate the hash once,
and not require additional lookups. nm_utils_named_values_from_strdict()
achieves that by returning the key and the value together. Also, often
we only need the list for a short time, so we can avoid heap allocating
the list, if it is short enough. This works by allowing the caller to
provide a pre-allocated buffer (usually on the stack) and only as fallback
allocate a new list.
2020-06-19 17:07:25 +02:00
Thomas Haller
4d6b96b48f shared: make NMUtilsNamedValue.value_ptr non const
If the value pointer is const, it is commonly inconvenient and requires
a cast. Requiring casts on a common base does not increase type safety,
but is annoying.
2020-06-19 17:07:19 +02:00
Thomas Haller
d64eb7201e build: merge branch 'ss/python-improvements'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/540
2020-06-19 12:59:13 +02:00
Thomas Haller
8c3ee4e857 gitlab-ci: enable python black check in gitlab-ci 2020-06-19 12:58:52 +02:00
Thomas Haller
70f3ad6785 gitlab-ci: run checkpatch test against fedora:32 target 2020-06-19 12:47:15 +02:00
Thomas Haller
c537852231 build: optionally skip python black check by setting NMTST_SKIP_PYTHON_BLACK=1 2020-06-19 12:46:20 +02:00
Sayed Shah
9f77d26ad0 build: create check for python black
If python black is install then it would check the
formating of all of the python files and test the for it.
Otherwise, it would just simply ignore the python black
if python black is not installed.
2020-06-19 12:34:40 +02:00
Yuri Chornoivan
38d291f229 po: update Ukrainian (uk) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/543
2020-06-19 10:17:11 +02:00
Beniamino Galvani
88e8f2829e ifcfg-rh: fix memory leak reading tc filters
Fixes: 902bbfdb18 ('ifcfg-rh: add tc support')
2020-06-18 17:45:45 +02:00
Beniamino Galvani
e12d32bf56 supplicant: fix memory leak
Fixes: b83f07916a ('supplicant: large rework of wpa_supplicant handling')
2020-06-18 17:45:43 +02:00
Beniamino Galvani
92208ebd1f libnm-core: fix memory leak in match setting
Fixes: 808e837149 ('all: add "path" property to the match setting')
2020-06-18 14:26:00 +02:00
Beniamino Galvani
3ecfd13ded cli: fix reference count handling in hotspot error path
The connection is automatically unreferenced when the function
returns.

Fixes: 9c5ea0917d ('devices: reuse the hotspot connection if we find appropriate one'):
2020-06-18 14:25:58 +02:00
Antonio Cardace
3e21357888 platform: merge branch 'ac/local_route'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/526
2020-06-16 10:46:25 +02:00
Antonio Cardace
7781f78435 setting-ip-config: validate route attributes in verify()
It's better to verify these route attributes so that the user can be
notified early if something is not supported or invalid.

The downside is that some incorrect profiles (with invalid route attributes)
that previously would work since this commit will not anymore as
the incorrect bits don't get ignored but rejected instead.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/407
https://bugzilla.redhat.com/show_bug.cgi?id=1821787
2020-06-16 10:01:26 +02:00
Antonio Cardace
5d0d13f570 platform: add support for local routes
Also update unit tests.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/407
https://bugzilla.redhat.com/show_bug.cgi?id=1821787
2020-06-16 10:01:22 +02:00
Thomas Haller
56b15ca0b6 build: fix detecting use of pregenerated docs in "configure.ac"
Without it, we fail to use the pregenerated gtk-doc files.

Fixes: 8a78b15c9b ('docs: merge branch 'th/nm-settings-manual'')
2020-06-16 00:04:02 +02:00
Thomas Haller
b378524507 release: bump version to 1.27.0 (development) 2020-06-15 17:13:38 +02:00
Thomas Haller
d7ff630425 release: bump version to 1.25.90 (1.26-rc1) 2020-06-15 17:12:41 +02:00
Thomas Haller
f9e14805e6 firewalld: allow access to SSH in "nm-shared" firewalld zone
SSH seems one of the few really trusted processes. It is even
allowed for the public zone. Allow it in "nm-shared" zone too.
2020-06-15 16:49:14 +02:00
Sayed Shah
be822b52e6 all: reformat python files with python black
Part of !537.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/537
2020-06-15 16:40:38 +02:00
Beniamino Galvani
b6febb0fd0 NEWS: update 2020-06-15 16:02:53 +02:00
Thomas Haller
edfe9fa9a2 glib: always re-implement g_steal_pointer()
g_steal_pointer() is marked as GLIB_AVAILABLE_STATIC_INLINE_IN_2_44,
that means we get a deprecated warning. Avoid that. We anyway
re-implement the macro so that we can use it before 2.44 and so
that it always does the typeof() cast.
2020-06-15 15:56:30 +02:00
Thomas Haller
c56c6e8faa build: ensure man directory exists for "man/nm-settings-docs-*.xml"
It would seem that the proper dependency is "man/.dirstamp". But that just
doesn't work. Use "man/common.ent" instead. If you figure out how to
convince autotools to make .dirstamp working, send a patch.
2020-06-15 15:34:16 +02:00
Thomas Haller
84a68972df lldp: merge branch 'th/lldp-mud-url'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/539
2020-06-15 15:05:31 +02:00
Thomas Haller
d0ce1eb351 lldp: omit empty "object-id" for LLDP management address
It seems common that the object-id might be empty. Omit the
field in that case.
2020-06-15 15:05:25 +02:00
Thomas Haller
dc08b42f45 lldp: expose "mud-url" LLDP attribute for the MUD usage description
See-also: https://github.com/systemd/systemd/pull/15234
See-also: c4f8796bf8/tests/lldp_mudurl.pcap
2020-06-15 15:05:22 +02:00
Thomas Haller
4043f82790 lldp: cleanup converting binary LLDP fields to string
Introduce and use format_string() helper to convert the binary fields
to string.

This is like systemd's parse_string() function.
2020-06-15 15:02:53 +02:00
Beniamino Galvani
6e02622f57 Revert "manager: change autoconnect-slaves logic for already active slaves"
The commit breaks many nmstate CI tests. It also breaks the
autoconnect-slaves functionality: if the master gets reactivated and
the slave was active, the slave is not reconnected.

A different solution is needed for the original issue.

This reverts commit 024e983c8e.
2020-06-15 09:51:25 +02:00
Thomas Haller
ea3de038f6 NEWS: update 2020-06-15 08:26:59 +02:00
Thomas Haller
e233e51df3 ndisc: merge branch 'th/revert-ipv6-slaac-lifetimes' for nm-1-26
These two changes are from a draft. They may not yet be ready for now.
Revert the change for now.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/396#note_462123

(cherry picked from commit 3192f65d3b)
2020-06-15 08:02:42 +02:00
Thomas Haller
f244da8ddf NEWS: update
(cherry picked from commit 5409db9fbd)
2020-06-15 08:02:04 +02:00
Thomas Haller
0ba9aff4bc Revert "IPv6 SLAAC: Clamp received PIO and RIO Lifetime Values"
This reverts commit 0cbd9193cd.
This reverts commit a5290915d5.

(cherry picked from commit ad5fdd9d62)
2020-06-15 08:00:54 +02:00
Thomas Haller
8b7f0c4606 Revert "IPv6 SLAAC: Honor small PIO Valid Lifetimes"
This reverts commit 2da092b592.

(cherry picked from commit a88be01da2)
2020-06-15 07:59:50 +02:00
Thomas Haller
ecf32c2c8f systemd: merge branch systemd into master 2020-06-13 17:08:22 +02:00
Thomas Haller
bbf57b114e systemd: update code from upstream (2020-06-13)
This is a direct dump from systemd git.

======

SYSTEMD_DIR=../systemd
COMMIT=6d0f38017c7476883103080372505d4811112346

(
  cd "$SYSTEMD_DIR"
  git checkout "$COMMIT"
  git reset --hard
  git clean -fdx
)

git ls-files -z :/src/systemd/src/ \
                :/shared/systemd/src/ \
                :/shared/nm-std-aux/unaligned.h | \
  xargs -0 rm -f

nm_copy_sd_shared() {
    mkdir -p "./shared/systemd/$(dirname "$1")"
    cp "$SYSTEMD_DIR/$1" "./shared/systemd/$1"
}

nm_copy_sd_core() {
    mkdir -p "./src/systemd/$(dirname "$1")"
    cp "$SYSTEMD_DIR/$1" "./src/systemd/$1"
}

nm_copy_sd_stdaux() {
    mkdir -p "./shared/nm-std-aux/"
    cp "$SYSTEMD_DIR/$1" "./shared/nm-std-aux/${1##*/}"
}

nm_copy_sd_core "src/libsystemd-network/arp-util.c"
nm_copy_sd_core "src/libsystemd-network/arp-util.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-identifier.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-identifier.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-lease-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-network.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-option.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-packet.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-protocol.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-lease-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-network.c"
nm_copy_sd_core "src/libsystemd-network/dhcp6-option.c"
nm_copy_sd_core "src/libsystemd-network/dhcp6-protocol.h"
nm_copy_sd_core "src/libsystemd-network/lldp-internal.h"
nm_copy_sd_core "src/libsystemd-network/lldp-neighbor.c"
nm_copy_sd_core "src/libsystemd-network/lldp-neighbor.h"
nm_copy_sd_core "src/libsystemd-network/lldp-network.c"
nm_copy_sd_core "src/libsystemd-network/lldp-network.h"
nm_copy_sd_core "src/libsystemd-network/network-internal.c"
nm_copy_sd_core "src/libsystemd-network/network-internal.h"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp-client.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp-lease.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp6-client.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp6-lease.c"
nm_copy_sd_core "src/libsystemd-network/sd-ipv4acd.c"
nm_copy_sd_core "src/libsystemd-network/sd-ipv4ll.c"
nm_copy_sd_core "src/libsystemd-network/sd-lldp.c"
nm_copy_sd_core "src/libsystemd/sd-event/event-source.h"
nm_copy_sd_core "src/libsystemd/sd-event/event-util.c"
nm_copy_sd_core "src/libsystemd/sd-event/event-util.h"
nm_copy_sd_core "src/libsystemd/sd-event/sd-event.c"
nm_copy_sd_core "src/libsystemd/sd-id128/id128-util.c"
nm_copy_sd_core "src/libsystemd/sd-id128/id128-util.h"
nm_copy_sd_core "src/libsystemd/sd-id128/sd-id128.c"
nm_copy_sd_core "src/systemd/_sd-common.h"
nm_copy_sd_core "src/systemd/sd-dhcp-client.h"
nm_copy_sd_core "src/systemd/sd-dhcp-lease.h"
nm_copy_sd_core "src/systemd/sd-dhcp-option.h"
nm_copy_sd_core "src/systemd/sd-dhcp6-client.h"
nm_copy_sd_core "src/systemd/sd-dhcp6-lease.h"
nm_copy_sd_core "src/systemd/sd-dhcp6-option.h"
nm_copy_sd_core "src/systemd/sd-event.h"
nm_copy_sd_core "src/systemd/sd-id128.h"
nm_copy_sd_core "src/systemd/sd-ipv4acd.h"
nm_copy_sd_core "src/systemd/sd-ipv4ll.h"
nm_copy_sd_core "src/systemd/sd-lldp.h"
nm_copy_sd_core "src/systemd/sd-ndisc.h"
nm_copy_sd_shared "src/basic/alloc-util.c"
nm_copy_sd_shared "src/basic/alloc-util.h"
nm_copy_sd_shared "src/basic/async.h"
nm_copy_sd_shared "src/basic/cgroup-util.h"
nm_copy_sd_shared "src/basic/env-file.c"
nm_copy_sd_shared "src/basic/env-file.h"
nm_copy_sd_shared "src/basic/env-util.c"
nm_copy_sd_shared "src/basic/env-util.h"
nm_copy_sd_shared "src/basic/errno-util.h"
nm_copy_sd_shared "src/basic/escape.c"
nm_copy_sd_shared "src/basic/escape.h"
nm_copy_sd_shared "src/basic/ether-addr-util.c"
nm_copy_sd_shared "src/basic/ether-addr-util.h"
nm_copy_sd_shared "src/basic/extract-word.c"
nm_copy_sd_shared "src/basic/extract-word.h"
nm_copy_sd_shared "src/basic/fd-util.c"
nm_copy_sd_shared "src/basic/fd-util.h"
nm_copy_sd_shared "src/basic/fileio.c"
nm_copy_sd_shared "src/basic/fileio.h"
nm_copy_sd_shared "src/basic/format-util.c"
nm_copy_sd_shared "src/basic/format-util.h"
nm_copy_sd_shared "src/basic/fs-util.c"
nm_copy_sd_shared "src/basic/fs-util.h"
nm_copy_sd_shared "src/basic/hash-funcs.c"
nm_copy_sd_shared "src/basic/hash-funcs.h"
nm_copy_sd_shared "src/basic/hashmap.c"
nm_copy_sd_shared "src/basic/hashmap.h"
nm_copy_sd_shared "src/basic/hexdecoct.c"
nm_copy_sd_shared "src/basic/hexdecoct.h"
nm_copy_sd_shared "src/basic/hostname-util.c"
nm_copy_sd_shared "src/basic/hostname-util.h"
nm_copy_sd_shared "src/basic/in-addr-util.c"
nm_copy_sd_shared "src/basic/in-addr-util.h"
nm_copy_sd_shared "src/basic/io-util.c"
nm_copy_sd_shared "src/basic/io-util.h"
nm_copy_sd_shared "src/basic/list.h"
nm_copy_sd_shared "src/basic/log.h"
nm_copy_sd_shared "src/basic/macro.h"
nm_copy_sd_shared "src/basic/memory-util.c"
nm_copy_sd_shared "src/basic/memory-util.h"
nm_copy_sd_shared "src/basic/mempool.c"
nm_copy_sd_shared "src/basic/mempool.h"
nm_copy_sd_shared "src/basic/missing_fcntl.h"
nm_copy_sd_shared "src/basic/missing_random.h"
nm_copy_sd_shared "src/basic/missing_socket.h"
nm_copy_sd_shared "src/basic/missing_stat.h"
nm_copy_sd_shared "src/basic/missing_syscall.h"
nm_copy_sd_shared "src/basic/missing_type.h"
nm_copy_sd_shared "src/basic/parse-util.c"
nm_copy_sd_shared "src/basic/parse-util.h"
nm_copy_sd_shared "src/basic/path-util.c"
nm_copy_sd_shared "src/basic/path-util.h"
nm_copy_sd_shared "src/basic/prioq.c"
nm_copy_sd_shared "src/basic/prioq.h"
nm_copy_sd_shared "src/basic/process-util.c"
nm_copy_sd_shared "src/basic/process-util.h"
nm_copy_sd_shared "src/basic/random-util.c"
nm_copy_sd_shared "src/basic/random-util.h"
nm_copy_sd_shared "src/basic/set.h"
nm_copy_sd_shared "src/basic/signal-util.c"
nm_copy_sd_shared "src/basic/signal-util.h"
nm_copy_sd_shared "src/basic/siphash24.h"
nm_copy_sd_shared "src/basic/socket-util.c"
nm_copy_sd_shared "src/basic/socket-util.h"
nm_copy_sd_shared "src/basic/sort-util.h"
nm_copy_sd_shared "src/basic/sparse-endian.h"
nm_copy_sd_shared "src/basic/stat-util.c"
nm_copy_sd_shared "src/basic/stat-util.h"
nm_copy_sd_shared "src/basic/stdio-util.h"
nm_copy_sd_shared "src/basic/string-table.c"
nm_copy_sd_shared "src/basic/string-table.h"
nm_copy_sd_shared "src/basic/string-util.c"
nm_copy_sd_shared "src/basic/string-util.h"
nm_copy_sd_shared "src/basic/strv.c"
nm_copy_sd_shared "src/basic/strv.h"
nm_copy_sd_shared "src/basic/strxcpyx.c"
nm_copy_sd_shared "src/basic/strxcpyx.h"
nm_copy_sd_shared "src/basic/time-util.c"
nm_copy_sd_shared "src/basic/time-util.h"
nm_copy_sd_shared "src/basic/tmpfile-util.c"
nm_copy_sd_shared "src/basic/tmpfile-util.h"
nm_copy_sd_shared "src/basic/umask-util.h"
nm_copy_sd_shared "src/basic/user-util.h"
nm_copy_sd_shared "src/basic/utf8.c"
nm_copy_sd_shared "src/basic/utf8.h"
nm_copy_sd_shared "src/basic/util.c"
nm_copy_sd_shared "src/basic/util.h"
nm_copy_sd_shared "src/shared/dns-domain.c"
nm_copy_sd_shared "src/shared/dns-domain.h"
nm_copy_sd_shared "src/shared/web-util.c"
nm_copy_sd_shared "src/shared/web-util.h"
nm_copy_sd_stdaux "src/basic/unaligned.h"
2020-06-13 15:38:01 +02:00
Beniamino Galvani
707d7c9ef9 merge: branch 'bg/match-path-rh1673321'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/536
https://bugzilla.redhat.com/show_bug.cgi?id=1673321
2020-06-12 16:05:40 +02:00
Beniamino Galvani
d90c7b70f3 device: honor the match.path property 2020-06-12 16:04:06 +02:00
Beniamino Galvani
808e837149 all: add "path" property to the match setting
Add a new "path" property to the match setting, which can be used to
restrict a connection to devices with a given hardware path. The new
property is a list of patterns that are matched against the ID_PATH
udev property of devices.

ID_PATH represents the topological persistent path of a device and
typically contains a subsystem string (pci, usb, platform, etc.) and a
subsystem-specific identifier. Some examples of paths are:

 pci-0000:00:02.0
 pci-0000:00:14.0-usb-0:5:1.0
 platform-1c40000.ethernet

systemd-networkd also has a "Path=" option to match a device by udev
ID_PATH.
2020-06-12 16:04:06 +02:00
Beniamino Galvani
d13ca45ca2 all: add device.path property
Add a device property to expose its path as reported in the ID_PATH
udev property.
2020-06-12 16:04:06 +02:00
Beniamino Galvani
755e894b91 platform: add nm_platform_link_get_path()
Add a function to obtain the link path as exported by the ID_PATH udev
property.
2020-06-12 16:04:06 +02:00
Beniamino Galvani
3d9e2650c1 platform: rework nm_platform_link_get_unmanaged()
Split out the code to get udev properties. It will be reused in the next
commit.
2020-06-12 16:04:06 +02:00
Beniamino Galvani
2f21a52eeb platform: rework nm_platform_link_get_udi()
Implement the function directly in nm-platform.c without virtual
functions.
2020-06-12 16:04:05 +02:00
Beniamino Galvani
639f2e36b0 docs: fix build with meson
Fix the following build error with meson:

/usr/bin/python3 /home/bgalvani/work/NetworkManager/tools/generate-docs-nm-settings-docs-merge.py man/nm-settings-docs-nmcli.xml --only-from-first clients/cli/generate-docs-nm-settings-nmcli.xml libnm/nm-propery-infos-nmcli.xml libnm/nm-settings-docs-gir.xml
Traceback (most recent call last):
  File "/home/bgalvani/work/NetworkManager/tools/generate-docs-nm-settings-docs-merge.py", line 120, in <module>
    xml_roots = list([ET.parse(f).getroot() for f in gl_input_files])
  File "/home/bgalvani/work/NetworkManager/tools/generate-docs-nm-settings-docs-merge.py", line 120, in <listcomp>
    xml_roots = list([ET.parse(f).getroot() for f in gl_input_files])
  File "/usr/lib64/python3.8/xml/etree/ElementTree.py", line 1202, in parse
    tree.parse(source, parser)
  File "/usr/lib64/python3.8/xml/etree/ElementTree.py", line 584, in parse
    source = open(source, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '--only-from-first'

Fixes: 3c11116c48 ('docs: in "generate-docs-nm-settings-docs-merge.py" only take properties from first setting')
2020-06-12 16:01:45 +02:00
Thomas Haller
125cbf5737 docs: show aliases for settings in man nm-settings-nmcli 2020-06-12 14:01:26 +02:00
Thomas Haller
3347278799 docs: don't show properties in man nm-settings-nmcli as table 2020-06-12 13:05:53 +02:00
Thomas Haller
a1161781bd docs: drop "property aliases" section from man nmcli
The aliases are now shown in `man nm-settings-nmcli`. Also the list there
gets generated and isn't hardcoded.
2020-06-12 13:02:02 +02:00
Thomas Haller
efe0ccf04a docs: use describe_doc for "generate-docs-nm-settings-nmcli.c"
In practice, this is exactly the same, because also the describe_doc
is generated. However, in the future they might diverge.
2020-06-12 12:29:37 +02:00
Thomas Haller
a3b9b661d4 docs: add "Alias" column to man nm-settings-nmcli 2020-06-12 12:09:30 +02:00
Thomas Haller
3c11116c48 docs: in "generate-docs-nm-settings-docs-merge.py" only take properties from first setting
Especially for "nm-settings-docs-nmcli.xml", the first XML to merge is
"clients/cli/generate-docs-nm-settings-nmcli.xml". That file is
generated with the meta data from nmcli, and it contains all the
properties that are supported. Properties from other XML files,
that are passed as additional arguments should not be merged.

In most cases, there is no difference. It only matters for
"ipv6.dad-timeout" and "user.data". For example, "ipv6.dad-timeout"
is supported by GObject (part of "libnm/nm-settings-docs-gir.xml"),
but not by nmcli. Don't include it in the manual.

This also drops the now empty settings "dummy", "user", and "generic".
2020-06-12 10:26:27 +02:00
Yuri Chornoivan
c2d4e47f71 po: update Ukrainian (uk) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/538
2020-06-11 22:33:13 +02:00