Commit graph

25603 commits

Author SHA1 Message Date
Thomas Haller
b93e12cb43
cli: avoid redundant "if" check that is always TRUE in nmcli_editor_tab_completion() 2020-05-07 13:58:09 +02:00
Thomas Haller
6f0dadabd7
cli: avoid non-thread-safe localtime() function in nmcli
Static analysis tools flag the use of localtime() because it is not
thread safe. Of course, that was no problem here, but avoiding the
warning is simple.

Also, if we allocate 128 bytes, let strftime use it.
2020-05-07 13:58:08 +02:00
Thomas Haller
53b2297701
ndisc: avoid static analysis complaining about overflow check in receive_ra()
lgtm.com flags this. The check was there to be better safe than sorry.
Also, it seems better to have code that shows what happens instead
of a verbose code comment (or no comment at all). Anyway, avoid the
false positive.
2020-05-07 13:58:08 +02:00
Thomas Haller
b447c80ad8
acd: avoid alloca() inside an unbounded loop 2020-05-07 13:58:08 +02:00
Thomas Haller
d170f8b7f2
device: fix compilation error "--without-more-asserts"
Defining the name "dispose" breaks

   object_class->dispose = dispose;

below.

Fixes: fdba9200c0 ('device: avoid coverity warning about unused variable')
2020-05-07 11:15:22 +02:00
Beniamino Galvani
be3549abbd merge: branch 'bg/coverity'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/495
2020-05-07 10:37:56 +02:00
Beniamino Galvani
a29b13c7f1 libnm: remove early return statement in test_nm_auth_permissions()
Reported by coverity:

>>> CID 210230: Control flow issues (UNREACHABLE)
>>> This code cannot be reached: "i = 0;".

Fixes: 09e17888f7 ('libnm: add mapping functions between string and NMClientPermission enum')
2020-05-07 10:01:59 +02:00
Beniamino Galvani
581aa981c2 ifcfg-rh: check return value of fdopen()
Reported by coverity:

>>> CID 210222: Null pointer dereferences (NULL_RETURNS)
>>> Dereferencing a pointer that might be "NULL" "f" when calling
    "fseek".

Fixes: ac5206aa9c ('2007-11-21')
2020-05-07 10:01:57 +02:00
Beniamino Galvani
272f19108b libnm: fix assertion in NML_IS_DBUS_OBJECT()
Reported by coverity:

>>> CID 210228: Null pointer dereferences (REVERSE_INULL)
>>> Null-checking "dbobj" suggests that it may be null, but it has
    already been dereferenced on all paths leading to the check.

Fixes: ce0e898fb4 ('libnm: refactor caching of D-Bus objects in NMClient')
2020-05-07 10:01:56 +02:00
Beniamino Galvani
966e3341a6 libnm-core: replace malloc() with g_malloc()
For consistency with the rest of the code, prefer g_malloc() over
malloc().
2020-05-07 10:01:54 +02:00
Beniamino Galvani
8cb58ef1eb cli/polkit: add missing variable initialization in retrieve_session_id_cb()
Reported by coverity:

>>> CID 210213 Uninitialized pointer read (UNINIT)
>>> Using uninitialized value iter when calling
    _nm_auto_free_variant_iter

Fixes: df1d214b2e ('clients: polkit-agent: implement polkit agent without using libpolkit')
2020-05-07 10:01:52 +02:00
Beniamino Galvani
fbccd24db6 cli/polkit: add missing variable initialization in dbus_method_call_cb()
Reported by coverity:

>>> CID 210217: (UNINIT)
>>> Using uninitialized value "identities_gvariant" when calling
    "gs_local_variant_unref".

Fixes: df1d214b2e ('clients: polkit-agent: implement polkit agent without using libpolkit')
2020-05-07 10:01:50 +02:00
Thomas Haller
20f5d8877b
all: merge branch 'af/settings-add-matches'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/431
2020-05-07 00:07:15 +02:00
Thomas Haller
5beb42b942
device: style fixes 2020-05-06 17:10:31 +02:00
Thomas Haller
bdd0e89b9a
device: handle match.driver also with unknown device driver
If the driver is unknown, that doesn't necessarily mean that the match
passes. Instead, the match passes if there is no positive match that
asks for the driver name.
2020-05-06 16:20:11 +02:00
Thomas Haller
623cf7c9a3
core: accept %NULL argument to nm_wildcard_match_check()
%NULL means that the string is unknown. The pattern should still match
if there are no positive matches that want to match against the string.

For example, the nm_device_get_driver() might return NULL. If we have
a match.driver setting, we still need to handle that somehow that it
makes sense.
2020-05-06 16:14:16 +02:00
Thomas Haller
ace437338d
ifcfg-rh: minor cleanup of make_match_setting() 2020-05-06 16:01:13 +02:00
Thomas Haller
cf546ee789
ifcfg-rh: refactor write_match_setting()
- write_match_setting() never fails. Don't let it return a boolean
  error result.

- drop "if (!name || !name[0])" checks. It's not possibly to configure
  a name %NULL in NMSettingMatch (without triggering assertions). Also,
  an empty name "" is not valid, so we wouldn't expect it. There is one
  problem with the way how we concatenate the string list: it uses
  spaces as separator, while stripping spaces. That means, in the
  currenty format, an empty token "" cannot be expressed. On the other
  hand, serializing it would lead to duplicate spaces, that get dropped
  during re-read. So the empty name wasn't valid from the start, but it
  also cannot be encoded.

