Commit graph

30481 commits

Author SHA1 Message Date
Thomas Haller
cd09f3d364
dhcp: fix logging of event in _nm_dhcp_client_notify() 2022-05-31 18:32:34 +02:00
Thomas Haller
d60ba91c87
core: move NM_ACD_TIMEOUT_MAX_MSEC define to "nm-l3cfg.h" header for reuse 2022-05-31 18:32:34 +02:00
Thomas Haller
f9d601ef06
device: initialize full v4/v6 union of NMDhcpClientConfig in _dev_ipdhcpx_start()
I think the previous was technically correct in any case too.
Still change it, because I feel with union and struct initialization,
we should always explicitly pick one union member that we fully
initialize.
2022-05-31 18:32:34 +02:00
Thomas Haller
eed9acc191
glib-aux: add assertions to nm_strvarray_*() helpers 2022-05-31 18:32:33 +02:00
Thomas Haller
08c010cb2b
glib-aux: add nm_g_array_index_p() helper and cleanup nm_g_array*() helpers 2022-05-31 18:32:33 +02:00
Thomas Haller
d81a9aec31
glib-aux/logging: add LOGD_DHCP_af() helper macro 2022-05-31 18:32:33 +02:00
Thomas Haller
65992349d0
contrib: install black/clang-format in nm-in-container.sh
It's just convenient to have some tools around, not only
for testing, but also for (some limited) development.

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

Add a script to do this.

The script is supposed to be idempotent and do nothing, unless
necessary. By default it also only prints what it would do.
2022-05-31 18:04:03 +02:00
Thomas Haller
b9af281ac0
tools: merge branch 'gfm:generate-docs-nm-settings-docs-gir-preserve-newlines'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1246
2022-05-31 13:29:24 +02:00
Igor Ponomarev
f00e90923c
tools: Use ElementTree to write XML in generate-docs-nm-settings-docs-gir.py
Instead of manually writting XML line by line.
Quoting is automatic.
Makes it much easier to modify. (just add new elements)

Generated XML not indented at the moment.
2022-05-31 13:28:59 +02:00
Igor Ponomarev
a2298d31c0
tools: Modernize generate-docs-nm-settings-docs-gir.py to 2022 standards
* Create main() function and put its execution under
  __name__ == '__main__' guard.
* Only one module import per line
* Use required=True to check if necessary arguments have
  been passed.
* Remove usage() as ArgumentParser handles that already
2022-05-31 13:28:51 +02:00
Thomas Haller
8df3cb1355
core: fix unused variable in _write_hostname_on_idle_cb()
Fixes: 4dc3f3da17 ('core/hostname: avoid blocking calls in NMHostnameManager setting static hostname')
2022-05-30 18:46:40 +02:00
Thomas Haller
9c07f29e27
gitlab-ci: add f37 and Ubuntu 22.04 containers 2022-05-30 18:01:18 +02:00
Thomas Haller
cbad660225
core: merge branch 'th/save-hostname-fixes'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1238
2022-05-30 16:57:10 +02:00
Thomas Haller
4dc3f3da17
core/hostname: avoid blocking calls in NMHostnameManager setting static hostname
Of course, blocking and synchronous code is much simpler. But it's also
fundamentally wrong to block while we talk to systemd-hostnamed.

