mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 13:38:43 +02:00
all: merge branch 'th/coverity'
Various fixes for Coverity. For the most part, these are refactorings to avoid false positive warnings.
This commit is contained in:
commit
d3bd7b9bee
15 changed files with 101 additions and 87 deletions
|
|
@ -1298,17 +1298,16 @@ got_secrets (GObject *source_object, GAsyncResult *res, gpointer user_data)
|
||||||
{
|
{
|
||||||
NMRemoteConnection *remote = NM_REMOTE_CONNECTION (source_object);
|
NMRemoteConnection *remote = NM_REMOTE_CONNECTION (source_object);
|
||||||
GetSecretsData *data = user_data;
|
GetSecretsData *data = user_data;
|
||||||
GVariant *secrets;
|
gs_unref_variant GVariant *secrets = NULL;
|
||||||
GError *error = NULL;
|
|
||||||
|
|
||||||
secrets = nm_remote_connection_get_secrets_finish (remote, res, NULL);
|
secrets = nm_remote_connection_get_secrets_finish (remote, res, NULL);
|
||||||
if (secrets) {
|
if (secrets) {
|
||||||
|
gs_free_error GError *error = NULL;
|
||||||
|
|
||||||
if (!nm_connection_update_secrets (data->local, NULL, secrets, &error) && error) {
|
if (!nm_connection_update_secrets (data->local, NULL, secrets, &error) && error) {
|
||||||
g_printerr (_("Error updating secrets for %s: %s\n"),
|
g_printerr (_("Error updating secrets for %s: %s\n"),
|
||||||
data->setting_name, error->message);
|
data->setting_name, error->message);
|
||||||
g_clear_error (&error);
|
|
||||||
}
|
}
|
||||||
g_variant_unref (secrets);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_main_loop_quit (data->loop);
|
g_main_loop_quit (data->loop);
|
||||||
|
|
@ -2712,7 +2711,6 @@ parse_passwords (const char *passwd_file, GError **error)
|
||||||
if (!passwd_file)
|
if (!passwd_file)
|
||||||
return g_steal_pointer (&pwds_hash);
|
return g_steal_pointer (&pwds_hash);
|
||||||
|
|
||||||
/* Read the passwords file */
|
|
||||||
if (!g_file_get_contents (passwd_file, &contents, &len, &local_err)) {
|
if (!g_file_get_contents (passwd_file, &contents, &len, &local_err)) {
|
||||||
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
|
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
|
||||||
_("failed to read passwd-file '%s': %s"),
|
_("failed to read passwd-file '%s': %s"),
|
||||||
|
|
@ -2722,7 +2720,7 @@ parse_passwords (const char *passwd_file, GError **error)
|
||||||
}
|
}
|
||||||
|
|
||||||
strv = nm_utils_strsplit_set (contents, "\r\n");
|
strv = nm_utils_strsplit_set (contents, "\r\n");
|
||||||
for (iter = strv; *iter; iter++) {
|
for (iter = strv; strv && *iter; iter++) {
|
||||||
gs_free char *iter_s = g_strdup (*iter);
|
gs_free char *iter_s = g_strdup (*iter);
|
||||||
|
|
||||||
pwd = strchr (iter_s, ':');
|
pwd = strchr (iter_s, ':');
|
||||||
|
|
@ -2764,6 +2762,7 @@ parse_passwords (const char *passwd_file, GError **error)
|
||||||
|
|
||||||
g_hash_table_insert (pwds_hash, pwd_spec, g_strdup (pwd));
|
g_hash_table_insert (pwds_hash, pwd_spec, g_strdup (pwd));
|
||||||
}
|
}
|
||||||
|
|
||||||
return g_steal_pointer (&pwds_hash);
|
return g_steal_pointer (&pwds_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2783,22 +2782,24 @@ nmc_activate_connection (NmCli *nmc,
|
||||||
NMDevice *device = NULL;
|
NMDevice *device = NULL;
|
||||||
const char *spec_object = NULL;
|
const char *spec_object = NULL;
|
||||||
gboolean device_found;
|
gboolean device_found;
|
||||||
GError *local = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail (nmc, FALSE);
|
g_return_val_if_fail (nmc, FALSE);
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||||
|
|
||||||
if (connection && (ifname || ap || nsp)) {
|
if ( connection
|
||||||
|
&& ( ifname
|
||||||
|
|| ap
|
||||||
|
|| nsp)) {
|
||||||
|
gs_free_error GError *local = NULL;
|
||||||
|
|
||||||
device_found = find_device_for_connection (nmc, connection, ifname, ap, nsp, &device, &spec_object, &local);
|
device_found = find_device_for_connection (nmc, connection, ifname, ap, nsp, &device, &spec_object, &local);
|
||||||
|
|
||||||
/* Virtual connection may not have their interfaces created yet */
|
/* Virtual connection may not have their interfaces created yet */
|
||||||
if (!device_found && !nm_connection_is_virtual (connection)) {
|
if (!device_found && !nm_connection_is_virtual (connection)) {
|
||||||
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_CON_ACTIVATION,
|
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_CON_ACTIVATION,
|
||||||
"%s", local->message);
|
"%s", local->message);
|
||||||
g_clear_error (&local);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
g_clear_error (&local);
|
|
||||||
} else if (ifname) {
|
} else if (ifname) {
|
||||||
device = nm_client_get_device_by_iface (nmc->client, ifname);
|
device = nm_client_get_device_by_iface (nmc->client, ifname);
|
||||||
if (!device) {
|
if (!device) {
|
||||||
|
|
@ -2813,11 +2814,10 @@ nmc_activate_connection (NmCli *nmc,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse passwords given in passwords file */
|
/* Parse passwords given in passwords file */
|
||||||
pwds_hash = parse_passwords (pwds, &local);
|
pwds_hash = parse_passwords (pwds, error);
|
||||||
if (local) {
|
if (!pwds_hash)
|
||||||
g_propagate_error (error, local);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
if (nmc->pwds_hash)
|
if (nmc->pwds_hash)
|
||||||
g_hash_table_destroy (nmc->pwds_hash);
|
g_hash_table_destroy (nmc->pwds_hash);
|
||||||
nmc->pwds_hash = pwds_hash;
|
nmc->pwds_hash = pwds_hash;
|
||||||
|
|
@ -7573,18 +7573,19 @@ editor_menu_main (NmCli *nmc, NMConnection *connection, const char *connection_t
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
gs_free char *prop_name = NULL;
|
gs_free char *prop_name = NULL;
|
||||||
GError *tmp_err = NULL;
|
gs_free GError *tmp_err = NULL;
|
||||||
|
|
||||||
prop_name = is_property_valid (ss, cmd_arg_p, &tmp_err);
|
prop_name = is_property_valid (ss, cmd_arg_p, &tmp_err);
|
||||||
if (prop_name) {
|
if (prop_name) {
|
||||||
if (!nmc_setting_set_property (nmc->client, ss, prop_name, '\0', NULL, &tmp_err)) {
|
if (!nmc_setting_set_property (nmc->client, ss, prop_name, '\0', NULL, &tmp_err)) {
|
||||||
g_print (_("Error: failed to remove value of '%s': %s\n"), prop_name,
|
g_print (_("Error: failed to remove value of '%s': %s\n"),
|
||||||
|
prop_name,
|
||||||
tmp_err->message);
|
tmp_err->message);
|
||||||
g_clear_error (&tmp_err);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* If the string is not a property, try it as a setting */
|
|
||||||
NMSetting *s_tmp;
|
NMSetting *s_tmp;
|
||||||
|
|
||||||
|
/* If the string is not a property, try it as a setting */
|
||||||
s_tmp = is_setting_valid (connection,
|
s_tmp = is_setting_valid (connection,
|
||||||
valid_settings_main,
|
valid_settings_main,
|
||||||
valid_settings_slave,
|
valid_settings_slave,
|
||||||
|
|
@ -7592,16 +7593,17 @@ editor_menu_main (NmCli *nmc, NMConnection *connection, const char *connection_t
|
||||||
if (s_tmp) {
|
if (s_tmp) {
|
||||||
/* Remove setting from the connection */
|
/* Remove setting from the connection */
|
||||||
connection_remove_setting (connection, s_tmp);
|
connection_remove_setting (connection, s_tmp);
|
||||||
|
|
||||||
/* coverity[copy_paste_error] - suppress Coverity COPY_PASTE_ERROR defect */
|
/* coverity[copy_paste_error] - suppress Coverity COPY_PASTE_ERROR defect */
|
||||||
if (ss == menu_ctx.curr_setting) {
|
if (ss == menu_ctx.curr_setting) {
|
||||||
/* If we removed the setting we are in, go up */
|
/* If we removed the setting we are in, go up */
|
||||||
menu_switch_to_level0 (&nmc->nmc_config, &menu_ctx, BASE_PROMPT);
|
menu_switch_to_level0 (&nmc->nmc_config, &menu_ctx, BASE_PROMPT);
|
||||||
nmc_tab_completion.setting = NULL; /* for TAB completion */
|
nmc_tab_completion.setting = NULL; /* for TAB completion */
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
g_print (_("Error: %s properties, nor it is a setting name.\n"),
|
g_print (_("Error: %s properties, nor it is a setting name.\n"),
|
||||||
tmp_err->message);
|
tmp_err->message);
|
||||||
g_clear_error (&tmp_err);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -7661,7 +7663,7 @@ editor_menu_main (NmCli *nmc, NMConnection *connection, const char *connection_t
|
||||||
/* Show description for all properties */
|
/* Show description for all properties */
|
||||||
print_setting_description (ss);
|
print_setting_description (ss);
|
||||||
} else {
|
} else {
|
||||||
GError *tmp_err = NULL;
|
gs_free_error GError *tmp_err = NULL;
|
||||||
gs_free char *prop_name = NULL;
|
gs_free char *prop_name = NULL;
|
||||||
|
|
||||||
prop_name = is_property_valid (ss, cmd_arg_p, &tmp_err);
|
prop_name = is_property_valid (ss, cmd_arg_p, &tmp_err);
|
||||||
|
|
@ -7678,11 +7680,11 @@ editor_menu_main (NmCli *nmc, NMConnection *connection, const char *connection_t
|
||||||
cmd_arg_p);
|
cmd_arg_p);
|
||||||
if (s_tmp)
|
if (s_tmp)
|
||||||
print_setting_description (s_tmp);
|
print_setting_description (s_tmp);
|
||||||
else
|
else {
|
||||||
g_print (_("Error: invalid property: %s, "
|
g_print (_("Error: invalid property: %s, "
|
||||||
"neither a valid setting name.\n"),
|
"neither a valid setting name.\n"),
|
||||||
tmp_err->message);
|
tmp_err->message);
|
||||||
g_clear_error (&tmp_err);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -7769,19 +7771,21 @@ editor_menu_main (NmCli *nmc, NMConnection *connection, const char *connection_t
|
||||||
|
|
||||||
if ( menu_ctx.curr_setting
|
if ( menu_ctx.curr_setting
|
||||||
&& (!cmd_arg || strcmp (cmd_arg, "all") != 0)) {
|
&& (!cmd_arg || strcmp (cmd_arg, "all") != 0)) {
|
||||||
GError *tmp_err = NULL;
|
gs_free_error GError *tmp_err = NULL;
|
||||||
(void) nm_setting_verify (menu_ctx.curr_setting, NULL, &tmp_err);
|
|
||||||
|
nm_setting_verify (menu_ctx.curr_setting, NULL, &tmp_err);
|
||||||
g_print (_("Verify setting '%s': %s\n"),
|
g_print (_("Verify setting '%s': %s\n"),
|
||||||
nm_setting_get_name (menu_ctx.curr_setting),
|
nm_setting_get_name (menu_ctx.curr_setting),
|
||||||
tmp_err ? tmp_err->message : "OK");
|
tmp_err ? tmp_err->message : "OK");
|
||||||
g_clear_error (&tmp_err);
|
|
||||||
} else {
|
} else {
|
||||||
GError *tmp_err = NULL;
|
gs_free_error GError *tmp_err = NULL;
|
||||||
gboolean valid, modified;
|
|
||||||
gboolean fixed = TRUE;
|
gboolean fixed = TRUE;
|
||||||
|
gboolean modified;
|
||||||
|
gboolean valid;
|
||||||
|
|
||||||
valid = nm_connection_verify (connection, &tmp_err);
|
valid = nm_connection_verify (connection, &tmp_err);
|
||||||
if (!valid && (g_strcmp0 (cmd_arg, "fix") == 0)) {
|
if ( !valid
|
||||||
|
&& nm_streq0 (cmd_arg, "fix")) {
|
||||||
/* Try to fix normalizable errors */
|
/* Try to fix normalizable errors */
|
||||||
g_clear_error (&tmp_err);
|
g_clear_error (&tmp_err);
|
||||||
fixed = nm_connection_normalize (connection, NULL, &modified, &tmp_err);
|
fixed = nm_connection_normalize (connection, NULL, &modified, &tmp_err);
|
||||||
|
|
@ -7790,7 +7794,6 @@ editor_menu_main (NmCli *nmc, NMConnection *connection, const char *connection_t
|
||||||
tmp_err ? tmp_err->message : "OK");
|
tmp_err ? tmp_err->message : "OK");
|
||||||
if (!fixed)
|
if (!fixed)
|
||||||
g_print (_("The error cannot be fixed automatically.\n"));
|
g_print (_("The error cannot be fixed automatically.\n"));
|
||||||
g_clear_error (&tmp_err);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3755,7 +3755,7 @@ _get_fcn_vlan_xgress_priority_map (ARGS_GET_FCN)
|
||||||
NMVlanPriorityMap map_type = _vlan_priority_map_type_from_property_info (property_info);
|
NMVlanPriorityMap map_type = _vlan_priority_map_type_from_property_info (property_info);
|
||||||
NMSettingVlan *s_vlan = NM_SETTING_VLAN (setting);
|
NMSettingVlan *s_vlan = NM_SETTING_VLAN (setting);
|
||||||
GString *str = NULL;
|
GString *str = NULL;
|
||||||
guint32 i, num;
|
gint32 i, num;
|
||||||
|
|
||||||
RETURN_UNSUPPORTED_GET_TYPE ();
|
RETURN_UNSUPPORTED_GET_TYPE ();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3394,10 +3394,9 @@ _read_setting_wireguard_peer (KeyfileReaderInfo *info)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!nm_wireguard_peer_is_valid (peer, TRUE, TRUE, &error)) {
|
if (!nm_wireguard_peer_is_valid (peer, TRUE, TRUE, &error)) {
|
||||||
if (!handle_warn (info, key, NM_KEYFILE_WARN_SEVERITY_WARN,
|
handle_warn (info, key, NM_KEYFILE_WARN_SEVERITY_WARN,
|
||||||
_("peer '%s' is invalid: %s"),
|
_("peer '%s' is invalid: %s"),
|
||||||
info->group, error->message))
|
info->group, error->message);
|
||||||
return;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,7 @@ check_replace_duplicate_priority (GSList *list, guint32 from, guint32 to)
|
||||||
* the Linux SKB priorities to 802.1p priorities.
|
* the Linux SKB priorities to 802.1p priorities.
|
||||||
*
|
*
|
||||||
* Returns: %TRUE if the entry was successfully added to the list, or it
|
* Returns: %TRUE if the entry was successfully added to the list, or it
|
||||||
* overwrote the old value, %FALSE if error
|
* overwrote the old value, %FALSE if @str is not a valid mapping.
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
nm_setting_vlan_add_priority_str (NMSettingVlan *setting,
|
nm_setting_vlan_add_priority_str (NMSettingVlan *setting,
|
||||||
|
|
@ -235,11 +235,11 @@ nm_setting_vlan_add_priority_str (NMSettingVlan *setting,
|
||||||
g_return_val_if_fail (map == NM_VLAN_INGRESS_MAP || map == NM_VLAN_EGRESS_MAP, FALSE);
|
g_return_val_if_fail (map == NM_VLAN_INGRESS_MAP || map == NM_VLAN_EGRESS_MAP, FALSE);
|
||||||
g_return_val_if_fail (str && str[0], FALSE);
|
g_return_val_if_fail (str && str[0], FALSE);
|
||||||
|
|
||||||
list = get_map (setting, map);
|
|
||||||
|
|
||||||
item = priority_map_new_from_str (map, str);
|
item = priority_map_new_from_str (map, str);
|
||||||
if (!item)
|
if (!item)
|
||||||
g_return_val_if_reached (FALSE);
|
return FALSE;
|
||||||
|
|
||||||
|
list = get_map (setting, map);
|
||||||
|
|
||||||
/* Duplicates get replaced */
|
/* Duplicates get replaced */
|
||||||
if (check_replace_duplicate_priority (list, item->from, item->to)) {
|
if (check_replace_duplicate_priority (list, item->from, item->to)) {
|
||||||
|
|
@ -264,7 +264,7 @@ nm_setting_vlan_add_priority_str (NMSettingVlan *setting,
|
||||||
* #NMSettingVlan:ingress_priority_map or #NMSettingVlan:egress_priority_map
|
* #NMSettingVlan:ingress_priority_map or #NMSettingVlan:egress_priority_map
|
||||||
* properties of this setting.
|
* properties of this setting.
|
||||||
*
|
*
|
||||||
* Returns: return the number of ingress/egress priority entries, -1 if error
|
* Returns: return the number of ingress/egress priority entries.
|
||||||
**/
|
**/
|
||||||
gint32
|
gint32
|
||||||
nm_setting_vlan_get_num_priorities (NMSettingVlan *setting, NMVlanPriorityMap map)
|
nm_setting_vlan_get_num_priorities (NMSettingVlan *setting, NMVlanPriorityMap map)
|
||||||
|
|
@ -280,13 +280,13 @@ nm_setting_vlan_get_num_priorities (NMSettingVlan *setting, NMVlanPriorityMap ma
|
||||||
* @setting: the #NMSettingVlan
|
* @setting: the #NMSettingVlan
|
||||||
* @map: the type of priority map
|
* @map: the type of priority map
|
||||||
* @idx: the zero-based index of the ingress/egress priority map entry
|
* @idx: the zero-based index of the ingress/egress priority map entry
|
||||||
* @out_from: (out): on return the value of the priority map's 'from' item
|
* @out_from: (out) (allow-none): on return the value of the priority map's 'from' item
|
||||||
* @out_to: (out): on return the value of priority map's 'to' item
|
* @out_to: (out) (allow-none): on return the value of priority map's 'to' item
|
||||||
*
|
*
|
||||||
* Retrieve one of the entries of the #NMSettingVlan:ingress_priority_map
|
* Retrieve one of the entries of the #NMSettingVlan:ingress_priority_map
|
||||||
* or #NMSettingVlan:egress_priority_map properties of this setting.
|
* or #NMSettingVlan:egress_priority_map properties of this setting.
|
||||||
*
|
*
|
||||||
* Returns: %TRUE if a priority map was returned, %FALSE if error
|
* Returns: returns %TRUE if @idx is in range. Otherwise %FALSE.
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
nm_setting_vlan_get_priority (NMSettingVlan *setting,
|
nm_setting_vlan_get_priority (NMSettingVlan *setting,
|
||||||
|
|
@ -295,21 +295,23 @@ nm_setting_vlan_get_priority (NMSettingVlan *setting,
|
||||||
guint32 *out_from,
|
guint32 *out_from,
|
||||||
guint32 *out_to)
|
guint32 *out_to)
|
||||||
{
|
{
|
||||||
GSList *list = NULL;
|
NMVlanQosMapping *item;
|
||||||
NMVlanQosMapping *item = NULL;
|
GSList *list;
|
||||||
|
|
||||||
g_return_val_if_fail (NM_IS_SETTING_VLAN (setting), FALSE);
|
g_return_val_if_fail (NM_IS_SETTING_VLAN (setting), FALSE);
|
||||||
g_return_val_if_fail (map == NM_VLAN_INGRESS_MAP || map == NM_VLAN_EGRESS_MAP, FALSE);
|
g_return_val_if_fail (NM_IN_SET (map, NM_VLAN_INGRESS_MAP, NM_VLAN_EGRESS_MAP), FALSE);
|
||||||
g_return_val_if_fail (out_from != NULL, FALSE);
|
|
||||||
g_return_val_if_fail (out_to != NULL, FALSE);
|
|
||||||
|
|
||||||
list = get_map (setting, map);
|
list = get_map (setting, map);
|
||||||
g_return_val_if_fail (idx < g_slist_length (list), FALSE);
|
|
||||||
|
|
||||||
item = g_slist_nth_data (list, idx);
|
item = g_slist_nth_data (list, idx);
|
||||||
g_assert (item);
|
|
||||||
*out_from = item->from;
|
if (!item) {
|
||||||
*out_to = item->to;
|
NM_SET_OUT (out_from, 0);
|
||||||
|
NM_SET_OUT (out_to, 0);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
NM_SET_OUT (out_from, item->from);
|
||||||
|
NM_SET_OUT (out_to, item->to);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -331,8 +333,7 @@ nm_setting_vlan_get_priority (NMSettingVlan *setting,
|
||||||
* If @map is #NM_VLAN_EGRESS_MAP then @from is the Linux SKB priority value and
|
* If @map is #NM_VLAN_EGRESS_MAP then @from is the Linux SKB priority value and
|
||||||
* @to is the outgoing 802.1q VLAN Priority Code Point (PCP) value.
|
* @to is the outgoing 802.1q VLAN Priority Code Point (PCP) value.
|
||||||
*
|
*
|
||||||
* Returns: %TRUE if the new priority mapping was successfully added to the
|
* Returns: %TRUE.
|
||||||
* list, %FALSE if error
|
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
nm_setting_vlan_add_priority (NMSettingVlan *setting,
|
nm_setting_vlan_add_priority (NMSettingVlan *setting,
|
||||||
|
|
|
||||||
|
|
@ -277,7 +277,7 @@ foreach_item_helper (NMSettingVpn *self,
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
nm_assert (keys[i]);
|
nm_assert (keys && keys[i]);
|
||||||
keys[i] = g_strdup (keys[i]);
|
keys[i] = g_strdup (keys[i]);
|
||||||
}
|
}
|
||||||
nm_assert (!keys[i]);
|
nm_assert (!keys[i]);
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ typedef enum {
|
||||||
NM_TEAM_ATTRIBUTE_PORT_LACP_KEY,
|
NM_TEAM_ATTRIBUTE_PORT_LACP_KEY,
|
||||||
_NM_TEAM_ATTRIBUTE_PORT_NUM,
|
_NM_TEAM_ATTRIBUTE_PORT_NUM,
|
||||||
|
|
||||||
_NM_TEAM_ATTRIBUTE_NUM = NM_CONST_MAX (_NM_TEAM_ATTRIBUTE_MASTER_NUM, _NM_TEAM_ATTRIBUTE_PORT_NUM),
|
_NM_TEAM_ATTRIBUTE_NUM = MAX (_NM_TEAM_ATTRIBUTE_MASTER_NUM, _NM_TEAM_ATTRIBUTE_PORT_NUM),
|
||||||
|
|
||||||
} NMTeamAttribute;
|
} NMTeamAttribute;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ nm_key_file_db_ref (NMKeyFileDB *self)
|
||||||
|
|
||||||
g_return_val_if_fail (_IS_KEY_FILE_DB (self, FALSE, TRUE), NULL);
|
g_return_val_if_fail (_IS_KEY_FILE_DB (self, FALSE, TRUE), NULL);
|
||||||
|
|
||||||
nm_assert (self->ref_count <= G_MAXUINT);
|
nm_assert (self->ref_count < G_MAXUINT);
|
||||||
self->ref_count++;
|
self->ref_count++;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1939,7 +1939,7 @@ nm_utils_buf_utf8safe_escape (gconstpointer buf, gssize buflen, NMUtilsStrUtf8Sa
|
||||||
break;
|
break;
|
||||||
|
|
||||||
s = &p[1];
|
s = &p[1];
|
||||||
g_utf8_validate (s, buflen, &p);
|
(void) g_utf8_validate (s, buflen, &p);
|
||||||
} while (TRUE);
|
} while (TRUE);
|
||||||
|
|
||||||
*to_free = g_string_free (gstr, FALSE);
|
*to_free = g_string_free (gstr, FALSE);
|
||||||
|
|
@ -2834,10 +2834,15 @@ nm_utils_g_slist_find_str (const GSList *list,
|
||||||
int
|
int
|
||||||
nm_utils_g_slist_strlist_cmp (const GSList *a, const GSList *b)
|
nm_utils_g_slist_strlist_cmp (const GSList *a, const GSList *b)
|
||||||
{
|
{
|
||||||
for (; a && b; a = a->next, b = b->next)
|
while (TRUE) {
|
||||||
|
if (!a)
|
||||||
|
return !b ? 0 : -1;
|
||||||
|
if (!b)
|
||||||
|
return 1;
|
||||||
NM_CMP_DIRECT_STRCMP0 (a->data, b->data);
|
NM_CMP_DIRECT_STRCMP0 (a->data, b->data);
|
||||||
NM_CMP_SELF (a, b);
|
a = a->next;
|
||||||
return 0;
|
b = b->next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
@ -2878,7 +2883,7 @@ _nm_utils_user_data_unpack (gpointer user_data, int nargs, ...)
|
||||||
}
|
}
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
|
|
||||||
g_slice_free1 (((gsize) nargs) * sizeof (gconstpointer), user_data);
|
g_slice_free1 (((gsize) nargs) * sizeof (gconstpointer), data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
||||||
|
|
@ -155,6 +155,7 @@ br2684_assign_vcc (NMDeviceAdsl *self, NMSettingAdsl *s_adsl)
|
||||||
if (priv->brfd < 0) {
|
if (priv->brfd < 0) {
|
||||||
errsv = errno;
|
errsv = errno;
|
||||||
_LOGE (LOGD_ADSL, "failed to open ATM control socket (%d)", errsv);
|
_LOGE (LOGD_ADSL, "failed to open ATM control socket (%d)", errsv);
|
||||||
|
priv->brfd = -1;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1467,7 +1467,7 @@ link_config (NMDeviceWireGuard *self,
|
||||||
plpeers_len,
|
plpeers_len,
|
||||||
wg_change_flags);
|
wg_change_flags);
|
||||||
|
|
||||||
nm_explicit_bzero (plpeers, sizeof (plpeers) * plpeers_len);
|
nm_explicit_bzero (plpeers, sizeof (plpeers[0]) * plpeers_len);
|
||||||
|
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_CONFIG_FAILED);
|
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_CONFIG_FAILED);
|
||||||
|
|
|
||||||
|
|
@ -244,7 +244,7 @@ parse_ip (GHashTable *connections, const char *sysfs_dir, char *argument)
|
||||||
dns[0] = tmp;
|
dns[0] = tmp;
|
||||||
dns[1] = get_word (&argument, ':');
|
dns[1] = get_word (&argument, ':');
|
||||||
dns_addr_family[1] = guess_ip_address_family (dns[1]);
|
dns_addr_family[1] = guess_ip_address_family (dns[1]);
|
||||||
if (argument && *argument)
|
if (*argument)
|
||||||
_LOGW (LOGD_CORE, "Ignoring extra: '%s'.", argument);
|
_LOGW (LOGD_CORE, "Ignoring extra: '%s'.", argument);
|
||||||
} else {
|
} else {
|
||||||
mtu = tmp;
|
mtu = tmp;
|
||||||
|
|
|
||||||
|
|
@ -544,6 +544,9 @@ _addresses_sort_cmp (gconstpointer a, gconstpointer b, gpointer user_data)
|
||||||
const NMPlatformIP4Address *a2 = NMP_OBJECT_CAST_IP4_ADDRESS (*((const NMPObject **) b));
|
const NMPlatformIP4Address *a2 = NMP_OBJECT_CAST_IP4_ADDRESS (*((const NMPObject **) b));
|
||||||
guint32 n1, n2;
|
guint32 n1, n2;
|
||||||
|
|
||||||
|
nm_assert (a1);
|
||||||
|
nm_assert (a2);
|
||||||
|
|
||||||
/* Sort by address type. For example link local will
|
/* Sort by address type. For example link local will
|
||||||
* be sorted *after* a global address. */
|
* be sorted *after* a global address. */
|
||||||
p1 = _addresses_sort_cmp_get_prio (a1->address);
|
p1 = _addresses_sort_cmp_get_prio (a1->address);
|
||||||
|
|
@ -577,6 +580,9 @@ sort_captured_addresses (const CList *lst_a, const CList *lst_b, gconstpointer u
|
||||||
const NMPlatformIP4Address *addr_a = NMP_OBJECT_CAST_IP4_ADDRESS (c_list_entry (lst_a, NMDedupMultiEntry, lst_entries)->obj);
|
const NMPlatformIP4Address *addr_a = NMP_OBJECT_CAST_IP4_ADDRESS (c_list_entry (lst_a, NMDedupMultiEntry, lst_entries)->obj);
|
||||||
const NMPlatformIP4Address *addr_b = NMP_OBJECT_CAST_IP4_ADDRESS (c_list_entry (lst_b, NMDedupMultiEntry, lst_entries)->obj);
|
const NMPlatformIP4Address *addr_b = NMP_OBJECT_CAST_IP4_ADDRESS (c_list_entry (lst_b, NMDedupMultiEntry, lst_entries)->obj);
|
||||||
|
|
||||||
|
nm_assert (addr_a);
|
||||||
|
nm_assert (addr_b);
|
||||||
|
|
||||||
/* Primary addresses first */
|
/* Primary addresses first */
|
||||||
return NM_FLAGS_HAS (addr_a->n_ifa_flags, IFA_F_SECONDARY) -
|
return NM_FLAGS_HAS (addr_a->n_ifa_flags, IFA_F_SECONDARY) -
|
||||||
NM_FLAGS_HAS (addr_b->n_ifa_flags, IFA_F_SECONDARY);
|
NM_FLAGS_HAS (addr_b->n_ifa_flags, IFA_F_SECONDARY);
|
||||||
|
|
|
||||||
|
|
@ -284,8 +284,8 @@ nl80211_get_wake_on_wlan_handler (struct nl_msg *msg, void *arg)
|
||||||
struct genlmsghdr *gnlh = nlmsg_data (nlmsg_hdr (msg));
|
struct genlmsghdr *gnlh = nlmsg_data (nlmsg_hdr (msg));
|
||||||
|
|
||||||
nla_parse_arr (attrs,
|
nla_parse_arr (attrs,
|
||||||
genlmsg_attrdata(gnlh, 0),
|
genlmsg_attrdata (gnlh, 0),
|
||||||
genlmsg_attrlen(gnlh, 0),
|
genlmsg_attrlen (gnlh, 0),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (!attrs[NL80211_ATTR_WOWLAN_TRIGGERS])
|
if (!attrs[NL80211_ATTR_WOWLAN_TRIGGERS])
|
||||||
|
|
@ -343,10 +343,10 @@ wifi_nl80211_set_wake_on_wlan (NMWifiUtils *data, NMSettingWirelessWakeOnWLan wo
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
msg = nl80211_alloc_msg (self, NL80211_CMD_SET_WOWLAN, 0);
|
msg = nl80211_alloc_msg (self, NL80211_CMD_SET_WOWLAN, 0);
|
||||||
if (!msg)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
triggers = nla_nest_start (msg, NL80211_ATTR_WOWLAN_TRIGGERS);
|
triggers = nla_nest_start (msg, NL80211_ATTR_WOWLAN_TRIGGERS);
|
||||||
|
if (!triggers)
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
if (NM_FLAGS_HAS (wowl, NM_SETTING_WIRELESS_WAKE_ON_WLAN_ANY))
|
if (NM_FLAGS_HAS (wowl, NM_SETTING_WIRELESS_WAKE_ON_WLAN_ANY))
|
||||||
NLA_PUT_FLAG (msg, NL80211_WOWLAN_TRIG_ANY);
|
NLA_PUT_FLAG (msg, NL80211_WOWLAN_TRIG_ANY);
|
||||||
|
|
@ -363,7 +363,7 @@ wifi_nl80211_set_wake_on_wlan (NMWifiUtils *data, NMSettingWirelessWakeOnWLan wo
|
||||||
if (NM_FLAGS_HAS (wowl, NM_SETTING_WIRELESS_WAKE_ON_WLAN_RFKILL_RELEASE))
|
if (NM_FLAGS_HAS (wowl, NM_SETTING_WIRELESS_WAKE_ON_WLAN_RFKILL_RELEASE))
|
||||||
NLA_PUT_FLAG (msg, NL80211_WOWLAN_TRIG_RFKILL_RELEASE);
|
NLA_PUT_FLAG (msg, NL80211_WOWLAN_TRIG_RFKILL_RELEASE);
|
||||||
|
|
||||||
nla_nest_end(msg, triggers);
|
nla_nest_end (msg, triggers);
|
||||||
|
|
||||||
err = nl80211_send_and_recv (self, msg, NULL, NULL);
|
err = nl80211_send_and_recv (self, msg, NULL, NULL);
|
||||||
|
|
||||||
|
|
@ -634,14 +634,12 @@ nl80211_get_ap_info (NMWifiUtilsNl80211 *self,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
msg = nl80211_alloc_msg (self, NL80211_CMD_GET_STATION, 0);
|
msg = nl80211_alloc_msg (self, NL80211_CMD_GET_STATION, 0);
|
||||||
if (msg) {
|
NLA_PUT (msg, NL80211_ATTR_MAC, ETH_ALEN, bss_info.bssid);
|
||||||
NLA_PUT (msg, NL80211_ATTR_MAC, ETH_ALEN, bss_info.bssid);
|
|
||||||
|
|
||||||
nl80211_send_and_recv (self, msg, nl80211_station_handler, sta_info);
|
nl80211_send_and_recv (self, msg, nl80211_station_handler, sta_info);
|
||||||
if (!sta_info->signal_valid) {
|
if (!sta_info->signal_valid) {
|
||||||
/* Fall back to bss_info signal quality (both are in percent) */
|
/* Fall back to bss_info signal quality (both are in percent) */
|
||||||
sta_info->signal = bss_info.beacon_signal;
|
sta_info->signal = bss_info.beacon_signal;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -2866,7 +2866,7 @@ _clear_connections_cached_list (NMSettingsPrivate *priv)
|
||||||
* it. That is a bug, this code just tries to make it blow up
|
* it. That is a bug, this code just tries to make it blow up
|
||||||
* more eagerly. */
|
* more eagerly. */
|
||||||
memset (priv->connections_cached_list,
|
memset (priv->connections_cached_list,
|
||||||
0xdeaddead,
|
0x43,
|
||||||
sizeof (NMSettingsConnection *) * (priv->connections_len + 1));
|
sizeof (NMSettingsConnection *) * (priv->connections_len + 1));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3629,7 +3629,10 @@ make_wpa_setting (shvarFile *ifcfg,
|
||||||
wpa_sae = nm_streq0 (v, "SAE");
|
wpa_sae = nm_streq0 (v, "SAE");
|
||||||
wpa_eap = nm_streq0 (v, "WPA-EAP");
|
wpa_eap = nm_streq0 (v, "WPA-EAP");
|
||||||
ieee8021x = nm_streq0 (v, "IEEE8021X");
|
ieee8021x = nm_streq0 (v, "IEEE8021X");
|
||||||
if (!wpa_psk && !wpa_sae && !wpa_eap && !ieee8021x)
|
if ( !wpa_psk
|
||||||
|
&& !wpa_sae
|
||||||
|
&& !wpa_eap
|
||||||
|
&& !ieee8021x)
|
||||||
return NULL; /* Not WPA or Dynamic WEP */
|
return NULL; /* Not WPA or Dynamic WEP */
|
||||||
|
|
||||||
/* WPS */
|
/* WPS */
|
||||||
|
|
@ -3689,11 +3692,13 @@ make_wpa_setting (shvarFile *ifcfg,
|
||||||
g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-none", NULL);
|
g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-none", NULL);
|
||||||
else if (wpa_psk)
|
else if (wpa_psk)
|
||||||
g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-psk", NULL);
|
g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-psk", NULL);
|
||||||
else if (wpa_sae)
|
else {
|
||||||
|
nm_assert (wpa_sae);
|
||||||
g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "sae", NULL);
|
g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "sae", NULL);
|
||||||
else
|
}
|
||||||
g_assert_not_reached ();
|
} else {
|
||||||
} else if (wpa_eap || ieee8021x) {
|
nm_assert (wpa_eap || ieee8021x);
|
||||||
|
|
||||||
/* Adhoc mode is mutually exclusive with any 802.1x-based authentication */
|
/* Adhoc mode is mutually exclusive with any 802.1x-based authentication */
|
||||||
if (adhoc) {
|
if (adhoc) {
|
||||||
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
|
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
|
||||||
|
|
@ -3710,10 +3715,6 @@ make_wpa_setting (shvarFile *ifcfg,
|
||||||
|
|
||||||
g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, lower, NULL);
|
g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, lower, NULL);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
|
|
||||||
"Unknown wireless KEY_MGMT type '%s'", v);
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
i_val = NM_SETTING_WIRELESS_SECURITY_PMF_DEFAULT;
|
i_val = NM_SETTING_WIRELESS_SECURITY_PMF_DEFAULT;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue