Commit 3bdab811 authored by Robert Love's avatar Robert Love Committed by Robert Love
Browse files

2005-08-16 Robert Love <rml@novell.com>

        Patch from j@bootlab.org
	* src/backends/NetworkManagerDebian.c, src/backends/interface_parser.c,
	  src/backends/interface_parser.h: Debian dialup support.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@851 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent fcce3431
2005-08-16 Robert Love <rml@novell.com>
Patch from j@bootlab.org
* src/backends/NetworkManagerDebian.c, src/backends/interface_parser.c,
src/backends/interface_parser.h: Debian dialup support.
2005-08-16 Christopher Aillon <caillon@redhat.com>
* vpn-daemons/vpnc/properties/nm-vpnc-dialog.glade:
......
......@@ -30,6 +30,7 @@
#include "NetworkManagerSystem.h"
#include "NetworkManagerUtils.h"
#include "NetworkManagerDevice.h"
#include "NetworkManagerDialup.h"
#include "interface_parser.h"
#include "nm-utils.h"
......@@ -641,3 +642,88 @@ NMIP4Config *nm_system_device_new_ip4_system_config (NMDevice *dev)
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_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;
if_block *curr_device;
gboolean error = FALSE;
GError *err;
unsigned int i = 0;
size_t len;
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;
}
......@@ -162,6 +162,11 @@ void ifparser_destroy()
first = last = NULL;
}
if_block *ifparser_getfirst()
{
return first;
}
if_block *ifparser_getif(const char* iface)
{
if_block *curr = first;
......
......@@ -45,6 +45,7 @@ void ifparser_destroy();
const char* ifparser_interfaces();
if_block *ifparser_getif(const char* iface);
if_block *ifparser_getfirst();
const char *ifparser_getkey(if_block* iface, const char *key);
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment