Commit Graph

26072 Commits

Author SHA1 Message Date
Thomas Haller
7ecc1cfaaf platform: assert struct alignment of NMPlatformIPRoute/NMPlatformIPAddress type 2020-06-05 15:14:30 +02:00
Thomas Haller
21c96342e9 keyfile: merge branch 'th/keyfile-public-api' (part 1)
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/517
2020-06-05 09:18:00 +02:00
Thomas Haller
e2f83d4e92 keyfile: add NMKeyfileHandlerFlags
nm_keyfile_read() and nm_keyfile_write() will be public API.
As such, it must be flexible and extendible for future needs.
There is already the handler callback that fully solves this
(e.g. a future handler event could request whether a certain
behavior is enabled or not).

As additional possibility for future extension, add a flags
argument. Currently no flags are implemented.
2020-06-05 09:17:21 +02:00
Thomas Haller
00b3a3505a keyfile: add nm_keyfile_handler_data_warn_get() and construct message lazy
Add an accessor for the warning event.

Also, as we now have an accessor, we can construct the warning
message only if it actually needed.
2020-06-05 09:17:20 +02:00
Thomas Haller
4230a1d4fb keyfile: add accessors for NMKeyfileHandlerData
For introspection/bindings it is cumbersome to access the
fields of the NMKeyfileHandlerData struct. Instead add accessor
functions.

Also, we wouldn't want to expose the struct in public API directly,
because it makes it harder to extend it without breaking ABI.
2020-06-05 09:17:20 +02:00
Thomas Haller
7d47a8fdbf keyfile: add handler context for all parser callbacks
From inside a callback 4 properties are potentially interesting
to all callbacks: the currenty group, key, setting and property-name.

Refactor the code to track these properties in NMKeyfileHandlerData
and distinguish between the property name and the keyfile key.
2020-06-05 09:17:19 +02:00
Thomas Haller
5c67b72bb7 keyfile: use cleanup attribute for GBytes and GByteArray 2020-06-05 09:17:19 +02:00
Thomas Haller
021726e54e keyfile: don't check for info->error before calling handle_warn()
When an error gets set, we should abort right away. We should
not come into a situation where we would try to emit another warning.

Don't check for a condition that should never happen and assert
against it.
2020-06-05 09:17:19 +02:00
Thomas Haller
8afb8ba819 keyfile: style cleanup calling handle_warn() 2020-06-05 09:17:18 +02:00
Thomas Haller
ab7d0c62f9 keyfile: rework error reporting from read/write handler
Setting the error on the callback does not work well from bindings.
Instead, let bindings call a (future) nm_keyfile_handler_data_fail_with_error()
function on the handler_data to indicate failure.
2020-06-05 09:17:18 +02:00
Thomas Haller
e3d7ba89e5 keyfile: rename handler variable in KeyfileReaderInfo and KeyfileWriterInfo 2020-06-05 09:17:18 +02:00
Thomas Haller
0bfdb26973 keyfile: add NMKeyfileHandlerData typedef for arguments of keyfile callbacks
As the keyfile handler callback will become public API, it needs to be
usable via bindings. A plain void pointer is not usable. Instead, add
a new type that can be used via introspection.
2020-06-05 09:17:18 +02:00
Thomas Haller
18c1fe6ed8 keyfile: merge NMKeyfile{Read,Write}Type as NMKeyfileHandlerType
This will become public API. The enum for read and write callback
serves very similar purposes. Merge them so that we have fewer
types in the public API.
2020-06-05 09:17:14 +02:00
Thomas Haller
ccac506a8a build: print deleted references in release.sh script 2020-06-04 13:17:57 +02:00
Thomas Haller
61b9201898 build: print commands in color for release.sh script 2020-06-04 12:31:39 +02:00
Thomas Haller
207fd8dfb1 build: implement release mode "rc" in release.sh script
Still not implemented are the first release candidate (rc1)
and the major release.
2020-06-04 11:54:31 +02:00
Thomas Haller
bbb95c979e build: optionally sign source tarball in build.sh script
This defaults to $DO_RELEASE. In that case, the script will also GPG sign
the source tarball.

The purpose is that when we do a release we want to ensure that the
published tarball is really the one that we generated. In that case,
the SHA sum would suffice, however that requires you to manually note
it down and compare the result. With the gpg signature, that
verification can be better automated.
2020-06-04 11:33:00 +02:00
Thomas Haller
0ac05a3faa build: add "release.sh" script
Currently only "minor" and "devel" releases are implement. It's also not yet
tested with --no-dry-run, because that would actually create a release.

Test it when using it the next time.
2020-06-04 10:51:12 +02:00
Thomas Haller
c9b36b1370 libnm/crypto: suppress "-Wstrict-prototypes" warning in NSS library
On Debian sid, libnss3-dev (2:3.53-1) causes a compiler warning:

  In file included from ../libnm-core/nm-crypto-nss.c:13:
  /usr/include/nss/pk11pub.h:951:1: error: function declaration isn't a prototype [-Werror=strict-prototypes]
    951 | int SECMOD_GetSystemFIPSEnabled();
        | ^~~
2020-06-03 23:08:33 +02:00
Thomas Haller
65b6fc7871 nettools: reimport nettools' n-dhcp4 and rework logging
git subtree pull --prefix shared/n-dhcp4/ git@github.com:nettools/n-dhcp4.git master --squash
2020-06-03 22:34:22 +02:00
Thomas Haller
cc3e23d2e5 Squashed 'shared/n-dhcp4/' changes from fb1d43449ba8..6876b73ec113
6876b73ec113 all: rework logging to append logging messages to the event queue
65ca0e4bea32 client: check length of client id for n_dhcp4_client_config_set_client_id()
6a9ca10b7ad6 client: close timer file descriptor explicitly when EPOLL_CTL_ADD fails
e5f3b27f5301 connection: don't fail dispatch in case of receive errors
68790d5ec950 connection: keep trying after a failure in send()
788b03891cd0 n-dhcp4: fix logging macro
6cd0fd5e8b3f probe: request previous address after expiration
ef11c7079ad7 connection: avoid double free of NDhcp4Outgoing
922a9a2326e7 n-dhcp4: fix initialization of the 'secs' DHCP header field
7fff54117436 outgoing: fix uninitialized variable in n_dhcp4_outgoing_append()
27547faaf258 probe: move back to INIT after lease expires
d07cb4e32884 incoming: accept options that are longer than requested
34d365e2267f client: handle invalid return codes gracefully during n_dhcp4_client_dispatch()
2e8c6017f85b n-dhcp4: use packet socket in rebinding state
9a7c82143c06 n-dhcp4: support init-reboot state
e615e3f5b063 n-dhcp4/socket: use SO_REUSEADDR on UDP socket
8dbfa1ad2549 merge branch 'bengal:log'
6e50189fba86 n-dhcp4: log outgoing packets
aea0315d3862 n-dhcp4: log incoming packets
1ca64a82393d n-dhcp4: add logging API
72c16a0028ac client-probe: fix state transitions on timer dispatch
c023ae2ad829 merge branch 'leasetime'
780f94c333ca lease: add n_dhcp4_client_lease_get_basetime()
a94378274cf4 incoming: don't handle 0xFFFFFFFF timestamps special in n_dhcp4_incoming_query_u32()
6bb277aefe0b probe: unconditionally pass ownership of message in n_dhcp4_client_probe_dispatch_io()
1cf87c90c6a1 probe: fix leaking message during client probe
55239cef2d63 lease: remove unreachable code in n_dhcp4_incoming_get_timeouts()
fa5ee7903061 lease: expose the server IP address
0cfce4a4fe07 all: merge branch 'th/build-centos76'
cae4868e5f7e all: avoid {net,linux}/if.h clashes on old distros
05859a3e4d32 all: avoid c_min() macro to work with old GCC
0be7033dd940 probe: arm timers in bound state
8735cdb0f95f ci: switch to c-util automation
a0bb7c69a11a client: fallback to CLOCK_MONOTONIC for timerfd
308cb242caf7 ci: disable valgrind run
468c93195ad3 build: update submodules
9d0f690f9ee8 ci: switch to github actions
9ba143a037bb probe: allocate memory of right size in n_dhcp4_client_probe_option_new()
2546aa2c809d util/link: suppress gcc warning
e4a01f5870a6 ci: drop broken armv7hl
2e2fbfa18f2c build: update submodules
6277dfd20eca Merge pull request #2 from NetworkManager/th/declaration-after-statement
1b660ae2d12a outgoing: avoid "-Werror=declaration-after-statement" warning with static_assert
f34a54cd9719 client/probe: fix memory leak
21e68f3bba80 client/connection: fix memory leak

git-subtree-dir: shared/n-dhcp4
git-subtree-split: 6876b73ec113328712a5cdc2ffb9497fd774c0e2
2020-06-03 22:21:50 +02:00
Thomas Haller
53f27cfd40 shared/n-acd: reimport
git subtree pull --prefix shared/n-acd git@github.com:nettools/n-acd.git master --squash
2020-06-03 22:14:39 +02:00
Thomas Haller
2a30e4b75b Squashed 'shared/n-acd/' changes from 54708168399f..0237ba54bef7
0237ba54bef7 ci: switch to c-util automation
0a8c47d55a65 ci: switch to github-actions
b10e6918ab42 build: update submodules
596b7e70acbe n-acd: fix valgrind warnings
70e2822584e0 build: update submodules
1446edb496d9 ci: drop broken armv7hl
6093f34b019b n-acd: fix leaking socket handle in n_acd_socket_new() when setsockopt() fails