- use nm_gstring_add_space_delimiter() and nm_gstring_prepare().
2020-05-06 15:58:43 +02:00
Thomas Haller
8bb172ee2b
cli: use default implementation of getter for NMSettingMatch properties
The default implementation should be good enough. Use it.
2020-05-06 15:44:29 +02:00
Thomas Haller
0ba444a084
libnm: allocate device and kernel_command_line arrays in NMSettingMatch lazy 2020-05-06 15:39:14 +02:00
Thomas Haller
7939c8e770
libnm: allocate interface_name array in NMSettingMatch lazy
Also track the interface_name in a GArray so that
nm_setting_match_get_interface_names() returns a NULL
terminated strv array.
2020-05-06 15:39:08 +02:00
Thomas Haller
5056e0d3c8
shared: add nm_strvarray_*() helper API
GPtrArray does not support NULL terminating the pointer array. That
makes it cumbersome to use it for tracking a strv array. Add a few
helper functions nm_strvarray_*() that help using a GArray instead.
2020-05-06 15:19:27 +02:00
Thomas Haller
8dd74fe364
shared: add nm_indirect_g_free() helper 2020-05-06 15:19:25 +02:00
Thomas Haller
070535c6f6
shared: add nm_g_array_len() helper 2020-05-06 15:19:24 +02:00
Thomas Haller
46bee5298b
shared: add nm_g_ptr_array_len() helper 2020-05-06 15:19:23 +02:00
Thomas Haller
ef16dcaee4
libnm: cleanup NMSettingMatch.verify() 2020-05-06 15:19:22 +02:00
Thomas Haller
eaf3862075
libnm: fix gtk-doc annotations for nm_setting_match_get_{kernel_command_lines,drivers}()
Otherwise the function is not usable via generated bindings.
2020-05-06 15:07:09 +02:00
Thomas Haller
fa0913b5d2
libnm: sort entires in libnm.ver 2020-05-06 15:05:21 +02:00
Adrian Freihofer
369d858525
ifcfg-rh: support new match filters 2020-05-06 15:05:21 +02:00
Adrian Freihofer
d8a7f65ef4
ifcfg-rh-reader: match refactoring 2020-05-06 15:05:21 +02:00
Adrian Freihofer
e8885db046
po add libnm-core/nm-setting-match.c 2020-05-06 15:05:21 +02:00
Adrian Freihofer
214b31dcbc
settings: add match for driver
Add a new "driver" match option to nm-settings. It allows to disable a
network connection configuration if a pattern is found or is not found
in the device driver name.
2020-05-06 15:05:21 +02:00
Adrian Freihofer
3a8e46f2a5
settings: add match for proc cmdline
Add a new "kernel-command-line" match option to nm-settings. It allows
to disable a network connection configuration if a pattern is found or
is not found in /proc/cmdline.
2020-05-06 15:05:20 +02:00
Adrian Freihofer
b42c3aa97a
settings: add match verify function 2020-05-06 15:05:20 +02:00
Thomas Haller
180cda7632
libnm: fix gtk-doc annotations for nm_setting_match_get_interface_names()
Otherwise the function is not usable via generated bindings.

Fixes: 9b9dce9486 ('all: add 'match' setting')
2020-05-06 15:01:06 +02:00
Thomas Haller
fdba9200c0
device: avoid coverity warning about unused variable
This warning is from coverity against 1.18.6. But it applies
in a similar manner here.

  1. NetworkManager-1.18.6/src/devices/nm-device-macsec.c:811:25: warning: Value stored to 'priv' during its initialization is never read
  #         NMDeviceMacsecPrivate *priv = NM_DEVICE_MACSEC_GET_PRIVATE (self);
  #                                ^~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. NetworkManager-1.18.6/src/devices/nm-device-macsec.c:811:25: note: Value stored to 'priv' during its initialization is never read
  #         NMDeviceMacsecPrivate *priv = NM_DEVICE_MACSEC_GET_PRIVATE (self);
  #                                ^~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  #   809|   {
  #   810|   	NMDeviceMacsec *self = NM_DEVICE_MACSEC (object);
  #   811|-> 	NMDeviceMacsecPrivate *priv = NM_DEVICE_MACSEC_GET_PRIVATE (self);
  #   812|
  #   813|   	macsec_secrets_cancel (self);
2020-05-06 11:50:15 +02:00
Yuri Chornoivan
9a7a66b7b2
po: update Ukrainian (uk) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/493
2020-05-06 11:00:15 +02:00
Beniamino Galvani
5ca44bc780 initrd: merge branch 'bg/initrd-hostname'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/419
2020-05-06 10:34:03 +02:00
Beniamino Galvani
2035353dab man: initrd: describe differences from network-legacy module 2020-05-06 10:33:42 +02:00
Beniamino Galvani
fbf54ab182 initrd: parse 'rd.net.timeout.dhcp' option 2020-05-06 10:32:25 +02:00
Beniamino Galvani
93d7a9b005 initrd: parse rd.peerdns early
Instead of generating connections and then apply the rd.peerdns to
them, parse the option early and set it when each connection is
created.
2020-05-06 10:32:25 +02:00
Beniamino Galvani
ff70adf873 initrd: save hostname to a file in /run
Save the hostname read from command line to a file in /run so that it
can be applied later by the NM dracut module.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/419
2020-05-06 10:32:25 +02:00
Beniamino Galvani
f14cc584d5 initrd: add command line option to specify initrd data directory 2020-05-06 10:32:25 +02:00
Thomas Haller
05fd2a9272
device: fix scope of variable in commit_option() 2020-05-04 18:01:38 +02:00
Antonio Cardace
4a293844b8
bridge: merge branch 'ac/bridge_options_2'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/473
2020-05-04 17:33:26 +02:00
Antonio Cardace
05d9381060
nm-setting-bridge: add 'multicast-startup-query-interval' bridge option
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-05-04 17:33:01 +02:00
Antonio Cardace
abe660f780
nm-setting-bridge: add 'multicast-startup-query-count' bridge option
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-05-04 17:33:00 +02:00
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