mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-15 12:34:55 +00:00
2008-10-26 Dan Williams <dcbw@redhat.com>
Patch from Tambet Ingo <tambet@gmail.com> * libnm-util/libnm-util.ver libnm-util/nm-setting-wired.c libnm-util/nm-setting-wired.h - Make properties private and add accessor functions * src/nm-device-ethernet.c system-settings/plugins/ifcfg-fedora/nm-ifcfg-connection.c system-settings/plugins/ifcfg-suse/parser.c system-settings/src/main.c - Use those accessors git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4215 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
3949779389
commit
fff2e85bd6
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
||||||
|
2008-10-26 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
|
Patch from Tambet Ingo <tambet@gmail.com>
|
||||||
|
|
||||||
|
* libnm-util/libnm-util.ver
|
||||||
|
libnm-util/nm-setting-wired.c
|
||||||
|
libnm-util/nm-setting-wired.h
|
||||||
|
- Make properties private and add accessor functions
|
||||||
|
|
||||||
|
* src/nm-device-ethernet.c
|
||||||
|
system-settings/plugins/ifcfg-fedora/nm-ifcfg-connection.c
|
||||||
|
system-settings/plugins/ifcfg-suse/parser.c
|
||||||
|
system-settings/src/main.c
|
||||||
|
- Use those accessors
|
||||||
|
|
||||||
2008-10-26 Dan Williams <dcbw@redhat.com>
|
2008-10-26 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
Patch from Tambet Ingo <tambet@gmail.com>
|
Patch from Tambet Ingo <tambet@gmail.com>
|
||||||
|
|
|
@ -95,6 +95,12 @@ global:
|
||||||
nm_setting_wired_error_quark;
|
nm_setting_wired_error_quark;
|
||||||
nm_setting_wired_get_type;
|
nm_setting_wired_get_type;
|
||||||
nm_setting_wired_new;
|
nm_setting_wired_new;
|
||||||
|
nm_setting_wired_get_port;
|
||||||
|
nm_setting_wired_get_speed;
|
||||||
|
nm_setting_wired_get_duplex;
|
||||||
|
nm_setting_wired_get_auto_negotiate;
|
||||||
|
nm_setting_wired_get_mac_address;
|
||||||
|
nm_setting_wired_get_mtu;
|
||||||
nm_setting_wireless_ap_security_compatible;
|
nm_setting_wireless_ap_security_compatible;
|
||||||
nm_setting_wireless_error_get_type;
|
nm_setting_wireless_error_get_type;
|
||||||
nm_setting_wireless_error_quark;
|
nm_setting_wireless_error_quark;
|
||||||
|
|
|
@ -65,6 +65,17 @@ nm_setting_wired_error_get_type (void)
|
||||||
|
|
||||||
G_DEFINE_TYPE (NMSettingWired, nm_setting_wired, NM_TYPE_SETTING)
|
G_DEFINE_TYPE (NMSettingWired, nm_setting_wired, NM_TYPE_SETTING)
|
||||||
|
|
||||||
|
#define NM_SETTING_WIRED_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_WIRED, NMSettingWiredPrivate))
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char *port;
|
||||||
|
guint32 speed;
|
||||||
|
char *duplex;
|
||||||
|
gboolean auto_negotiate;
|
||||||
|
GByteArray *mac_address;
|
||||||
|
guint32 mtu;
|
||||||
|
} NMSettingWiredPrivate;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_PORT,
|
PROP_PORT,
|
||||||
|
@ -83,14 +94,62 @@ nm_setting_wired_new (void)
|
||||||
return (NMSetting *) g_object_new (NM_TYPE_SETTING_WIRED, NULL);
|
return (NMSetting *) g_object_new (NM_TYPE_SETTING_WIRED, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
nm_setting_wired_get_port (NMSettingWired *setting)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (NM_IS_SETTING_WIRED (setting), NULL);
|
||||||
|
|
||||||
|
return NM_SETTING_WIRED_GET_PRIVATE (setting)->port;
|
||||||
|
}
|
||||||
|
|
||||||
|
guint32
|
||||||
|
nm_setting_wired_get_speed (NMSettingWired *setting)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (NM_IS_SETTING_WIRED (setting), 0);
|
||||||
|
|
||||||
|
return NM_SETTING_WIRED_GET_PRIVATE (setting)->speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
nm_setting_wired_get_duplex (NMSettingWired *setting)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (NM_IS_SETTING_WIRED (setting), NULL);
|
||||||
|
|
||||||
|
return NM_SETTING_WIRED_GET_PRIVATE (setting)->duplex;
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
nm_setting_wired_get_auto_negotiate (NMSettingWired *setting)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (NM_IS_SETTING_WIRED (setting), FALSE);
|
||||||
|
|
||||||
|
return NM_SETTING_WIRED_GET_PRIVATE (setting)->auto_negotiate;
|
||||||
|
}
|
||||||
|
|
||||||
|
const GByteArray *
|
||||||
|
nm_setting_wired_get_mac_address (NMSettingWired *setting)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (NM_IS_SETTING_WIRED (setting), NULL);
|
||||||
|
|
||||||
|
return NM_SETTING_WIRED_GET_PRIVATE (setting)->mac_address;
|
||||||
|
}
|
||||||
|
|
||||||
|
guint32
|
||||||
|
nm_setting_wired_get_mtu (NMSettingWired *setting)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (NM_IS_SETTING_WIRED (setting), 0);
|
||||||
|
|
||||||
|
return NM_SETTING_WIRED_GET_PRIVATE (setting)->mtu;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
verify (NMSetting *setting, GSList *all_settings, GError **error)
|
verify (NMSetting *setting, GSList *all_settings, GError **error)
|
||||||
{
|
{
|
||||||
NMSettingWired *self = NM_SETTING_WIRED (setting);
|
NMSettingWiredPrivate *priv = NM_SETTING_WIRED_GET_PRIVATE (setting);
|
||||||
const char *valid_ports[] = { "tp", "aui", "bnc", "mii", NULL };
|
const char *valid_ports[] = { "tp", "aui", "bnc", "mii", NULL };
|
||||||
const char *valid_duplex[] = { "half", "full", NULL };
|
const char *valid_duplex[] = { "half", "full", NULL };
|
||||||
|
|
||||||
if (self->port && !nm_utils_string_in_list (self->port, valid_ports)) {
|
if (priv->port && !nm_utils_string_in_list (priv->port, valid_ports)) {
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
NM_SETTING_WIRED_ERROR,
|
NM_SETTING_WIRED_ERROR,
|
||||||
NM_SETTING_WIRED_ERROR_INVALID_PROPERTY,
|
NM_SETTING_WIRED_ERROR_INVALID_PROPERTY,
|
||||||
|
@ -98,7 +157,7 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->duplex && !nm_utils_string_in_list (self->duplex, valid_duplex)) {
|
if (priv->duplex && !nm_utils_string_in_list (priv->duplex, valid_duplex)) {
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
NM_SETTING_WIRED_ERROR,
|
NM_SETTING_WIRED_ERROR,
|
||||||
NM_SETTING_WIRED_ERROR_INVALID_PROPERTY,
|
NM_SETTING_WIRED_ERROR_INVALID_PROPERTY,
|
||||||
|
@ -106,7 +165,7 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->mac_address && self->mac_address->len != ETH_ALEN) {
|
if (priv->mac_address && priv->mac_address->len != ETH_ALEN) {
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
NM_SETTING_WIRED_ERROR,
|
NM_SETTING_WIRED_ERROR,
|
||||||
NM_SETTING_WIRED_ERROR_INVALID_PROPERTY,
|
NM_SETTING_WIRED_ERROR_INVALID_PROPERTY,
|
||||||
|
@ -126,13 +185,13 @@ nm_setting_wired_init (NMSettingWired *setting)
|
||||||
static void
|
static void
|
||||||
finalize (GObject *object)
|
finalize (GObject *object)
|
||||||
{
|
{
|
||||||
NMSettingWired *self = NM_SETTING_WIRED (object);
|
NMSettingWiredPrivate *priv = NM_SETTING_WIRED_GET_PRIVATE (object);
|
||||||
|
|
||||||
g_free (self->port);
|
g_free (priv->port);
|
||||||
g_free (self->duplex);
|
g_free (priv->duplex);
|
||||||
|
|
||||||
if (self->mac_address)
|
if (priv->mac_address)
|
||||||
g_byte_array_free (self->mac_address, TRUE);
|
g_byte_array_free (priv->mac_address, TRUE);
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_setting_wired_parent_class)->finalize (object);
|
G_OBJECT_CLASS (nm_setting_wired_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
@ -141,30 +200,30 @@ static void
|
||||||
set_property (GObject *object, guint prop_id,
|
set_property (GObject *object, guint prop_id,
|
||||||
const GValue *value, GParamSpec *pspec)
|
const GValue *value, GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
NMSettingWired *setting = NM_SETTING_WIRED (object);
|
NMSettingWiredPrivate *priv = NM_SETTING_WIRED_GET_PRIVATE (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_PORT:
|
case PROP_PORT:
|
||||||
g_free (setting->port);
|
g_free (priv->port);
|
||||||
setting->port = g_value_dup_string (value);
|
priv->port = g_value_dup_string (value);
|
||||||
break;
|
break;
|
||||||
case PROP_SPEED:
|
case PROP_SPEED:
|
||||||
setting->speed = g_value_get_uint (value);
|
priv->speed = g_value_get_uint (value);
|
||||||
break;
|
break;
|
||||||
case PROP_DUPLEX:
|
case PROP_DUPLEX:
|
||||||
g_free (setting->duplex);
|
g_free (priv->duplex);
|
||||||
setting->duplex = g_value_dup_string (value);
|
priv->duplex = g_value_dup_string (value);
|
||||||
break;
|
break;
|
||||||
case PROP_AUTO_NEGOTIATE:
|
case PROP_AUTO_NEGOTIATE:
|
||||||
setting->auto_negotiate = g_value_get_boolean (value);
|
priv->auto_negotiate = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
case PROP_MAC_ADDRESS:
|
case PROP_MAC_ADDRESS:
|
||||||
if (setting->mac_address)
|
if (priv->mac_address)
|
||||||
g_byte_array_free (setting->mac_address, TRUE);
|
g_byte_array_free (priv->mac_address, TRUE);
|
||||||
setting->mac_address = g_value_dup_boxed (value);
|
priv->mac_address = g_value_dup_boxed (value);
|
||||||
break;
|
break;
|
||||||
case PROP_MTU:
|
case PROP_MTU:
|
||||||
setting->mtu = g_value_get_uint (value);
|
priv->mtu = g_value_get_uint (value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
@ -180,22 +239,22 @@ get_property (GObject *object, guint prop_id,
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_PORT:
|
case PROP_PORT:
|
||||||
g_value_set_string (value, setting->port);
|
g_value_set_string (value, nm_setting_wired_get_port (setting));
|
||||||
break;
|
break;
|
||||||
case PROP_SPEED:
|
case PROP_SPEED:
|
||||||
g_value_set_uint (value, setting->speed);
|
g_value_set_uint (value, nm_setting_wired_get_speed (setting));
|
||||||
break;
|
break;
|
||||||
case PROP_DUPLEX:
|
case PROP_DUPLEX:
|
||||||
g_value_set_string (value, setting->duplex);
|
g_value_set_string (value, nm_setting_wired_get_duplex (setting));
|
||||||
break;
|
break;
|
||||||
case PROP_AUTO_NEGOTIATE:
|
case PROP_AUTO_NEGOTIATE:
|
||||||
g_value_set_boolean (value, setting->auto_negotiate);
|
g_value_set_boolean (value, nm_setting_wired_get_auto_negotiate (setting));
|
||||||
break;
|
break;
|
||||||
case PROP_MAC_ADDRESS:
|
case PROP_MAC_ADDRESS:
|
||||||
g_value_set_boxed (value, setting->mac_address);
|
g_value_set_boxed (value, nm_setting_wired_get_mac_address (setting));
|
||||||
break;
|
break;
|
||||||
case PROP_MTU:
|
case PROP_MTU:
|
||||||
g_value_set_uint (value, setting->mtu);
|
g_value_set_uint (value, nm_setting_wired_get_mtu (setting));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
@ -209,6 +268,8 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_class)
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (setting_class);
|
GObjectClass *object_class = G_OBJECT_CLASS (setting_class);
|
||||||
NMSettingClass *parent_class = NM_SETTING_CLASS (setting_class);
|
NMSettingClass *parent_class = NM_SETTING_CLASS (setting_class);
|
||||||
|
|
||||||
|
g_type_class_add_private (setting_class, sizeof (NMSettingWiredPrivate));
|
||||||
|
|
||||||
/* virtual methods */
|
/* virtual methods */
|
||||||
object_class->set_property = set_property;
|
object_class->set_property = set_property;
|
||||||
object_class->get_property = get_property;
|
object_class->get_property = get_property;
|
||||||
|
|
|
@ -61,13 +61,6 @@ GQuark nm_setting_wired_error_quark (void);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NMSetting parent;
|
NMSetting parent;
|
||||||
|
|
||||||
char *port;
|
|
||||||
guint32 speed;
|
|
||||||
char *duplex;
|
|
||||||
gboolean auto_negotiate;
|
|
||||||
GByteArray *mac_address;
|
|
||||||
guint32 mtu;
|
|
||||||
} NMSettingWired;
|
} NMSettingWired;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -76,7 +69,13 @@ typedef struct {
|
||||||
|
|
||||||
GType nm_setting_wired_get_type (void);
|
GType nm_setting_wired_get_type (void);
|
||||||
|
|
||||||
NMSetting *nm_setting_wired_new (void);
|
NMSetting *nm_setting_wired_new (void);
|
||||||
|
const char *nm_setting_wired_get_port (NMSettingWired *setting);
|
||||||
|
guint32 nm_setting_wired_get_speed (NMSettingWired *setting);
|
||||||
|
const char *nm_setting_wired_get_duplex (NMSettingWired *setting);
|
||||||
|
gboolean nm_setting_wired_get_auto_negotiate (NMSettingWired *setting);
|
||||||
|
const GByteArray *nm_setting_wired_get_mac_address (NMSettingWired *setting);
|
||||||
|
guint32 nm_setting_wired_get_mtu (NMSettingWired *setting);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -570,8 +570,10 @@ real_get_best_auto_connection (NMDevice *dev,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (s_wired) {
|
if (s_wired) {
|
||||||
if ( s_wired->mac_address
|
const GByteArray *mac;
|
||||||
&& memcmp (s_wired->mac_address->data, priv->hw_addr.ether_addr_octet, ETH_ALEN))
|
|
||||||
|
mac = nm_setting_wired_get_mac_address (s_wired);
|
||||||
|
if (mac && memcmp (mac->data, priv->hw_addr.ether_addr_octet, ETH_ALEN))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1326,6 +1328,7 @@ real_act_stage4_get_ip4_config (NMDevice *device,
|
||||||
if (ret == NM_ACT_STAGE_RETURN_SUCCESS) {
|
if (ret == NM_ACT_STAGE_RETURN_SUCCESS) {
|
||||||
NMConnection *connection;
|
NMConnection *connection;
|
||||||
NMSettingWired *s_wired;
|
NMSettingWired *s_wired;
|
||||||
|
guint32 mtu;
|
||||||
|
|
||||||
connection = nm_act_request_get_connection (nm_device_get_act_request (device));
|
connection = nm_act_request_get_connection (nm_device_get_act_request (device));
|
||||||
g_assert (connection);
|
g_assert (connection);
|
||||||
|
@ -1333,8 +1336,9 @@ real_act_stage4_get_ip4_config (NMDevice *device,
|
||||||
g_assert (s_wired);
|
g_assert (s_wired);
|
||||||
|
|
||||||
/* MTU override */
|
/* MTU override */
|
||||||
if (s_wired->mtu)
|
mtu = nm_setting_wired_get_mtu (s_wired);
|
||||||
nm_ip4_config_set_mtu (*config, s_wired->mtu);
|
if (mtu)
|
||||||
|
nm_ip4_config_set_mtu (*config, mtu);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* PPPoE */
|
/* PPPoE */
|
||||||
|
@ -1401,8 +1405,10 @@ real_check_connection_compatible (NMDevice *device,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_wired) {
|
if (s_wired) {
|
||||||
if ( s_wired->mac_address
|
const GByteArray *mac;
|
||||||
&& memcmp (s_wired->mac_address->data, &(priv->hw_addr.ether_addr_octet), ETH_ALEN)) {
|
|
||||||
|
mac = nm_setting_wired_get_mac_address (s_wired);
|
||||||
|
if (mac && memcmp (mac->data, &(priv->hw_addr.ether_addr_octet), ETH_ALEN)) {
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
NM_ETHERNET_ERROR, NM_ETHERNET_ERROR_CONNECTION_INCOMPATIBLE,
|
NM_ETHERNET_ERROR, NM_ETHERNET_ERROR_CONNECTION_INCOMPATIBLE,
|
||||||
"The connection's MAC address did not match this device.");
|
"The connection's MAC address did not match this device.");
|
||||||
|
|
|
@ -79,7 +79,7 @@ enum {
|
||||||
static guint signals[LAST_SIGNAL] = { 0 };
|
static guint signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
get_ether_device_udi (DBusGConnection *g_connection, GByteArray *mac, GSList *devices)
|
get_ether_device_udi (DBusGConnection *g_connection, const GByteArray *mac, GSList *devices)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GSList *iter;
|
GSList *iter;
|
||||||
|
@ -168,7 +168,7 @@ get_udi_for_connection (NMConnection *connection,
|
||||||
s_wired = (NMSettingWired *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED);
|
s_wired = (NMSettingWired *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED);
|
||||||
if (s_wired) {
|
if (s_wired) {
|
||||||
devices = nm_system_config_hal_manager_get_devices_of_type (hal_mgr, NM_DEVICE_TYPE_ETHERNET);
|
devices = nm_system_config_hal_manager_get_devices_of_type (hal_mgr, NM_DEVICE_TYPE_ETHERNET);
|
||||||
udi = get_ether_device_udi (g_connection, s_wired->mac_address, devices);
|
udi = get_ether_device_udi (g_connection, nm_setting_wired_get_mac_address (s_wired), devices);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -199,7 +199,7 @@ make_wired_setting (shvarFile *ifcfg)
|
||||||
;
|
;
|
||||||
else if (get_int (str, &mtu)) {
|
else if (get_int (str, &mtu)) {
|
||||||
if (mtu >= 0 && mtu < G_MAXINT)
|
if (mtu >= 0 && mtu < G_MAXINT)
|
||||||
s_wired->mtu = mtu;
|
g_object_set (s_wired, NM_SETTING_WIRED_MTU, mtu, NULL);
|
||||||
} else
|
} else
|
||||||
g_warning ("Ignoring invalid MTU: '%s'", str);
|
g_warning ("Ignoring invalid MTU: '%s'", str);
|
||||||
g_free (str);
|
g_free (str);
|
||||||
|
|
|
@ -281,6 +281,7 @@ have_connection_for_device (Application *app, GByteArray *mac)
|
||||||
GSList *list, *iter;
|
GSList *list, *iter;
|
||||||
NMSettingConnection *s_con;
|
NMSettingConnection *s_con;
|
||||||
NMSettingWired *s_wired;
|
NMSettingWired *s_wired;
|
||||||
|
const GByteArray *setting_mac;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
|
||||||
g_return_val_if_fail (app != NULL, FALSE);
|
g_return_val_if_fail (app != NULL, FALSE);
|
||||||
|
@ -311,9 +312,10 @@ have_connection_for_device (Application *app, GByteArray *mac)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_wired->mac_address) {
|
setting_mac = nm_setting_wired_get_mac_address (s_wired);
|
||||||
|
if (setting_mac) {
|
||||||
/* A connection mac-locked to this device */
|
/* A connection mac-locked to this device */
|
||||||
if (!memcmp (s_wired->mac_address->data, mac->data, ETH_ALEN)) {
|
if (!memcmp (setting_mac->data, mac->data, ETH_ALEN)) {
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -337,6 +339,7 @@ add_default_dhcp_connection (gpointer user_data)
|
||||||
NMSettingConnection *s_con;
|
NMSettingConnection *s_con;
|
||||||
NMSettingWired *s_wired;
|
NMSettingWired *s_wired;
|
||||||
NMConnection *wrapped;
|
NMConnection *wrapped;
|
||||||
|
GByteArray *setting_mac;
|
||||||
|
|
||||||
if (info->add_id)
|
if (info->add_id)
|
||||||
info->add_id = 0;
|
info->add_id = 0;
|
||||||
|
@ -373,8 +376,12 @@ add_default_dhcp_connection (gpointer user_data)
|
||||||
|
|
||||||
/* Lock the connection to this device */
|
/* Lock the connection to this device */
|
||||||
s_wired = NM_SETTING_WIRED (nm_setting_wired_new ());
|
s_wired = NM_SETTING_WIRED (nm_setting_wired_new ());
|
||||||
s_wired->mac_address = g_byte_array_sized_new (ETH_ALEN);
|
|
||||||
g_byte_array_append (s_wired->mac_address, info->mac->data, ETH_ALEN);
|
setting_mac = g_byte_array_sized_new (ETH_ALEN);
|
||||||
|
g_byte_array_append (setting_mac, info->mac->data, ETH_ALEN);
|
||||||
|
g_object_set (s_wired, NM_SETTING_WIRED_MAC_ADDRESS, setting_mac, NULL);
|
||||||
|
g_byte_array_free (setting_mac, TRUE);
|
||||||
|
|
||||||
nm_connection_add_setting (wrapped, NM_SETTING (s_wired));
|
nm_connection_add_setting (wrapped, NM_SETTING (s_wired));
|
||||||
|
|
||||||
nm_sysconfig_settings_add_connection (info->app->settings, info->connection);
|
nm_sysconfig_settings_add_connection (info->app->settings, info->connection);
|
||||||
|
|
Loading…
Reference in a new issue