Commit graph

23833 commits

Author SHA1 Message Date
Thomas Haller
8a347dbd55 secret-agent: drop unused private-socket code from secret-agent
In the past, we had a private unix socket. That is long gone.
Drop the remains in "nm-secret-agent.c". The request here really
always comes from the main D-Bus connection.

Maybe the private unix socket makes sense and we might resurrect it one
day. But at that point it would be an entire rewrite and the existing
code is probably not useful either way. Drop it.
2019-08-08 10:07:55 +02:00
Thomas Haller
58e5e55f17 secret-agent: enable trace log messages
They seem useful for debugging. Don't only enable them --with-more-logging.
2019-08-08 10:07:55 +02:00
Thomas Haller
dda3289206 shared: add nm_c_list_elem_find_first() helper macro
- add nm_c_list_elem_find_first() macro that takes a predicate
  and returns the first match.

  This macro has a non-function-like behavior, which we often try to
  avoid because macros should behave like functions. In this case it's
  however convenient, so let's do it.
  Also, despite being non-function-like, it should be pretty hard to
  use wrongly.

- rename nm_c_list_elem_find_first() to nm_c_list_elem_find_first_ptr().
2019-08-08 10:07:15 +02:00
Thomas Haller
b80b25050f n-dhcp4: allocate memory of right size in n_dhcp4_client_probe_option_new()
Non-critical, as the allocated memory was larger than needed.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/224
2019-08-08 07:46:41 +02:00
Thomas Haller
1b59d752be firewall: refactor "nm-firewall-manager.c" to not use GDBusProxy
- Don't use GDBusProxy but plain GDBusConnection. NMFirewallManager
  is very simple, it doesn't use any of the features that GDBusProxy
  provides.

- make NMFirewallManagerCallId typedef a pointer to the opaque call-id
  struct, instead of the struct itself. It's confusing to have a
  variable that does not look like a pointer and assigning %NULL to
  it.

- internally drop the CBInfo typename and name the call-id variable
  constsistantly as "call_id".

- no need to keep the call-id struct alive after cancelling it. That
  simplifies the lifetime managment of the pending call because the
  completion callback is always invoked shortly before destroying
  the call-id.

- note that the caller is no longer allowed to cancel a call-id from
  inside the completion callback. That just complicates the
  implementation and is not necessary. Assert against that.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/230
