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.
This commit is contained in:
Thomas Haller 2019-08-06 13:01:05 +02:00
commit 96339fa5ea
20 changed files with 268 additions and 213 deletions

View file

@ -2933,7 +2933,8 @@ do_connection_up (NmCli *nmc, int argc, char **argv)
pwds = *argv; pwds = *argv;
} }
else if (!nmc->complete) { else if (!nmc->complete) {
g_printerr (_("Unknown parameter: %s\n"), *argv); g_string_printf (nmc->return_text, _("Error: invalid extra argument '%s'."), *argv);
return NMC_RESULT_ERROR_USER_INPUT;
} }
next_arg (nmc, &argc, &argv, NULL); next_arg (nmc, &argc, &argv, NULL);
@ -3135,7 +3136,7 @@ do_connection_down (NmCli *nmc, int argc, char **argv)
} }
if (arg_num == 0) { if (arg_num == 0) {
g_string_printf (nmc->return_text, _("Error: No connection specified.")); g_string_printf (nmc->return_text, _("Error: No connection specified."));
NMC_RETURN (nmc, NMC_RESULT_ERROR_USER_INPUT); return NMC_RESULT_ERROR_USER_INPUT;
} }
} }
@ -3153,7 +3154,7 @@ do_connection_down (NmCli *nmc, int argc, char **argv)
arg_ptr++; arg_ptr++;
if (!arg_num) { if (!arg_num) {
g_string_printf (nmc->return_text, _("Error: %s argument is missing."), selector); g_string_printf (nmc->return_text, _("Error: %s argument is missing."), selector);
NMC_RETURN (nmc, NMC_RESULT_ERROR_USER_INPUT); return NMC_RESULT_ERROR_USER_INPUT;
} }
} }
@ -3174,7 +3175,7 @@ do_connection_down (NmCli *nmc, int argc, char **argv)
if (!found_active_cons) { if (!found_active_cons) {
g_string_printf (nmc->return_text, _("Error: no active connection provided.")); g_string_printf (nmc->return_text, _("Error: no active connection provided."));
NMC_RETURN (nmc, NMC_RESULT_ERROR_NOT_FOUND); return NMC_RESULT_ERROR_NOT_FOUND;
} }
nm_assert (found_active_cons->len > 0); nm_assert (found_active_cons->len > 0);
@ -8220,7 +8221,7 @@ do_connection_edit (NmCli *nmc, int argc, char **argv)
else { else {
if (!nmc_parse_args (exp_args, TRUE, &argc, &argv, &error)) { if (!nmc_parse_args (exp_args, TRUE, &argc, &argv, &error)) {
g_string_assign (nmc->return_text, error->message); g_string_assign (nmc->return_text, error->message);
NMC_RETURN (nmc, error->code); return error->code;
} }
} }
@ -8250,7 +8251,7 @@ do_connection_edit (NmCli *nmc, int argc, char **argv)
} else { } else {
g_string_printf (nmc->return_text, g_string_printf (nmc->return_text,
_("Error: only one of 'id', 'filename', uuid, or 'path' can be provided.")); _("Error: only one of 'id', 'filename', uuid, or 'path' can be provided."));
NMC_RETURN (nmc, NMC_RESULT_ERROR_USER_INPUT); return NMC_RESULT_ERROR_USER_INPUT;
} }
} }
@ -8264,7 +8265,7 @@ do_connection_edit (NmCli *nmc, int argc, char **argv)
if (!found_con) { if (!found_con) {
g_string_printf (nmc->return_text, _("Error: Unknown connection '%s'."), con); g_string_printf (nmc->return_text, _("Error: Unknown connection '%s'."), con);
NMC_RETURN (nmc, NMC_RESULT_ERROR_NOT_FOUND); return NMC_RESULT_ERROR_NOT_FOUND;
} }
/* Duplicate the connection and use that so that we need not /* Duplicate the connection and use that so that we need not
@ -8418,7 +8419,7 @@ do_connection_modify (NmCli *nmc,
connection = get_connection (nmc, &argc, &argv, NULL, NULL, NULL, &error); connection = get_connection (nmc, &argc, &argv, NULL, NULL, NULL, &error);
if (!connection) { if (!connection) {
g_string_printf (nmc->return_text, _("Error: %s."), error->message); g_string_printf (nmc->return_text, _("Error: %s."), error->message);
NMC_RETURN (nmc, error->code); return error->code;
} }
rc = nm_client_get_connection_by_uuid (nmc->client, rc = nm_client_get_connection_by_uuid (nmc->client,
@ -8426,12 +8427,12 @@ do_connection_modify (NmCli *nmc,
if (!rc) { if (!rc) {
g_string_printf (nmc->return_text, _("Error: Unknown connection '%s'."), g_string_printf (nmc->return_text, _("Error: Unknown connection '%s'."),
nm_connection_get_uuid (connection)); nm_connection_get_uuid (connection));
NMC_RETURN (nmc, NMC_RESULT_ERROR_NOT_FOUND); return NMC_RESULT_ERROR_NOT_FOUND;
} }
if (!nmc_read_connection_properties (nmc, NM_CONNECTION (rc), &argc, &argv, &error)) { if (!nmc_read_connection_properties (nmc, NM_CONNECTION (rc), &argc, &argv, &error)) {
g_string_assign (nmc->return_text, error->message); g_string_assign (nmc->return_text, error->message);
NMC_RETURN (nmc, error->code); return error->code;
} }
if (nmc->complete) if (nmc->complete)
@ -8509,7 +8510,7 @@ do_connection_clone (NmCli *nmc, int argc, char **argv)
connection = get_connection (nmc, argc_ptr, argv_ptr, NULL, NULL, NULL, &error); connection = get_connection (nmc, argc_ptr, argv_ptr, NULL, NULL, NULL, &error);
if (!connection) { if (!connection) {
g_string_printf (nmc->return_text, _("Error: %s."), error->message); g_string_printf (nmc->return_text, _("Error: %s."), error->message);
NMC_RETURN (nmc, error->code); return error->code;
} }
if (nmc->complete) if (nmc->complete)
@ -8522,12 +8523,12 @@ do_connection_clone (NmCli *nmc, int argc, char **argv)
_("New connection name: ")); _("New connection name: "));
} else { } else {
g_string_printf (nmc->return_text, _("Error: <new name> argument is missing.")); g_string_printf (nmc->return_text, _("Error: <new name> argument is missing."));
NMC_RETURN (nmc, NMC_RESULT_ERROR_USER_INPUT); return NMC_RESULT_ERROR_USER_INPUT;
} }
if (next_arg (nmc->ask ? NULL : nmc, argc_ptr, argv_ptr, NULL) == 0) { if (next_arg (nmc->ask ? NULL : nmc, argc_ptr, argv_ptr, NULL) == 0) {
g_string_printf (nmc->return_text, _("Error: unknown extra argument: '%s'."), *argv); g_string_printf (nmc->return_text, _("Error: unknown extra argument: '%s'."), *argv);
NMC_RETURN (nmc, NMC_RESULT_ERROR_USER_INPUT); return NMC_RESULT_ERROR_USER_INPUT;
} }
new_connection = nm_simple_connection_new_clone (connection); new_connection = nm_simple_connection_new_clone (connection);
@ -8858,7 +8859,7 @@ do_connection_import (NmCli *nmc, int argc, char **argv)
filename = nm_strstrip (filename_ask); filename = nm_strstrip (filename_ask);
} else { } else {
g_string_printf (nmc->return_text, _("Error: No arguments provided.")); g_string_printf (nmc->return_text, _("Error: No arguments provided."));
NMC_RETURN (nmc, NMC_RESULT_ERROR_USER_INPUT); return NMC_RESULT_ERROR_USER_INPUT;
} }
} }
@ -8874,7 +8875,7 @@ do_connection_import (NmCli *nmc, int argc, char **argv)
argv++; argv++;
if (!argc) { if (!argc) {
g_string_printf (nmc->return_text, _("Error: %s argument is missing."), *(argv-1)); g_string_printf (nmc->return_text, _("Error: %s argument is missing."), *(argv-1));
NMC_RETURN (nmc, NMC_RESULT_ERROR_USER_INPUT); return NMC_RESULT_ERROR_USER_INPUT;
} }
if ( argc == 1 if ( argc == 1
@ -8895,7 +8896,7 @@ do_connection_import (NmCli *nmc, int argc, char **argv)
argv++; argv++;
if (!argc) { if (!argc) {
g_string_printf (nmc->return_text, _("Error: %s argument is missing."), *(argv-1)); g_string_printf (nmc->return_text, _("Error: %s argument is missing."), *(argv-1));
NMC_RETURN (nmc, NMC_RESULT_ERROR_USER_INPUT); return NMC_RESULT_ERROR_USER_INPUT;
} }
if (argc == 1 && nmc->complete) if (argc == 1 && nmc->complete)
nmc->return_value = NMC_RESULT_COMPLETE_FILE; nmc->return_value = NMC_RESULT_COMPLETE_FILE;
@ -8904,8 +8905,8 @@ do_connection_import (NmCli *nmc, int argc, char **argv)
else else
g_printerr (_("Warning: 'file' already specified, ignoring extra one.\n")); g_printerr (_("Warning: 'file' already specified, ignoring extra one.\n"));
} else { } else {
g_string_printf (nmc->return_text, _("Unknown parameter: %s"), *argv); g_string_printf (nmc->return_text, _("Error: invalid extra argument '%s'."), *argv);
NMC_RETURN (nmc, NMC_RESULT_ERROR_USER_INPUT); return NMC_RESULT_ERROR_USER_INPUT;
} }
next_arg (nmc, &argc, &argv, NULL); next_arg (nmc, &argc, &argv, NULL);
@ -8916,11 +8917,11 @@ do_connection_import (NmCli *nmc, int argc, char **argv)
if (!type) { if (!type) {
g_string_printf (nmc->return_text, _("Error: 'type' argument is required.")); g_string_printf (nmc->return_text, _("Error: 'type' argument is required."));
NMC_RETURN (nmc, NMC_RESULT_ERROR_USER_INPUT); return NMC_RESULT_ERROR_USER_INPUT;
} }
if (!filename) { if (!filename) {
g_string_printf (nmc->return_text, _("Error: 'file' argument is required.")); g_string_printf (nmc->return_text, _("Error: 'file' argument is required."));
NMC_RETURN (nmc, NMC_RESULT_ERROR_USER_INPUT); return NMC_RESULT_ERROR_USER_INPUT;
} }
if (nm_streq (type, "wireguard")) if (nm_streq (type, "wireguard"))
@ -8929,7 +8930,7 @@ do_connection_import (NmCli *nmc, int argc, char **argv)
service_type = nm_vpn_plugin_info_list_find_service_type (nm_vpn_get_plugin_infos (), type); service_type = nm_vpn_plugin_info_list_find_service_type (nm_vpn_get_plugin_infos (), type);
if (!service_type) { if (!service_type) {
g_string_printf (nmc->return_text, _("Error: failed to find VPN plugin for %s."), type); g_string_printf (nmc->return_text, _("Error: failed to find VPN plugin for %s."), type);
NMC_RETURN (nmc, NMC_RESULT_ERROR_UNKNOWN); return NMC_RESULT_ERROR_UNKNOWN;
} }
/* Import VPN configuration */ /* Import VPN configuration */
@ -8937,7 +8938,7 @@ do_connection_import (NmCli *nmc, int argc, char **argv)
if (!plugin) { if (!plugin) {
g_string_printf (nmc->return_text, _("Error: failed to load VPN plugin: %s."), g_string_printf (nmc->return_text, _("Error: failed to load VPN plugin: %s."),
error->message); error->message);
NMC_RETURN (nmc, NMC_RESULT_ERROR_UNKNOWN); return NMC_RESULT_ERROR_UNKNOWN;
} }
connection = nm_vpn_editor_plugin_import (plugin, filename, &error); connection = nm_vpn_editor_plugin_import (plugin, filename, &error);
@ -8946,7 +8947,7 @@ do_connection_import (NmCli *nmc, int argc, char **argv)
if (!connection) { if (!connection) {
g_string_printf (nmc->return_text, _("Error: failed to import '%s': %s."), g_string_printf (nmc->return_text, _("Error: failed to import '%s': %s."),
filename, error->message); filename, error->message);
NMC_RETURN (nmc, NMC_RESULT_ERROR_UNKNOWN); return NMC_RESULT_ERROR_UNKNOWN;
} }
add_connection (nmc->client, add_connection (nmc->client,

View file

@ -1681,9 +1681,9 @@ do_devices_status (NmCli *nmc, int argc, char **argv)
if (nmc->complete) if (nmc->complete)
return nmc->return_value; return nmc->return_value;
while (argc > 0) { if (argc) {
g_printerr (_("Unknown parameter: %s\n"), *argv); g_string_printf (nmc->return_text, _("Error: invalid extra argument '%s'."), *argv);
next_arg (nmc, &argc, &argv, NULL); return NMC_RESULT_ERROR_USER_INPUT;
} }
if (!nmc->required_fields || strcasecmp (nmc->required_fields, "common") == 0) if (!nmc->required_fields || strcasecmp (nmc->required_fields, "common") == 0)
@ -1836,20 +1836,52 @@ connected_state_cb (NMDevice *device, NMActiveConnection *active)
typedef struct { typedef struct {
NmCli *nmc; NmCli *nmc;
NMDevice *device; NMDevice *device;
gboolean hotspot; char *specific_object;
gboolean create; bool hotspot:1;
bool create:1;
} AddAndActivateInfo; } AddAndActivateInfo;
static AddAndActivateInfo *
add_and_activate_info_new (NmCli *nmc,
NMDevice *device,
gboolean hotspot,
gboolean create,
const char *specific_object)
{
AddAndActivateInfo *info;
info = g_slice_new (AddAndActivateInfo);
*info = (AddAndActivateInfo) {
.nmc = nmc,
.device = g_object_ref (device),
.hotspot = hotspot,
.create = create,
.specific_object = g_strdup (specific_object),
};
return info;
}
static void
add_and_activate_info_free (AddAndActivateInfo *info)
{
g_object_unref (info->device);
g_free (info->specific_object);
nm_g_slice_free (info);
}
NM_AUTO_DEFINE_FCN0 (AddAndActivateInfo *, _nm_auto_free_add_and_activate_info, add_and_activate_info_free)
#define nm_auto_free_add_and_activate_info nm_auto (_nm_auto_free_add_and_activate_info)
static void static void
add_and_activate_cb (GObject *client, add_and_activate_cb (GObject *client,
GAsyncResult *result, GAsyncResult *result,
gpointer user_data) gpointer user_data)
{ {
AddAndActivateInfo *info = (AddAndActivateInfo *) user_data; nm_auto_free_add_and_activate_info AddAndActivateInfo *info = user_data;
NmCli *nmc = info->nmc; NmCli *nmc = info->nmc;
NMDevice *device = info->device; NMDevice *device = info->device;
NMActiveConnection *active; gs_unref_object NMActiveConnection *active = NULL;
GError *error = NULL; gs_free_error GError *error = NULL;
if (info->create) if (info->create)
active = nm_client_add_and_activate_connection_finish (NM_CLIENT (client), result, &error); active = nm_client_add_and_activate_connection_finish (NM_CLIENT (client), result, &error);
@ -1857,37 +1889,36 @@ add_and_activate_cb (GObject *client,
active = nm_client_activate_connection_finish (NM_CLIENT (client), result, &error); active = nm_client_activate_connection_finish (NM_CLIENT (client), result, &error);
if (error) { if (error) {
if (info->hotspot) if (info->hotspot) {
g_string_printf (nmc->return_text, _("Error: Failed to setup a Wi-Fi hotspot: %s"), g_string_printf (nmc->return_text, _("Error: Failed to setup a Wi-Fi hotspot: %s"),
error->message); error->message);
else if (info->create) } else if (info->create) {
g_string_printf (nmc->return_text, _("Error: Failed to add/activate new connection: %s"), g_string_printf (nmc->return_text, _("Error: Failed to add/activate new connection: %s"),
error->message); error->message);
else } else {
g_string_printf (nmc->return_text, _("Error: Failed to activate connection: %s"), g_string_printf (nmc->return_text, _("Error: Failed to activate connection: %s"),
error->message); error->message);
g_error_free (error); }
nmc->return_value = NMC_RESULT_ERROR_CON_ACTIVATION; nmc->return_value = NMC_RESULT_ERROR_CON_ACTIVATION;
quit (); quit ();
} else { return;
if (nmc->nowait_flag) {
g_object_unref (active);
quit ();
} else {
g_object_ref (device);
g_signal_connect (device, "notify::state", G_CALLBACK (device_state_cb), active);
g_signal_connect (active, "notify::state", G_CALLBACK (active_state_cb), device);
connected_state_cb (device, active);
g_timeout_add_seconds (nmc->timeout, timeout_cb, nmc); /* Exit if timeout expires */
if (nmc->nmc_config.print_output == NMC_PRINT_PRETTY)
progress_id = g_timeout_add (120, progress_cb, device);
}
} }
g_free (info); if (nmc->nowait_flag) {
quit ();
return;
}
g_signal_connect (device, "notify::state", G_CALLBACK (device_state_cb), active);
g_signal_connect (active, "notify::state", G_CALLBACK (active_state_cb), device);
connected_state_cb (g_object_ref (device),
g_steal_pointer (&active));
g_timeout_add_seconds (nmc->timeout, timeout_cb, nmc); /* Exit if timeout expires */
if (nmc->nmc_config.print_output == NMC_PRINT_PRETTY)
progress_id = g_timeout_add (120, progress_cb, device);
} }
static void static void
@ -1916,9 +1947,9 @@ create_connect_connection_for_device (AddAndActivateInfo *info)
static void static void
connect_device_cb (GObject *client, GAsyncResult *result, gpointer user_data) connect_device_cb (GObject *client, GAsyncResult *result, gpointer user_data)
{ {
AddAndActivateInfo *info = (AddAndActivateInfo *) user_data; nm_auto_free_add_and_activate_info AddAndActivateInfo *info = user_data;
NmCli *nmc = info->nmc; NmCli *nmc = info->nmc;
NMActiveConnection *active; gs_unref_object NMActiveConnection *active = NULL;
GError *error = NULL; GError *error = NULL;
const GPtrArray *devices; const GPtrArray *devices;
NMDevice *device; NMDevice *device;
@ -1929,7 +1960,7 @@ connect_device_cb (GObject *client, GAsyncResult *result, gpointer user_data)
/* If no connection existed for the device, create one and activate it */ /* If no connection existed for the device, create one and activate it */
if (g_error_matches (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_UNKNOWN_CONNECTION)) { if (g_error_matches (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_UNKNOWN_CONNECTION)) {
info->create = TRUE; info->create = TRUE;
create_connect_connection_for_device (info); create_connect_connection_for_device (g_steal_pointer (&info));
return; return;
} }
@ -1938,42 +1969,41 @@ connect_device_cb (GObject *client, GAsyncResult *result, gpointer user_data)
g_error_free (error); g_error_free (error);
nmc->return_value = NMC_RESULT_ERROR_CON_ACTIVATION; nmc->return_value = NMC_RESULT_ERROR_CON_ACTIVATION;
quit (); quit ();
} else { return;
g_assert (active);
devices = nm_active_connection_get_devices (active);
if (devices->len == 0) {
g_string_printf (nmc->return_text, _("Error: Device activation failed: device was disconnected"));
nmc->return_value = NMC_RESULT_ERROR_CON_ACTIVATION;
g_object_unref (active);
quit ();
g_free (info);
return;
}
device = g_ptr_array_index (devices, 0);
if (nmc->nowait_flag) {
g_object_unref (active);
quit ();
} else {
if (nmc->secret_agent) {
NMRemoteConnection *connection = nm_active_connection_get_connection (active);
nm_secret_agent_simple_enable (nmc->secret_agent,
nm_connection_get_path (NM_CONNECTION (connection)));
}
g_object_ref (device);
g_signal_connect (device, "notify::state", G_CALLBACK (device_state_cb), active);
g_signal_connect (active, "notify::state", G_CALLBACK (active_state_cb), device);
connected_state_cb (device, active);
/* Start timer not to loop forever if "notify::state" signal is not issued */
g_timeout_add_seconds (nmc->timeout, timeout_cb, nmc);
}
} }
g_free (info);
nm_assert (NM_IS_ACTIVE_CONNECTION (active));
devices = nm_active_connection_get_devices (active);
if (devices->len == 0) {
g_string_printf (nmc->return_text, _("Error: Device activation failed: device was disconnected"));
nmc->return_value = NMC_RESULT_ERROR_CON_ACTIVATION;
quit ();
return;
}
device = g_ptr_array_index (devices, 0);
if (nmc->nowait_flag) {
quit ();
return;
}
if (nmc->secret_agent) {
NMRemoteConnection *connection = nm_active_connection_get_connection (active);
nm_secret_agent_simple_enable (nmc->secret_agent,
nm_connection_get_path (NM_CONNECTION (connection)));
}
g_signal_connect (device, "notify::state", G_CALLBACK (device_state_cb), active);
g_signal_connect (active, "notify::state", G_CALLBACK (active_state_cb), device);
connected_state_cb (g_object_ref (device),
g_steal_pointer (&active));
/* Start timer not to loop forever if "notify::state" signal is not issued */
g_timeout_add_seconds (nmc->timeout, timeout_cb, nmc);
} }
static NMCResultCode static NMCResultCode
@ -2018,10 +2048,7 @@ do_device_connect (NmCli *nmc, int argc, char **argv)
nmc); nmc);
} }
info = g_malloc0 (sizeof (AddAndActivateInfo)); info = add_and_activate_info_new (nmc, device, FALSE, FALSE, NULL);
info->nmc = nmc;
info->device = device;
info->hotspot = FALSE;
nm_client_activate_connection_async (nmc->client, nm_client_activate_connection_async (nmc->client,
NULL, /* let NM find a connection automatically */ NULL, /* let NM find a connection automatically */
@ -3027,8 +3054,10 @@ do_device_wifi_list (NmCli *nmc, int argc, char **argv)
if (nmc->complete) if (nmc->complete)
return nmc->return_value; return nmc->return_value;
if (argc) if (argc) {
g_printerr (_("Unknown parameter: %s\n"), *argv); g_string_printf (nmc->return_text, _("Error: invalid extra argument '%s'."), *argv);
return NMC_RESULT_ERROR_USER_INPUT;
}
if (rescan == NULL || strcmp (rescan, "auto") == 0) { if (rescan == NULL || strcmp (rescan, "auto") == 0) {
rescan_cutoff = NM_MAX (nm_utils_get_timestamp_msec () - 30 * NM_UTILS_MSEC_PER_SECOND, 0); rescan_cutoff = NM_MAX (nm_utils_get_timestamp_msec () - 30 * NM_UTILS_MSEC_PER_SECOND, 0);
@ -3116,14 +3145,43 @@ do_device_wifi_list (NmCli *nmc, int argc, char **argv)
return nmc->return_value; return nmc->return_value;
} }
static void
activate_update2_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
NMRemoteConnection *remote_con = NM_REMOTE_CONNECTION (source_object);
nm_auto_free_add_and_activate_info AddAndActivateInfo *info = user_data;
NmCli *nmc = info->nmc;
gs_unref_variant GVariant *ret = NULL;
GError *error = NULL;
ret = nm_remote_connection_update2_finish (remote_con, res, &error);
if (!ret) {
g_string_printf (nmc->return_text, _("Error: %s."), error->message);
nmc->return_value = NMC_RESULT_ERROR_UNKNOWN;
g_error_free (error);
quit ();
return;
}
nm_client_activate_connection_async (nmc->client,
NM_CONNECTION (remote_con),
info->device,
info->specific_object,
NULL,
add_and_activate_cb,
g_steal_pointer (&info));
}
static NMCResultCode static NMCResultCode
do_device_wifi_connect_network (NmCli *nmc, int argc, char **argv) do_device_wifi_connect (NmCli *nmc, int argc, char **argv)
{ {
NMDevice *device = NULL; NMDevice *device = NULL;
NMAccessPoint *ap = NULL; NMAccessPoint *ap = NULL;
NM80211ApFlags ap_flags; NM80211ApFlags ap_flags;
NM80211ApSecurityFlags ap_wpa_flags; NM80211ApSecurityFlags ap_wpa_flags;
NM80211ApSecurityFlags ap_rsn_flags; NM80211ApSecurityFlags ap_rsn_flags;
NMRemoteConnection *remote_con = NULL;
NMConnection *connection = NULL; NMConnection *connection = NULL;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSettingWireless *s_wifi; NMSettingWireless *s_wifi;
@ -3144,7 +3202,6 @@ do_device_wifi_connect_network (NmCli *nmc, int argc, char **argv)
char *passwd_ask = NULL; char *passwd_ask = NULL;
const GPtrArray *avail_cons; const GPtrArray *avail_cons;
gboolean name_match = FALSE; gboolean name_match = FALSE;
gboolean existing_con = FALSE;
int i; int i;
/* Set default timeout waiting for operation completion. */ /* Set default timeout waiting for operation completion. */
@ -3291,7 +3348,9 @@ do_device_wifi_connect_network (NmCli *nmc, int argc, char **argv)
goto finish; goto finish;
} }
} else if (!nmc->complete) { } else if (!nmc->complete) {
g_printerr (_("Unknown parameter: %s\n"), *argv); g_string_printf (nmc->return_text, _("Error: invalid extra argument '%s'."), *argv);
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
goto finish;
} }
next_arg (nmc, &argc, &argv, NULL); next_arg (nmc, &argc, &argv, NULL);
@ -3391,22 +3450,22 @@ do_device_wifi_connect_network (NmCli *nmc, int argc, char **argv)
/* ap has been checked against bssid1, bssid2 and the ssid /* ap has been checked against bssid1, bssid2 and the ssid
* and now avail_con has been checked against ap. * and now avail_con has been checked against ap.
*/ */
connection = NM_CONNECTION (avail_con); remote_con = avail_con;
existing_con = TRUE; connection = NM_CONNECTION (remote_con);
break; break;
} }
} }
if (name_match && !existing_con) { if (name_match && !remote_con) {
g_string_printf (nmc->return_text, _("Error: Connection '%s' exists but properties don't match."), con_name); g_string_printf (nmc->return_text, _("Error: Connection '%s' exists but properties don't match."), con_name);
nmc->return_value = NMC_RESULT_ERROR_NOT_FOUND; nmc->return_value = NMC_RESULT_ERROR_NOT_FOUND;
goto finish; goto finish;
} }
if (!existing_con) { if (!remote_con) {
/* If there are some connection data from user, create a connection and /* If there are some connection data from user, create a connection and
* fill them into proper settings. */ * fill them into proper settings. */
if (con_name || private || bssid2_arr || password || hidden) if (con_name || private || bssid2_arr || hidden)
connection = nm_simple_connection_new (); connection = nm_simple_connection_new ();
if (con_name || private) { if (con_name || private) {
@ -3518,24 +3577,21 @@ do_device_wifi_connect_network (NmCli *nmc, int argc, char **argv)
nmc->nowait_flag = (nmc->timeout == 0); nmc->nowait_flag = (nmc->timeout == 0);
nmc->should_wait++; nmc->should_wait++;
info = g_malloc0 (sizeof (AddAndActivateInfo)); info = add_and_activate_info_new (nmc, device, FALSE, !remote_con, nm_object_get_path (NM_OBJECT (ap)));
info->nmc = nmc;
info->device = device; if (remote_con) {
info->hotspot = FALSE; nm_remote_connection_update2 (remote_con,
info->create = !existing_con; nm_connection_to_dbus (connection, NM_CONNECTION_SERIALIZE_ALL),
if (existing_con) { NM_SETTINGS_UPDATE2_FLAG_BLOCK_AUTOCONNECT,
nm_client_activate_connection_async (nmc->client, NULL,
connection, NULL,
device, activate_update2_cb,
nm_object_get_path (NM_OBJECT (ap)), info);
NULL,
add_and_activate_cb,
info);
} else { } else {
nm_client_add_and_activate_connection_async (nmc->client, nm_client_add_and_activate_connection_async (nmc->client,
connection, connection,
device, info->device,
nm_object_get_path (NM_OBJECT (ap)), info->specific_object,
NULL, NULL,
add_and_activate_cb, add_and_activate_cb,
info); info);
@ -3784,7 +3840,7 @@ do_device_wifi_hotspot (NmCli *nmc, int argc, char **argv)
} else if (nmc_arg_is_option (*argv, "show-password")) { } else if (nmc_arg_is_option (*argv, "show-password")) {
show_password = TRUE; show_password = TRUE;
} else { } else {
g_string_printf (nmc->return_text, _("Error: Unknown parameter %s."), *argv); g_string_printf (nmc->return_text, _("Error: invalid extra argument '%s'."), *argv);
return NMC_RESULT_ERROR_USER_INPUT; return NMC_RESULT_ERROR_USER_INPUT;
} }
@ -3888,11 +3944,7 @@ do_device_wifi_hotspot (NmCli *nmc, int argc, char **argv)
nmc->nowait_flag = (nmc->timeout == 0); nmc->nowait_flag = (nmc->timeout == 0);
nmc->should_wait++; nmc->should_wait++;
info = g_malloc0 (sizeof (AddAndActivateInfo)); info = add_and_activate_info_new (nmc, device, TRUE, TRUE, NULL);
info->nmc = nmc;
info->device = device;
info->hotspot = TRUE;
info->create = TRUE;
nm_client_add_and_activate_connection_async (nmc->client, nm_client_add_and_activate_connection_async (nmc->client,
connection, connection,
@ -3966,8 +4018,11 @@ do_device_wifi_rescan (NmCli *nmc, int argc, char **argv)
goto finish; goto finish;
} }
g_ptr_array_add (ssids, *argv); g_ptr_array_add (ssids, *argv);
} else if (!nmc->complete) } else if (!nmc->complete) {
g_printerr (_("Unknown parameter: %s\n"), *argv); g_string_printf (nmc->return_text, _("Error: invalid extra argument '%s'."), *argv);
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
goto finish;
}
next_arg (nmc, &argc, &argv, NULL); next_arg (nmc, &argc, &argv, NULL);
} }
@ -4013,11 +4068,11 @@ finish:
} }
static NMCCommand device_wifi_cmds[] = { static NMCCommand device_wifi_cmds[] = {
{ "list", do_device_wifi_list, NULL, TRUE, TRUE }, { "list", do_device_wifi_list, NULL, TRUE, TRUE },
{ "connect", do_device_wifi_connect_network, NULL, TRUE, TRUE }, { "connect", do_device_wifi_connect, NULL, TRUE, TRUE },
{ "hotspot", do_device_wifi_hotspot, NULL, TRUE, TRUE }, { "hotspot", do_device_wifi_hotspot, NULL, TRUE, TRUE },
{ "rescan", do_device_wifi_rescan, NULL, TRUE, TRUE }, { "rescan", do_device_wifi_rescan, NULL, TRUE, TRUE },
{ NULL, do_device_wifi_list, NULL, TRUE, TRUE }, { NULL, do_device_wifi_list, NULL, TRUE, TRUE },
}; };
static NMCResultCode static NMCResultCode

