Commit Graph

25937 Commits

Author SHA1 Message Date
Antonio Cardace
62facc59e8 nm-setting-bridge: add 'multicast-query-response-interval' bridge option
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-05-04 17:33:00 +02:00
Antonio Cardace
9842c55503 nm-setting-bridge: add 'multicast-query-interval' bridge option
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-05-04 17:33:00 +02:00
Antonio Cardace
b9b9a95395 nm-setting-bridge: add 'multicast-querier-interval' bridge option
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-05-04 17:33:00 +02:00
Antonio Cardace
c1bc1570f3 nm-setting-bridge: add 'multicast-membership-interval' bridge option
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-05-04 17:33:00 +02:00
Antonio Cardace
1c437090ff nm-setting-bridge: add 'multicast-last-member-interval' bridge option
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-05-04 17:33:00 +02:00
Antonio Cardace
c49f20887a nm-setting-bridge: add 'multicast-last-member-count' bridge option
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-05-04 17:33:00 +02:00
Antonio Cardace
673d51bd5c nm-setting-bridge: add 'multicast-hash-max' bridge option
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-05-04 17:32:59 +02:00
Antonio Cardace
8e945c8967 nm-setting-bridge: add missing 'Since: X.Y' comments to options
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-05-04 17:32:52 +02:00
Yuri Chornoivan
fd7136d80f po: update Ukrainian (uk) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/489
2020-05-04 14:47:46 +02:00
Beniamino Galvani
1ffb194d1e platform: fix test failure when /proc is mounted read-only
Expect a failure when writing to /proc if the file system is mounted
read-only.

(cherry picked from commit 211eb3ff8a)
2020-05-04 14:21:41 +02:00
Beniamino Galvani
211eb3ff8a platform: fix test failure when /proc is mounted read-only
Expect a failure when writing to /proc if the file system is mounted
read-only.
2020-05-04 13:59:18 +02:00
Thomas Haller
2f749963fb keyfile: merge branch 'th/keyfile-cleanup-accessors'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/483
2020-05-04 13:14:59 +02:00
Thomas Haller
3ebfb67df4 keyfile: implement nm_keyfile_plugin_kf_get_string_list() directly without macro
There is only one user of the macro left. Drop it.
2020-05-04 13:12:43 +02:00
Thomas Haller
dade5055fb keyfile: add nm_keyfile_plugin_kf_get_integer_list_uint() to parse a list of integers
We had three callers of nm_keyfile_plugin_kf_get_integer_list(). Two
only wanted to read values in range of guint8. One, wanted to read
unsigned integers (for which nm_keyfile_plugin_kf_get_integer_list()
was not suitable).

Instead, implement a integer list reader ourself.

One change is that g_key_file_get_integer_list() would accept list elements
with a number followed by a white space and garbage ([1]). We don't do that,
so there is a change in behavior here. That seems preferable, we don't
want to accept garbage.

The error reason text from the reader now also changes, and obviously we
no longer fail for integer values larger than G_MAXINT.

[1] c9bf247eb9/glib/gkeyfile.c (L4445)
2020-05-04 13:12:43 +02:00
Thomas Haller
bbdb47adaf keyfile: implement nm_keyfile_plugin_kf_set_string_list() directly without macro
There is only one user of the macro left. Drop it.
2020-05-04 13:12:43 +02:00
Thomas Haller
93285a465f keyfile: refactor writing of G_TYPE_ARRAY list of unsigned integers
Keyfile handles GObject properties of type G_TYPE_ARRAY as a GArray
of unsigned ints. That is correct, because all our properties of this
GType happen to be of this kind.

However, then the function was using nm_keyfile_plugin_kf_set_integer_list(),
which only can handle signed integers. There was thus an assertion that all
integers were non-negative. Which, probably was also correct, because NMSettingDcb
would validate that all values of such kind are in fact positive. Anyway, that
is an unexpected limitation (if not a bug).

Fix that by handling the array as unsigned list of integers.

Also, since glib doesn't provide an API for storing lists of unsigend
integers, we have to implement our own. but that is no loss. We probably
do it better anyway.
2020-05-04 12:47:11 +02:00
Thomas Haller
42aea87d51 keyfile: use NMStrBuf in nm_keyfile_plugin_kf_set_integer_list_uint8()
Previously, we were preallocating a string buffer of fixed size. For guint8
we reserved 3 characters per number, which is sufficient. However, it is
not obviously sufficient. NMStrBuf would grow as needed.