2019-08-07 13:21:48 +02:00
Thomas Haller
7d3a05d493 cli/trivial: align property definitions with spaces and not with tabs
Our coding style is to indent with tabs, but align with spaces.
This is not about the coding style though, but about the code
looking broken when not using 4 spaces per tab (in fact, some code
there is aligned as if using 8 spaces and it's already inconsistent).

Realign with spaces.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/223
2019-08-06 15:46:12 +02:00
Thomas Haller
96339fa5ea release: bump version to 1.21.1-dev after 1.20.0 release
After 1.20.0 is released, merge it back into master so that
1.20.0 is part of the history of master. That means,
  $ git log --first-parent master
will also traverse 1.20.0 and 1.20-rc*.

Also bump the micro version to 1.21.1-dev to indicate that this is
after 1.20.0 is out.
2019-08-06 13:01:05 +02:00
Thomas Haller
c438f01b19 release: bump version to 1.20.0 2019-08-06 12:22:44 +02:00
Thomas Haller
fb49607de1 libnm/doc: add missing "Since: 1.20" comments
(cherry picked from commit e48089b039)
2019-08-06 12:22:16 +02:00
Thomas Haller
fa0c5a41c1 ifupdown: fix assertion during logging %NULL storage in load_eni_ifaces()
(cherry picked from commit ddb08e3602)
2019-08-06 12:22:15 +02:00
Thomas Haller
e48089b039 libnm/doc: add missing "Since: 1.20" comments 2019-08-06 12:16:29 +02:00
Thomas Haller
ddb08e3602 ifupdown: fix assertion during logging %NULL storage in load_eni_ifaces() 2019-08-06 12:10:37 +02:00
Thomas Haller
3cef1b98cc libnm/doc: add Since tag for %NM_SETTING_IP6_CONFIG_METHOD_DISABLED
(cherry picked from commit f988e85025)
2019-08-06 11:52:08 +02:00
Thomas Haller
9374aa5f2f NEWS: update 2019-08-06 11:51:17 +02:00
Thomas Haller
f988e85025 libnm/doc: add Since tag for %NM_SETTING_IP6_CONFIG_METHOD_DISABLED 2019-08-06 11:50:00 +02:00
Beniamino Galvani
47c772354e modem: fix memory leak
Fixes: 9b935fad9b ('modem: don't use GAsyncResult pattern for disconnecting modem')
(cherry picked from commit 22cd9e754b)
2019-08-06 09:17:10 +02:00
Beniamino Galvani
22cd9e754b modem: fix memory leak
Fixes: 9b935fad9b ('modem: don't use GAsyncResult pattern for disconnecting modem')
2019-08-06 08:35:01 +02:00
Beniamino Galvani
617ad31f39 build: merge branch 'bg/meson-fixes'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/226
2019-08-05 16:14:15 +02:00
Beniamino Galvani
7c2317a557 build: fix meson warning about 'install' arg in 'configure_file'
WARNING: Project targetting '>= 0.44.0' but tried to use feature
introduced in '0.50.0': install arg in configure_file

From the documentation:

 "install (added 0.50.0) When true, this generated file is installed
 during the install step, and install_dir must be set and not
 empty. When false, this generated file is not installed regardless of
 the value of install_dir. When omitted it defaults to true when
 install_dir is set and not empty, false otherwise."

The parameter can be omitted because install_dir is set.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/216
2019-08-05 16:05:30 +02:00
Beniamino Galvani
91b9b08e33 build: fix meson warning about wrong custom target argument
src/meson.build:294: WARNING: Custom target input 'NetworkManager'
can't be converted to File object(s).
This will become a hard error in the future.
2019-08-05 16:05:30 +02:00
Beniamino Galvani
00bb6cdb4f build: fix meson warning about path separator in target
Fix the following:

 WARNING: Target "nm-utils/tests/test-shared-general" has a path
 separator in its name.  This is not supported, it can cause
 unexpected failures and will become a hard error in the future.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/217
2019-08-05 16:05:30 +02:00
Beniamino Galvani
9fe2b6135b build: fix meson warning about invalid 'depends' keyword
Fix this:

 libnm/meson.build:215: WARNING: Passed invalid keyword argument
 "depends".
 WARNING: This will become a hard error in the future.
2019-08-05 16:05:30 +02:00
Beniamino Galvani
df5d76b0dc libnm-core: fix ifcfg-rh variable name for DHCPv6 hostname
Fixes: 2852b50945 ('ifcfg-rh: add DHCPV6_HOSTNAME and DHCPV6_SEND_HOSTNAME vars')
(cherry picked from commit 657b8b31b0)
2019-08-05 16:01:48 +02:00
Beniamino Galvani
657b8b31b0 libnm-core: fix ifcfg-rh variable name for DHCPv6 hostname
Fixes: 2852b50945 ('ifcfg-rh: add DHCPV6_HOSTNAME and DHCPV6_SEND_HOSTNAME vars')
2019-08-05 15:56:16 +02:00
Thomas Haller
66088a09b2 libnm: when stringifying policy routing rule place "not" specifier after "priority"
Otherwise, it just looks odd:

  "not priority 31265 from 0.0.0.0/0 fwmark 0xcb87 table 52103"

Better is:

  "priority 31265 not from 0.0.0.0/0 fwmark 0xcb87 table 52103"

The "not" specifier should come after the priority. It makes more sense
to read it that way. As far as parsing the string is concerned, the
order does not matter. So this change in behavior is no problem.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/228
2019-08-05 10:16:10 +02:00
Beniamino Galvani
e41bb8fc8e settings: fix memory leak
Fixes: d35d3c468a
(cherry picked from commit 956ffb7e96)
2019-08-05 10:11:08 +02:00
Thomas Haller
d4fabd728a cli: merge branch 'th/nmcli-add-and-activate-cleanup'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/227
2019-08-05 10:11:01 +02:00
Thomas Haller
b298f2e605 cli: use cleanup macro for freeing AddAndActivateInfo
We should prefer the cleanup macors nm_auto*() because they express
ownership in code.

Also, they allow to return early without additional cleanup code.
That way we can refactor if-else blocks.

Also, in cases where we intentionally pass on the reference, we use
g_steal_pointer(), which literally spells out what happens in code.
2019-08-05 10:11:01 +02:00
Thomas Haller
cf6cd06422 cli: add helper function to create and initialize AddAndActivateInfo struct
Also use gslice allocator instead of malloc as the size of
AddAndActivateInfo is fixed and known beforehand.
2019-08-05 10:11:01 +02:00
Beniamino Galvani
956ffb7e96 settings: fix memory leak
Fixes: d35d3c468a
2019-08-05 09:36:12 +02:00
Thomas Haller
8b017dc2fb settings: fix registering AgentManager.RegisterWithCapabilities() twice
Fixes: 297d4985ab
(cherry picked from commit 1634fff1ad)
2019-08-03 18:36:15 +02:00
Thomas Haller
1634fff1ad settings: fix registering AgentManager.RegisterWithCapabilities() twice
Fixes: 297d4985ab
2019-08-03 18:33:55 +02:00
Thomas Haller
a3f9ab473b wireguard: fix use-after free in _peers_remove()
(cherry picked from commit 85c26341a2)
2019-08-03 12:28:33 +02:00
Thomas Haller
85c26341a2 wireguard: fix use-after free in _peers_remove() 2019-08-03 12:27:57 +02:00
Thomas Haller
8f2e3d1439 libnm: fix leak in NMSettingWireGuard's update_one_secret()
(cherry picked from commit eea8bbd9ae)
2019-08-03 11:29:41 +02:00
Thomas Haller
eea8bbd9ae libnm: fix leak in NMSettingWireGuard's update_one_secret() 2019-08-03 11:25:10 +02:00
Lubomir Rintel
377a775a2a merge: branch 'lr/nm-d-wifi-con-update'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/219
2019-08-02 23:00:55 +02:00
Lubomir Rintel
a4740fb82a cli: update the existing connection on "dev wifi connect"
If we find a matching connection, ensure it's exactly as we want it
before actually proceeding to activate it. Fixes this problem:

  # nmcli dev wifi connect "Network of Doom" password santa <-- bad
  Error: Connection activation failed: (7) Invalid secrets
  # nmcli dev wifi connect "Network of Doom" password satan <-- correct
  Error: Connection activation failed: (7) Invalid secrets

The password is now correct, but nmcli chose to re-activate the wrong
connection it created previously.
2019-08-02 23:00:26 +02:00
Lubomir Rintel
bc614783f0 cli: take a reference to device in AddAndActivateInfo
The device could vanish in between.
2019-08-02 23:00:26 +02:00
Lubomir Rintel
69ed759ddf cli: remove an unnecessary condition
Do not check for password when creating a simple connection object for
"nmcli dev wifi connect".

This makes no difference in practice. The password is checked for
existence later on and the connection instance is created anyway. This
just makes things look a bit more consistent.
2019-08-02 23:00:26 +02:00
Lubomir Rintel
cc3681c96c cli: (trivial) rename do_device_wifi_connect_network() to do_device_wifi_connect()
This is consistent with the surrounding code and avoids lines
unnecessarily too wide.
2019-08-02 23:00:26 +02:00
Thomas Haller
79660f1f5b supplicant: mark static arrays as const and static in "nm-supplicant-settings-verify.c"
They should be "static" and only visible to this source file.

Also, they should be "const", that allows the linker to place them
into read-only memory.

(cherry picked from commit 722b167953)
2019-08-02 18:19:49 +02:00
Thomas Haller
da933ffe2a supplicant: don't put binary data in error message for supplicant
For better or worse, the API does not require the value to be a
UTF-8 string. We cannot just concatenate binary to a string.
Instead, backslash escape it with utf8safe-escape.

Also, this will shut up a (wrong) coverity warning at this place.

(cherry picked from commit 55143dad95)
2019-08-02 18:19:49 +02:00
Thomas Haller
d99925a1b0 supplicant: fix nm_supplicant_settings_verify_setting() honoring the string length
We must not just pretend that the value is a NULL terminated string.
That's why we have the length argument.

(cherry picked from commit 9ed26de3da)
2019-08-02 18:19:49 +02:00
Thomas Haller
3ebad253e8 device/bluetooth: explicitly ignore return value of ioctl() in nm_bluez5_dun_cleanup()
Coverity doesn't like us not checking the result.

(cherry picked from commit 526601e4f3)
2019-08-02 18:19:49 +02:00
Thomas Haller
3ebeb43c5f libnm: remove dead code in nm_team_setting_config_get()
I was aware that this code is not reachable. But for consistency, it
seems better to be explict about it (to avoid future bugs when refactoring).

Anyway, Coverity complains about it. So assert instead.

(cherry picked from commit 643bc4ca22)
2019-08-02 18:19:49 +02:00
Thomas Haller
722b167953 supplicant: mark static arrays as const and static in "nm-supplicant-settings-verify.c"
They should be "static" and only visible to this source file.

Also, they should be "const", that allows the linker to place them
into read-only memory.
2019-08-02 18:18:30 +02:00
Thomas Haller
55143dad95 supplicant: don't put binary data in error message for supplicant
For better or worse, the API does not require the value to be a
UTF-8 string. We cannot just concatenate binary to a string.
Instead, backslash escape it with utf8safe-escape.

Also, this will shut up a (wrong) coverity warning at this place.
2019-08-02 18:18:30 +02:00
Thomas Haller
9ed26de3da supplicant: fix nm_supplicant_settings_verify_setting() honoring the string length
We must not just pretend that the value is a NULL terminated string.
That's why we have the length argument.
2019-08-02 18:18:30 +02:00
Thomas Haller
526601e4f3 device/bluetooth: explicitly ignore return value of ioctl() in nm_bluez5_dun_cleanup()
Coverity doesn't like us not checking the result.
2019-08-02 18:10:58 +02:00