Commit graph

30952 commits

Author SHA1 Message Date
Thomas Haller
fde772643c
libnm: merge branch 'th/libnm-doc-annotation-fixes'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1352
2022-09-02 19:04:05 +02:00
Thomas Haller
18eeb4bf6c
libnm: fix invalid doc annotations for missing end tag 2022-09-02 19:03:35 +02:00
Thomas Haller
2ccbf8af3b
libnm: style cleanups for property annotations
The parser will become stricter, and expect certain
things. The strictness should help, to avoid writing wrong annotations.

Adjust for that.
2022-09-02 19:03:35 +02:00
Thomas Haller
e70607aa55
libnm: avoid "tag:" text inside documentation
The parser is reworked, and this line could be wrongly parsed
because it starts with " *     value:" which could be misinterpreted
as a tag. It actually won't be parsed wrongly and is not parsed
wrongly now. Still, avoid this potential ambiguity by breaking
the line differently.
2022-09-02 19:02:57 +02:00
Thomas Haller
29dae2939a
libnm: drop invalid "---ifcfg-rh---" blocks 2022-09-02 19:02:25 +02:00
Thomas Haller
6d945b4fd3
libnm: fix documentation annotations for ifcfg-rh plugin 2022-09-02 19:02:24 +02:00
Lubomir Rintel
f3327835c1 team: restore port configuration after teamd respawn
If teamd crashes, we restore it. That's very nice, but if it really
crashed then it left ports attached and the slave connections are not
going to fail and the port configuration (e.g. priority or link watcher) in
teamd's memory will be gone.

This will restore the port configuration when the teamd connection is
re-established. This probably also fixes a race where a slave connection
would be enslaved (only possible externally and manually?) while we
didn't establish a connection to teamd yet. We'll just send the port
configuration in once're connected.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1361
2022-09-02 12:51:25 +02:00
Lubomir Rintel
38251ad59f team: trivial: use a variable instead of nm_device_get_ip_iface() calls
This reads a little better and performs marginally better.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1361
2022-09-02 12:51:09 +02:00
Vojtech Bubela
db88bc5090 ovs: merge branch 'add-ovs-option'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1322
2022-09-02 09:11:29 +00:00
Vojtech Bubela
5fde7814dc ovs: add ofport_request option to ovs interface
Add option to set ofport_request when configuring ovs interface. When
connection with ofport_request configured is activated ovsdb will first
try to activated on the port set by ofport_request.
2022-09-02 08:46:36 +00:00
Thomas Haller
39e8707f0d
version: reformat file for latest style
the .h.in file is not formatted by our nm-code-format.sh
file. It also contains .in template parameters that the
formatting would destroy.

Still, follow our current style and reformat the parts manually.
2022-09-01 16:33:39 +02:00
Thomas Haller
8ae132cc49
contrib: add "reset" command to "nm-in-container.sh"
It's between "stop" and "clean". It removes the container,
but keeps the container images. This is to fast restart without
rebuilding the container (image).
2022-09-01 16:33:39 +02:00
Lubomir Rintel
222bd85fdc nmcli: don't translate "%s"
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1354
2022-09-01 13:07:23 +02:00
Lubomir Rintel
b071041d17 manager: drop useless use of a format string
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1355
2022-09-01 13:05:57 +02:00
Vojtech Bubela
7dccb5f548
version: add 1.42 macros 2022-08-31 19:23:26 +02:00
Thomas Haller
424f09e43d
nmcli: merge branch 'th/nmcli-modify-uuid'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1349
2022-08-31 19:22:27 +02:00
Thomas Haller
ef712733aa
NEWS: update 2022-08-31 19:22:01 +02:00
Thomas Haller
130479c8b2
nmcli: allow setting the "connection.uuid" for new profiles
Because, why not?

The client side determines the UUID, so there is no security implication
by letting the nmcli user explicitly choose it.

  $ nmcli connection add type ethernet con-name x connection.uuid 6965f79c-4424-4918-98e8-3c0982434011
  Connection 'x' (6965f79c-4424-4918-98e8-3c0982434011) successfully added.
  $ nmcli connection add type ethernet con-name x connection.uuid 6965f79c-4424-4918-98e8-3c0982434011
  Error: Failed to add 'x' connection: a connection with this UUID already exists
  $ nmcli connection modify x connection.uuid 6965f79c-4424-4918-98e8-3c0982434011
  $ nmcli connection modify x connection.uuid 6965f79c-4424-4918-98e8-3c0982434012
  Error: failed to modify connection.uuid: the property can't be changed.