Next, I will add nm_keyfile_plugin_kf_set_integer_list_uint(), where it
is more unclear how large the string can be at most. To avoid that question
from the start, it will use NMStrBuf. To keep the implementations similar,
use NMStrBuf also in this case.
2020-05-04 12:47:11 +02:00
Thomas Haller
ff84211cf6 keyfile: refactor defining keyfile list getter/setter functions 2020-05-04 12:47:11 +02:00
Thomas Haller
867964d7e0 keyfile: refactor defining keyfile getter/setter functions
Split the macros to define the setter and getter so that setters
and getters are defined by separate macros. This will be used
to define the boolean getter differently, but still using the
macro to define the setter.

Also, don't construct function names in the macro. Instead, pass
the full names as argument to the macro. This helps with the problem
where ctags/cscope is unable to locate the implementation of the
function. Since we define the function with macro, the tools still
don't recognize this as the location of the definition. But at least
when showing all occurrences of the name, it can be found.
2020-05-04 12:47:07 +02:00
Thomas Haller
d4615e73ed libnm: avoid compiler warning about uninitalized variable in nm_setting_bridge_port_remove_vlan_by_vid()
With LTO, compiler warns:

    libnm-core/nm-setting-bridge-port.c: In function nm_setting_bridge_port_remove_vlan_by_vid:
    libnm-core/nm-setting-bridge-port.c:252:6: error: v_start may be used uninitialized in this function [-Werror=maybe-uninitialized]
      252 |   if (v_start == vid_start && v_end == vid_end) {
          |      ^
    libnm-core/nm-setting-bridge-port.c:239:10: note: v_start was declared here
      239 |  guint16 v_start, v_end;
          |          ^
    libnm-core/nm-setting-bridge-port.c:252:28: error: v_end may be used uninitialized in this function [-Werror=maybe-uninitialized]
      252 |   if (v_start == vid_start && v_end == vid_end) {
          |                            ^
    libnm-core/nm-setting-bridge-port.c:239:19: note: v_end was declared here
      239 |  guint16 v_start, v_end;
          |                   ^

Avoid the (false positive) warning.
2020-05-03 11:01:56 +02:00
Thomas Haller
53476d821d nm-online: fix build of nm-online for missing libcsiphash.la
Fixes: e468b48ab7 ('nm-online: allow configuring timeout via NM_ONLINE_TIMEOUT environment')
(cherry picked from commit 69798fa6cd)
2020-05-02 23:00:08 +02:00
Thomas Haller
69798fa6cd nm-online: fix build of nm-online for missing libcsiphash.la
Fixes: e468b48ab7 ('nm-online: allow configuring timeout via NM_ONLINE_TIMEOUT environment')
2020-05-02 22:40:42 +02:00
Thomas Haller
496fea7db8 release: bump version to 1.23.91 (1.24-rc2) 2020-05-02 21:47:58 +02:00
Thomas Haller
bd0a713495 NEWS: update
(cherry picked from commit 938aca3fab)
2020-05-02 21:40:04 +02:00
Thomas Haller
60c67b713b dispatcher: merge branch 'th/dispatcher-doc-connectivity-change-arg'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/485

(cherry picked from commit 2a319c5dbb)
2020-04-30 21:53:21 +02:00
Thomas Haller
775ebba658 dispatcher: minor cleanup error paths in script_dispatch()
Handle the error case first and return early.

(cherry picked from commit 259a07ae46)
2020-04-30 21:53:21 +02:00
Thomas Haller
62b135d337 dispatcher: clarify documentation about first argument to dispatcher scripts for "connectivity-change"
The manual page claimed that for "connectivitiy-change" actions, the dispatcher
scripts would get as first argument (the device name) "none". That was not done,
only for "hostname" actions.

For consistency, maybe that should be adjusted to also pass "none" for connectivity
change events. However, "none" is really an odd value, if there is no device. Passing
an empty word is IMO nicer. So stick to that behavior, despite being inconsistent.
Also fix the documentation about that.

(cherry picked from commit 0b168f7b99)
2020-04-30 21:53:21 +02:00
Thomas Haller
2a319c5dbb dispatcher: merge branch 'th/dispatcher-doc-connectivity-change-arg'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/485
2020-04-30 21:51:49 +02:00
Thomas Haller
259a07ae46 dispatcher: minor cleanup error paths in script_dispatch()
Handle the error case first and return early.
2020-04-30 21:50:28 +02:00
Thomas Haller
0b168f7b99 dispatcher: clarify documentation about first argument to dispatcher scripts for "connectivity-change"
The manual page claimed that for "connectivitiy-change" actions, the dispatcher
scripts would get as first argument (the device name) "none". That was not done,
only for "hostname" actions.

For consistency, maybe that should be adjusted to also pass "none" for connectivity
change events. However, "none" is really an odd value, if there is no device. Passing
an empty word is IMO nicer. So stick to that behavior, despite being inconsistent.
Also fix the documentation about that.
2020-04-30 21:50:28 +02:00
Thomas Haller
02513e4b5d nm-online: allow configuring timeout via NM_ONLINE_TIMEOUT environment
https://bugzilla.redhat.com/show_bug.cgi?id=1828458

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/484
(cherry picked from commit e468b48ab7)
2020-04-30 21:47:30 +02:00
Thomas Haller
e468b48ab7 nm-online: allow configuring timeout via NM_ONLINE_TIMEOUT environment
https://bugzilla.redhat.com/show_bug.cgi?id=1828458

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/484
2020-04-30 21:46:59 +02:00
Beniamino Galvani
bee01292f8 n-dhcp4: don't fail dispatch in case of receive errors
Currently any error encountered in n_dhcp4_c_connection_dispatch_io()
causes a dispatch failure and interrupts the library state
machine. The recvmsg() on the socket can fail for different reasons;
one of these is for example that the UDP request previously sent got a
ICMP port-unreachable response. This can be reproduced in the
following way:

 ip netns add ns1
 ip link add veth0 type veth peer name veth1
 ip link set veth1 netns ns1
 ip link set veth0 up

 cat > dhcpd.conf <<EOF
 server-identifier 172.25.0.1;
 max-lease-time 120;
 default-lease-time 120;
 subnet 172.25.0.0 netmask 255.255.255.0 {
        range 172.25.0.100 172.25.0.200;
 }
 EOF

 ip -n ns1 link set veth1 up
 ip -n ns1 address add dev veth1 172.25.0.1/24
 ip netns exec ns1 iptables -A INPUT -p udp --dport 67 -j REJECT
 ip netns exec ns1 dhcpd -4 -cf dhcpd.conf -pf /tmp/dhcp-server.pid

If a client is started on veth0, it is able to obtain a lease despite
the firewall rule blocking DHCP, because dhcpd uses a packet
socket. Then it fails during the renewal because the recvmsg() fails:

 dhcp4 (veth0): send REQUEST of 172.25.0.178 to 172.25.0.1
 dhcp4 (veth0): error -111 dispatching events
 dhcp4 (veth0): state changed bound -> fail

The client should consider such errors non fatal and keep running.

https://bugzilla.redhat.com/show_bug.cgi?id=1829178
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/486
(cherry picked from commit c5d1d4c498)
2020-04-30 18:15:42 +02:00
Beniamino Galvani
c5d1d4c498 n-dhcp4: don't fail dispatch in case of receive errors
Currently any error encountered in n_dhcp4_c_connection_dispatch_io()
causes a dispatch failure and interrupts the library state
machine. The recvmsg() on the socket can fail for different reasons;
one of these is for example that the UDP request previously sent got a
ICMP port-unreachable response. This can be reproduced in the
following way:

 ip netns add ns1
 ip link add veth0 type veth peer name veth1
 ip link set veth1 netns ns1
 ip link set veth0 up

 cat > dhcpd.conf <<EOF
 server-identifier 172.25.0.1;
 max-lease-time 120;
 default-lease-time 120;
 subnet 172.25.0.0 netmask 255.255.255.0 {
        range 172.25.0.100 172.25.0.200;
 }
 EOF

 ip -n ns1 link set veth1 up
 ip -n ns1 address add dev veth1 172.25.0.1/24
 ip netns exec ns1 iptables -A INPUT -p udp --dport 67 -j REJECT
 ip netns exec ns1 dhcpd -4 -cf dhcpd.conf -pf /tmp/dhcp-server.pid

If a client is started on veth0, it is able to obtain a lease despite
the firewall rule blocking DHCP, because dhcpd uses a packet
socket. Then it fails during the renewal because the recvmsg() fails:

 dhcp4 (veth0): send REQUEST of 172.25.0.178 to 172.25.0.1
 dhcp4 (veth0): error -111 dispatching events
 dhcp4 (veth0): state changed bound -> fail

The client should consider such errors non fatal and keep running.

https://bugzilla.redhat.com/show_bug.cgi?id=1829178
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/486
2020-04-30 18:12:08 +02:00
Thomas Haller
7151575920 keyfile: don't declare keyfile getters/setter functions with macro
In general, I like macros. But in this case it seems the make the code harder
to understand than it needs to be. There are repeated patterns in these declarations,
but I feel they are better recognizible by aligning the lines nicely.
2020-04-30 13:58:14 +02:00
Thomas Haller
a05dbeb31f bus-manager/dhcp: don't log pointer values directly
Direct pointer values can be used to circumvent ASLR. Obfuscate
the pointer values.
2020-04-30 11:44:07 +02:00
Thomas Haller
39a8dd0dc8 wifi: clear scan_request_ssids_hash if not needed
It is very uncommon that a user provides explicit SSIDs to scan.
So, most of the time there is nothing to do here.

(cherry picked from commit d9740d108d)
2020-04-30 11:21:22 +02:00
Thomas Haller
9f09b17340 wifi: don't unnecessarily trim tracked ssid list
Only _scan_request_ssids_track() adds elements to the list, and that already
trims the list to a maxium length. In all other cases, we never expect a need
to trim the list.

(cherry picked from commit 3af9209d47)
2020-04-30 11:21:22 +02:00
Thomas Haller
6dc581f9af wifi: pass now_msec to _scan_request_ssids_fetch()
We make decisions based on the timestamp. We should only fetch the timestamp
once, and make consistent decisions about that. Don't read different timestamps.

(cherry picked from commit a0e115cb44)
2020-04-30 11:21:22 +02:00
Thomas Haller
783be3ab7e wifi: fix trimming list of tracked ssids to scan
Fixes: e07fc217ec ('wifi: rework scanning of Wi-Fi device')
(cherry picked from commit 8fb2241183)
2020-04-30 11:21:22 +02:00
Thomas Haller
c81f599b04 wifi: really fix crash during dispose of NMDeviceWifi
The right fix is to return from _scan_kickoff() right away.

Backtrace:

  #0  0x00007f520eeb2002 g_logv (libglib-2.0.so.0 + 0x5a002)
  #1  0x00007f520eeb2273 g_log (libglib-2.0.so.0 + 0x5a273)
  #2  0x000056026929b25a nm_supplicant_interface_get_max_scan_ssids (NetworkManager + 0x27e25a)
  #3  0x00007f520c238bb1 _scan_request_ssids_build_hidden (libnm-device-plugin-wifi.so + 0x15bb1)
  #4  0x00007f520c23a2d5 _scan_notify_is_scanning (libnm-device-plugin-wifi.so + 0x172d5)
  #5  0x00007f520c2433d3 dispose (libnm-device-plugin-wifi.so + 0x203d3)
  #6  0x00007f520efa3c78 g_object_unref (libgobject-2.0.so.0 + 0x18c78)
  #7  0x00005602690ada1a remove_device (NetworkManager + 0x90a1a)
  #8  0x00005602690be428 nm_manager_stop (NetworkManager + 0xa1428)
  #9  0x0000560269064adb main (NetworkManager + 0x47adb)
  #10 0x00007f520ec70042 __libc_start_main (libc.so.6 + 0x27042)
  #11 0x0000560269064efe _start (NetworkManager + 0x47efe)

Fixes: e07fc217ec ('wifi: rework scanning of Wi-Fi device')
Fixes: a2deb0da5e ('wifi: fix crash during dispose of NMDeviceWifi')
(cherry picked from commit 2794f3cff8)
2020-04-30 11:21:22 +02:00
Thomas Haller
ed32651ab8 dhcp: cleanup build_signal_parameters() in nm-dhcp-helper
Also, silently ignore all environment variables with a name that
is not valid UTF-8. We would hit an assertion trying to put that
in a GVariant (or sending it via D-Bus).
2020-04-30 11:20:12 +02:00
Thomas Haller
d9740d108d wifi: clear scan_request_ssids_hash if not needed
It is very uncommon that a user provides explicit SSIDs to scan.
So, most of the time there is nothing to do here.
2020-04-30 10:36:41 +02:00
Thomas Haller
3af9209d47 wifi: don't unnecessarily trim tracked ssid list
Only _scan_request_ssids_track() adds elements to the list, and that already
trims the list to a maxium length. In all other cases, we never expect a need
to trim the list.
2020-04-30 10:07:36 +02:00
Thomas Haller
a0e115cb44 wifi: pass now_msec to _scan_request_ssids_fetch()
We make decisions based on the timestamp. We should only fetch the timestamp
once, and make consistent decisions about that. Don't read different timestamps.
2020-04-30 10:06:55 +02:00
Thomas Haller
8fb2241183 wifi: fix trimming list of tracked ssids to scan
Fixes: e07fc217ec ('wifi: rework scanning of Wi-Fi device')
2020-04-30 10:06:55 +02:00
Thomas Haller
2794f3cff8 wifi: really fix crash during dispose of NMDeviceWifi
The right fix is to return from _scan_kickoff() right away.

Backtrace:

  #0  0x00007f520eeb2002 g_logv (libglib-2.0.so.0 + 0x5a002)
  #1  0x00007f520eeb2273 g_log (libglib-2.0.so.0 + 0x5a273)
  #2  0x000056026929b25a nm_supplicant_interface_get_max_scan_ssids (NetworkManager + 0x27e25a)
  #3  0x00007f520c238bb1 _scan_request_ssids_build_hidden (libnm-device-plugin-wifi.so + 0x15bb1)
  #4  0x00007f520c23a2d5 _scan_notify_is_scanning (libnm-device-plugin-wifi.so + 0x172d5)
  #5  0x00007f520c2433d3 dispose (libnm-device-plugin-wifi.so + 0x203d3)
  #6  0x00007f520efa3c78 g_object_unref (libgobject-2.0.so.0 + 0x18c78)
  #7  0x00005602690ada1a remove_device (NetworkManager + 0x90a1a)
  #8  0x00005602690be428 nm_manager_stop (NetworkManager + 0xa1428)
  #9  0x0000560269064adb main (NetworkManager + 0x47adb)
  #10 0x00007f520ec70042 __libc_start_main (libc.so.6 + 0x27042)
  #11 0x0000560269064efe _start (NetworkManager + 0x47efe)

Fixes: e07fc217ec ('wifi: rework scanning of Wi-Fi device')
Fixes: a2deb0da5e ('wifi: fix crash during dispose of NMDeviceWifi')
2020-04-30 10:05:54 +02:00
Thomas Haller
db68ebd41c wifi: fix crash during dispose of NMDeviceWifi
Backtrace:

  #0  0x00007f520eeb2002 g_logv (libglib-2.0.so.0 + 0x5a002)
  #1  0x00007f520eeb2273 g_log (libglib-2.0.so.0 + 0x5a273)
  #2  0x000056026929b25a nm_supplicant_interface_get_max_scan_ssids (NetworkManager + 0x27e25a)
  #3  0x00007f520c238bb1 _scan_request_ssids_build_hidden (libnm-device-plugin-wifi.so + 0x15bb1)
  #4  0x00007f520c23a2d5 _scan_notify_is_scanning (libnm-device-plugin-wifi.so + 0x172d5)
  #5  0x00007f520c2433d3 dispose (libnm-device-plugin-wifi.so + 0x203d3)
  #6  0x00007f520efa3c78 g_object_unref (libgobject-2.0.so.0 + 0x18c78)
  #7  0x00005602690ada1a remove_device (NetworkManager + 0x90a1a)
  #8  0x00005602690be428 nm_manager_stop (NetworkManager + 0xa1428)
  #9  0x0000560269064adb main (NetworkManager + 0x47adb)
  #10 0x00007f520ec70042 __libc_start_main (libc.so.6 + 0x27042)
  #11 0x0000560269064efe _start (NetworkManager + 0x47efe)

Fixes: e07fc217ec ('wifi: rework scanning of Wi-Fi device')
(cherry picked from commit a2deb0da5e)
2020-04-29 21:16:10 +02:00
Thomas Haller
a2deb0da5e wifi: fix crash during dispose of NMDeviceWifi
Backtrace:

  #0  0x00007f520eeb2002 g_logv (libglib-2.0.so.0 + 0x5a002)
  #1  0x00007f520eeb2273 g_log (libglib-2.0.so.0 + 0x5a273)
  #2  0x000056026929b25a nm_supplicant_interface_get_max_scan_ssids (NetworkManager + 0x27e25a)
  #3  0x00007f520c238bb1 _scan_request_ssids_build_hidden (libnm-device-plugin-wifi.so + 0x15bb1)
  #4  0x00007f520c23a2d5 _scan_notify_is_scanning (libnm-device-plugin-wifi.so + 0x172d5)
  #5  0x00007f520c2433d3 dispose (libnm-device-plugin-wifi.so + 0x203d3)
  #6  0x00007f520efa3c78 g_object_unref (libgobject-2.0.so.0 + 0x18c78)
  #7  0x00005602690ada1a remove_device (NetworkManager + 0x90a1a)
  #8  0x00005602690be428 nm_manager_stop (NetworkManager + 0xa1428)
  #9  0x0000560269064adb main (NetworkManager + 0x47adb)
  #10 0x00007f520ec70042 __libc_start_main (libc.so.6 + 0x27042)
  #11 0x0000560269064efe _start (NetworkManager + 0x47efe)

Fixes: e07fc217ec ('wifi: rework scanning of Wi-Fi device')
2020-04-29 21:15:19 +02:00
Thomas Haller
4940cfcd7e clients/trivial: rename VpnPasswordName struct to have NM prefix 2020-04-29 16:18:31 +02:00