View file

@ -149,11 +149,6 @@ typedef struct _NmCli {
char *palette_buffer; /* Buffer with sequences for terminal-colors.d(5)-based coloring. */ char *palette_buffer; /* Buffer with sequences for terminal-colors.d(5)-based coloring. */
} NmCli; } NmCli;
#define NMC_RETURN(nmc, rvalue) \
G_STMT_START { \
return ((nmc)->return_value = (rvalue)); \
} G_STMT_END
extern NmCli nm_cli; extern NmCli nm_cli;
/* Error quark for GError domain */ /* Error quark for GError domain */

View file

@ -892,9 +892,9 @@ GENERAL.ZONE: --
GENERAL.MASTER-PATH: -- GENERAL.MASTER-PATH: --
<<< <<<
size: 1459 size: 1409
location: clients/tests/test-client.py:951:test_003()/31 location: clients/tests/test-client.py:951:test_003()/31
cmd: $NMCLI -f ALL dev s eth0 cmd: $NMCLI -f ALL dev status
lang: C lang: C
returncode: 0 returncode: 0
stdout: 1272 bytes stdout: 1272 bytes
@ -907,14 +907,9 @@ wlan1 wifi unavailable unknown unknown /org/freedesk
wlan1 wifi unavailable unknown unknown /org/freedesktop/NetworkManager/Devices/5 -- -- -- wlan1 wifi unavailable unknown unknown /org/freedesktop/NetworkManager/Devices/5 -- -- --
<<< <<<
stderr: 24 bytes size: 1424
>>>
Unknown parameter: eth0
<<<
size: 1474
location: clients/tests/test-client.py:951:test_003()/32 location: clients/tests/test-client.py:951:test_003()/32
cmd: $NMCLI -f ALL dev s eth0 cmd: $NMCLI -f ALL dev status
lang: pl_PL.UTF-8 lang: pl_PL.UTF-8
returncode: 0 returncode: 0
stdout: 1277 bytes stdout: 1277 bytes
@ -926,11 +921,6 @@ wlan0 wifi niedostępne nieznane nieznane /org/freedes
wlan1 wifi niedostępne nieznane nieznane /org/freedesktop/NetworkManager/Devices/4 -- -- -- wlan1 wifi niedostępne nieznane nieznane /org/freedesktop/NetworkManager/Devices/4 -- -- --
wlan1 wifi niedostępne nieznane nieznane /org/freedesktop/NetworkManager/Devices/5 -- -- -- wlan1 wifi niedostępne nieznane nieznane /org/freedesktop/NetworkManager/Devices/5 -- -- --
<<<
stderr: 24 bytes
>>>
Nieznany parametr: eth0
<<< <<<
size: 3494 size: 3494
location: clients/tests/test-client.py:954:test_003()/33 location: clients/tests/test-client.py:954:test_003()/33
@ -1782,9 +1772,9 @@ GENERAL.ZONE: --
GENERAL.MASTER-PATH: -- GENERAL.MASTER-PATH: --
<<< <<<
size: 1459 size: 1409
location: clients/tests/test-client.py:951:test_003()/54 location: clients/tests/test-client.py:951:test_003()/54
cmd: $NMCLI -f ALL dev s eth0 cmd: $NMCLI -f ALL dev status
lang: C lang: C
returncode: 0 returncode: 0
stdout: 1272 bytes stdout: 1272 bytes
@ -1797,14 +1787,9 @@ wlan1 wifi unavailable unknown unknown /org/freedesk
wlan1 wifi unavailable unknown unknown /org/freedesktop/NetworkManager/Devices/5 -- -- -- wlan1 wifi unavailable unknown unknown /org/freedesktop/NetworkManager/Devices/5 -- -- --
<<< <<<
stderr: 24 bytes size: 1424
>>>
Unknown parameter: eth0
<<<
size: 1474
location: clients/tests/test-client.py:951:test_003()/55 location: clients/tests/test-client.py:951:test_003()/55
cmd: $NMCLI -f ALL dev s eth0 cmd: $NMCLI -f ALL dev status
lang: pl_PL.UTF-8 lang: pl_PL.UTF-8
returncode: 0 returncode: 0
stdout: 1277 bytes stdout: 1277 bytes
@ -1816,11 +1801,6 @@ wlan0 wifi niedostępne nieznane nieznane /org/freedes
wlan1 wifi niedostępne nieznane nieznane /org/freedesktop/NetworkManager/Devices/4 -- -- -- wlan1 wifi niedostępne nieznane nieznane /org/freedesktop/NetworkManager/Devices/4 -- -- --
wlan1 wifi niedostępne nieznane nieznane /org/freedesktop/NetworkManager/Devices/5 -- -- -- wlan1 wifi niedostępne nieznane nieznane /org/freedesktop/NetworkManager/Devices/5 -- -- --
<<<
stderr: 24 bytes
>>>
Nieznany parametr: eth0
<<< <<<
size: 3494 size: 3494
location: clients/tests/test-client.py:954:test_003()/56 location: clients/tests/test-client.py:954:test_003()/56

