2005-09-28 Dan Williams <dcbw@redhat.com>
Support for named + DBus, using Red Hat DBus patches for named. You can find those patches here, with "dbus" in the patch's filename: http://cvs.fedora.redhat.com/viewcvs/devel/bind/ Don't forget the named dbus service file either. Instead of writing a config file and spawing a named process, NM will use an already-running dbus-enabled named if it finds one. NM will update named's forwarder configuration on the fly using dbus. If there is no dbus-enabled named running, NM will automatically fall back to writing the most-recent DNS server information to /etc/resolv.conf and calling nm_system_update_dns() to kick the system's resolver. Accordingly, all named-related configure-time options have been removed. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@981 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
19
ChangeLog
19
ChangeLog
@@ -1,3 +1,22 @@
|
||||
2005-09-28 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
Support for named + DBus, using Red Hat DBus patches for named. You
|
||||
can find those patches here, with "dbus" in the patch's filename:
|
||||
|
||||
http://cvs.fedora.redhat.com/viewcvs/devel/bind/
|
||||
|
||||
Don't forget the named dbus service file either.
|
||||
|
||||
Instead of writing a config file and spawing a named process, NM will
|
||||
use an already-running dbus-enabled named if it finds one. NM will
|
||||
update named's forwarder configuration on the fly using dbus.
|
||||
|
||||
If there is no dbus-enabled named running, NM will automatically fall
|
||||
back to writing the most-recent DNS server information to /etc/resolv.conf
|
||||
and calling nm_system_update_dns() to kick the system's resolver.
|
||||
|
||||
Accordingly, all named-related configure-time options have been removed.
|
||||
|
||||
2005-09-26 Robert Love <rml@novell.com>
|
||||
|
||||
* src/backends/NetworkManagerSuSE.c, (nm_system_get_dialup_config): Add
|
||||
|
10
configure.in
10
configure.in
@@ -187,16 +187,6 @@ fi
|
||||
AC_SUBST(DBUS_SYS_DIR)
|
||||
AC_DEFINE_UNQUOTED(DBUS_SYSTEMD_DIR, "$DBUS_SYS_DIR", [Where system.d dir for DBUS is])
|
||||
|
||||
AC_ARG_WITH(named, AC_HELP_STRING([--with-named=PATH], [path to the named binary]))
|
||||
AC_ARG_WITH(named_dir, AC_HELP_STRING([--with-named-dir=PATH], [path to the named data directory]))
|
||||
AC_ARG_WITH(named_user, AC_HELP_STRING([--with-named-user=USERNAME], [named username]))
|
||||
if test "x${with_named}" = "x" -o "x${with_named}" = xno; then
|
||||
AC_DEFINE(NM_NO_NAMED,,[Define if you want to disable named support])
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(NM_NAMED_BINARY_PATH, "$with_named", [Define to path of named binary])
|
||||
AC_DEFINE_UNQUOTED(NM_NAMED_DATA_DIR, "$with_named_dir", [Define to path of named data directory])
|
||||
AC_DEFINE_UNQUOTED(NM_NAMED_USER, "$with_named_user", [Define to named username])
|
||||
|
||||
AC_ARG_WITH(dhcdbd, AC_HELP_STRING([--with-dhcdbd=/path/to/dhcdbd], [path to dhcdbd]))
|
||||
if test "x${with_dhcdbd}" = x; then
|
||||
AC_PATH_PROG(DHCDBD_BINARY_PATH, dhcdbd, [], $PATH:/sbin:/usr/sbin)
|
||||
|
@@ -403,8 +403,6 @@ static NMData *nm_data_new (gboolean enable_test_devices)
|
||||
sigaction (SIGINT, &action, NULL);
|
||||
sigaction (SIGTERM, &action, NULL);
|
||||
|
||||
data->named_manager = nm_named_manager_new (data->main_context);
|
||||
|
||||
/* Initialize the device list mutex to protect additions/deletions to it. */
|
||||
data->dev_list_mutex = g_mutex_new ();
|
||||
data->dialup_list_mutex = g_mutex_new ();
|
||||
@@ -917,6 +915,7 @@ int main( int argc, char *argv[] )
|
||||
/* Need to happen after DBUS is initialized */
|
||||
nm_data->vpn_manager = nm_vpn_manager_new (nm_data);
|
||||
nm_data->dhcp_manager = nm_dhcp_manager_new (nm_data);
|
||||
nm_data->named_manager = nm_named_manager_new (nm_data->dbus_connection);
|
||||
|
||||
/* If NMI is running, grab allowed wireless network lists from it ASAP */
|
||||
if (nm_dbus_is_info_daemon_running (nm_data->dbus_connection))
|
||||
@@ -951,13 +950,6 @@ int main( int argc, char *argv[] )
|
||||
/* Get modems, ISDN, and so on's configuration from the system */
|
||||
nm_data->dialup_list = nm_system_get_dialup_config ();
|
||||
|
||||
if (!nm_named_manager_start (nm_data->named_manager, &error))
|
||||
{
|
||||
nm_error ("couldn't initialize nameserver: %s",
|
||||
error->message);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
nm_schedule_state_change_signal_broadcast (nm_data);
|
||||
|
||||
/* Wheeee!!! */
|
||||
|
@@ -1079,27 +1079,17 @@ static DBusHandlerResult nm_dbus_signal_filter (DBusConnection *connection, DBus
|
||||
nm_hal_deinit (data);
|
||||
}
|
||||
else if (nm_dhcp_manager_process_name_owner_changed (data->dhcp_manager, service, old_owner, new_owner) == TRUE)
|
||||
{
|
||||
/* Processed by the DHCP manager */
|
||||
handled = TRUE;
|
||||
}
|
||||
else if (nm_vpn_manager_process_name_owner_changed (data->vpn_manager, service, old_owner, new_owner) == TRUE)
|
||||
{
|
||||
/* Processed by the VPN manager */
|
||||
handled = TRUE;
|
||||
}
|
||||
else if (nm_named_manager_process_name_owner_changed (data->named_manager, service, old_owner, new_owner) == TRUE)
|
||||
handled = TRUE;
|
||||
}
|
||||
}
|
||||
else if (nm_dhcp_manager_process_signal (data->dhcp_manager, message) == TRUE)
|
||||
{
|
||||
/* Processed by the DHCP manager */
|
||||
handled = TRUE;
|
||||
}
|
||||
else if (nm_vpn_manager_process_signal (data->vpn_manager, message) == TRUE)
|
||||
{
|
||||
/* Processed by the VPN manager */
|
||||
handled = TRUE;
|
||||
}
|
||||
|
||||
if (dbus_error_is_set (&error))
|
||||
dbus_error_free (&error);
|
||||
|
@@ -3199,8 +3199,7 @@ gboolean nm_device_deactivate (NMDevice *dev)
|
||||
/* Remove any device nameservers and domains */
|
||||
if ((config = nm_device_get_ip4_config (dev)))
|
||||
{
|
||||
nm_system_remove_ip4_config_nameservers (dev->app_data->named_manager, config);
|
||||
nm_system_remove_ip4_config_search_domains (dev->app_data->named_manager, config);
|
||||
nm_named_manager_remove_ip4_config (dev->app_data->named_manager, config);
|
||||
nm_device_set_ip4_config (dev, NULL);
|
||||
}
|
||||
|
||||
|
@@ -66,116 +66,6 @@ static gboolean nm_system_device_set_ip4_route (NMDevice *dev, int ip4_gatew
|
||||
static gboolean nm_system_device_set_ip4_route_with_iface (NMDevice *dev, const char *iface, int ip4_gateway, int ip4_dest, int ip4_netmask);
|
||||
|
||||
|
||||
/*
|
||||
* nm_system_remove_ip4_config_nameservers
|
||||
*
|
||||
* Remove an IPv4 Config's nameservers from the name service.
|
||||
*
|
||||
*/
|
||||
void nm_system_remove_ip4_config_nameservers (NMNamedManager *named, NMIP4Config *config)
|
||||
{
|
||||
GError *error = NULL;
|
||||
int i, len;
|
||||
|
||||
g_return_if_fail (config != NULL);
|
||||
|
||||
len = nm_ip4_config_get_num_nameservers (config);
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
guint id = nm_ip4_config_get_nameserver_id (config, i);
|
||||
if ((id != 0) && !nm_named_manager_remove_nameserver_ipv4 (named, id, &error))
|
||||
{
|
||||
nm_warning ("Couldn't remove nameserver: %s", error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
else
|
||||
nm_ip4_config_set_nameserver_id (config, i, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void set_nameservers (NMNamedManager *named, NMIP4Config *config)
|
||||
{
|
||||
GError *error = NULL;
|
||||
int i, len;
|
||||
|
||||
g_return_if_fail (config != NULL);
|
||||
|
||||
len = nm_ip4_config_get_num_nameservers (config);
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
guint id;
|
||||
guint ns_addr = nm_ip4_config_get_nameserver (config, i);
|
||||
struct in_addr temp_addr;
|
||||
char * nameserver;
|
||||
|
||||
temp_addr.s_addr = ns_addr;
|
||||
nameserver = g_strdup (inet_ntoa (temp_addr));
|
||||
nm_info ("Adding nameserver: %s", nameserver);
|
||||
if ((id = nm_named_manager_add_nameserver_ipv4 (named, nameserver, &error)))
|
||||
nm_ip4_config_set_nameserver_id (config, i, id);
|
||||
else
|
||||
{
|
||||
nm_warning ("Couldn't add nameserver: %s", error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
g_free (nameserver);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nm_system_remove_ip4_config_search_domains
|
||||
*
|
||||
* Remove an IPv4 Config's search domains from the name service.
|
||||
*
|
||||
*/
|
||||
void nm_system_remove_ip4_config_search_domains (NMNamedManager *named, NMIP4Config *config)
|
||||
{
|
||||
GError *error = NULL;
|
||||
int i, len;
|
||||
|
||||
g_return_if_fail (config != NULL);
|
||||
|
||||
len = nm_ip4_config_get_num_domains (config);
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
guint id = nm_ip4_config_get_domain_id (config, i);
|
||||
if ((id != 0) && !nm_named_manager_remove_domain_search (named, id, &error))
|
||||
{
|
||||
nm_warning ("Couldn't remove domain search: %s", error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
else
|
||||
nm_ip4_config_set_domain_id (config, i, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void set_search_domains (NMNamedManager *named, NMIP4Config *config)
|
||||
{
|
||||
GError *error = NULL;
|
||||
int i, len;
|
||||
|
||||
g_return_if_fail (config != NULL);
|
||||
|
||||
len = nm_ip4_config_get_num_domains (config);
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
const char * domain = nm_ip4_config_get_domain (config, i);
|
||||
guint id;
|
||||
|
||||
nm_info ("Adding domain search: %s", domain);
|
||||
if ((id = nm_named_manager_add_domain_search (named, domain, &error)))
|
||||
nm_ip4_config_set_domain_id (config, i, id);
|
||||
else
|
||||
{
|
||||
nm_warning ("Couldn't add domain search: %s", error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nm_system_device_set_from_ip4_config
|
||||
*
|
||||
@@ -206,8 +96,7 @@ gboolean nm_system_device_set_from_ip4_config (NMDevice *dev)
|
||||
sleep (1);
|
||||
nm_system_device_set_ip4_route (dev, nm_ip4_config_get_gateway (config), 0, 0);
|
||||
|
||||
set_nameservers (app_data->named_manager, config);
|
||||
set_search_domains (app_data->named_manager, config);
|
||||
nm_named_manager_add_ip4_config (app_data->named_manager, config);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -302,12 +191,9 @@ gboolean nm_system_vpn_device_set_from_ip4_config (NMNamedManager *named, NMDevi
|
||||
g_return_val_if_fail (iface != NULL, FALSE);
|
||||
g_return_val_if_fail (config != NULL, FALSE);
|
||||
|
||||
/* Set up a route to the VPN gateway through the real network device */
|
||||
if (active_device && (ad_config = nm_device_get_ip4_config (active_device)))
|
||||
{
|
||||
nm_system_remove_ip4_config_nameservers (named, ad_config);
|
||||
nm_system_remove_ip4_config_search_domains (named, ad_config);
|
||||
nm_system_device_set_ip4_route (active_device, nm_ip4_config_get_gateway (ad_config), nm_ip4_config_get_gateway (config), 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
nm_system_device_set_up_down_with_iface (NULL, iface, TRUE);
|
||||
|
||||
@@ -345,8 +231,26 @@ gboolean nm_system_vpn_device_set_from_ip4_config (NMNamedManager *named, NMDevi
|
||||
}
|
||||
}
|
||||
|
||||
set_nameservers (named, config);
|
||||
set_search_domains (named, config);
|
||||
nm_named_manager_add_ip4_config (named, config);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nm_system_vpn_device_unset_from_ip4_config
|
||||
*
|
||||
* Unset an IPv4 configuration of a VPN device from an NMIP4Config object.
|
||||
*
|
||||
*/
|
||||
gboolean nm_system_vpn_device_unset_from_ip4_config (NMNamedManager *named, NMDevice *active_device, const char *iface, NMIP4Config *config)
|
||||
{
|
||||
g_return_val_if_fail (named != NULL, FALSE);
|
||||
g_return_val_if_fail (active_device != NULL, FALSE);
|
||||
g_return_val_if_fail (iface != NULL, FALSE);
|
||||
g_return_val_if_fail (config != NULL, FALSE);
|
||||
|
||||
nm_named_manager_remove_ip4_config (named, config);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -61,12 +61,9 @@ NMIP4Config * nm_system_device_new_ip4_system_config (NMDevice *dev);
|
||||
|
||||
gboolean nm_system_device_get_use_dhcp (NMDevice *dev);
|
||||
|
||||
/* Prototypes for system-layer network functions (ie setting IP address, etc) */
|
||||
void nm_system_remove_ip4_config_nameservers (NMNamedManager *named, NMIP4Config *config);
|
||||
void nm_system_remove_ip4_config_search_domains (NMNamedManager *named, NMIP4Config *config);
|
||||
|
||||
gboolean nm_system_device_set_from_ip4_config (NMDevice *dev);
|
||||
gboolean nm_system_vpn_device_set_from_ip4_config (NMNamedManager *named, NMDevice *active_device, const char *iface, NMIP4Config *config, char **routes, int num_routes);
|
||||
gboolean nm_system_vpn_device_unset_from_ip4_config (NMNamedManager *named, NMDevice *active_device, const char *iface, NMIP4Config *config);
|
||||
|
||||
gboolean nm_system_device_set_up_down (NMDevice *dev, gboolean up);
|
||||
gboolean nm_system_device_set_up_down_with_iface (NMDevice *dev, const char *iface, gboolean up);
|
||||
|
@@ -3,12 +3,12 @@ namedconfdir = $(pkgdatadir)
|
||||
|
||||
EXTRA_DIST = $(namedconf_DATA)
|
||||
|
||||
INCLUDES = -I${top_srcdir}/utils
|
||||
INCLUDES = -I${top_srcdir}/utils -I${top_srcdir}/src
|
||||
|
||||
noinst_LTLIBRARIES = libnamed-manager.la
|
||||
|
||||
libnamed_manager_la_SOURCES = nm-named-manager.h nm-named-manager.c
|
||||
|
||||
libnamed_manager_la_CPPFLAGS = $(DBUS_CFLAGS) $(GTHREAD_CFLAGS) -DNM_PKGDATADIR=\"$(pkgdatadir)\" -DNM_LOCALSTATEDIR=\"$(localstatedir)\"
|
||||
libnamed_manager_la_CPPFLAGS = $(DBUS_CFLAGS) $(GTHREAD_CFLAGS) -DNM_PKGDATADIR=\"$(pkgdatadir)\" -DNM_LOCALSTATEDIR=\"$(localstatedir)\" -DDBUS_API_SUBJECT_TO_CHANGE
|
||||
|
||||
libnamed_manager_la_LIBADD = $(DBUS_LIBS) $(GTHREAD_LIBS)
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -25,6 +25,8 @@
|
||||
|
||||
#include "config.h"
|
||||
#include <glib-object.h>
|
||||
#include <dbus/dbus.h>
|
||||
#include "nm-ip4-config.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@@ -63,30 +65,15 @@ typedef struct
|
||||
|
||||
GType nm_named_manager_get_type (void);
|
||||
|
||||
NMNamedManager * nm_named_manager_new (GMainContext *main_context);
|
||||
NMNamedManager * nm_named_manager_new (DBusConnection *connection);
|
||||
|
||||
gboolean nm_named_manager_start (NMNamedManager *mgr, GError **error);
|
||||
gboolean nm_named_manager_process_name_owner_changed (NMNamedManager *mgr,
|
||||
const char *changed_service_name,
|
||||
const char *old_owner, const char *new_owner);
|
||||
|
||||
guint nm_named_manager_add_domain_search (NMNamedManager *mgr,
|
||||
const char *domain,
|
||||
GError **error);
|
||||
guint nm_named_manager_add_nameserver_ipv4 (NMNamedManager *mgr,
|
||||
const char *server,
|
||||
GError **error);
|
||||
guint nm_named_manager_add_domain_nameserver_ipv4 (NMNamedManager *mgr,
|
||||
const char *domain,
|
||||
const char *server,
|
||||
GError **error);
|
||||
gboolean nm_named_manager_add_ip4_config (NMNamedManager *mgr, NMIP4Config *config);
|
||||
|
||||
gboolean nm_named_manager_remove_domain_search (NMNamedManager *mgr,
|
||||
guint id,
|
||||
GError **error);
|
||||
gboolean nm_named_manager_remove_nameserver_ipv4 (NMNamedManager *mgr,
|
||||
guint id,
|
||||
GError **error);
|
||||
gboolean nm_named_manager_remove_domain_nameserver_ipv4 (NMNamedManager *mgr,
|
||||
guint id,
|
||||
GError **error);
|
||||
gboolean nm_named_manager_remove_ip4_config (NMNamedManager *mgr, NMIP4Config *config);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@@ -27,18 +27,6 @@
|
||||
#include "nm-ip4-config.h"
|
||||
|
||||
|
||||
typedef struct NamserverID
|
||||
{
|
||||
guint32 ns_address;
|
||||
guint32 ns_id;
|
||||
} NameserverID;
|
||||
|
||||
typedef struct DomainID
|
||||
{
|
||||
char * domain;
|
||||
guint32 domain_id;
|
||||
} DomainID;
|
||||
|
||||
struct NMIP4Config
|
||||
{
|
||||
guint refcount;
|
||||
@@ -48,13 +36,15 @@ struct NMIP4Config
|
||||
guint32 ip4_broadcast;
|
||||
GSList * nameservers;
|
||||
GSList * domains;
|
||||
|
||||
/* If this is a VPN/etc config that requires
|
||||
* another device (like Ethernet) to already have
|
||||
* an IP4Config before it can be used.
|
||||
*/
|
||||
gboolean secondary;
|
||||
};
|
||||
|
||||
|
||||
static void domain_id_free (DomainID *did);
|
||||
static void nameserver_id_free (NameserverID *ns);
|
||||
|
||||
|
||||
NMIP4Config *nm_ip4_config_new (void)
|
||||
{
|
||||
NMIP4Config *config = g_malloc0 (sizeof (NMIP4Config));
|
||||
@@ -104,9 +94,8 @@ void nm_ip4_config_unref (NMIP4Config *config)
|
||||
config->refcount--;
|
||||
if (config->refcount <= 0)
|
||||
{
|
||||
g_slist_foreach (config->nameservers, (GFunc) nameserver_id_free, NULL);
|
||||
g_slist_free (config->nameservers);
|
||||
g_slist_foreach (config->domains, (GFunc) domain_id_free, NULL);
|
||||
g_slist_foreach (config->domains, (GFunc) g_free, NULL);
|
||||
g_slist_free (config->domains);
|
||||
|
||||
memset (config, 0, sizeof (NMIP4Config));
|
||||
@@ -114,6 +103,20 @@ void nm_ip4_config_unref (NMIP4Config *config)
|
||||
}
|
||||
}
|
||||
|
||||
gboolean nm_ip4_config_get_secondary (NMIP4Config *config)
|
||||
{
|
||||
g_return_val_if_fail (config != NULL, FALSE);
|
||||
|
||||
return config->secondary;
|
||||
}
|
||||
|
||||
void nm_ip4_config_set_secondary (NMIP4Config *config, gboolean secondary)
|
||||
{
|
||||
g_return_if_fail (config != NULL);
|
||||
|
||||
config->secondary = secondary;
|
||||
}
|
||||
|
||||
guint32 nm_ip4_config_get_address (NMIP4Config *config)
|
||||
{
|
||||
g_return_val_if_fail (config != NULL, 0);
|
||||
@@ -170,63 +173,25 @@ void nm_ip4_config_set_broadcast (NMIP4Config *config, guint32 broadcast)
|
||||
config->ip4_broadcast = broadcast;
|
||||
}
|
||||
|
||||
|
||||
static NameserverID *nameserver_id_new (guint32 nameserver)
|
||||
{
|
||||
NameserverID *ns = g_malloc0 (sizeof (NameserverID));
|
||||
|
||||
ns->ns_address = nameserver;
|
||||
|
||||
return ns;
|
||||
}
|
||||
|
||||
static void nameserver_id_free (NameserverID *ns)
|
||||
{
|
||||
g_free (ns);
|
||||
}
|
||||
|
||||
void nm_ip4_config_add_nameserver (NMIP4Config *config, guint32 nameserver)
|
||||
{
|
||||
g_return_if_fail (config != NULL);
|
||||
|
||||
config->nameservers = g_slist_append (config->nameservers, nameserver_id_new (nameserver));
|
||||
config->nameservers = g_slist_append (config->nameservers, GINT_TO_POINTER (nameserver));
|
||||
}
|
||||
|
||||
guint32 nm_ip4_config_get_nameserver (NMIP4Config *config, guint index)
|
||||
{
|
||||
NameserverID *ns;
|
||||
guint32 nameserver;
|
||||
|
||||
g_return_val_if_fail (config != NULL, 0);
|
||||
g_return_val_if_fail (index < g_slist_length (config->nameservers), 0);
|
||||
|
||||
if ((ns = g_slist_nth_data (config->nameservers, index)))
|
||||
return ns->ns_address;
|
||||
if ((nameserver = (guint32) g_slist_nth_data (config->nameservers, index)))
|
||||
return nameserver;
|
||||
return 0;
|
||||
}
|
||||
|
||||
guint32 nm_ip4_config_get_nameserver_id (NMIP4Config *config, guint index)
|
||||
{
|
||||
NameserverID *ns;
|
||||
|
||||
g_return_val_if_fail (config != NULL, 0);
|
||||
g_return_val_if_fail (index < g_slist_length (config->nameservers), 0);
|
||||
|
||||
if ((ns = g_slist_nth_data (config->nameservers, index)))
|
||||
return ns->ns_id;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void nm_ip4_config_set_nameserver_id (NMIP4Config *config, guint index, guint32 id)
|
||||
{
|
||||
NameserverID *ns;
|
||||
|
||||
g_return_if_fail (config != NULL);
|
||||
g_return_if_fail (index < g_slist_length (config->nameservers));
|
||||
|
||||
if ((ns = g_slist_nth_data (config->nameservers, index)))
|
||||
ns->ns_id = id;
|
||||
}
|
||||
|
||||
guint32 nm_ip4_config_get_num_nameservers (NMIP4Config *config)
|
||||
{
|
||||
g_return_val_if_fail (config != NULL, 0);
|
||||
@@ -235,24 +200,6 @@ guint32 nm_ip4_config_get_num_nameservers (NMIP4Config *config)
|
||||
}
|
||||
|
||||
|
||||
static DomainID *domain_id_new (const char *domain)
|
||||
{
|
||||
DomainID *did = g_malloc0 (sizeof (DomainID));
|
||||
|
||||
did->domain = g_strdup (domain);
|
||||
|
||||
return did;
|
||||
}
|
||||
|
||||
static void domain_id_free (DomainID *did)
|
||||
{
|
||||
if (!did)
|
||||
return;
|
||||
|
||||
g_free (did->domain);
|
||||
g_free (did);
|
||||
}
|
||||
|
||||
void nm_ip4_config_add_domain (NMIP4Config *config, const char *domain)
|
||||
{
|
||||
g_return_if_fail (config != NULL);
|
||||
@@ -261,44 +208,21 @@ void nm_ip4_config_add_domain (NMIP4Config *config, const char *domain)
|
||||
if (!strlen (domain))
|
||||
return;
|
||||
|
||||
config->domains = g_slist_append (config->domains, domain_id_new (domain));
|
||||
config->domains = g_slist_append (config->domains, g_strdup (domain));
|
||||
}
|
||||
|
||||
const char *nm_ip4_config_get_domain (NMIP4Config *config, guint index)
|
||||
{
|
||||
DomainID *did;
|
||||
const char *domain;
|
||||
|
||||
g_return_val_if_fail (config != NULL, NULL);
|
||||
g_return_val_if_fail (index < g_slist_length (config->domains), NULL);
|
||||
|
||||
if ((did = g_slist_nth_data (config->domains, index)))
|
||||
return did->domain;
|
||||
if ((domain = (const char *) g_slist_nth_data (config->domains, index)))
|
||||
return domain;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
guint32 nm_ip4_config_get_domain_id (NMIP4Config *config, guint index)
|
||||
{
|
||||
DomainID *did;
|
||||
|
||||
g_return_val_if_fail (config != NULL, 0);
|
||||
g_return_val_if_fail (index < g_slist_length (config->domains), 0);
|
||||
|
||||
if ((did = g_slist_nth_data (config->domains, index)))
|
||||
return did->domain_id;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void nm_ip4_config_set_domain_id (NMIP4Config *config, guint index, guint32 id)
|
||||
{
|
||||
DomainID *did;
|
||||
|
||||
g_return_if_fail (config != NULL);
|
||||
g_return_if_fail (index < g_slist_length (config->domains));
|
||||
|
||||
if ((did = g_slist_nth_data (config->domains, index)))
|
||||
did->domain_id = id;
|
||||
}
|
||||
|
||||
guint32 nm_ip4_config_get_num_domains (NMIP4Config *config)
|
||||
{
|
||||
g_return_val_if_fail (config != NULL, 0);
|
||||
|
@@ -32,6 +32,9 @@ NMIP4Config * nm_ip4_config_copy (NMIP4Config *config);
|
||||
void nm_ip4_config_ref (NMIP4Config *config);
|
||||
void nm_ip4_config_unref (NMIP4Config *config);
|
||||
|
||||
gboolean nm_ip4_config_get_secondary (NMIP4Config *config);
|
||||
void nm_ip4_config_set_secondary (NMIP4Config *config, gboolean secondary);
|
||||
|
||||
guint32 nm_ip4_config_get_address (NMIP4Config *config);
|
||||
void nm_ip4_config_set_address (NMIP4Config *config, guint32 addr);
|
||||
|
||||
@@ -46,14 +49,10 @@ void nm_ip4_config_set_broadcast (NMIP4Config *config, guint32 broadcast);
|
||||
|
||||
void nm_ip4_config_add_nameserver (NMIP4Config *config, guint32 nameserver);
|
||||
guint32 nm_ip4_config_get_nameserver (NMIP4Config *config, guint index);
|
||||
guint32 nm_ip4_config_get_nameserver_id (NMIP4Config *config, guint index);
|
||||
void nm_ip4_config_set_nameserver_id (NMIP4Config *config, guint index, guint32 id);
|
||||
guint32 nm_ip4_config_get_num_nameservers (NMIP4Config *config);
|
||||
|
||||
void nm_ip4_config_add_domain (NMIP4Config *config, const char *domain);
|
||||
const char * nm_ip4_config_get_domain (NMIP4Config *config, guint index);
|
||||
guint32 nm_ip4_config_get_domain_id (NMIP4Config *config, guint index);
|
||||
void nm_ip4_config_set_domain_id (NMIP4Config *config, guint index, guint32 id);
|
||||
guint32 nm_ip4_config_get_num_domains (NMIP4Config *config);
|
||||
|
||||
#endif
|
||||
|
@@ -146,12 +146,6 @@ void nm_vpn_connection_deactivate (NMVPNConnection *connection)
|
||||
{
|
||||
g_return_if_fail (connection != NULL);
|
||||
|
||||
if (connection->ip4_config)
|
||||
{
|
||||
nm_system_remove_ip4_config_nameservers (connection->named_manager, connection->ip4_config);
|
||||
nm_system_remove_ip4_config_search_domains (connection->named_manager, connection->ip4_config);
|
||||
}
|
||||
|
||||
if (connection->vpn_iface)
|
||||
{
|
||||
nm_system_device_set_up_down_with_iface (NULL, connection->vpn_iface, FALSE);
|
||||
@@ -161,6 +155,10 @@ void nm_vpn_connection_deactivate (NMVPNConnection *connection)
|
||||
|
||||
if (connection->ip4_config)
|
||||
{
|
||||
/* Remove attributes of the VPN's IP4 Config */
|
||||
nm_system_vpn_device_unset_from_ip4_config (connection->named_manager, connection->parent_dev,
|
||||
connection->vpn_iface, connection->ip4_config);
|
||||
|
||||
/* Reset routes, nameservers, and domains of the currently active device */
|
||||
nm_system_device_set_from_ip4_config (connection->parent_dev);
|
||||
}
|
||||
|
@@ -672,6 +672,8 @@ static void nm_vpn_service_stage4_ip_config_get (NMVPNService *service, NMVPNAct
|
||||
|
||||
config = nm_ip4_config_new ();
|
||||
|
||||
nm_ip4_config_set_secondary (config, TRUE);
|
||||
|
||||
nm_ip4_config_set_address (config, ip4_internal_address);
|
||||
|
||||
if (ip4_internal_netmask)
|
||||
@@ -885,7 +887,8 @@ gboolean nm_vpn_service_process_signal (NMVPNService *service, NMVPNActRequest *
|
||||
|
||||
/* If the VPN daemon state is now stopped and it was starting, clear the active connection */
|
||||
if (((new_state == NM_VPN_STATE_STOPPED) || (new_state == NM_VPN_STATE_SHUTDOWN) || (new_state == NM_VPN_STATE_STOPPING))
|
||||
&& ((old_state == NM_VPN_STATE_STARTED) || (old_state == NM_VPN_STATE_STARTING)))
|
||||
&& ((old_state == NM_VPN_STATE_STARTED) || (old_state == NM_VPN_STATE_STARTING))
|
||||
&& valid_vpn)
|
||||
{
|
||||
nm_vpn_act_request_unref (req);
|
||||
nm_vpn_manager_schedule_vpn_connection_died (service->manager, req);
|
||||
|
Reference in New Issue
Block a user