2008-02-28 Tambet Ingo <tambet@gmail.com>
Get rid of a bunch of unused distro specific functions. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3360 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
2008-02-28 Tambet Ingo <tambet@gmail.com>
|
||||||
|
|
||||||
|
Get rid of a bunch of unused distro specific functions.
|
||||||
|
|
||||||
2008-02-28 Tambet Ingo <tambet@gmail.com>
|
2008-02-28 Tambet Ingo <tambet@gmail.com>
|
||||||
|
|
||||||
Implement suse plugin for system settings daemon.
|
Implement suse plugin for system settings daemon.
|
||||||
|
@@ -1,14 +0,0 @@
|
|||||||
#ifndef _NETWORK_MANAGER_DIALUP_H
|
|
||||||
#define _NETWORK_MANAGER_DIALUP_H
|
|
||||||
|
|
||||||
#define NM_DIALUP_TYPE_MODEM 1
|
|
||||||
#define NM_DIALUP_TYPE_ISDN 2
|
|
||||||
|
|
||||||
typedef struct NMDialUpConfig
|
|
||||||
{
|
|
||||||
char *name; /* user-readable name, unique */
|
|
||||||
void *data; /* backend internal data */
|
|
||||||
unsigned int type; /* type: modem or ISDN, currently */
|
|
||||||
} NMDialUpConfig;
|
|
||||||
|
|
||||||
#endif /* _NETWORK_MANAGER_DIALUP_H */
|
|
@@ -57,9 +57,6 @@ void nm_system_device_add_ip6_link_address (NMDevice *dev);
|
|||||||
|
|
||||||
void * nm_system_device_get_system_config (NMDevice *dev);
|
void * nm_system_device_get_system_config (NMDevice *dev);
|
||||||
void nm_system_device_free_system_config (NMDevice *dev, void *system_config_data);
|
void nm_system_device_free_system_config (NMDevice *dev, void *system_config_data);
|
||||||
NMIP4Config * nm_system_device_new_ip4_system_config (NMDevice *dev);
|
|
||||||
|
|
||||||
gboolean nm_system_device_get_use_dhcp (NMDevice *dev);
|
|
||||||
|
|
||||||
gboolean nm_system_device_get_disabled (NMDevice *dev);
|
gboolean nm_system_device_get_disabled (NMDevice *dev);
|
||||||
|
|
||||||
@@ -81,11 +78,6 @@ gboolean nm_system_device_set_up_down_with_iface (const char *iface, gboolean
|
|||||||
|
|
||||||
gboolean nm_system_device_update_resolv_conf (void *data, int len, const char *domain_name);
|
gboolean nm_system_device_update_resolv_conf (void *data, int len, const char *domain_name);
|
||||||
|
|
||||||
GSList * nm_system_get_dialup_config (void);
|
|
||||||
void nm_system_deactivate_all_dialup (GSList *list);
|
|
||||||
gboolean nm_system_activate_dialup (GSList *list, const char *dialup);
|
|
||||||
gboolean nm_system_deactivate_dialup (GSList *list, const char *dialup);
|
|
||||||
|
|
||||||
void nm_system_set_hostname (NMIP4Config *config);
|
void nm_system_set_hostname (NMIP4Config *config);
|
||||||
void nm_system_activate_nis (NMIP4Config *config);
|
void nm_system_activate_nis (NMIP4Config *config);
|
||||||
void nm_system_shutdown_nis (void);
|
void nm_system_shutdown_nis (void);
|
||||||
|
@@ -48,7 +48,6 @@
|
|||||||
#include "nm-device.h"
|
#include "nm-device.h"
|
||||||
#include "nm-device-802-3-ethernet.h"
|
#include "nm-device-802-3-ethernet.h"
|
||||||
#include "nm-device-802-11-wireless.h"
|
#include "nm-device-802-11-wireless.h"
|
||||||
#include "NetworkManagerDialup.h"
|
|
||||||
#include "interface_parser.h"
|
#include "interface_parser.h"
|
||||||
#include "nm-utils.h"
|
#include "nm-utils.h"
|
||||||
|
|
||||||
@@ -635,27 +634,6 @@ void nm_system_device_free_system_config (NMDevice *dev, void *system_config_dat
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* nm_system_device_get_use_dhcp
|
|
||||||
*
|
|
||||||
* Return whether the distro-specific system config tells us to use
|
|
||||||
* dhcp for this device.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
gboolean nm_system_device_get_use_dhcp (NMDevice *dev)
|
|
||||||
{
|
|
||||||
ArchSystemConfigData *sys_data;
|
|
||||||
|
|
||||||
g_return_val_if_fail (dev != NULL, TRUE);
|
|
||||||
|
|
||||||
if ((sys_data = nm_device_get_system_config_data(dev)))
|
|
||||||
{
|
|
||||||
return sys_data->use_dhcp;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nm_system_device_get_disabled
|
* nm_system_device_get_disabled
|
||||||
*
|
*
|
||||||
@@ -668,130 +646,6 @@ gboolean nm_system_device_get_disabled (NMDevice *dev)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NMIP4Config *nm_system_device_new_ip4_system_config (NMDevice *dev)
|
|
||||||
{
|
|
||||||
ArchSystemConfigData *sys_data;
|
|
||||||
NMIP4Config *new_config = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail (dev != NULL, NULL);
|
|
||||||
|
|
||||||
if ((sys_data = nm_device_get_system_config_data (dev)))
|
|
||||||
new_config = nm_ip4_config_copy (sys_data->config);
|
|
||||||
|
|
||||||
return new_config;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nm_system_deactivate_all_dialup (GSList *list)
|
|
||||||
{
|
|
||||||
GSList *elt;
|
|
||||||
|
|
||||||
for (elt = list; elt; elt = g_slist_next (elt))
|
|
||||||
{
|
|
||||||
NMDialUpConfig *config = (NMDialUpConfig *) elt->data;
|
|
||||||
char *cmd;
|
|
||||||
|
|
||||||
cmd = g_strdup_printf ("/sbin/ifconfig %s down", (char *) config->data);
|
|
||||||
nm_spawn_process (cmd);
|
|
||||||
g_free (cmd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean nm_system_deactivate_dialup (GSList *list, const char *dialup)
|
|
||||||
{
|
|
||||||
GSList *elt;
|
|
||||||
gboolean ret = FALSE;
|
|
||||||
|
|
||||||
for (elt = list; elt; elt = g_slist_next (elt))
|
|
||||||
{
|
|
||||||
NMDialUpConfig *config = (NMDialUpConfig *) elt->data;
|
|
||||||
if (strcmp (dialup, config->name) == 0)
|
|
||||||
{
|
|
||||||
char *cmd;
|
|
||||||
|
|
||||||
nm_info ("Deactivating dialup device %s (%s) ...", dialup, (char *) config->data);
|
|
||||||
cmd = g_strdup_printf ("/sbin/ifconfig %s down", (char *) config->data);
|
|
||||||
nm_spawn_process (cmd);
|
|
||||||
g_free (cmd);
|
|
||||||
ret = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean nm_system_activate_dialup (GSList *list, const char *dialup)
|
|
||||||
{
|
|
||||||
GSList *elt;
|
|
||||||
gboolean ret = FALSE;
|
|
||||||
|
|
||||||
for (elt = list; elt; elt = g_slist_next (elt))
|
|
||||||
{
|
|
||||||
NMDialUpConfig *config = (NMDialUpConfig *) elt->data;
|
|
||||||
if (strcmp (dialup, config->name) == 0)
|
|
||||||
{
|
|
||||||
char *cmd;
|
|
||||||
|
|
||||||
nm_info ("Activating dialup device %s (%s) ...", dialup, (char *) config->data);
|
|
||||||
cmd = g_strdup_printf ("/sbin/ifconfig %s up", (char *) config->data);
|
|
||||||
nm_spawn_process (cmd);
|
|
||||||
g_free (cmd);
|
|
||||||
ret = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
GSList * nm_system_get_dialup_config (void)
|
|
||||||
{
|
|
||||||
const char *buf;
|
|
||||||
if_block *curr_device;
|
|
||||||
gboolean error = FALSE;
|
|
||||||
GError *err;
|
|
||||||
unsigned int i = 0;
|
|
||||||
size_t len;
|
|
||||||
GSList *list = NULL;
|
|
||||||
#if 0 // PORT me
|
|
||||||
if_block *curr;
|
|
||||||
ifparser_init();
|
|
||||||
|
|
||||||
/* FIXME: get all ppp(and others?) lines from /e/n/i here */
|
|
||||||
curr = ifparser_getfirst();
|
|
||||||
while (curr!=NULL)
|
|
||||||
{
|
|
||||||
NMDialUpConfig *config;
|
|
||||||
if (strcmp(curr->type,"iface")==0)
|
|
||||||
{
|
|
||||||
buf = ifparser_getkey(curr,"inet");
|
|
||||||
if (buf && strcmp (buf, "ppp")==0)
|
|
||||||
{
|
|
||||||
config = g_malloc (sizeof (NMDialUpConfig));
|
|
||||||
config->name = g_strdup_printf ("Modem (#%d)", i++);
|
|
||||||
config->data = g_strdup (curr->name); /* interface name */
|
|
||||||
|
|
||||||
list = g_slist_append (list, config);
|
|
||||||
|
|
||||||
nm_info ("Found dial up configuration for %s: %s", config->name, (char *) config->data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
curr = curr->next;
|
|
||||||
}
|
|
||||||
ifparser_destroy();
|
|
||||||
|
|
||||||
/* Hack: Go back and remove the "(#0)" if there is only one device */
|
|
||||||
if (i == 1)
|
|
||||||
{
|
|
||||||
NMDialUpConfig *config = (NMDialUpConfig *) list->data;
|
|
||||||
g_free (config->name);
|
|
||||||
config->name = g_strdup ("Modem");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nm_system_activate_nis
|
* nm_system_activate_nis
|
||||||
*
|
*
|
||||||
|
@@ -37,7 +37,6 @@
|
|||||||
#include "nm-device.h"
|
#include "nm-device.h"
|
||||||
#include "nm-device-802-3-ethernet.h"
|
#include "nm-device-802-3-ethernet.h"
|
||||||
#include "nm-device-802-11-wireless.h"
|
#include "nm-device-802-11-wireless.h"
|
||||||
#include "NetworkManagerDialup.h"
|
|
||||||
#include "interface_parser.h"
|
#include "interface_parser.h"
|
||||||
#include "nm-utils.h"
|
#include "nm-utils.h"
|
||||||
|
|
||||||
@@ -354,26 +353,6 @@ void nm_system_device_free_system_config (NMDevice *dev, void *system_config_dat
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* nm_system_device_get_use_dhcp
|
|
||||||
*
|
|
||||||
* Return whether the distro-specific system config tells us to use
|
|
||||||
* dhcp for this device.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
gboolean nm_system_device_get_use_dhcp (NMDevice *dev)
|
|
||||||
{
|
|
||||||
DebSystemConfigData *sys_data;
|
|
||||||
|
|
||||||
g_return_val_if_fail (dev != NULL, TRUE);
|
|
||||||
|
|
||||||
if ((sys_data = nm_device_get_system_config_data (dev)))
|
|
||||||
return sys_data->use_dhcp;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nm_system_device_get_disabled
|
* nm_system_device_get_disabled
|
||||||
*
|
*
|
||||||
@@ -386,125 +365,6 @@ gboolean nm_system_device_get_disabled (NMDevice *dev)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NMIP4Config *nm_system_device_new_ip4_system_config (NMDevice *dev)
|
|
||||||
{
|
|
||||||
DebSystemConfigData *sys_data;
|
|
||||||
NMIP4Config *new_config = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail (dev != NULL, NULL);
|
|
||||||
|
|
||||||
if ((sys_data = nm_device_get_system_config_data (dev)))
|
|
||||||
new_config = nm_ip4_config_copy (sys_data->config);
|
|
||||||
|
|
||||||
return new_config;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nm_system_deactivate_all_dialup (GSList *list)
|
|
||||||
{
|
|
||||||
GSList *elt;
|
|
||||||
|
|
||||||
for (elt = list; elt; elt = g_slist_next (elt))
|
|
||||||
{
|
|
||||||
NMDialUpConfig *config = (NMDialUpConfig *) elt->data;
|
|
||||||
char *cmd;
|
|
||||||
|
|
||||||
cmd = g_strdup_printf ("/sbin/ifdown %s", (char *) config->data);
|
|
||||||
nm_spawn_process (cmd);
|
|
||||||
g_free (cmd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean nm_system_deactivate_dialup (GSList *list, const char *dialup)
|
|
||||||
{
|
|
||||||
GSList *elt;
|
|
||||||
gboolean ret = FALSE;
|
|
||||||
|
|
||||||
for (elt = list; elt; elt = g_slist_next (elt))
|
|
||||||
{
|
|
||||||
NMDialUpConfig *config = (NMDialUpConfig *) elt->data;
|
|
||||||
if (strcmp (dialup, config->name) == 0)
|
|
||||||
{
|
|
||||||
char *cmd;
|
|
||||||
|
|
||||||
nm_info ("Deactivating dialup device %s (%s) ...", dialup, (char *) config->data);
|
|
||||||
cmd = g_strdup_printf ("/sbin/ifdown %s", (char *) config->data);
|
|
||||||
nm_spawn_process (cmd);
|
|
||||||
g_free (cmd);
|
|
||||||
ret = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean nm_system_activate_dialup (GSList *list, const char *dialup)
|
|
||||||
{
|
|
||||||
GSList *elt;
|
|
||||||
gboolean ret = FALSE;
|
|
||||||
|
|
||||||
for (elt = list; elt; elt = g_slist_next (elt))
|
|
||||||
{
|
|
||||||
NMDialUpConfig *config = (NMDialUpConfig *) elt->data;
|
|
||||||
if (strcmp (dialup, config->name) == 0)
|
|
||||||
{
|
|
||||||
char *cmd;
|
|
||||||
|
|
||||||
nm_info ("Activating dialup device %s (%s) ...", dialup, (char *) config->data);
|
|
||||||
cmd = g_strdup_printf ("/sbin/ifup %s", (char *) config->data);
|
|
||||||
nm_spawn_process (cmd);
|
|
||||||
g_free (cmd);
|
|
||||||
ret = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
GSList * nm_system_get_dialup_config (void)
|
|
||||||
{
|
|
||||||
const char *buf;
|
|
||||||
unsigned int i = 0;
|
|
||||||
GSList *list = NULL;
|
|
||||||
if_block *curr;
|
|
||||||
ifparser_init();
|
|
||||||
|
|
||||||
/* FIXME: get all ppp(and others?) lines from /e/n/i here */
|
|
||||||
curr = ifparser_getfirst();
|
|
||||||
while(curr!=NULL)
|
|
||||||
{
|
|
||||||
NMDialUpConfig *config;
|
|
||||||
if (strcmp(curr->type,"iface")==0)
|
|
||||||
{
|
|
||||||
buf = ifparser_getkey(curr,"inet");
|
|
||||||
if (buf && strcmp (buf, "ppp")==0)
|
|
||||||
{
|
|
||||||
config = g_malloc (sizeof (NMDialUpConfig));
|
|
||||||
config->name = g_strdup_printf ("Modem (#%d)", i++);
|
|
||||||
config->data = g_strdup (curr->name); /* interface name */
|
|
||||||
|
|
||||||
list = g_slist_append (list, config);
|
|
||||||
|
|
||||||
nm_info ("Found dial up configuration for %s: %s", config->name, (char *) config->data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
curr = curr->next;
|
|
||||||
}
|
|
||||||
ifparser_destroy();
|
|
||||||
|
|
||||||
/* Hack: Go back and remove the "(#0)" if there is only one device */
|
|
||||||
if (i == 1)
|
|
||||||
{
|
|
||||||
NMDialUpConfig *config = (NMDialUpConfig *) list->data;
|
|
||||||
g_free (config->name);
|
|
||||||
config->name = g_strdup ("Modem");
|
|
||||||
}
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nm_system_activate_nis
|
* nm_system_activate_nis
|
||||||
*
|
*
|
||||||
|
@@ -299,55 +299,10 @@ void nm_system_flush_arp_cache (void)
|
|||||||
nm_spawn_process ("/usr/sbin/ip neigh flush all");
|
nm_spawn_process ("/usr/sbin/ip neigh flush all");
|
||||||
}
|
}
|
||||||
|
|
||||||
void nm_system_deactivate_all_dialup (GSList *list)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean nm_system_deactivate_dialup (GSList *list, const char *dialup)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean nm_system_activate_dialup (GSList *list, const char *dialup)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* nm_system_get_dialup_config
|
|
||||||
*
|
|
||||||
* Enumerate dial up options on this system, allocate NMDialUpConfig's,
|
|
||||||
* fill them out, and return.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
GSList * nm_system_get_dialup_config (void)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nm_system_device_free_system_config (NMDevice *dev, void *system_config_data)
|
void nm_system_device_free_system_config (NMDevice *dev, void *system_config_data)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NMIP4Config *nm_system_device_new_ip4_system_config (NMDevice *dev)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean nm_system_device_get_use_dhcp (NMDevice *dev)
|
|
||||||
{
|
|
||||||
FWDeviceConfigData *sys_data;
|
|
||||||
|
|
||||||
g_return_val_if_fail (dev != NULL, TRUE);
|
|
||||||
|
|
||||||
if ((sys_data = nm_device_get_system_config_data(dev)))
|
|
||||||
{
|
|
||||||
return sys_data->use_dhcp;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get_current_profile_name
|
* get_current_profile_name
|
||||||
*
|
*
|
||||||
|
@@ -412,25 +412,6 @@ NMIP4Config *nm_generic_device_new_ip4_system_config (NMDevice *dev)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nm_generic_deactivate_all_dialup (GSList *list)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean nm_generic_deactivate_dialup (GSList *list, const char *dialup)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean nm_generic_activate_dialup (GSList *list, const char *dialup)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
GSList * nm_generic_get_dialup_config (void)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nm_generic_activate_nis
|
* nm_generic_activate_nis
|
||||||
*
|
*
|
||||||
|
@@ -74,11 +74,6 @@ gboolean nm_generic_device_set_up_down_with_iface (NMDevice *dev, const char *
|
|||||||
|
|
||||||
gboolean nm_generic_device_update_resolv_conf (void *data, int len, const char *domain_name);
|
gboolean nm_generic_device_update_resolv_conf (void *data, int len, const char *domain_name);
|
||||||
|
|
||||||
GSList * nm_generic_get_dialup_config (void);
|
|
||||||
void nm_generic_deactivate_all_dialup (GSList *list);
|
|
||||||
gboolean nm_generic_activate_dialup (GSList *list, const char *dialup);
|
|
||||||
gboolean nm_generic_deactivate_dialup (GSList *list, const char *dialup);
|
|
||||||
|
|
||||||
void nm_generic_set_hostname (NMIP4Config *config);
|
void nm_generic_set_hostname (NMIP4Config *config);
|
||||||
void nm_generic_activate_nis (NMIP4Config *config);
|
void nm_generic_activate_nis (NMIP4Config *config);
|
||||||
void nm_generic_shutdown_nis (void);
|
void nm_generic_shutdown_nis (void);
|
||||||
|
@@ -447,31 +447,6 @@ void nm_system_device_free_system_config (NMDevice *dev, void *system_config_dat
|
|||||||
g_free (sys_data);
|
g_free (sys_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
NMIP4Config *nm_system_device_new_ip4_system_config (NMDevice *dev)
|
|
||||||
{
|
|
||||||
GentooSystemConfigData *sys_data;
|
|
||||||
NMIP4Config *new_config = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail (dev != NULL, NULL);
|
|
||||||
|
|
||||||
if ((sys_data = nm_device_get_system_config_data (dev)))
|
|
||||||
new_config = nm_ip4_config_copy (sys_data->config);
|
|
||||||
|
|
||||||
return new_config;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean nm_system_device_get_use_dhcp (NMDevice *dev)
|
|
||||||
{
|
|
||||||
GentooSystemConfigData *sys_data;
|
|
||||||
|
|
||||||
g_return_val_if_fail (dev != NULL, TRUE);
|
|
||||||
|
|
||||||
if ((sys_data = nm_device_get_system_config_data (dev)))
|
|
||||||
return sys_data->use_dhcp;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nm_system_device_get_disabled
|
* nm_system_device_get_disabled
|
||||||
*
|
*
|
||||||
@@ -484,32 +459,6 @@ gboolean nm_system_device_get_disabled (NMDevice *dev)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nm_system_deactivate_all_dialup (GSList *list)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean nm_system_deactivate_dialup (GSList *list, const char *dialup)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean nm_system_activate_dialup (GSList *list, const char *dialup)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* nm_system_get_dialup_config
|
|
||||||
*
|
|
||||||
* Enumerate dial up options on this system, allocate NMDialUpConfig's,
|
|
||||||
* fill them out, and return.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
GSList * nm_system_get_dialup_config (void)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nm_system_activate_nis
|
* nm_system_activate_nis
|
||||||
*
|
*
|
||||||
|
@@ -466,26 +466,6 @@ void nm_system_device_free_system_config (NMDevice *dev, void *system_config_dat
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* nm_system_device_get_use_dhcp
|
|
||||||
*
|
|
||||||
* Return whether the distro-specific system config tells us to use
|
|
||||||
* dhcp for this device.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
gboolean nm_system_device_get_use_dhcp (NMDevice *dev)
|
|
||||||
{
|
|
||||||
PaldoSystemConfigData *sys_data;
|
|
||||||
|
|
||||||
g_return_val_if_fail (dev != NULL, TRUE);
|
|
||||||
|
|
||||||
if ((sys_data = nm_device_get_system_config_data (dev)))
|
|
||||||
return sys_data->use_dhcp;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nm_system_device_get_disabled
|
* nm_system_device_get_disabled
|
||||||
*
|
*
|
||||||
@@ -506,49 +486,6 @@ gboolean nm_system_device_get_disabled (NMDevice *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NMIP4Config *nm_system_device_new_ip4_system_config (NMDevice *dev)
|
|
||||||
{
|
|
||||||
PaldoSystemConfigData *sys_data;
|
|
||||||
NMIP4Config *new_config = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail (dev != NULL, NULL);
|
|
||||||
|
|
||||||
if ((sys_data = nm_device_get_system_config_data (dev)))
|
|
||||||
new_config = nm_ip4_config_copy (sys_data->config);
|
|
||||||
|
|
||||||
return new_config;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void nm_system_deactivate_all_dialup (GSList *list)
|
|
||||||
{
|
|
||||||
/* FIXME: implement for paldo */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
gboolean nm_system_deactivate_dialup (GSList *list, const char *dialup)
|
|
||||||
{
|
|
||||||
/* FIXME: implement for paldo */
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
gboolean nm_system_activate_dialup (GSList *list, const char *dialup)
|
|
||||||
{
|
|
||||||
/* FIXME: implement for paldo */
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GSList * nm_system_get_dialup_config (void)
|
|
||||||
{
|
|
||||||
/* FIXME: implement for paldo */
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nm_system_activate_nis
|
* nm_system_activate_nis
|
||||||
*
|
*
|
||||||
|
@@ -33,7 +33,6 @@
|
|||||||
#include "nm-device.h"
|
#include "nm-device.h"
|
||||||
#include "nm-device-802-3-ethernet.h"
|
#include "nm-device-802-3-ethernet.h"
|
||||||
#include "nm-device-802-11-wireless.h"
|
#include "nm-device-802-11-wireless.h"
|
||||||
#include "NetworkManagerDialup.h"
|
|
||||||
#include "nm-utils.h"
|
#include "nm-utils.h"
|
||||||
#include "shvar.h"
|
#include "shvar.h"
|
||||||
|
|
||||||
@@ -484,26 +483,6 @@ void nm_system_device_free_system_config (NMDevice *dev, void *system_config_dat
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* nm_system_device_get_use_dhcp
|
|
||||||
*
|
|
||||||
* Return whether the distro-specific system config tells us to use
|
|
||||||
* dhcp for this device.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
gboolean nm_system_device_get_use_dhcp (NMDevice *dev)
|
|
||||||
{
|
|
||||||
RHSystemConfigData *sys_data;
|
|
||||||
|
|
||||||
g_return_val_if_fail (dev != NULL, TRUE);
|
|
||||||
|
|
||||||
if ((sys_data = nm_device_get_system_config_data (dev)))
|
|
||||||
return sys_data->use_dhcp;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nm_system_device_get_disabled
|
* nm_system_device_get_disabled
|
||||||
*
|
*
|
||||||
@@ -523,228 +502,6 @@ gboolean nm_system_device_get_disabled (NMDevice *dev)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NMIP4Config *nm_system_device_new_ip4_system_config (NMDevice *dev)
|
|
||||||
{
|
|
||||||
RHSystemConfigData *sys_data;
|
|
||||||
NMIP4Config *new_config = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail (dev != NULL, NULL);
|
|
||||||
|
|
||||||
if ((sys_data = nm_device_get_system_config_data (dev)))
|
|
||||||
new_config = nm_ip4_config_copy (sys_data->config);
|
|
||||||
|
|
||||||
return new_config;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void nm_system_deactivate_all_dialup (GSList *list)
|
|
||||||
{
|
|
||||||
GSList *l;
|
|
||||||
|
|
||||||
for (l = list; l; l = g_slist_next(l))
|
|
||||||
{
|
|
||||||
NMDialUpConfig *config = (NMDialUpConfig *) l->data;
|
|
||||||
char *cmd;
|
|
||||||
|
|
||||||
cmd = g_strdup_printf ("/sbin/ifdown %s", (char *)config->data);
|
|
||||||
nm_spawn_process (cmd);
|
|
||||||
g_free(cmd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
gboolean nm_system_deactivate_dialup (GSList *list, const char *dialup)
|
|
||||||
{
|
|
||||||
GSList *l;
|
|
||||||
gboolean ret = FALSE;
|
|
||||||
|
|
||||||
for (l = list; l; l = g_slist_next (l))
|
|
||||||
{
|
|
||||||
NMDialUpConfig *config = (NMDialUpConfig *) l->data;
|
|
||||||
if (strcmp (dialup, config->name) == 0)
|
|
||||||
{
|
|
||||||
char *cmd;
|
|
||||||
int status;
|
|
||||||
|
|
||||||
nm_info ("Dectivating dialup device %s (%s) ...", dialup, (char *) config->data);
|
|
||||||
cmd = g_strdup_printf ("/sbin/ifdown %s", (char *) config->data);
|
|
||||||
status = nm_spawn_process (cmd);
|
|
||||||
g_free (cmd);
|
|
||||||
if (status == 0) {
|
|
||||||
ret = TRUE;
|
|
||||||
} else {
|
|
||||||
/* FIXME: Decode errors into something sensible */
|
|
||||||
nm_warning ("Couldn't deactivate dialup device %s (%s) - %d", dialup, (char *) config->data, status);
|
|
||||||
ret = FALSE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
gboolean nm_system_activate_dialup (GSList *list, const char *dialup)
|
|
||||||
{
|
|
||||||
GSList *l;
|
|
||||||
gboolean ret = FALSE;
|
|
||||||
|
|
||||||
for (l = list; l; l = g_slist_next (l))
|
|
||||||
{
|
|
||||||
NMDialUpConfig *config = (NMDialUpConfig *) l->data;
|
|
||||||
if (strcmp (dialup, config->name) == 0)
|
|
||||||
{
|
|
||||||
char *cmd;
|
|
||||||
int status;
|
|
||||||
|
|
||||||
nm_info ("Activating dialup device %s (%s) ...", dialup, (char *) config->data);
|
|
||||||
cmd = g_strdup_printf ("/sbin/ifup %s", (char *) config->data);
|
|
||||||
status = nm_spawn_process (cmd);
|
|
||||||
g_free (cmd);
|
|
||||||
if (status == 0) {
|
|
||||||
ret = TRUE;
|
|
||||||
} else {
|
|
||||||
/* FIXME: Decode errors into something sensible */
|
|
||||||
nm_warning ("Couldn't activate dialup device %s (%s) - %d", dialup, (char *) config->data, status);
|
|
||||||
ret = FALSE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static gboolean is_valid_cfg(const char *cfg)
|
|
||||||
{
|
|
||||||
char *exts[] = { ".rpmsave", ".rpmorig", ".rpmnew", "~", ".bak", NULL };
|
|
||||||
int x;
|
|
||||||
|
|
||||||
if (!g_str_has_prefix (cfg, "ifcfg-"))
|
|
||||||
return FALSE;
|
|
||||||
for (x = 0 ; exts[x] ; x++) {
|
|
||||||
if (g_str_has_suffix(cfg,exts[x]))
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *get_config_name(const char *cfg)
|
|
||||||
{
|
|
||||||
char *ret = NULL;
|
|
||||||
shvarFile *cfg_file;
|
|
||||||
char *path, *tmp;
|
|
||||||
gboolean is_dialup = FALSE;
|
|
||||||
|
|
||||||
path = g_strdup_printf ("/etc/sysconfig/network-scripts/%s", cfg);
|
|
||||||
cfg_file = svNewFile (path);
|
|
||||||
g_free (path);
|
|
||||||
if (!cfg_file)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
|
|
||||||
/* Check for a dialup TYPE */
|
|
||||||
tmp = svGetValue (cfg_file, "TYPE");
|
|
||||||
if (tmp)
|
|
||||||
{
|
|
||||||
if ((strcmp (tmp, "Modem") == 0) ||
|
|
||||||
(strcmp (tmp, "ISDN") == 0))
|
|
||||||
is_dialup = TRUE;
|
|
||||||
free(tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check for a dialup BOOTPROTO */
|
|
||||||
tmp = svGetValue (cfg_file, "BOOTPROTO");
|
|
||||||
if (tmp)
|
|
||||||
{
|
|
||||||
if ((strcmp (tmp, "dialup") == 0))
|
|
||||||
is_dialup = TRUE;
|
|
||||||
free(tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check for a dialup device name */
|
|
||||||
if (g_str_has_prefix(cfg+6, "ppp") || g_str_has_prefix(cfg+6, "ippp"))
|
|
||||||
is_dialup = TRUE;
|
|
||||||
|
|
||||||
if (!is_dialup)
|
|
||||||
goto out_close;
|
|
||||||
|
|
||||||
/* PROVIDER isn't actually used, but s-c-network writes it. */
|
|
||||||
tmp = svGetValue (cfg_file, "PROVIDER");
|
|
||||||
if (tmp)
|
|
||||||
{
|
|
||||||
ret = tmp;
|
|
||||||
goto out_close;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* NAME isn't used either... */
|
|
||||||
tmp = svGetValue (cfg_file, "NAME");
|
|
||||||
if (tmp)
|
|
||||||
{
|
|
||||||
ret = tmp;
|
|
||||||
goto out_close;
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp = svGetValue (cfg_file, "WVDIALSECT");
|
|
||||||
if (tmp)
|
|
||||||
{
|
|
||||||
ret = tmp;
|
|
||||||
goto out_close;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fallback - use the config*/
|
|
||||||
ret = strdup(cfg + 6);
|
|
||||||
|
|
||||||
out_close:
|
|
||||||
svCloseFile (cfg_file);
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
GSList * nm_system_get_dialup_config (void)
|
|
||||||
{
|
|
||||||
GSList *list = NULL;
|
|
||||||
GDir *dir;
|
|
||||||
GError *err;
|
|
||||||
const char *entry;
|
|
||||||
|
|
||||||
dir = g_dir_open ("/etc/sysconfig/network-scripts", 0, &err);
|
|
||||||
if (!dir)
|
|
||||||
{
|
|
||||||
nm_warning ("Could not open directory /etc/sysconfig/network-scripts: %s", err->message);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((entry = g_dir_read_name(dir)))
|
|
||||||
{
|
|
||||||
NMDialUpConfig *config;
|
|
||||||
char *buf;
|
|
||||||
|
|
||||||
if (!is_valid_cfg(entry))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
buf = get_config_name(entry);
|
|
||||||
|
|
||||||
if (!buf)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
config = g_malloc (sizeof (NMDialUpConfig));
|
|
||||||
config->name = g_strdup_printf ("%s via Modem", buf);
|
|
||||||
config->data = g_strdup (entry + 6);
|
|
||||||
list = g_slist_append (list, config);
|
|
||||||
|
|
||||||
nm_info ("Found dial up configuration for %s: %s", config->name, (char *) config->data);
|
|
||||||
|
|
||||||
free (buf);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
g_dir_close (dir);
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nm_system_activate_nis
|
* nm_system_activate_nis
|
||||||
*
|
*
|
||||||
|
@@ -265,47 +265,10 @@ void nm_system_flush_arp_cache (void)
|
|||||||
nm_generic_flush_arp_cache ();
|
nm_generic_flush_arp_cache ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void nm_system_deactivate_all_dialup (GSList *list)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean nm_system_deactivate_dialup (GSList *list, const char *dialup)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean nm_system_activate_dialup (GSList *list, const char *dialup)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* nm_system_get_dialup_config
|
|
||||||
*
|
|
||||||
* Enumerate dial up options on this system, allocate NMDialUpConfig's,
|
|
||||||
* fill them out, and return.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
GSList * nm_system_get_dialup_config (void)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nm_system_device_free_system_config (NMDevice *dev, void *system_config_data)
|
void nm_system_device_free_system_config (NMDevice *dev, void *system_config_data)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NMIP4Config *nm_system_device_new_ip4_system_config (NMDevice *dev)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean nm_system_device_get_use_dhcp (NMDevice *dev)
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nm_system_device_get_disabled
|
* nm_system_device_get_disabled
|
||||||
*
|
*
|
||||||
|
@@ -40,7 +40,6 @@
|
|||||||
#include "NetworkManagerPolicy.h"
|
#include "NetworkManagerPolicy.h"
|
||||||
#include "nm-device-802-3-ethernet.h"
|
#include "nm-device-802-3-ethernet.h"
|
||||||
#include "nm-device-802-11-wireless.h"
|
#include "nm-device-802-11-wireless.h"
|
||||||
#include "NetworkManagerDialup.h"
|
|
||||||
#include "nm-utils.h"
|
#include "nm-utils.h"
|
||||||
#include "shvar.h"
|
#include "shvar.h"
|
||||||
|
|
||||||
@@ -527,26 +526,6 @@ void nm_system_device_free_system_config (NMDevice *dev, void *system_config_dat
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* nm_system_device_get_use_dhcp
|
|
||||||
*
|
|
||||||
* Return whether the distro-specific system config tells us to use
|
|
||||||
* dhcp for this device.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
gboolean nm_system_device_get_use_dhcp (NMDevice *dev)
|
|
||||||
{
|
|
||||||
SuSEDeviceConfigData *sys_data;
|
|
||||||
|
|
||||||
g_return_val_if_fail (dev != NULL, FALSE);
|
|
||||||
|
|
||||||
if ((sys_data = nm_device_get_system_config_data (dev)))
|
|
||||||
return sys_data->use_dhcp;
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nm_system_device_get_disabled
|
* nm_system_device_get_disabled
|
||||||
*
|
*
|
||||||
@@ -566,231 +545,6 @@ gboolean nm_system_device_get_disabled (NMDevice *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NMIP4Config *nm_system_device_new_ip4_system_config (NMDevice *dev)
|
|
||||||
{
|
|
||||||
SuSEDeviceConfigData *sys_data;
|
|
||||||
NMIP4Config *new_config = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail (dev != NULL, NULL);
|
|
||||||
|
|
||||||
if ((sys_data = nm_device_get_system_config_data (dev)))
|
|
||||||
new_config = nm_ip4_config_copy (sys_data->config);
|
|
||||||
|
|
||||||
return new_config;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void nm_system_deactivate_all_dialup (GSList *list)
|
|
||||||
{
|
|
||||||
GSList *elt;
|
|
||||||
|
|
||||||
for (elt = list; elt; elt = g_slist_next (elt))
|
|
||||||
{
|
|
||||||
NMDialUpConfig *config = (NMDialUpConfig *) elt->data;
|
|
||||||
char *cmd;
|
|
||||||
|
|
||||||
if (config->type == NM_DIALUP_TYPE_ISDN)
|
|
||||||
{
|
|
||||||
cmd = g_strdup_printf ("/sbin/isdnctrl hangup %s", (char *) config->data);
|
|
||||||
nm_spawn_process (cmd);
|
|
||||||
g_free (cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd = g_strdup_printf ("/sbin/ifdown %s", (char *) config->data);
|
|
||||||
nm_spawn_process (cmd);
|
|
||||||
g_free (cmd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
gboolean nm_system_deactivate_dialup (GSList *list, const char *dialup)
|
|
||||||
{
|
|
||||||
GSList *elt;
|
|
||||||
gboolean ret = FALSE;
|
|
||||||
|
|
||||||
for (elt = list; elt; elt = g_slist_next (elt))
|
|
||||||
{
|
|
||||||
NMDialUpConfig *config = (NMDialUpConfig *) elt->data;
|
|
||||||
if (strcmp (dialup, config->name) == 0)
|
|
||||||
{
|
|
||||||
char *cmd;
|
|
||||||
|
|
||||||
nm_info ("Deactivating dialup device %s (%s) ...", dialup, (char *) config->data);
|
|
||||||
|
|
||||||
cmd = g_strdup_printf ("/sbin/ifdown %s", (char *) config->data);
|
|
||||||
nm_spawn_process (cmd);
|
|
||||||
g_free (cmd);
|
|
||||||
|
|
||||||
if (config->type == NM_DIALUP_TYPE_ISDN)
|
|
||||||
{
|
|
||||||
cmd = g_strdup_printf ("/sbin/isdnctrl hangup %s", (char *) config->data);
|
|
||||||
nm_spawn_process (cmd);
|
|
||||||
g_free (cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
gboolean nm_system_activate_dialup (GSList *list, const char *dialup)
|
|
||||||
{
|
|
||||||
GSList *elt;
|
|
||||||
gboolean ret = FALSE;
|
|
||||||
|
|
||||||
for (elt = list; elt; elt = g_slist_next (elt))
|
|
||||||
{
|
|
||||||
NMDialUpConfig *config = (NMDialUpConfig *) elt->data;
|
|
||||||
if (strcmp (dialup, config->name) == 0)
|
|
||||||
{
|
|
||||||
char *cmd;
|
|
||||||
|
|
||||||
nm_info ("Activating dialup device %s (%s) ...", dialup, (char *) config->data);
|
|
||||||
|
|
||||||
cmd = g_strdup_printf ("/sbin/ifup %s", (char *) config->data);
|
|
||||||
nm_spawn_process (cmd);
|
|
||||||
g_free (cmd);
|
|
||||||
|
|
||||||
if (config->type == NM_DIALUP_TYPE_ISDN)
|
|
||||||
{
|
|
||||||
cmd = g_strdup_printf ("/sbin/isdnctrl dial %s", (char *) config->data);
|
|
||||||
nm_spawn_process (cmd);
|
|
||||||
g_free (cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* verify_and_return_provider - given a provider identifier, verify that it is able to dial without
|
|
||||||
* prompting and return the provider name. On failure, return NULL. Caller is responsible for
|
|
||||||
* free'ing the return.
|
|
||||||
*/
|
|
||||||
static char * verify_and_return_provider (const char *provider)
|
|
||||||
{
|
|
||||||
shvarFile *file;
|
|
||||||
char *name, *buf = NULL;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
name = g_strdup_printf (SYSCONFDIR"/sysconfig/network/providers/%s", provider);
|
|
||||||
|
|
||||||
file = svNewFile (name);
|
|
||||||
if (!file)
|
|
||||||
goto out_gfree;
|
|
||||||
|
|
||||||
buf = svGetValue (file, "ASKPASSWORD");
|
|
||||||
if (!buf)
|
|
||||||
goto out_close;
|
|
||||||
ret = strcmp (buf, "no");
|
|
||||||
free (buf);
|
|
||||||
if (ret)
|
|
||||||
{
|
|
||||||
buf = NULL;
|
|
||||||
goto out_close;
|
|
||||||
}
|
|
||||||
|
|
||||||
buf = svGetValue (file, "PROVIDER");
|
|
||||||
|
|
||||||
out_close:
|
|
||||||
svCloseFile (file);
|
|
||||||
out_gfree:
|
|
||||||
g_free (name);
|
|
||||||
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* nm_system_get_dialup_config
|
|
||||||
*
|
|
||||||
* Enumerate dial up options on this system, allocate NMDialUpConfig's,
|
|
||||||
* fill them out, and return.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
GSList * nm_system_get_dialup_config (void)
|
|
||||||
{
|
|
||||||
GSList *list = NULL;
|
|
||||||
const char *dentry;
|
|
||||||
GError *err = NULL;
|
|
||||||
GDir *dir;
|
|
||||||
|
|
||||||
dir = g_dir_open (SYSCONFDIR "/sysconfig/network", 0, &err);
|
|
||||||
if (!dir)
|
|
||||||
{
|
|
||||||
nm_warning ("Could not open directory " SYSCONFDIR "/sysconfig/network: %s", err->message);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((dentry = g_dir_read_name (dir)))
|
|
||||||
{
|
|
||||||
NMDialUpConfig *config;
|
|
||||||
shvarFile *modem_file;
|
|
||||||
char *name, *buf, *provider_name;
|
|
||||||
int modem;
|
|
||||||
|
|
||||||
/* we only want modems and isdn */
|
|
||||||
if (g_str_has_prefix (dentry, "ifcfg-modem"))
|
|
||||||
modem = 1;
|
|
||||||
else if (g_str_has_prefix (dentry, "ifcfg-ippp"))
|
|
||||||
modem = 0;
|
|
||||||
else
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* open the configuration file */
|
|
||||||
name = g_strdup_printf (SYSCONFDIR"/sysconfig/network/%s", dentry);
|
|
||||||
modem_file = svNewFile (name);
|
|
||||||
if (!modem_file)
|
|
||||||
goto out_gfree;
|
|
||||||
/* get the name of the provider used for this entry */
|
|
||||||
buf = svGetValue (modem_file, "PROVIDER");
|
|
||||||
if (!buf)
|
|
||||||
goto out_close;
|
|
||||||
|
|
||||||
provider_name = verify_and_return_provider (buf);
|
|
||||||
if (!provider_name)
|
|
||||||
goto out_free;
|
|
||||||
|
|
||||||
config = g_malloc (sizeof (NMDialUpConfig));
|
|
||||||
config->data = g_strdup (dentry + 6); /* skip the "ifcfg-" prefix */
|
|
||||||
if (modem)
|
|
||||||
{
|
|
||||||
config->name = g_strdup_printf ("%s via modem (%s)", provider_name, (char *) config->data);
|
|
||||||
config->type = NM_DIALUP_TYPE_MODEM;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
config->name = g_strdup_printf ("%s via ISDN (%s)", provider_name, (char *) config->data);
|
|
||||||
config->type = NM_DIALUP_TYPE_ISDN;
|
|
||||||
}
|
|
||||||
|
|
||||||
list = g_slist_append (list, config);
|
|
||||||
|
|
||||||
nm_info ("Found dial up configuration for %s: %s", config->name, (char *) config->data);
|
|
||||||
|
|
||||||
free (provider_name);
|
|
||||||
out_free:
|
|
||||||
free (buf);
|
|
||||||
out_close:
|
|
||||||
svCloseFile (modem_file);
|
|
||||||
out_gfree:
|
|
||||||
g_free (name);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_dir_close (dir);
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nm_system_activate_nis
|
* nm_system_activate_nis
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user