mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-06 06:48:07 +02:00
2008-02-24 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting.c libnm-util/nm-setting.h - (nm_setting_compare): fix 'fuzzy' compare logic; add IGNORE_ID bits; fix return value to match nm_connection_compare() meaning git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3340 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
91eb286b27
commit
00a3dfbafa
3 changed files with 27 additions and 8 deletions
|
|
@ -1,3 +1,10 @@
|
||||||
|
2008-02-24 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
|
* libnm-util/nm-setting.c
|
||||||
|
libnm-util/nm-setting.h
|
||||||
|
- (nm_setting_compare): fix 'fuzzy' compare logic; add IGNORE_ID bits;
|
||||||
|
fix return value to match nm_connection_compare() meaning
|
||||||
|
|
||||||
2008-02-24 Dan Williams <dcbw@redhat.com>
|
2008-02-24 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
* libnm-util/nm-setting-wireless.c
|
* libnm-util/nm-setting-wireless.c
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
|
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "nm-setting.h"
|
#include "nm-setting.h"
|
||||||
|
#include "nm-setting-connection.h"
|
||||||
#include "nm-utils.h"
|
#include "nm-utils.h"
|
||||||
|
|
||||||
G_DEFINE_ABSTRACT_TYPE (NMSetting, nm_setting, G_TYPE_OBJECT)
|
G_DEFINE_ABSTRACT_TYPE (NMSetting, nm_setting, G_TYPE_OBJECT)
|
||||||
|
|
@ -150,7 +153,7 @@ nm_setting_compare (NMSetting *setting,
|
||||||
{
|
{
|
||||||
GParamSpec **property_specs;
|
GParamSpec **property_specs;
|
||||||
guint n_property_specs;
|
guint n_property_specs;
|
||||||
gboolean different;
|
gint different;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
g_return_val_if_fail (NM_IS_SETTING (setting), FALSE);
|
g_return_val_if_fail (NM_IS_SETTING (setting), FALSE);
|
||||||
|
|
@ -169,12 +172,17 @@ nm_setting_compare (NMSetting *setting,
|
||||||
GValue value1 = { 0 };
|
GValue value1 = { 0 };
|
||||||
GValue value2 = { 0 };
|
GValue value2 = { 0 };
|
||||||
|
|
||||||
/* Fuzzy compare ignores properties defined with the FUZZY_IGNORE flag */
|
/* Fuzzy compare ignores secrets and properties defined with the
|
||||||
|
* FUZZY_IGNORE flag
|
||||||
|
*/
|
||||||
if ( (flags & COMPARE_FLAGS_FUZZY)
|
if ( (flags & COMPARE_FLAGS_FUZZY)
|
||||||
&& (prop_spec->flags & NM_SETTING_PARAM_FUZZY_IGNORE)) {
|
&& (prop_spec->flags & (NM_SETTING_PARAM_FUZZY_IGNORE | NM_SETTING_PARAM_SECRET)))
|
||||||
different = TRUE;
|
continue;
|
||||||
|
|
||||||
|
if ( (flags & COMPARE_FLAGS_IGNORE_ID)
|
||||||
|
&& !strcmp (setting->name, NM_SETTING_CONNECTION_SETTING_NAME)
|
||||||
|
&& !strcmp (prop_spec->name, NM_SETTING_CONNECTION_ID))
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
g_value_init (&value1, prop_spec->value_type);
|
g_value_init (&value1, prop_spec->value_type);
|
||||||
g_object_get_property (G_OBJECT (setting), prop_spec->name, &value1);
|
g_object_get_property (G_OBJECT (setting), prop_spec->name, &value1);
|
||||||
|
|
@ -190,7 +198,7 @@ nm_setting_compare (NMSetting *setting,
|
||||||
|
|
||||||
g_free (property_specs);
|
g_free (property_specs);
|
||||||
|
|
||||||
return different;
|
return different == 0 ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -63,12 +63,16 @@ gboolean nm_setting_verify (NMSetting *setting,
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
/* Match all attributes exactly */
|
/* Match all attributes exactly */
|
||||||
COMPARE_FLAGS_EXACT = 0x00,
|
COMPARE_FLAGS_EXACT = 0x00000000,
|
||||||
|
|
||||||
/* Match only important attributes, like SSID, type, security settings, etc */
|
/* Match only important attributes, like SSID, type, security settings, etc */
|
||||||
COMPARE_FLAGS_FUZZY = 0x01,
|
COMPARE_FLAGS_FUZZY = 0x00000001,
|
||||||
|
|
||||||
|
/* Ignore the connection ID */
|
||||||
|
COMPARE_FLAGS_IGNORE_ID = 0x00000002,
|
||||||
} NMSettingCompareFlags;
|
} NMSettingCompareFlags;
|
||||||
|
|
||||||
|
/* Returns TRUE if the connections are the same */
|
||||||
gboolean nm_setting_compare (NMSetting *setting,
|
gboolean nm_setting_compare (NMSetting *setting,
|
||||||
NMSetting *other,
|
NMSetting *other,
|
||||||
NMSettingCompareFlags flags);
|
NMSettingCompareFlags flags);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue