Track both device and active connections at the same time and decide
whether activation finished (either successfully or not) in a single
place, check_activated().
This makes the already too complex code path a bit more straightforward
and also makes it possible to be more reasonable about the diagnostics.
Now that the active connection signals the reason, we include it; but if
the failure is due to the device disconnection while we're activating,
include a device reason instead, since it's often more useful. Like:
Before:
Error: Connection activation failed.
Without considering the device:
Error: Connection activation failed: the base network connection was interrupted
After:
Error: Connection activation failed: The Wi-Fi network could not be found
In practice, this should only matter when there are multiple
header files with the same name. That is something we try
to avoid already, by giving headers a distinct name.
When building NetworkManager itself, we clearly want to use
double-quotes for including our own headers.
But we also want to do that in our public headers. For example:
./a.c
#include <stdio.h>
#include <nm-1.h>
void main() {
printf ("INCLUDED %s/nm-2.h\n", SYMB);
}
./1/nm-1.h
#include <nm-2.h>
./1/nm-2.h
#define SYMB "1"
./2/nm-2.h
#define SYMB "2"
$ cc -I./2 -I./1 ./a.c
$ ./a.out
INCLUDED 2/nm-2.h
Exceptions to this are
- headers in "shared/nm-utils" that include <NetworkManager.h>. These
headers are copied into projects and hence used like headers owned by
those projects.
- examples/C
This makes it more likely that the user will end up with a master
connection that has connection.interface-name property. This makes it
possible for ifcfg plugin to specify the master in the for of device
name (as opposed to UUID) for compatibility with the legacy network
tooling.
This is equivalent to what nmcli does.
https://bugzilla.redhat.com/show_bug.cgi?id=1369091
This is sort of ugly, because it includes the domain and log levels
verbatim. They're just plain strings on the API, there's no way the
client would know which ones are valid.
On the other hand this kills one of two uses of nmc_parse_args(), which
probably means it's not a very good abstraction and maybe we should get
rid of it altogether. It is in particular unfriendly to argument
completion.
We can't pass the password obtained from
nm_setting_802_1x_get_*private_key_password() to
nm_setting_802_1x_set_*private_key() as the latter also frees the old
password.
Fixes: afd2811028
_return() assigns the return value @retval and asserts that
currently no return-value is assigned -- in order not to overwrite
a once set value.
That requires, that we call _return() and exit the main-loop right
away, without possibility to call _return() again.
However, during client_properties_changed() we easily might
receive the "notify" signal multiple times, and thus call
quit_if_connected() and _return() multiple times. That would
lead to a wrong assertion failure.
Avoid that, by disconnecting the signal handler once we reach
_return().
Fixes: f7875a42b0
libnm-core/nm-setting-bond.c:502:1: error: ‘static’ is not at beginning of declaration [-Werror=old-style-declaration]
const static struct {
^~~~~
In file included from clients/cli/common.c:32:0:
./clients/common/nm-vpn-helpers.h:27:1: error: ‘typedef’ is not at beginning of declaration [-Werror=old-style-declaration]
} typedef VpnPasswordName;
^
When using nm-online -t N, the countdown shows "0s" during the last second.
The countdown value should be rounded up so that "0s" is only shown when the
timeout is actually elapsed.
https://bugzilla.gnome.org/show_bug.cgi?id=778093
Moving nm-online to async init introduced various issues:
- with a timeout of zero, nm-online would terminate with failure
before initializing the NMClient instance.
- add a timeout for safeguarding the async creation of NMClient
- fix adding trailing newline for the progress bar.
While at it, refactor:
- use defines for the exit codes
- don't use exit(), but instead always properly quit the mainloop
and cleanup all resources.
- in non-quiet mode, print the result [online] or [offline] at
the end.
Fixes: c5f17a97eahttps://bugzilla.gnome.org/show_bug.cgi?id=777914
c5f17a97ea changed nm-online to determine
the status asynchronously, however this introduced a regression with
"nm-online -x -q" when there is connectivity.
if ( state == NM_STATE_CONNECTED_LOCAL
|| state == NM_STATE_CONNECTED_SITE
|| state == NM_STATE_CONNECTED_GLOBAL) {
data->retval = 0;
g_main_loop_quit (data->loop);
}
}
if (data->exit_no_nm && (state != NM_STATE_CONNECTING)) {
data->retval = 1;
g_main_loop_quit (data->loop);
}
After setting data->retval = 0 in the "state is connected" branch, the
function falls through to the "exit_no_nm and !connecting" branch,
overwriting data->retval. This causes "nm-online -x -q" to incorrectly
report an offline state.
Adding an explicit "return;" after any state where data->retval is set
ensures that the value isn't overwritten before main() uses it.
Fixes: c5f17a97eahttps://mail.gnome.org/archives/networkmanager-list/2017-January/msg00058.html
If the connection spontaneously disappears (perhaps along with the whole
daemon on crash) while we're deleting it, then the removal callback
would free up the context structure the delete operation is using.
Let's cancel the in-flight delete operations so that they won't touch
the structure after it's gone.
* all getter/setter/describe, ... functions grouped according to properties
* sort the settings groups alphabetically
(cherry picked from commit 418733f2c1)
It results in a rather confusing behavior:
# nmcli c modify wifi \
802-1x.private-key /etc/pki/themostsecret.key \
802-1x.private-key-password verystrong
Error: failed to modify 802-1x.private-key: private key
password not provided.
Moreover, the user might have a good reason for not specifying it on a command
liue and it's not strictly required anyway -- we'll do fine if we don't verify
a private key at addition time.
It helps listing or searching for slave connections. For example, one can do
$ nmcli -f name,uuid,type,slave connection show | awk '$NF == "bridge"'
to show all bridge slave connections.