git-subtree-dir: shared/n-acd
git-subtree-split: 0237ba54bef7d91232a9285c2ec93f3e5691a1b2
2020-06-03 22:11:43 +02:00
Thomas Haller
fc11843fdc shared/c-siphash: reimport
git subtree pull --prefix shared/c-siphash git@github.com:c-util/c-siphash.git master --squash
2020-06-03 22:10:22 +02:00
Thomas Haller
adea439ed2 Squashed 'shared/c-siphash/' changes from 7c42c5925819..996b79578d94
996b79578d94 ci: switch to c-util automation
2d159c7da1d5 ci: switch to github-actions
191416c20ec1 ci: drop broken armv7hl
719b1b0138a2 build: update submodules

git-subtree-dir: shared/c-siphash
git-subtree-split: 996b79578d94a6569c42aae1bf806e63b8c6fa9a
2020-06-03 22:09:14 +02:00
Thomas Haller
f9641b6b47 shared/c-rbtree: reimport
git subtree pull --prefix shared/c-rbtree git@github.com:c-util/c-rbtree.git master --squash
2020-06-03 22:08:05 +02:00
Thomas Haller
01e12646a6 Squashed 'shared/c-rbtree/' changes from b46392d25de7..7624b79b26d0
7624b79b26d0 ci: switch to c-util automation
c8cf17527845 ci: run additional CI with ptrace
7069619bc3a5 ci: switch to github-actions
fa97402c3faa ci: drop broken armv7hl
4d48f58a3c31 build: update submodules

git-subtree-dir: shared/c-rbtree
git-subtree-split: 7624b79b26d020a796fe7c624a4f2d3340f3d66b
2020-06-03 22:07:07 +02:00
Thomas Haller
a75d7de78b shared/c-stdaux: reimport
git subtree pull --prefix shared/c-stdaux git@github.com:c-util/c-stdaux.git master --squash
2020-06-03 22:05:14 +02:00
Thomas Haller
bcf93a2800 Squashed 'shared/c-stdaux/' changes from 11930d259212..3b35c47d2bee
3b35c47d2bee ci: switch to c-util automation
8b8f941c57a7 ci: switch to github-actions
d6ecce8afbb7 ci: drop broken armv7hl

git-subtree-dir: shared/c-stdaux
git-subtree-split: 3b35c47d2bee2d1c08fa8bf30e5259155d821712
2020-06-03 22:03:36 +02:00
Thomas Haller
70c71151c6 shared/c-list: reimport
git subtree pull --prefix shared/c-list git@github.com:c-util/c-list.git master --squash
2020-06-03 22:00:56 +02:00
Thomas Haller
722510b73d Squashed 'shared/c-list/' changes from 2e4b605c6217..ac7c83139821
ac7c83139821 ci: switch to c-util automation
6c53ef1c0066 ci: switch to github-actions
b1cd4dbf967d Fix assignment instead of comparison
50e67beedbd9 ci: drop broken armv7hl