Refactor to use async operations.
2022-05-30 16:56:38 +02:00
Thomas Haller
c9fcd30758
core: minor cleanup in hostname code 2022-05-30 16:56:38 +02:00
Thomas Haller
442b6630de
core: fix unsetting static hostname via empty argument
This was broken for a very long time, since 6a60dc2fe9 ('settings:
validate hostnames from D-Bus (bgo #711179)') from October 2013.

But there is really no reason to use this API, as we have
systemd-hostnamed.

https://bugzilla.redhat.com/show_bug.cgi?id=2090946
2022-05-30 16:56:38 +02:00
Ana Cabral
41b5831331 rpm: make the ifcfg informational message available from RHEL 9 2022-05-30 10:11:00 +02:00
Yuri Chornoivan
9d8a2d1ba0
po: update Ukrainian (uk) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1244
2022-05-30 08:30:16 +02:00
Ana Cabral
ddf300853e Merge branch 'ac/spec' into 'main'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1236
2022-05-27 11:07:44 -03:00
Ana Cabral
96d7362613 rpm: include a warning message for network configuration on /etc/sysconfig/network-scripts directory
NetworkManager now does not support network configuration through
ifcfg files by default anymore, it is provided in a separated
package:
https://fedoramagazine.org/converting-networkmanager-from-ifcfg-to-keyfiles/

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

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

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

Fixes: 50a6627fd7 ('rpm: split ifcfg-rh settings plugin into a separate package')
2022-05-27 14:04:20 +00:00
Thomas Haller
bc4d317302
examples: reword comments in "30-anon.conf" snippet 2022-05-27 15:05:03 +02:00
Adrian Freihofer
7e690ad496
mailmap: update to add Adrian
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1237
2022-05-27 12:42:56 +02:00
Thomas Haller
5d095062e6
NEWS: update 2022-05-27 08:53:55 +02:00
Alex Henrie
0004a408ae
device: introduce ipv6.mtu property
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1003

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1231
2022-05-27 08:51:44 +02:00
Thomas Haller
850d6550fc
merge branch 'afreof:af/ip4-link-local'
Related: https://mail.gnome.org/archives/networkmanager-list/2021-April/msg00015.html
Related: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/966

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1187
2022-05-27 08:31:52 +02:00
Adrian Freihofer
cdaa99cd35
ifcfg-rh: add support for ipv4.link-local 2022-05-27 08:24:40 +02:00
Adrian Freihofer
cbde63a493
settings: add ipv4.link-local flag
Introduction of a new setting ipv4.link-local, which enables
link-local IP addresses concurrently with other IP address assignment
implementations such as dhcp or manually.
No way is implemented to obtain a link-local address as a fallback when
dhcp does not respond (as dhcpd does, for example). This could be be
added later.

To maintain backward compatibility with ipv4.method ipv4.link-local has
lower priority than ipv4.method. This results in:
* method=link-local overrules link-local=disabled
* method=disabled overrules link-local=enabled

Furthermore, link-local=auto means that method defines whether
link-local is enabled or disabled:
* method=link-local --> link-local=enabled
* else --> link-local=disabled

The upside is, that this implementation requires no normalization.
Normalization is confusing to implement, because to get it really
right, we probably should support normalizing link-local based on
method, but also vice versa. And since the method affects how other
properties validate/normalize, it's hard to normalize that one, so that
the result makes sense. Normalization is also often not great to the
user, because it basically means to modify the profile based on other
settings.

The downside is that the auto flag becomes API and exists because
we need backward compatibility with ipv4.method.
We would never add this flag, if we would redesign "ipv4.method"
(by replacing by per-method-specific settings).

Defining a default setting for ipv4.link-local in the global
configuration is also supported.
The default setting for the new property can be "default", since old
users upgrading to a new version that supports ipv4.link-local will not
have configured the global default in NetworkManager.conf. Therefore,
they will always use the expected "auto" default unless they change
their configuration.

Co-Authored-By: Thomas Haller <thaller@redhat.com>
2022-05-27 08:24:28 +02:00
Alex Henrie
7d8b749293
libnm: allow manually specified IP addresses to have prefix length 0
In IPv4, /0 prevents the creation of a device route, making it
effectively the same as /32. However, in IPv6, /0 makes the device route
an all-encompassing default route. This allows, for example, an 'fe80::'
link-local address to be used to communicate with any public or private
address on the local network without any additional configuration.

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

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1232
2022-05-26 19:08:28 +02:00
bluikko
2a02896e2a
nm-settings-ifcfg-rh: fix typo
Fix one occurrence of "ifcfg-rh" being incorrectly typed
as "fcfg-rh" with a missing letter "i".

https://github.com/NetworkManager/NetworkManager/pull/364
2022-05-26 11:41:31 +02:00
Beniamino Galvani
e5868f21ec dns: detect more quickly when systemd-resolved can't be D-Bus activated
Pass a callback and a 4-second timeout to the "StartServiceByName()"
D-Bus call, so that we can detect any failure immediately.

In this way when systemd-resolved fails to start at boot (for example
because it's masked), nm-online doesn't need to wait those additional
4 seconds due to the fixed timeout source.

Fixes-test: @nm_online_wait_for_delayed_device

https://bugzilla.redhat.com/show_bug.cgi?id=2083332
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1233
2022-05-25 16:03:12 +02:00
Fernando Fernandez Mancera
bc6e28e585 ovsdb: do not set the device as DEACTIVATING if it is DISCONNECTED
During the deactivation of ovs interfaces, ovsdb receives the command to
remove the interface but for OVS system ports the device won't
disappear.

When reconnecting, ovsdb will update first the status and it will notice
that the OVS system interface was removed and it will set the status as
DEACTIVATING. This is incorrect if the status is already DEACTIVATING,
DISCONNECTED, UNMANAGED or UNAVAILABLE because it will block the
activation of the interface.

https://bugzilla.redhat.com/show_bug.cgi?id=2080236
2022-05-25 15:51:43 +02:00
Thomas Haller
ab1fa010a3
platform: drop redundant check for plen in nm_platform_ip4_address_generate_device_route() 2022-05-24 10:53:59 +02:00
Thomas Haller
0634dfd510
platform: avoid struct alignment issue for NMPlatformIP4Address
On m68k we get a static assertion, that NMPlatformIP4Address.address
is not at the same offset as NMPlatformIPAddress.address_ptr.

On most architectures, the bitfields fits in a gap between the fields,
but not on m68k, where integers are 2-byte aligned.
2022-05-19 16:11:34 +02:00
Thomas Haller
835554a4db
glib-aux/tests: fix and extend static assertions for NMIPAddr alignment
On m68k, integers are 2-byte aligned. Hence the assertion was wrong.

What we really want to check, is that NMIPAddr has not a smaller
alignment than in_addr_t and similar.

While at it, also assert the alignment for NMEtherAddr.
2022-05-19 16:08:01 +02:00
Thomas Haller
705e776776
glib-aux: fix static assertion for alignment of NMIPAddr for m68k
On m68k, 32-bit integers are 2-byte aligned, causing the assertion to fail.
Relax the check, it's good enough still.
2022-05-19 13:15:04 +02:00
Ana Cabral
b5829c9ac1 release: bump version to 1.39.5 (development) 2022-05-19 11:17:27 +02:00
Ana Cabral
d5b76a0a14 NEWS: update 2022-05-19 09:21:45 +02:00
Thomas Haller
fd9b7decb0
c-rbtree: re-import git-subtree for 'src/c-rbtree'
git subtree pull --prefix src/c-rbtree git@github.com:c-util/c-rbtree.git main --squash
2022-05-18 12:03:00 +02:00
Thomas Haller
4a4dbf6417 Squashed 'src/c-rbtree/' changes from 9b9713aeb9ec..eb778d39694a
eb778d39694a c-rbtree: fix alignment assertion on m64k

git-subtree-dir: src/c-rbtree
git-subtree-split: eb778d39694a0f3389f2438bbc45fb21685a047d
2022-05-18 12:02:19 +02:00
David Rheinsberg
78831d127f
c-rbtree: fix alignment assertion on m64k
We want to assert that our alignment-guarantees do not exceed the
guarantees of the system-linker or system-allocator on the target
platform. Hence, we check against max_align_t. This is a lower bound,
but not the exact check we actually want. And as it turns out, on m64k
it is too low. Add a static check against 4-byte alignment for m64k as
a workaround.

Reported-by: Michael Biebl
Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>

https://github.com/c-util/c-rbtree/issues/9
eb778d3969
2022-05-18 11:59:06 +02:00
Beniamino Galvani
9bc7278da3 device: don't require a hardware address for DHCPv6
DHCPv4 requires a hardware address, while DHCPv6 does not.

Anyway, the DHCP manager already checks that an address is available
when needed, so drop the check here.

Fixes: 58287cbcc0 ('core: rework IP configuration in NetworkManager using layer 3 configuration')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1228
2022-05-17 18:14:11 +02:00
Thomas Haller
3e5f0a0fa2
libnm/trivial: adjust code comment
clang-format likes to indent the comment, at the location where it was.
Move it.
2022-05-17 13:10:41 +02:00
Thomas Haller
76a0696882
dhcp: merge branch 'th/dhcp-cleanup-1'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1219
2022-05-16 21:45:09 +02:00
Thomas Haller
7f943f5fa6
dhcp: merge nm_dhcp_client_start_ip4() and nm_dhcp_client_start_ip6() implementations
As almost always, there is a point in keeping IPv4 and IPv6 implementations
similar. Behave different where there is an actual difference, at the bottom
of the stack.
2022-05-16 16:37:45 +02:00
Thomas Haller
2b8aeba06d
dhcp: move code in "nm-dhcp-client.c" (2) 2022-05-16 16:37:44 +02:00
Thomas Haller
ea13cff76c
dhcp: assert that resources are freed in NMDhcpClient.dispose() 2022-05-16 16:37:44 +02:00