2008-09-04 Dan Williams <dcbw@redhat.com>
* src/nm-ip4-config.c src/nm-ip4-config.h - (nm_ip4_config_new): don't export over D-Bus here - (nm_ip4_config_export): new function; export the config over D-Bus - (nm_ip4_config_is_exported): new function * src/nm-device.c - (nm_device_activate_stage5_ip_config_commit): fix leak of IP4Config objects by balancing the IP4Config constructor; the device holds a reference to the IP4Config already - (nm_device_set_ip4_config): export the IP4Config when needed git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4037 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
14
ChangeLog
14
ChangeLog
@@ -1,3 +1,17 @@
|
|||||||
|
2008-09-04 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
|
* src/nm-ip4-config.c
|
||||||
|
src/nm-ip4-config.h
|
||||||
|
- (nm_ip4_config_new): don't export over D-Bus here
|
||||||
|
- (nm_ip4_config_export): new function; export the config over D-Bus
|
||||||
|
- (nm_ip4_config_is_exported): new function
|
||||||
|
|
||||||
|
* src/nm-device.c
|
||||||
|
- (nm_device_activate_stage5_ip_config_commit): fix leak of IP4Config
|
||||||
|
objects by balancing the IP4Config constructor; the device holds
|
||||||
|
a reference to the IP4Config already
|
||||||
|
- (nm_device_set_ip4_config): export the IP4Config when needed
|
||||||
|
|
||||||
2008-09-04 Dan Williams <dcbw@redhat.com>
|
2008-09-04 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
* src/supplicant-manager/nm-supplicant-settings-verify.c
|
* src/supplicant-manager/nm-supplicant-settings-verify.c
|
||||||
|
@@ -1392,6 +1392,10 @@ nm_device_activate_stage5_ip_config_commit (gpointer user_data)
|
|||||||
out:
|
out:
|
||||||
nm_info ("Activation (%s) Stage 5 of 5 (IP Configure Commit) complete.",
|
nm_info ("Activation (%s) Stage 5 of 5 (IP Configure Commit) complete.",
|
||||||
iface);
|
iface);
|
||||||
|
|
||||||
|
/* Balance IP4Config creation; device takes ownership in set_ip4_config() */
|
||||||
|
g_object_unref (ip4_config);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1889,6 +1893,10 @@ nm_device_set_ip4_config (NMDevice *self, NMIP4Config *config, NMDeviceStateReas
|
|||||||
|
|
||||||
priv->ip4_config = g_object_ref (config);
|
priv->ip4_config = g_object_ref (config);
|
||||||
|
|
||||||
|
/* Export over D-Bus if needed */
|
||||||
|
if (!nm_ip4_config_is_exported (config))
|
||||||
|
nm_ip4_config_export (config);
|
||||||
|
|
||||||
success = nm_system_device_set_from_ip4_config (ip_iface, config);
|
success = nm_system_device_set_from_ip4_config (ip_iface, config);
|
||||||
if (success)
|
if (success)
|
||||||
nm_device_update_ip4_address (self);
|
nm_device_update_ip4_address (self);
|
||||||
|
@@ -45,6 +45,8 @@ G_DEFINE_TYPE (NMIP4Config, nm_ip4_config, G_TYPE_OBJECT)
|
|||||||
#define NM_IP4_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_IP4_CONFIG, NMIP4ConfigPrivate))
|
#define NM_IP4_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_IP4_CONFIG, NMIP4ConfigPrivate))
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
char *path;
|
||||||
|
|
||||||
GSList *addresses;
|
GSList *addresses;
|
||||||
guint32 ptp_address;
|
guint32 ptp_address;
|
||||||
|
|
||||||
@@ -75,20 +77,39 @@ enum {
|
|||||||
NMIP4Config *
|
NMIP4Config *
|
||||||
nm_ip4_config_new (void)
|
nm_ip4_config_new (void)
|
||||||
{
|
{
|
||||||
GObject *object;
|
return (NMIP4Config *) g_object_new (NM_TYPE_IP4_CONFIG, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nm_ip4_config_export (NMIP4Config *config)
|
||||||
|
{
|
||||||
|
NMIP4ConfigPrivate *priv;
|
||||||
|
NMDBusManager *dbus_mgr;
|
||||||
DBusGConnection *connection;
|
DBusGConnection *connection;
|
||||||
char *path;
|
|
||||||
static guint32 counter = 0;
|
static guint32 counter = 0;
|
||||||
|
|
||||||
object = g_object_new (NM_TYPE_IP4_CONFIG, NULL);
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
||||||
|
|
||||||
connection = nm_dbus_manager_get_connection (nm_dbus_manager_get ());
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
||||||
path = g_strdup_printf (NM_DBUS_PATH "/IP4Config/%d", counter++);
|
g_return_if_fail (priv->path == NULL);
|
||||||
|
|
||||||
dbus_g_connection_register_g_object (connection, path, object);
|
dbus_mgr = nm_dbus_manager_get ();
|
||||||
g_free (path);
|
connection = nm_dbus_manager_get_connection (dbus_mgr);
|
||||||
|
priv->path = g_strdup_printf (NM_DBUS_PATH "/IP4Config/%d", counter++);
|
||||||
|
|
||||||
return (NMIP4Config *) object;
|
dbus_g_connection_register_g_object (connection, priv->path, G_OBJECT (config));
|
||||||
|
g_object_unref (dbus_mgr);
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
nm_ip4_config_is_exported (NMIP4Config *config)
|
||||||
|
{
|
||||||
|
NMIP4ConfigPrivate *priv;
|
||||||
|
|
||||||
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), FALSE);
|
||||||
|
|
||||||
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
||||||
|
return !!priv->path;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@@ -56,7 +56,8 @@ GType nm_ip4_config_get_type (void);
|
|||||||
|
|
||||||
|
|
||||||
NMIP4Config * nm_ip4_config_new (void);
|
NMIP4Config * nm_ip4_config_new (void);
|
||||||
NMIP4Config * nm_ip4_config_copy (NMIP4Config *config);
|
void nm_ip4_config_export (NMIP4Config *config);
|
||||||
|
gboolean nm_ip4_config_is_exported (NMIP4Config *config);
|
||||||
|
|
||||||
void nm_ip4_config_take_address (NMIP4Config *config, NMSettingIP4Address *address);
|
void nm_ip4_config_take_address (NMIP4Config *config, NMSettingIP4Address *address);
|
||||||
void nm_ip4_config_add_address (NMIP4Config *config, NMSettingIP4Address *address);
|
void nm_ip4_config_add_address (NMIP4Config *config, NMSettingIP4Address *address);
|
||||||
|
Reference in New Issue
Block a user