diff --git a/ChangeLog b/ChangeLog index 26f6c681d1..758f56e136 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-02-28 Tambet Ingo + + Get rid of a bunch of unused distro specific functions. + 2008-02-28 Tambet Ingo Implement suse plugin for system settings daemon. diff --git a/src/NetworkManagerDialup.h b/src/NetworkManagerDialup.h deleted file mode 100644 index 4af82b9835..0000000000 --- a/src/NetworkManagerDialup.h +++ /dev/null @@ -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 */ diff --git a/src/NetworkManagerSystem.h b/src/NetworkManagerSystem.h index 1c98177cfc..5db80adcdc 100644 --- a/src/NetworkManagerSystem.h +++ b/src/NetworkManagerSystem.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_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); @@ -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); -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_activate_nis (NMIP4Config *config); void nm_system_shutdown_nis (void); diff --git a/src/backends/NetworkManagerArch.c b/src/backends/NetworkManagerArch.c index a99800c8ae..373335ea58 100644 --- a/src/backends/NetworkManagerArch.c +++ b/src/backends/NetworkManagerArch.c @@ -48,7 +48,6 @@ #include "nm-device.h" #include "nm-device-802-3-ethernet.h" #include "nm-device-802-11-wireless.h" -#include "NetworkManagerDialup.h" #include "interface_parser.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 * @@ -668,130 +646,6 @@ gboolean nm_system_device_get_disabled (NMDevice *dev) 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 * diff --git a/src/backends/NetworkManagerDebian.c b/src/backends/NetworkManagerDebian.c index cbe7632c8f..6be15f91b5 100644 --- a/src/backends/NetworkManagerDebian.c +++ b/src/backends/NetworkManagerDebian.c @@ -37,7 +37,6 @@ #include "nm-device.h" #include "nm-device-802-3-ethernet.h" #include "nm-device-802-11-wireless.h" -#include "NetworkManagerDialup.h" #include "interface_parser.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 * @@ -386,125 +365,6 @@ gboolean nm_system_device_get_disabled (NMDevice *dev) 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 * diff --git a/src/backends/NetworkManagerFrugalware.c b/src/backends/NetworkManagerFrugalware.c index 4c4d2ed23d..d1cc6fb8e0 100644 --- a/src/backends/NetworkManagerFrugalware.c +++ b/src/backends/NetworkManagerFrugalware.c @@ -299,55 +299,10 @@ void nm_system_flush_arp_cache (void) 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) { } -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 * diff --git a/src/backends/NetworkManagerGeneric.c b/src/backends/NetworkManagerGeneric.c index 524f89ebe2..adc57acd9e 100644 --- a/src/backends/NetworkManagerGeneric.c +++ b/src/backends/NetworkManagerGeneric.c @@ -412,25 +412,6 @@ NMIP4Config *nm_generic_device_new_ip4_system_config (NMDevice *dev) 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 * diff --git a/src/backends/NetworkManagerGeneric.h b/src/backends/NetworkManagerGeneric.h index 61e3cb9df0..962944311c 100644 --- a/src/backends/NetworkManagerGeneric.h +++ b/src/backends/NetworkManagerGeneric.h @@ -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); -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_activate_nis (NMIP4Config *config); void nm_generic_shutdown_nis (void); diff --git a/src/backends/NetworkManagerGentoo.c b/src/backends/NetworkManagerGentoo.c index 2de0b0cd67..703db021d0 100644 --- a/src/backends/NetworkManagerGentoo.c +++ b/src/backends/NetworkManagerGentoo.c @@ -447,31 +447,6 @@ void nm_system_device_free_system_config (NMDevice *dev, void *system_config_dat 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 * @@ -484,32 +459,6 @@ gboolean nm_system_device_get_disabled (NMDevice *dev) 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 * diff --git a/src/backends/NetworkManagerPaldo.c b/src/backends/NetworkManagerPaldo.c index 27fe516981..cb96b7e37c 100644 --- a/src/backends/NetworkManagerPaldo.c +++ b/src/backends/NetworkManagerPaldo.c @@ -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 * @@ -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 * diff --git a/src/backends/NetworkManagerRedHat.c b/src/backends/NetworkManagerRedHat.c index e79768e44e..5f653f79c7 100644 --- a/src/backends/NetworkManagerRedHat.c +++ b/src/backends/NetworkManagerRedHat.c @@ -33,7 +33,6 @@ #include "nm-device.h" #include "nm-device-802-3-ethernet.h" #include "nm-device-802-11-wireless.h" -#include "NetworkManagerDialup.h" #include "nm-utils.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 * @@ -523,228 +502,6 @@ gboolean nm_system_device_get_disabled (NMDevice *dev) 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 * diff --git a/src/backends/NetworkManagerSlackware.c b/src/backends/NetworkManagerSlackware.c index ec6590087a..ba6b67e9d7 100644 --- a/src/backends/NetworkManagerSlackware.c +++ b/src/backends/NetworkManagerSlackware.c @@ -265,47 +265,10 @@ void nm_system_flush_arp_cache (void) 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) { } -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 * diff --git a/src/backends/NetworkManagerSuSE.c b/src/backends/NetworkManagerSuSE.c index 7be7995ab3..e5afd61ac5 100644 --- a/src/backends/NetworkManagerSuSE.c +++ b/src/backends/NetworkManagerSuSE.c @@ -40,7 +40,6 @@ #include "NetworkManagerPolicy.h" #include "nm-device-802-3-ethernet.h" #include "nm-device-802-11-wireless.h" -#include "NetworkManagerDialup.h" #include "nm-utils.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 * @@ -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 *