2007-08-28 Dan Williams <dcbw@redhat.com>
* src/nm-device.c src/named-manager/nm-named-manager.c src/named-manager/nm-named-manager.h src/NetworkManager.c src/vpn-manager/nm-vpn-manager.c src/NetworkManagerMain.h src/NetworkManagerSystem.c - Remove the named-manager object from NMData structure in preparation for NMData's timely death. Make the NMNamedManager the singleton that it really is git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2739 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
13
ChangeLog
13
ChangeLog
@@ -1,3 +1,16 @@
|
|||||||
|
2007-08-28 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
|
* src/nm-device.c
|
||||||
|
src/named-manager/nm-named-manager.c
|
||||||
|
src/named-manager/nm-named-manager.h
|
||||||
|
src/NetworkManager.c
|
||||||
|
src/vpn-manager/nm-vpn-manager.c
|
||||||
|
src/NetworkManagerMain.h
|
||||||
|
src/NetworkManagerSystem.c
|
||||||
|
- Remove the named-manager object from NMData structure in preparation
|
||||||
|
for NMData's timely death. Make the NMNamedManager the singleton that
|
||||||
|
it really is
|
||||||
|
|
||||||
2007-08-28 Dan Williams <dcbw@redhat.com>
|
2007-08-28 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
Remove NMAPSecurity objects, they are replaced with flags on the APs for
|
Remove NMAPSecurity objects, they are replaced with flags on the APs for
|
||||||
|
@@ -147,8 +147,6 @@ static void nm_data_free (NMData *data)
|
|||||||
nm_ap_list_unref (data->allowed_ap_list);
|
nm_ap_list_unref (data->allowed_ap_list);
|
||||||
nm_ap_list_unref (data->invalid_ap_list);
|
nm_ap_list_unref (data->invalid_ap_list);
|
||||||
|
|
||||||
g_object_unref (data->named_manager);
|
|
||||||
|
|
||||||
g_slice_free (NMData, data);
|
g_slice_free (NMData, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,6 +301,7 @@ main (int argc, char *argv[])
|
|||||||
NMPolicy *policy;
|
NMPolicy *policy;
|
||||||
NMHalManager *hal_manager = NULL;
|
NMHalManager *hal_manager = NULL;
|
||||||
NMVPNManager *vpn_manager = NULL;
|
NMVPNManager *vpn_manager = NULL;
|
||||||
|
NMNamedManager *named_mgr = NULL;
|
||||||
NMDBusManager * dbus_mgr;
|
NMDBusManager * dbus_mgr;
|
||||||
DBusConnection *dbus_connection;
|
DBusConnection *dbus_connection;
|
||||||
NMSupplicantManager * sup_mgr = NULL;
|
NMSupplicantManager * sup_mgr = NULL;
|
||||||
@@ -425,8 +424,8 @@ main (int argc, char *argv[])
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
nm_data->named_manager = nm_named_manager_new ();
|
named_mgr = nm_named_manager_get ();
|
||||||
if (!nm_data->named_manager) {
|
if (!named_mgr) {
|
||||||
nm_warning ("Failed to start the named manager.");
|
nm_warning ("Failed to start the named manager.");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@@ -34,8 +34,6 @@ typedef struct NMVPNManager NMVPNManager;
|
|||||||
|
|
||||||
typedef struct NMData
|
typedef struct NMData
|
||||||
{
|
{
|
||||||
NMNamedManager * named_manager;
|
|
||||||
|
|
||||||
struct NMAccessPointList *allowed_ap_list;
|
struct NMAccessPointList *allowed_ap_list;
|
||||||
struct NMAccessPointList *invalid_ap_list;
|
struct NMAccessPointList *invalid_ap_list;
|
||||||
} NMData;
|
} NMData;
|
||||||
|
@@ -188,7 +188,7 @@ out:
|
|||||||
*/
|
*/
|
||||||
gboolean nm_system_device_set_from_ip4_config (NMDevice *dev)
|
gboolean nm_system_device_set_from_ip4_config (NMDevice *dev)
|
||||||
{
|
{
|
||||||
NMData * app_data;
|
NMNamedManager * named_mgr;
|
||||||
NMIP4Config * config;
|
NMIP4Config * config;
|
||||||
struct nl_handle * nlh = NULL;
|
struct nl_handle * nlh = NULL;
|
||||||
struct rtnl_addr * addr = NULL;
|
struct rtnl_addr * addr = NULL;
|
||||||
@@ -196,9 +196,6 @@ gboolean nm_system_device_set_from_ip4_config (NMDevice *dev)
|
|||||||
|
|
||||||
g_return_val_if_fail (dev != NULL, FALSE);
|
g_return_val_if_fail (dev != NULL, FALSE);
|
||||||
|
|
||||||
app_data = nm_device_get_app_data (dev);
|
|
||||||
g_return_val_if_fail (app_data != NULL, FALSE);
|
|
||||||
|
|
||||||
config = nm_device_get_ip4_config (dev);
|
config = nm_device_get_ip4_config (dev);
|
||||||
g_return_val_if_fail (config != NULL, FALSE);
|
g_return_val_if_fail (config != NULL, FALSE);
|
||||||
|
|
||||||
@@ -222,7 +219,9 @@ gboolean nm_system_device_set_from_ip4_config (NMDevice *dev)
|
|||||||
sleep (1);
|
sleep (1);
|
||||||
nm_system_device_set_ip4_route (dev, nm_ip4_config_get_gateway (config), 0, 0, nm_ip4_config_get_mss (config));
|
nm_system_device_set_ip4_route (dev, nm_ip4_config_get_gateway (config), 0, 0, nm_ip4_config_get_mss (config));
|
||||||
|
|
||||||
nm_named_manager_add_ip4_config (app_data->named_manager, config);
|
named_mgr = nm_named_manager_get ();
|
||||||
|
nm_named_manager_add_ip4_config (named_mgr, config);
|
||||||
|
g_object_unref (named_mgr);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@@ -79,6 +79,22 @@ struct NMNamedManagerPrivate {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
NMNamedManager *
|
||||||
|
nm_named_manager_get (void)
|
||||||
|
{
|
||||||
|
static NMNamedManager * singleton = NULL;
|
||||||
|
|
||||||
|
if (!singleton) {
|
||||||
|
singleton = NM_NAMED_MANAGER (g_object_new (NM_TYPE_NAMED_MANAGER, NULL));
|
||||||
|
} else {
|
||||||
|
g_object_ref (singleton);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_assert (singleton);
|
||||||
|
return singleton;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
GQuark
|
GQuark
|
||||||
nm_named_manager_error_quark (void)
|
nm_named_manager_error_quark (void)
|
||||||
{
|
{
|
||||||
|
@@ -62,7 +62,7 @@ typedef struct {
|
|||||||
|
|
||||||
GType nm_named_manager_get_type (void);
|
GType nm_named_manager_get_type (void);
|
||||||
|
|
||||||
NMNamedManager * nm_named_manager_new (void);
|
NMNamedManager * nm_named_manager_get (void);
|
||||||
|
|
||||||
gboolean nm_named_manager_add_ip4_config (NMNamedManager *mgr, NMIP4Config *config);
|
gboolean nm_named_manager_add_ip4_config (NMNamedManager *mgr, NMIP4Config *config);
|
||||||
|
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
#include "NetworkManagerSystem.h"
|
#include "NetworkManagerSystem.h"
|
||||||
#include "nm-dhcp-manager.h"
|
#include "nm-dhcp-manager.h"
|
||||||
#include "nm-dbus-manager.h"
|
#include "nm-dbus-manager.h"
|
||||||
|
#include "nm-named-manager.h"
|
||||||
#include "nm-utils.h"
|
#include "nm-utils.h"
|
||||||
#include "autoip.h"
|
#include "autoip.h"
|
||||||
#include "nm-netlink.h"
|
#include "nm-netlink.h"
|
||||||
@@ -1030,6 +1031,7 @@ nm_device_deactivate (NMDeviceInterface *device)
|
|||||||
{
|
{
|
||||||
NMDevice *self = NM_DEVICE (device);
|
NMDevice *self = NM_DEVICE (device);
|
||||||
NMIP4Config * config;
|
NMIP4Config * config;
|
||||||
|
NMNamedManager * named_mgr;
|
||||||
|
|
||||||
g_return_if_fail (self != NULL);
|
g_return_if_fail (self != NULL);
|
||||||
|
|
||||||
@@ -1038,10 +1040,11 @@ nm_device_deactivate (NMDeviceInterface *device)
|
|||||||
nm_device_deactivate_quickly (self);
|
nm_device_deactivate_quickly (self);
|
||||||
|
|
||||||
/* Remove any device nameservers and domains */
|
/* Remove any device nameservers and domains */
|
||||||
if ((config = nm_device_get_ip4_config (self)))
|
if ((config = nm_device_get_ip4_config (self))) {
|
||||||
{
|
named_mgr = nm_named_manager_get ();
|
||||||
nm_named_manager_remove_ip4_config (self->priv->app_data->named_manager, config);
|
nm_named_manager_remove_ip4_config (named_mgr, config);
|
||||||
nm_device_set_ip4_config (self, NULL);
|
nm_device_set_ip4_config (self, NULL);
|
||||||
|
g_object_unref (named_mgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Take out any entries in the routing table and any IP address the device had. */
|
/* Take out any entries in the routing table and any IP address the device had. */
|
||||||
|
@@ -23,6 +23,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <dbus/dbus.h>
|
#include <dbus/dbus.h>
|
||||||
#include "nm-vpn-manager.h"
|
#include "nm-vpn-manager.h"
|
||||||
|
#include "nm-named-manager.h"
|
||||||
#include "NetworkManager.h"
|
#include "NetworkManager.h"
|
||||||
#include "NetworkManagerMain.h"
|
#include "NetworkManagerMain.h"
|
||||||
#include "NetworkManagerDbus.h"
|
#include "NetworkManagerDbus.h"
|
||||||
@@ -248,6 +249,7 @@ nm_vpn_manager_add_connection (NMVPNManager *manager,
|
|||||||
NMVPNService * service;
|
NMVPNService * service;
|
||||||
DBusConnection * dbus_connection;
|
DBusConnection * dbus_connection;
|
||||||
NMDBusManager * dbus_mgr = NULL;
|
NMDBusManager * dbus_mgr = NULL;
|
||||||
|
NMNamedManager * named_mgr = NULL;
|
||||||
GSList * elt;
|
GSList * elt;
|
||||||
|
|
||||||
g_return_val_if_fail (manager != NULL, NULL);
|
g_return_val_if_fail (manager != NULL, NULL);
|
||||||
@@ -266,10 +268,12 @@ nm_vpn_manager_add_connection (NMVPNManager *manager,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
named_mgr = nm_named_manager_get ();
|
||||||
connection = nm_vpn_connection_new (name,
|
connection = nm_vpn_connection_new (name,
|
||||||
user_name,
|
user_name,
|
||||||
service_name,
|
service_name,
|
||||||
manager->app_data->named_manager);
|
named_mgr);
|
||||||
|
g_object_unref (named_mgr);
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
nm_warning ("couldn't create VPN connecton for '%s (%s).",
|
nm_warning ("couldn't create VPN connecton for '%s (%s).",
|
||||||
name,
|
name,
|
||||||
|
Reference in New Issue
Block a user