2022-08-31 19:20:12 +02:00
Thomas Haller
fcf32d81bd
nmcli: allow changing the UUID of a profile in offline mode
It is useful to modify the UUID in offline mode. Otherwise, it's
cumbersome to clone a profile, because the cloned profile will
have the same UUID (and NetworkManager cannot load them both
at the same time).

  umask 077
  nmcli --offline connection modify \
      connection.id profile2 \
      connection.uuid new \
    < /etc/NetworkManager/system-connections/profile1.nmconnection \
    > /etc/NetworkManager/system-connections/profile2.nmconnection \

The doctext doesn't actually work for `man nm-settings-nmcli`. The
generation of our docs is still an incomprehensible mess that needs
fixing.
2022-08-31 19:20:11 +02:00
Thomas Haller
14828a0932
nmcli: support changing the connection type in offline mode 2022-08-31 19:20:11 +02:00
Thomas Haller
71a111bb9c
nmcli: add get_env_flags() accessor to NMMetaEnvironment for checking offline mode
We will want to know whether we are in offline mode.
Add an accessor to get environment flags, which libnmc-setting
can use.
2022-08-31 19:20:11 +02:00
Thomas Haller
686d9ebd4f
libnmc: avoid "g_set_error(error, 1, 0, ...)" and use nm_utils_error_set()
We really should not pass bogus values "1, 0" to g_set_error().
As we don't care about a particular error code, use
NM_UTILS_ERROR_UNKNOWN.

While at it, use nm_utils_error_set() everywhere.
2022-08-31 19:20:11 +02:00
Thomas Haller
f16a6f55fb
glib-aux/trivial: fix typo in comment 2022-08-31 19:20:10 +02:00
Thomas Haller
1326e42823
glib-aux: first try stack allocated temporary buffer in nm_uuid_generate_from_strings()
Try to first use a stack allocated buffer for the temporary string.
Only if the data is too large, NMStrBuf will automatically grow
the buffer on the heap.

In many cases, this buffer will be large enough, and we can avoid the
heap allocation.
2022-08-31 19:20:10 +02:00
Thomas Haller
c5ec4ebd77
glib-aux: fix spurious semicolon after NM_STR_BUF_INIT() macros
It's wrong, and it breaks certain uses.

Fixes: 13d25f9d0b ('glib-aux: add support for starting with stack-allocated buffer in NMStrBuf')
2022-08-31 19:20:10 +02:00
Thomas Haller
98c3ac1480
checkpatch.pl: discourage g_str_hash()/g_direct_hash() and g_direct_equal()
- instead of g_str_hash()/g_direct_hash(), use our own functions
  nm_str_hash()/nm_direct_hash(). Those use siphash24 with a random
  seed.

- don't pass g_direct_equal() to GHashTable. When omitting the equal
  function, it falls back to direct pointer comparison, which is likely
  faster. In any case, it's consistent to not use g_direct_hash()
  when using pointer equality.

- instead of g_int_hash()/g_int64_hash()/g_double_hash(), use
  our nm_pint_hash()/nm_pint64_hash()/nm_pdouble_hash(). The latter
  two don't exist yet.
  The reason is that we want to use siphash24.
  Yes, our name differs from glib's. Our naming seems to make sense
  to me however, because we also have nm_pstr_hash(), nm_pdirect_hash()
  and even nm_ppdirect_hash() for following the pointers. Naming is hard.

- instead of g_int_equal()/g_int64_equal()/g_double_equal() use
  our nm_pint_equal()/nm_pint64_equal()/nm_pdouble_equal(). The latter
  two don't exist yet. The reason is purely naming consistency since
  our hash variants follow the other name.
2022-08-31 10:59:22 +02:00
Thomas Haller
6b74f3cc14
cloud-setup,glib-aux: use NULL instead of g_direct_equal() for hash tables 2022-08-31 09:47:48 +02:00
Thomas Haller
4c48864972
initrd: avoid duplicate file check and NULL pointer dereference in nmi_ibft_read()
- move the second g_file_test() inside the if-block. No need to check
  twice, if the file exists.

- load_one_nic() can return NULL. Use nm_g_hash_table_lookup() to avoid
  NULL pointer assertion.

- use cleanup attribute for "nic" variable, and explicitly pass
  ownership on with g_steal_pointer().
2022-08-31 09:42:23 +02:00
Adrian Freihofer
ff7c5f4024
device: load only required modules
Honor firewall-backend for modules loading and ip forwarding enabling as
well:
* iptables: do not load nftables modules
* nftables: do not load iptables modules
* none: do not load any modules and do not enable ip forwarding

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1356
2022-08-31 09:19:01 +02:00
Thomas Haller
b336b249f5
wifi: use GSource instead of source ID for Wi-Fi scan_kickoff_timeout 2022-08-30 10:09:23 +02:00
Thomas Haller
ade9e17664
wifi: allow explicit scans during AP/ADHOC modes
The user might still want to see the scan list, to decide whether to
stop the hotspot/ADHOC connection and connect to something else.