git-subtree-dir: shared/c-list
git-subtree-split: ac7c831398219acd8d63038e866035a6f86f9e21
2020-06-03 21:59:32 +02:00
Thomas Haller
b698c92861 TODO: add new items 2020-06-03 20:03:34 +02:00
Thomas Haller
b5c440f54a TODO: drop completed item "Implement NM_DEVICE_STATE_DISCONNECTING"
This seems to be done.
2020-06-03 20:03:34 +02:00
Thomas Haller
e171ae5f7a TODO: drop completed item "Internet Connectivity Detection Enhancements"
This is mostly done. What is not done is to delay the ACTIVATED state
until the connectivty check passed. Delaying that might be problematic
and should only be done as opt-in. Unclear whether that would ever be useful
though.
2020-06-03 20:03:34 +02:00
Thomas Haller
462877084f core: fix maybe-uninitialized warning in periodic_update_active_connection_timestamps()
../src/nm-manager.c: In function periodic_update_active_connection_timestamps:
  ../src/nm-manager.c:7358:43: error: t may be used uninitialized in this function [-Werror=maybe-uninitialized]
     nm_settings_connection_update_timestamp (nm_active_connection_get_settings_connection (ac),
                                             ^
Fixes: 6f3ae8a563 ('core: in periodic_update_active_connection_timestamps() use same timestamp')
2020-06-03 20:03:34 +02:00
Thomas Haller
aeb81183de core: drop mask argument from nm_settings_connection_autoconnect_blocked_reason_get()
We don't need the mask argument. If the caller wants to check only for certain
flags, she can do that right away with

  NM_FLAGS_ANY (nm_settings_connection_autoconnect_blocked_reason_get (sett_con), flags)
2020-06-03 18:35:54 +02:00
Thomas Haller
fce4fa1cbf settings: merge branch 'unblock-autoconnect-on-secrets'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/507
2020-06-03 18:31:20 +02:00
Alfonso Sánchez-Beato
440a5c03b3 settings: unblock autoconnect on new secrets
When the secrets for a connection are updated, unblock autoconnection
in case it had been blocked previously due to bad or no
secrets. Otherwise we would need to manually activate the connection
or restart NM to get another try with the new secrets.
2020-06-03 18:29:12 +02:00
Alfonso Sánchez-Beato
fcfc12d50f settings: move up autoconnect initialization functions
Move autoconnect initialization functions up so we can use them from
update_auth_cb.
2020-06-03 18:29:12 +02:00
Thomas Haller
6022af9963 wifi: merge branch 'th/connection-timestamp-for-wifi'
https://bugzilla.redhat.com/show_bug.cgi?id=1781253

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/524
2020-06-03 18:26:52 +02:00
Thomas Haller
9be9ad4843 NEWS: update 2020-06-03 18:25:33 +02:00
Thomas Haller
835175e4fb Revert "wifi: don't autoconnect to networks that have never been successful"
As commit ccfe5fec8d ('wifi: don't autoconnect to networks that have
never been successful') explains, Wi-Fi profiles only autoconnected
if they had no or a positive timestamp.

The problem that tried to solve is when a user accidentally clicks on a
Wi-Fi network in applet. Then the created profile may not be usable
(because of wrong credentials). To avoid indefinitely to autoconnect,
uch a profile will have a timestamp of 0, which prevents further
auto activations.

However, I find that problematic.

An important use case is pre-deploying profiles. In that case, the user
cannot set the timestamp, because the timestamp cache
/var/lib/NetworkManager/timestamps is internal, undocumented API. Also,
ifcfg-rh doesn't support the timestamp and anyway, does the timestamp
of the NMConnection does not get honored (only the one from the
timestamps file).
Maybe that could be an alternative solution here, to allow the user to
mark profiles as "I really want it to autoconnect". But that seems
unnecessary and wrong to me.

The problem really is that the user cannot do anything to ensure that
autoconnect will work tomorrow (short of editing the timestamps
database). The problem is that the property of whether a profile
every connected successfully is not in direct control of the user (it
depends on external conditions).

If the user has bogus profiles configured, those profiles should be
deleted (or autoconnect disabled) and not keep autoconnect blocked.

Also note that if you are at home and accidentally click on your
neighbour's Wi-Fi network, then you presumably still also have a working
profile to your own network. That usable profile will have a more
recent timestamp and be preferred during autoconnect already.

This reverts commit ccfe5fec8d.

https://bugzilla.redhat.com/show_bug.cgi?id=1781253
2020-06-03 18:25:33 +02:00
Thomas Haller
a9d20141b9 core: log changes to the profile timestamp 2020-06-03 18:25:33 +02:00
Thomas Haller
c3db3e0044 core: don't do anything if there are no changes in nm_settings_connection_update_timestamp()
Updating the timestamp marks the keyfile database as dirty. Avoid
that, if there is no change. Of course, nm_key_file_db_set_value()
itself already checks whether the are any changes, and does nothing
if there aren't.

Simply perform the check earlier, to do nothing.
2020-06-03 18:25:32 +02:00
Thomas Haller
6f3ae8a563 core: in periodic_update_active_connection_timestamps() use same timestamp
When performing  a synchronous action together (like iterating
over all settings and set the current timestamp), it's nicer
to pretend that all this would happen instantaneously. That means,
ensure we use the same timestamp throughout.

On a minor point, there really is no need to call time() multiple times.
2020-06-03 18:25:11 +02:00
Thomas Haller
968b444603 initrd: drop unused include of platform header 2020-06-03 18:08:37 +02:00
Thomas Haller
1c2d9581e9 initrd: use nm_streq()/NM_IN_STRSET() instead of strcmp()
Code like

»···»···if (strcmp (tag, "net.ifnames") == 0)
»···»···»···net_ifnames = strcmp (argument, "0") != 0;

is really hard to understand (at least to me). Compare to

»···»···if (nm_streq (tag, "net.ifnames"))
»···»···»···net_ifnames = !nm_streq (argument, "0");
2020-06-03 18:00:05 +02:00
Thomas Haller
b4fb2a4f94 contrib/rpm: remove trailing whitespaces from spec file 2020-05-29 17:06:59 +02:00
Beniamino Galvani
043be7699c release: bump version to 1.25.2-dev 2020-05-29 16:14:16 +02:00
Beniamino Galvani
2a9c009a21 NEWS: update 2020-05-29 16:14:16 +02:00