View file

@ -947,7 +947,7 @@ class TestNmcli(NmTestBase):
self.call_nmcli_l(['con', 's', 'ethernet'], self.call_nmcli_l(['con', 's', 'ethernet'],
replace_stdout = replace_stdout) replace_stdout = replace_stdout)
self.call_nmcli_l(['-f', 'ALL', 'dev', 's', 'eth0'], self.call_nmcli_l(['-f', 'ALL', 'dev', 'status'],
replace_stdout = replace_stdout) replace_stdout = replace_stdout)
self.call_nmcli_l(['-f', 'ALL', 'dev', 'show', 'eth0'], self.call_nmcli_l(['-f', 'ALL', 'dev', 'show', 'eth0'],

View file

@ -7,8 +7,8 @@ dnl - add corresponding NM_VERSION_x_y_z macros in
dnl "shared/nm-version-macros.h.in" dnl "shared/nm-version-macros.h.in"
dnl - update number in meson.build dnl - update number in meson.build
m4_define([nm_major_version], [1]) m4_define([nm_major_version], [1])
m4_define([nm_minor_version], [20]) m4_define([nm_minor_version], [21])
m4_define([nm_micro_version], [0]) m4_define([nm_micro_version], [1])
m4_define([nm_version], m4_define([nm_version],
[nm_major_version.nm_minor_version.nm_micro_version]) [nm_major_version.nm_minor_version.nm_micro_version])

View file

@ -11,7 +11,6 @@ server = 'server.conf'
configure_file( configure_file(
input: server + '.in', input: server + '.in',
output: server, output: server,
install: true,
install_dir: join_paths(nm_datadir, 'doc', nm_name, 'examples'), install_dir: join_paths(nm_datadir, 'doc', nm_name, 'examples'),
configuration: data_conf, configuration: data_conf,
) )
@ -32,7 +31,6 @@ if install_systemd_unit_dir
configure_file( configure_file(
input: service + '.in', input: service + '.in',
output: service, output: service,
install: true,
install_dir: systemd_system_unit_dir, install_dir: systemd_system_unit_dir,
configuration: data_conf, configuration: data_conf,
) )

View file

@ -13,7 +13,6 @@ service = 'org.freedesktop.nm_dispatcher.service'
configure_file( configure_file(
input: service + '.in', input: service + '.in',
output: service, output: service,
install: true,
install_dir: dbus_sys_dir, install_dir: dbus_sys_dir,
configuration: service_conf, configuration: service_conf,
) )

View file

@ -3110,7 +3110,8 @@ nm_ip_routing_rule_from_string (const char *str,
goto next_words_consumed; goto next_words_consumed;
} }
if (NM_IN_STRSET (word0, "not")) { if (NM_IN_STRSET (word0, "not")) {
/* we accept multiple "not" specifiers. */ /* we accept multiple "not" specifiers. "not not" still means
* not. */
val_invert = TRUE; val_invert = TRUE;
goto next_words_consumed; goto next_words_consumed;
} }
@ -3460,15 +3461,15 @@ nm_ip_routing_rule_to_string (const NMIPRoutingRule *self,
str = g_string_sized_new (30); str = g_string_sized_new (30);
if (self->invert)
g_string_append (str, "not");
if (self->priority_has) { if (self->priority_has) {
g_string_append_printf (nm_gstring_add_space_delimiter (str), g_string_append_printf (nm_gstring_add_space_delimiter (str),
"priority %u", "priority %u",
(guint) self->priority); (guint) self->priority);
} }
if (self->invert)
g_string_append (nm_gstring_add_space_delimiter (str), "not");
_rr_string_append_inet_addr (str, _rr_string_append_inet_addr (str,
TRUE, TRUE,
( !self->to_has ( !self->to_has

View file

@ -215,4 +215,18 @@
# define NM_AVAILABLE_IN_1_20 # define NM_AVAILABLE_IN_1_20
#endif #endif
#if NM_VERSION_MIN_REQUIRED >= NM_VERSION_1_22
# define NM_DEPRECATED_IN_1_22 G_DEPRECATED
# define NM_DEPRECATED_IN_1_22_FOR(f) G_DEPRECATED_FOR(f)
#else
# define NM_DEPRECATED_IN_1_22
# define NM_DEPRECATED_IN_1_22_FOR(f)
#endif
#if NM_VERSION_MAX_ALLOWED < NM_VERSION_1_22
# define NM_AVAILABLE_IN_1_22 G_UNAVAILABLE(1,22)
#else
# define NM_AVAILABLE_IN_1_22
#endif
#endif /* NM_VERSION_H */ #endif /* NM_VERSION_H */

View file

@ -3168,7 +3168,9 @@ test_routing_rule (gconstpointer test_data)
_rr_from_str ("priority 5 from :: iif a\\\\303b table 25"); _rr_from_str ("priority 5 from :: iif a\\\\303b table 25");
_rr_from_str ("priority 5 to 0.0.0.0 sport 10 table 6", _rr_from_str ("priority 5 to 0.0.0.0 sport 10 table 6",
"priority 5 to 0.0.0.0 sport 10-10 table 6"); "priority 5 to 0.0.0.0 sport 10-10 table 6");
_rr_from_str ("not priority 5 to 0.0.0.0 dport 10-133 table 6", _rr_from_str ("priority 5 not to 0.0.0.0 dport 10-133 table 6",
"not priority 5 to 0.0.0.0 dport 10-133 table 6",
"not priority 5 not to 0.0.0.0 dport 10-133 table 6",
"priority 5 to 0.0.0.0 not dport 10-133 not table 6", "priority 5 to 0.0.0.0 not dport 10-133 not table 6",
"priority 5 to 0.0.0.0 not dport 10-\\ 133 not table 6"); "priority 5 to 0.0.0.0 not dport 10-\\ 133 not table 6");
_rr_from_str ("priority 5 to 0.0.0.0 ipproto 10 sport 10 table 6"); _rr_from_str ("priority 5 to 0.0.0.0 ipproto 10 sport 10 table 6");

View file

@ -224,7 +224,7 @@ if enable_introspection
extra_args: cflags, extra_args: cflags,
header: 'NetworkManager.h', header: 'NetworkManager.h',
install: true, install: true,
depends: libnm_dep, dependencies: libnm_dep,
) )
generate_plugin_docs = join_paths(meson.current_source_dir(), 'generate-plugin-docs.pl') generate_plugin_docs = join_paths(meson.current_source_dir(), 'generate-plugin-docs.pl')

View file

@ -4,7 +4,7 @@ project(
# - add corresponding NM_VERSION_x_y_z macros in # - add corresponding NM_VERSION_x_y_z macros in
# "shared/nm-version-macros.h.in" # "shared/nm-version-macros.h.in"
# - update number in configure.ac # - update number in configure.ac
version: '1.20.0', version: '1.21.1',
license: 'GPL2+', license: 'GPL2+',
default_options: [ default_options: [
'buildtype=debugoptimized', 'buildtype=debugoptimized',

View file

@ -330,24 +330,6 @@ libnm_systemd_shared_no_logging_dep = declare_dependency(
], ],
) )
############################################################################### if enable_tests
subdir('nm-utils/tests')
exe = executable( endif
'nm-utils/tests/test-shared-general',
[ 'nm-utils/tests/test-shared-general.c' ],
c_args: [
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)',
],
dependencies: [
shared_nm_glib_aux_dep,
libnm_systemd_shared_no_logging_dep,
shared_c_siphash_dep,
],
)
test(
'shared/nm-utils/tests/test-shared-general',
test_script,
args: test_args + [exe.full_path()]
)

View file

@ -0,0 +1,22 @@
test_unit = 'test-shared-general'
exe = executable(
test_unit,
test_unit + '.c',
c_args: [
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)',
],
dependencies: [
shared_nm_glib_aux_dep,
libnm_systemd_shared_no_logging_dep,
shared_c_siphash_dep,
],
)
test(
'shared/nm-utils/' + test_unit,
test_script,
args: test_args + [exe.full_path()],
timeout: default_test_timeout,
)

View file

@ -76,6 +76,7 @@
#define NM_VERSION_1_16 (NM_ENCODE_VERSION (1, 16, 0)) #define NM_VERSION_1_16 (NM_ENCODE_VERSION (1, 16, 0))
#define NM_VERSION_1_18 (NM_ENCODE_VERSION (1, 18, 0)) #define NM_VERSION_1_18 (NM_ENCODE_VERSION (1, 18, 0))
#define NM_VERSION_1_20 (NM_ENCODE_VERSION (1, 20, 0)) #define NM_VERSION_1_20 (NM_ENCODE_VERSION (1, 20, 0))
#define NM_VERSION_1_22 (NM_ENCODE_VERSION (1, 22, 0))
/* For releases, NM_API_VERSION is equal to NM_VERSION. /* For releases, NM_API_VERSION is equal to NM_VERSION.
* *

View file

@ -416,10 +416,12 @@ release_slave (NMDevice *device,
int ifindex_slave; int ifindex_slave;
int ifindex; int ifindex;
ifindex = nm_device_get_ifindex (device); if (configure) {
if ( ifindex <= 0 ifindex = nm_device_get_ifindex (device);
|| !nm_platform_link_get (nm_device_get_platform (device), ifindex)) if ( ifindex <= 0
configure = FALSE; || !nm_platform_link_get (nm_device_get_platform (device), ifindex))
configure = FALSE;
}
ifindex_slave = nm_device_get_ip_ifindex (slave); ifindex_slave = nm_device_get_ip_ifindex (slave);

View file

@ -628,10 +628,12 @@ release_slave (NMDevice *device,
int ifindex_slave; int ifindex_slave;
int ifindex; int ifindex;
ifindex = nm_device_get_ifindex (device); if (configure) {
if ( ifindex <= 0 ifindex = nm_device_get_ifindex (device);
|| !nm_platform_link_get (nm_device_get_platform (device), ifindex)) if ( ifindex <= 0
configure = FALSE; || !nm_platform_link_get (nm_device_get_platform (device), ifindex))
configure = FALSE;
}
ifindex_slave = nm_device_get_ip_ifindex (slave); ifindex_slave = nm_device_get_ip_ifindex (slave);

View file

@ -777,10 +777,12 @@ release_slave (NMDevice *device,
int ifindex_slave; int ifindex_slave;
int ifindex; int ifindex;
ifindex = nm_device_get_ifindex (device); if (configure) {
if ( ifindex <= 0 ifindex = nm_device_get_ifindex (device);
|| !nm_platform_link_get (nm_device_get_platform (device), ifindex)) if ( ifindex <= 0
configure = FALSE; || !nm_platform_link_get (nm_device_get_platform (device), ifindex))
configure = FALSE;
}
ifindex_slave = nm_device_get_ip_ifindex (slave); ifindex_slave = nm_device_get_ip_ifindex (slave);

View file

@ -293,10 +293,9 @@ network_manager_sym = executable(
# this uses symbols from nm-full-symbols instead of libNetworkManager.a # this uses symbols from nm-full-symbols instead of libNetworkManager.a
ver_script = custom_target( ver_script = custom_target(
symbol_map_name, symbol_map_name,
input: meson.source_root(),
output: symbol_map_name, output: symbol_map_name,
depends: [ network_manager_sym, core_plugins ], depends: [ network_manager_sym, core_plugins ],
command: [create_exports_networkmanager, '--called-from-build', '@INPUT@'], command: [create_exports_networkmanager, '--called-from-build', meson.source_root()],
) )
ldflags = ['-rdynamic', '-Wl,--version-script,@0@'.format(ver_script.full_path())] ldflags = ['-rdynamic', '-Wl,--version-script,@0@'.format(ver_script.full_path())]