Allow explicit scans.
2022-08-30 09:58:03 +02:00
Thomas Haller
55767cf5c5
NEWS: update 2022-08-26 19:45:28 +02:00
Thomas Haller
7a0c2f8be9
release: bump version to 1.41.1 (development) 2022-08-26 19:28:11 +02:00
Ana Cabral
5d4802f7d8 release: bump version to 1.40.0 2022-08-26 16:41:39 +02:00
Ana Cabral
1ece234b24 NEWS: update 2022-08-26 16:26:18 +02:00
Ana Cabral
2652df3f47 NEWS: update 2022-08-26 16:17:40 +02:00
Thomas Haller
c4465b4df7
tests: merge branch 'th/test-client-no-pexpect' 2022-08-26 00:01:37 +02:00
Thomas Haller
36ad9855d1
tests: fix "test-client.py" for early python3 versions
ModuleNotFoundError was only introduced in later python 3 versions.
Use just "ImportError", which is the parent class anyway.

Fixes: f7e484c8ed ('tests: fix "test-client.py" ignoring missing "NM" module')
(cherry picked from commit 9902373c6d)
2022-08-26 00:01:12 +02:00
Thomas Haller
d6d76f900f
tests: fix "test-client.py" ignoring missing "NM" module
Fixes: 8959083784 ('tests: skip test in "test-client.py" if the pexepect dependency is not available')
(cherry picked from commit f7e484c8ed)
2022-08-26 00:01:12 +02:00
Thomas Haller
3dc5943134
tests: skip test in "test-client.py" if the pexepect dependency is not available
(cherry picked from commit 8959083784)
2022-08-26 00:01:11 +02:00
Thomas Haller
9902373c6d
tests: fix "test-client.py" for early python3 versions
ModuleNotFoundError was only introduced in later python 3 versions.
Use just "ImportError", which is the parent class anyway.

Fixes: f7e484c8ed ('tests: fix "test-client.py" ignoring missing "NM" module')
2022-08-26 00:00:14 +02:00
Thomas Haller
2b1f7cfff4
style: fix code formatting
Fixes: eec9efd989 ('glib-aux: fix nicks for zero flag in nm_utils_enum_to_str()')
(cherry picked from commit befbad7375)
2022-08-25 23:28:05 +02:00
Thomas Haller
befbad7375
style: fix code formatting
Fixes: eec9efd989 ('glib-aux: fix nicks for zero flag in nm_utils_enum_to_str()')
2022-08-25 23:27:36 +02:00
Thomas Haller
14633422e2
dhcp: merge branch 'bg/restart-dhcp-on-mac-change'
https://bugzilla.redhat.com/show_bug.cgi?id=2110000

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

(cherry picked from commit 7f40eb1b04)
2022-08-25 23:24:48 +02:00
Beniamino Galvani
5a49a2f6b2
device: restart DHCP when the MAC changes
If the MAC changes there is the possibility that the DHCP client will
not be able to renew the address because it uses the old MAC as
CHADDR. Depending on the implementation, the DHCP server might use
CHADDR (so, the old address) as the destination MAC for DHCP replies,
and those packets will be lost.

To avoid this problem, restart the DHCP client when the MAC changes.

https://bugzilla.redhat.com/show_bug.cgi?id=2110000
(cherry picked from commit 905adabdba)
2022-08-25 23:24:47 +02:00
Beniamino Galvani
2f8e4e2b06
core: log when dynamic IP configuration is restarted and why
(cherry picked from commit 6cd69fde33)
2022-08-25 23:24:46 +02:00
Thomas Haller
7f40eb1b04
dhcp: merge branch 'bg/restart-dhcp-on-mac-change'
https://bugzilla.redhat.com/show_bug.cgi?id=2110000

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1343
2022-08-25 23:21:41 +02:00
Beniamino Galvani
905adabdba
device: restart DHCP when the MAC changes
If the MAC changes there is the possibility that the DHCP client will
not be able to renew the address because it uses the old MAC as
CHADDR. Depending on the implementation, the DHCP server might use
CHADDR (so, the old address) as the destination MAC for DHCP replies,
and those packets will be lost.

To avoid this problem, restart the DHCP client when the MAC changes.

https://bugzilla.redhat.com/show_bug.cgi?id=2110000
2022-08-25 23:19:13 +02:00
Beniamino Galvani
6cd69fde33
core: log when dynamic IP configuration is restarted and why 2022-08-25 23:18:53 +02:00
Lubomir Rintel
9d7e5a3b79
device: wait for carrier on unavailable device even when it gets a connection assumed
The test in question leaves the device with a master set, which caused a
connection to get assumed and therefore the previous fix didn't kick in.

Fixes-test: @restart_L2_only_lacp
Fixes: 5b7f8f3f70 ('device: wait for carrier even if it wasn't us who brought the device IFF_UP')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1348
(cherry picked from commit c183f10f65)
2022-08-25 23:16:13 +02:00