NetworkManager r3902 - in branches/modem-manager: . introspection libnm-glib libnm-util po src src/dhcp-manager src/dnsmasq-manager src/modem-manager src/ppp-manager src/vpn-manager system-settings/plugins/ifcfg-fedora system-settings/plugins/ifcfg-suse system-settings/plugins/keyfile vpn-daemons/openvpn vpn-daemons/openvpn/po vpn-daemons/openvpn/src vpn-daemons/pptp/po vpn-daemons/vpnc vpn-daemons/vpnc/po vpn-daemons/vpnc/properties vpn-daemons/vpnc/src



Author: dcbw
Date: Thu Aug  7 13:41:04 2008
New Revision: 3902
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3902&view=rev

Log:
Merge from trunk r3901

Modified:
   branches/modem-manager/ChangeLog
   branches/modem-manager/introspection/nm-ip4-config.xml
   branches/modem-manager/libnm-glib/nm-device.c
   branches/modem-manager/libnm-glib/nm-ip4-config.c
   branches/modem-manager/libnm-glib/nm-ip4-config.h
   branches/modem-manager/libnm-util/nm-connection.c
   branches/modem-manager/libnm-util/nm-connection.h
   branches/modem-manager/libnm-util/nm-setting-cdma.c
   branches/modem-manager/libnm-util/nm-setting-gsm.c
   branches/modem-manager/libnm-util/nm-setting-ip4-config.c
   branches/modem-manager/libnm-util/nm-setting-ip4-config.h
   branches/modem-manager/libnm-util/nm-setting-vpn.c
   branches/modem-manager/libnm-util/nm-setting-vpn.h
   branches/modem-manager/libnm-util/nm-utils.c
   branches/modem-manager/libnm-util/nm-utils.h
   branches/modem-manager/po/ChangeLog
   branches/modem-manager/po/bg.po
   branches/modem-manager/po/pt_BR.po
   branches/modem-manager/src/NetworkManager.c
   branches/modem-manager/src/NetworkManagerPolicy.c
   branches/modem-manager/src/NetworkManagerSystem.c
   branches/modem-manager/src/NetworkManagerUtils.c
   branches/modem-manager/src/dhcp-manager/nm-dhcp-manager.c
   branches/modem-manager/src/dnsmasq-manager/nm-dnsmasq-manager.c
   branches/modem-manager/src/modem-manager/nm-modem-device.c
   branches/modem-manager/src/modem-manager/nm-modem-manager.c
   branches/modem-manager/src/modem-manager/nm-modem-types.h
   branches/modem-manager/src/nm-activation-request.c
   branches/modem-manager/src/nm-device-ethernet.c
   branches/modem-manager/src/nm-device-wifi.c
   branches/modem-manager/src/nm-device.c
   branches/modem-manager/src/nm-ip4-config.c
   branches/modem-manager/src/nm-ip4-config.h
   branches/modem-manager/src/nm-manager.c
   branches/modem-manager/src/nm-manager.h
   branches/modem-manager/src/ppp-manager/nm-ppp-manager.c
   branches/modem-manager/src/ppp-manager/nm-ppp-manager.h
   branches/modem-manager/src/ppp-manager/nm-pppd-plugin.c
   branches/modem-manager/src/ppp-manager/nm-pppd-plugin.h
   branches/modem-manager/src/vpn-manager/nm-vpn-connection.c
   branches/modem-manager/system-settings/plugins/ifcfg-fedora/common.h
   branches/modem-manager/system-settings/plugins/ifcfg-fedora/plugin.c
   branches/modem-manager/system-settings/plugins/ifcfg-fedora/reader.c
   branches/modem-manager/system-settings/plugins/ifcfg-suse/parser.c
   branches/modem-manager/system-settings/plugins/keyfile/reader.c
   branches/modem-manager/system-settings/plugins/keyfile/writer.c
   branches/modem-manager/vpn-daemons/openvpn/ChangeLog
   branches/modem-manager/vpn-daemons/openvpn/po/ChangeLog
   branches/modem-manager/vpn-daemons/openvpn/po/bg.po
   branches/modem-manager/vpn-daemons/openvpn/src/nm-openvpn-service-openvpn-helper.c
   branches/modem-manager/vpn-daemons/pptp/po/ChangeLog
   branches/modem-manager/vpn-daemons/pptp/po/bg.po
   branches/modem-manager/vpn-daemons/vpnc/ChangeLog
   branches/modem-manager/vpn-daemons/vpnc/po/ChangeLog
   branches/modem-manager/vpn-daemons/vpnc/po/bg.po
   branches/modem-manager/vpn-daemons/vpnc/properties/nm-vpnc.c
   branches/modem-manager/vpn-daemons/vpnc/src/nm-vpnc-service-vpnc-helper.c
   branches/modem-manager/vpn-daemons/vpnc/src/nm-vpnc-service.c

Modified: branches/modem-manager/introspection/nm-ip4-config.xml
==============================================================================
--- branches/modem-manager/introspection/nm-ip4-config.xml	(original)
+++ branches/modem-manager/introspection/nm-ip4-config.xml	Thu Aug  7 13:41:04 2008
@@ -3,7 +3,7 @@
 <node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0";>
   <interface name="org.freedesktop.NetworkManager.IP4Config">
     <property name="Addresses" type="aau" access="read">
-      <tp:docstring>Tuples of IPv4 address/prefix/gateway.  The gateway is optional, if not given should be 0.</tp:docstring>
+      <tp:docstring>Tuples of IPv4 address/prefix/gateway.</tp:docstring>
     </property>
     <property name="Hostname" type="s" access="read">
       <tp:docstring>The hostname associated with this IPv4 address. FIXME: what about multiple hostnames?</tp:docstring>
@@ -20,6 +20,9 @@
     <property name="NisServers" type="au" access="read">
       <tp:docstring>The NIS servers associated with this address.</tp:docstring>
     </property>
+    <property name="Routes" type="aau" access="read">
+      <tp:docstring>Tuples of IPv4 route/prefix/next-hop/metric.</tp:docstring>
+    </property>
   </interface>
 </node>
 

Modified: branches/modem-manager/libnm-glib/nm-device.c
==============================================================================
--- branches/modem-manager/libnm-glib/nm-device.c	(original)
+++ branches/modem-manager/libnm-glib/nm-device.c	Thu Aug  7 13:41:04 2008
@@ -547,19 +547,14 @@
 }
 
 static char *
-get_product_and_vendor (NMDevice *device,
-                        DBusGConnection *connection,
-                        const char *udi,
-                        gboolean want_origdev,
-                        gboolean warn,
-                        char **product,
-                        char **vendor)
+get_ancestor_device (NMDevice *device,
+                     DBusGConnection *connection,
+                     const char *udi,
+                     gboolean want_origdev)
 {
 	DBusGProxy *proxy;
 	GError *err = NULL;
 	char *parent = NULL;
-	char *tmp_product = NULL;
-	char *tmp_vendor = NULL;
 
 	g_return_val_if_fail (connection != NULL, NULL);
 	g_return_val_if_fail (udi != NULL, NULL);
@@ -568,28 +563,6 @@
 	if (!proxy)
 		return NULL;
 
-	if (!dbus_g_proxy_call (proxy, "GetPropertyString", &err,
-							G_TYPE_STRING, "info.product",
-							G_TYPE_INVALID,
-							G_TYPE_STRING, &tmp_product,
-							G_TYPE_INVALID)) {
-		if (warn)
-			g_warning ("Error getting device %s product from HAL: %s", udi, err->message);
-		g_error_free (err);
-		err = NULL;
-    }
-
-	if (!dbus_g_proxy_call (proxy, "GetPropertyString", &err,
-							G_TYPE_STRING, "info.vendor",
-							G_TYPE_INVALID,
-							G_TYPE_STRING, &tmp_vendor,
-							G_TYPE_INVALID)) {
-		if (warn)
-			g_warning ("Error getting device %s vendor from HAL: %s", udi, err->message);
-		g_error_free (err);
-		err = NULL;
-    }
-
 	if (want_origdev) {
 		gboolean serial = FALSE;
 
@@ -628,7 +601,79 @@
 	    }
 	}
 
-	if (parent && tmp_product && tmp_vendor) {
+	g_object_unref (proxy);
+	return parent;
+}
+
+static char *
+proxy_get_string (DBusGProxy *proxy,
+                  const char *property,
+                  gboolean warn)
+{
+	GError *error = NULL;
+	char *result = NULL;
+
+	g_return_val_if_fail (proxy != NULL, NULL);
+	g_return_val_if_fail (property != NULL, NULL);
+
+	if (dbus_g_proxy_call (proxy, "GetPropertyString", &error,
+	                       G_TYPE_STRING, property, G_TYPE_INVALID,
+	                       G_TYPE_STRING, &result, G_TYPE_INVALID))
+		return result;
+
+	if (warn) {
+		g_warning ("Error getting HAL property '%s' from device '%s': %s",
+		           property, dbus_g_proxy_get_path (proxy),
+		           error ? error->message : "unknown");
+	}
+	g_error_free (error);
+	return NULL;
+}
+
+static gboolean
+get_product_and_vendor (DBusGConnection *connection,
+                        const char *udi,
+                        char **product,
+                        char **vendor)
+{
+	DBusGProxy *proxy;
+	char *tmp_product = NULL;
+	char *tmp_vendor = NULL;
+	char *subsys = NULL;
+	gboolean product_fallback = TRUE, vendor_fallback = TRUE;
+	gboolean warn = FALSE;
+
+	g_return_val_if_fail (connection != NULL, FALSE);
+	g_return_val_if_fail (udi != NULL, FALSE);
+
+	g_return_val_if_fail (product != NULL, FALSE);
+	g_return_val_if_fail (*product == NULL, FALSE);
+
+	g_return_val_if_fail (vendor != NULL, FALSE);
+	g_return_val_if_fail (*vendor == NULL, FALSE);
+
+	proxy = dbus_g_proxy_new_for_name (connection, "org.freedesktop.Hal", udi, "org.freedesktop.Hal.Device");
+	if (!proxy)
+		return FALSE;
+
+	subsys = proxy_get_string (proxy, "info.subsystem", warn);
+	if (subsys && !strcmp (subsys, "pci")) {
+		tmp_product = proxy_get_string (proxy, "pci.subsys_product", warn);
+		if (tmp_product)
+			product_fallback = FALSE;
+
+		tmp_vendor = proxy_get_string (proxy, "pci.subsys_vendor", warn);
+		if (tmp_vendor)
+			vendor_fallback = FALSE;
+	}
+	g_free (subsys);
+
+	if (product_fallback)
+		tmp_product = proxy_get_string (proxy, "info.product", warn);
+	if (vendor_fallback)
+		tmp_vendor = proxy_get_string (proxy, "info.vendor", warn);
+
+	if (tmp_product && tmp_vendor) {
 		*product = tmp_product;
 		*vendor = tmp_vendor;
 	} else {
@@ -637,7 +682,7 @@
 	}
 	g_object_unref (proxy);
 
-	return parent;
+	return (*product && *vendor) ? TRUE : FALSE;
 }
 
 static void
@@ -647,7 +692,7 @@
 	DBusGConnection *connection;
 	const char *udi;
 	char *orig_dev_udi = NULL;
-	char *pd_parent_udi = NULL;
+	char *parent_udi = NULL;
 
 	g_return_if_fail (NM_IS_DEVICE (device));
 	priv = NM_DEVICE_GET_PRIVATE (device);
@@ -662,38 +707,19 @@
 
 	/* First, get the udi of the originating device */
 	udi = nm_device_get_udi (device);
-	orig_dev_udi = get_product_and_vendor (device, connection, udi, TRUE, FALSE,
-	                                       &priv->product, &priv->vendor);
+	orig_dev_udi = get_ancestor_device (device, connection, udi, TRUE);
 
-	/* Ignore product and vendor for the Network Interface */
-	if (priv->product || priv->vendor) {
-		g_free (priv->product);
-		priv->product = NULL;
-		g_free (priv->vendor);
-		priv->vendor = NULL;
+	/* Get product and vendor off the originating device if possible */
+	if (!get_product_and_vendor (connection, orig_dev_udi, &priv->product, &priv->vendor)) {
+		 /* Try the parent of the originating device */
+		parent_udi = get_ancestor_device (device, connection, orig_dev_udi, FALSE);
+		if (parent_udi)
+			get_product_and_vendor (connection, parent_udi, &priv->product, &priv->vendor);
+		g_free (parent_udi);
 	}
 
-	/* Get product and vendor off the originating device if possible */
-	pd_parent_udi = get_product_and_vendor (device,
-	                                        connection,
-	                                        orig_dev_udi,
-	                                        FALSE,
-	                                        FALSE,
-	                                        &priv->product,
-	                                        &priv->vendor);
 	g_free (orig_dev_udi);
 
-	/* If one of the product/vendor isn't found on the originating device, try the
-	 * parent of the originating device.
-	 */
-	if (!priv->product || !priv->vendor) {
-		char *ignore;
-		ignore = get_product_and_vendor (device, connection, pd_parent_udi,
-		                                 FALSE, TRUE, &priv->product, &priv->vendor);
-		g_free (ignore);
-	}
-	g_free (pd_parent_udi);
-
 	nm_object_queue_notify (NM_OBJECT (device), NM_DEVICE_VENDOR);
 	nm_object_queue_notify (NM_OBJECT (device), NM_DEVICE_PRODUCT);
 }

Modified: branches/modem-manager/libnm-glib/nm-ip4-config.c
==============================================================================
--- branches/modem-manager/libnm-glib/nm-ip4-config.c	(original)
+++ branches/modem-manager/libnm-glib/nm-ip4-config.c	Thu Aug  7 13:41:04 2008
@@ -19,6 +19,7 @@
 	GPtrArray *domains;
 	char *nis_domain;
 	GArray *nis_servers;
+	GSList *routes;
 } NMIP4ConfigPrivate;
 
 enum {
@@ -29,6 +30,7 @@
 	PROP_DOMAINS,
 	PROP_NIS_DOMAIN,
 	PROP_NIS_SERVERS,
+	PROP_ROUTES,
 
 	LAST_PROP
 };
@@ -76,6 +78,21 @@
 	return TRUE;
 }
 
+static gboolean
+demarshal_ip4_routes_array (NMObject *object, GParamSpec *pspec, GValue *value, gpointer field)
+{
+	NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (object);
+
+	g_slist_foreach (priv->routes, (GFunc) g_free, NULL);
+	g_slist_free (priv->routes);
+	priv->routes = NULL;
+
+	priv->routes = nm_utils_ip4_routes_from_gvalue (value);
+	nm_object_queue_notify (object, NM_IP4_CONFIG_ROUTES);
+
+	return TRUE;
+}
+
 static void
 register_for_property_changed (NMIP4Config *config)
 {
@@ -87,6 +104,7 @@
 		{ NM_IP4_CONFIG_DOMAINS,     demarshal_domains,            &priv->domains },
 		{ NM_IP4_CONFIG_NIS_DOMAIN,  nm_object_demarshal_generic,  &priv->nis_domain },
 		{ NM_IP4_CONFIG_NIS_SERVERS, demarshal_ip4_array,          &priv->nis_servers },
+		{ NM_IP4_CONFIG_ROUTES,      demarshal_ip4_routes_array,   &priv->routes },
 		{ NULL },
 	};
 
@@ -131,6 +149,9 @@
 	g_slist_foreach (priv->addresses, (GFunc) g_free, NULL);
 	g_slist_free (priv->addresses);
 
+	g_slist_foreach (priv->routes, (GFunc) g_free, NULL);
+	g_slist_free (priv->routes);
+
 	g_free (priv->hostname);
 	g_free (priv->nis_domain);
 	if (priv->nameservers)
@@ -174,6 +195,9 @@
 	case PROP_NIS_SERVERS:
 		g_value_set_boxed (value, nm_ip4_config_get_nis_servers (self));
 		break;
+	case PROP_ROUTES:
+		nm_utils_ip4_routes_to_gvalue (priv->routes, value);
+		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 		break;
@@ -239,6 +263,13 @@
 						    "NIS servers",
 						    NM_TYPE_UINT_ARRAY,
 						    G_PARAM_READABLE));
+
+	g_object_class_install_property
+		(object_class, PROP_ROUTES,
+		 g_param_spec_pointer (NM_IP4_CONFIG_ROUTES,
+						       "Routes",
+						       "Routes",
+						       G_PARAM_READABLE));
 }
 
 GObject *
@@ -366,7 +397,7 @@
 	return priv->nis_domain;
 }
 
-GArray *
+const GArray *
 nm_ip4_config_get_nis_servers (NMIP4Config *config)
 {
 	NMIP4ConfigPrivate *priv;
@@ -392,3 +423,29 @@
 
 	return priv->nis_servers;
 }
+
+const GSList *
+nm_ip4_config_get_routes (NMIP4Config *config)
+{
+	NMIP4ConfigPrivate *priv;
+	GValue value = { 0, };
+
+	g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0);
+
+	priv = NM_IP4_CONFIG_GET_PRIVATE (config);
+	if (priv->routes)
+		return priv->routes;
+
+	if (!nm_object_get_property (NM_OBJECT (config),
+	                             "org.freedesktop.DBus.Properties",
+	                             "Routes",
+	                             &value)) {
+		return NULL;
+	}
+
+	demarshal_ip4_routes_array (NM_OBJECT (config), NULL, &value, &priv->routes);
+	g_value_unset (&value);
+
+	return priv->routes;
+}
+

Modified: branches/modem-manager/libnm-glib/nm-ip4-config.h
==============================================================================
--- branches/modem-manager/libnm-glib/nm-ip4-config.h	(original)
+++ branches/modem-manager/libnm-glib/nm-ip4-config.h	Thu Aug  7 13:41:04 2008
@@ -29,6 +29,7 @@
 #define NM_IP4_CONFIG_DOMAINS "domains"
 #define NM_IP4_CONFIG_NIS_DOMAIN "nis-domain"
 #define NM_IP4_CONFIG_NIS_SERVERS "nis-servers"
+#define NM_IP4_CONFIG_ROUTES "routes"
 
 GType nm_ip4_config_get_type (void);
 
@@ -39,7 +40,8 @@
 const GArray *   nm_ip4_config_get_nameservers (NMIP4Config *config);
 const GPtrArray *nm_ip4_config_get_domains     (NMIP4Config *config);
 const char *     nm_ip4_config_get_nis_domain  (NMIP4Config *config);
-GArray *         nm_ip4_config_get_nis_servers (NMIP4Config *config);
+const GArray *   nm_ip4_config_get_nis_servers (NMIP4Config *config);
+const GSList *   nm_ip4_config_get_routes      (NMIP4Config *config);
 
 G_END_DECLS
 

Modified: branches/modem-manager/libnm-util/nm-connection.c
==============================================================================
--- branches/modem-manager/libnm-util/nm-connection.c	(original)
+++ branches/modem-manager/libnm-util/nm-connection.c	Thu Aug  7 13:41:04 2008
@@ -45,6 +45,37 @@
 #include "nm-setting-gsm.h"
 #include "nm-setting-cdma.h"
 
+GQuark
+nm_connection_error_quark (void)
+{
+	static GQuark quark;
+
+	if (G_UNLIKELY (!quark))
+		quark = g_quark_from_static_string ("nm-connection-error-quark");
+	return quark;
+}
+
+/* This should really be standard. */
+#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
+
+GType
+nm_connection_error_get_type (void)
+{
+	static GType etype = 0;
+
+	if (etype == 0) {
+		static const GEnumValue values[] = {
+			/* Unknown error. */
+			ENUM_ENTRY (NM_CONNECTION_ERROR_UNKNOWN, "UnknownError"),
+			/* The required 'connection' setting was not found. */
+			ENUM_ENTRY (NM_CONNECTION_ERROR_CONNECTION_SETTING_NOT_FOUND, "ConnectionSettingNotFound"),
+			{ 0, 0, 0 }
+		};
+		etype = g_enum_register_static ("NMConnectionError", values);
+	}
+	return etype;
+}
+
 typedef struct {
 	GHashTable *settings;
 
@@ -430,7 +461,7 @@
 nm_connection_verify (NMConnection *connection, GError **error)
 {
 	NMConnectionPrivate *priv;
-	NMSetting *connection_setting;
+	NMSetting *s_con;
 	VerifySettingsInfo info;
 
 	g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
@@ -440,9 +471,12 @@
 	priv = NM_CONNECTION_GET_PRIVATE (connection);
 
 	/* First, make sure there's at least 'connection' setting */
-	connection_setting = nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
-	if (!connection_setting) {
-		g_warning ("'connection' setting not present.");
+	s_con = nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
+	if (!s_con) {
+		g_set_error (error,
+		             NM_CONNECTION_ERROR,
+		             NM_CONNECTION_ERROR_CONNECTION_SETTING_NOT_FOUND,
+		             "connection setting not found");
 		return FALSE;
 	}
 

Modified: branches/modem-manager/libnm-util/nm-connection.h
==============================================================================
--- branches/modem-manager/libnm-util/nm-connection.h	(original)
+++ branches/modem-manager/libnm-util/nm-connection.h	Thu Aug  7 13:41:04 2008
@@ -45,6 +45,18 @@
 	NM_CONNECTION_SCOPE_USER
 } NMConnectionScope;
 
+typedef enum
+{
+	NM_CONNECTION_ERROR_UNKNOWN = 0,
+	NM_CONNECTION_ERROR_CONNECTION_SETTING_NOT_FOUND
+} NMConnectionError;
+
+#define NM_TYPE_CONNECTION_ERROR (nm_connection_error_get_type ()) 
+GType nm_connection_error_get_type (void);
+
+#define NM_CONNECTION_ERROR nm_connection_error_quark ()
+GQuark nm_connection_error_quark (void);
+
 #define NM_CONNECTION_SCOPE "scope"
 #define NM_CONNECTION_PATH "path"
 

Modified: branches/modem-manager/libnm-util/nm-setting-cdma.c
==============================================================================
--- branches/modem-manager/libnm-util/nm-setting-cdma.c	(original)
+++ branches/modem-manager/libnm-util/nm-setting-cdma.c	Thu Aug  7 13:41:04 2008
@@ -117,9 +117,42 @@
 		return FALSE;
 	}
 
+	if (self->username && !strlen (self->username)) {
+		g_set_error (error,
+		             NM_SETTING_CDMA_ERROR,
+		             NM_SETTING_CDMA_ERROR_INVALID_PROPERTY,
+		             NM_SETTING_CDMA_USERNAME);
+		return FALSE;
+	}
+
+	if (self->password && !strlen (self->password)) {
+		g_set_error (error,
+		             NM_SETTING_CDMA_ERROR,
+		             NM_SETTING_CDMA_ERROR_INVALID_PROPERTY,
+		             NM_SETTING_CDMA_PASSWORD);
+		return FALSE;
+	}
+
 	return TRUE;
 }
 
+static GPtrArray *
+need_secrets (NMSetting *setting)
+{
+	NMSettingCdma *self = NM_SETTING_CDMA (setting);
+	GPtrArray *secrets = NULL;
+
+	if (self->password)
+		return NULL;
+
+	if (self->username) {
+		secrets = g_ptr_array_sized_new (1);
+		g_ptr_array_add (secrets, NM_SETTING_CDMA_PASSWORD);
+	}
+
+	return secrets;
+}
+
 static void
 nm_setting_cdma_init (NMSettingCdma *setting)
 {
@@ -196,6 +229,7 @@
 	object_class->get_property = get_property;
 	object_class->finalize     = finalize;
 	parent_class->verify       = verify;
+	parent_class->need_secrets = need_secrets;
 
 	/* Properties */
 	g_object_class_install_property

Modified: branches/modem-manager/libnm-util/nm-setting-gsm.c
==============================================================================
--- branches/modem-manager/libnm-util/nm-setting-gsm.c	(original)
+++ branches/modem-manager/libnm-util/nm-setting-gsm.c	Thu Aug  7 13:41:04 2008
@@ -133,9 +133,42 @@
 		return FALSE;
 	}
 
+	if (self->username && !strlen (self->username)) {
+		g_set_error (error,
+		             NM_SETTING_GSM_ERROR,
+		             NM_SETTING_GSM_ERROR_INVALID_PROPERTY,
+		             NM_SETTING_GSM_USERNAME);
+		return FALSE;
+	}
+
+	if (self->password && !strlen (self->password)) {
+		g_set_error (error,
+		             NM_SETTING_GSM_ERROR,
+		             NM_SETTING_GSM_ERROR_INVALID_PROPERTY,
+		             NM_SETTING_GSM_USERNAME);
+		return FALSE;
+	}
+
 	return TRUE;
 }
 
+static GPtrArray *
+need_secrets (NMSetting *setting)
+{
+	NMSettingGsm *self = NM_SETTING_GSM (setting);
+	GPtrArray *secrets = NULL;
+
+	if (self->password)
+		return NULL;
+
+	if (self->username) {
+		secrets = g_ptr_array_sized_new (1);
+		g_ptr_array_add (secrets, NM_SETTING_GSM_PASSWORD);
+	}
+
+	return secrets;
+}
+
 static void
 nm_setting_gsm_init (NMSettingGsm *setting)
 {
@@ -256,6 +289,7 @@
 	object_class->get_property = get_property;
 	object_class->finalize     = finalize;
 	parent_class->verify       = verify;
+	parent_class->need_secrets = need_secrets;
 
 	/* Properties */
 	g_object_class_install_property

Modified: branches/modem-manager/libnm-util/nm-setting-ip4-config.c
==============================================================================
--- branches/modem-manager/libnm-util/nm-setting-ip4-config.c	(original)
+++ branches/modem-manager/libnm-util/nm-setting-ip4-config.c	Thu Aug  7 13:41:04 2008
@@ -76,7 +76,8 @@
 	PROP_DNS_SEARCH,
 	PROP_ADDRESSES,
 	PROP_ROUTES,
-	PROP_IGNORE_DHCP_DNS,
+	PROP_IGNORE_AUTO_ROUTES,
+	PROP_IGNORE_AUTO_DNS,
 	PROP_DHCP_CLIENT_ID,
 	PROP_DHCP_HOSTNAME,
 
@@ -112,7 +113,7 @@
 			             NM_SETTING_IP4_CONFIG_ADDRESSES);
 			return FALSE;
 		}
-	} else if (   !strcmp (self->method, NM_SETTING_IP4_CONFIG_METHOD_AUTOIP)
+	} else if (   !strcmp (self->method, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL)
 	           || !strcmp (self->method, NM_SETTING_IP4_CONFIG_METHOD_SHARED)) {
 		if (self->dns && self->dns->len) {
 			g_set_error (error,
@@ -137,7 +138,7 @@
 			             NM_SETTING_IP4_CONFIG_ADDRESSES);
 			return FALSE;
 		}
-	} else if (!strcmp (self->method, NM_SETTING_IP4_CONFIG_METHOD_DHCP)) {
+	} else if (!strcmp (self->method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
 		/* nothing to do */
 	} else {
 		g_set_error (error,
@@ -186,9 +187,9 @@
 
 	/* Validate routes */
 	for (iter = self->routes, i = 0; iter; iter = g_slist_next (iter), i++) {
-		NMSettingIP4Address *addr = (NMSettingIP4Address *) iter->data;
+		NMSettingIP4Route *route = (NMSettingIP4Route *) iter->data;
 
-		if (!addr->address) {
+		if (!route->address) {
 			g_set_error (error,
 			             NM_SETTING_IP4_CONFIG_ERROR,
 			             NM_SETTING_IP4_CONFIG_ERROR_INVALID_PROPERTY,
@@ -196,7 +197,7 @@
 			return FALSE;
 		}
 
-		if (!addr->prefix || addr->prefix > 32) {
+		if (!route->prefix || route->prefix > 32) {
 			g_set_error (error,
 			             NM_SETTING_IP4_CONFIG_ERROR,
 			             NM_SETTING_IP4_CONFIG_ERROR_INVALID_PROPERTY,
@@ -258,10 +259,13 @@
 		break;
 	case PROP_ROUTES:
 		nm_utils_slist_free (setting->routes, g_free);
-		setting->routes = nm_utils_ip4_addresses_from_gvalue (value);
+		setting->routes = nm_utils_ip4_routes_from_gvalue (value);
 		break;
-	case PROP_IGNORE_DHCP_DNS:
-		setting->ignore_dhcp_dns = g_value_get_boolean (value);
+	case PROP_IGNORE_AUTO_ROUTES:
+		setting->ignore_auto_routes = g_value_get_boolean (value);
+		break;
+	case PROP_IGNORE_AUTO_DNS:
+		setting->ignore_auto_dns = g_value_get_boolean (value);
 		break;
 	case PROP_DHCP_CLIENT_ID:
 		g_free (setting->dhcp_client_id);
@@ -297,10 +301,13 @@
 		nm_utils_ip4_addresses_to_gvalue (setting->addresses, value);
 		break;
 	case PROP_ROUTES:
-		nm_utils_ip4_addresses_to_gvalue (setting->routes, value);
+		nm_utils_ip4_routes_to_gvalue (setting->routes, value);
+		break;
+	case PROP_IGNORE_AUTO_ROUTES:
+		g_value_set_boolean (value, setting->ignore_auto_routes);
 		break;
-	case PROP_IGNORE_DHCP_DNS:
-		g_value_set_boolean (value, setting->ignore_dhcp_dns);
+	case PROP_IGNORE_AUTO_DNS:
+		g_value_set_boolean (value, setting->ignore_auto_dns);
 		break;
 	case PROP_DHCP_CLIENT_ID:
 		g_value_set_string (value, setting->dhcp_client_id);
@@ -363,15 +370,23 @@
 		(object_class, PROP_ROUTES,
 		 nm_param_spec_specialized (NM_SETTING_IP4_CONFIG_ROUTES,
 							   "Routes",
-							   "List of NMSettingIP4Addresses",
+							   "List of NMSettingIP4Routes",
 							   DBUS_TYPE_G_ARRAY_OF_ARRAY_OF_UINT,
 							   G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
 
 	g_object_class_install_property
-		(object_class, PROP_IGNORE_DHCP_DNS,
-		 g_param_spec_boolean (NM_SETTING_IP4_CONFIG_IGNORE_DHCP_DNS,
-						   "Ignore DHCP DNS",
-						   "Ignore DHCP DNS",
+		(object_class, PROP_IGNORE_AUTO_ROUTES,
+		 g_param_spec_boolean (NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES,
+						   "Ignore automatic routes",
+						   "Ignore automatic routes",
+						   FALSE,
+						   G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
+
+	g_object_class_install_property
+		(object_class, PROP_IGNORE_AUTO_DNS,
+		 g_param_spec_boolean (NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS,
+						   "Ignore automatic DNS",
+						   "Ignore automatic DNS",
 						   FALSE,
 						   G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
 

Modified: branches/modem-manager/libnm-util/nm-setting-ip4-config.h
==============================================================================
--- branches/modem-manager/libnm-util/nm-setting-ip4-config.h	(original)
+++ branches/modem-manager/libnm-util/nm-setting-ip4-config.h	Thu Aug  7 13:41:04 2008
@@ -53,19 +53,20 @@
 #define NM_SETTING_IP4_CONFIG_ERROR nm_setting_ip4_config_error_quark ()
 GQuark nm_setting_ip4_config_error_quark (void);
 
-#define NM_SETTING_IP4_CONFIG_METHOD          "method"
-#define NM_SETTING_IP4_CONFIG_DNS             "dns"
-#define NM_SETTING_IP4_CONFIG_DNS_SEARCH      "dns-search"
-#define NM_SETTING_IP4_CONFIG_ADDRESSES       "addresses"
-#define NM_SETTING_IP4_CONFIG_ROUTES          "routes"
-#define NM_SETTING_IP4_CONFIG_IGNORE_DHCP_DNS "ignore-dhcp-dns"
-#define NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID  "dhcp-client-id"
-#define NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME   "dhcp-hostname"
-
-#define NM_SETTING_IP4_CONFIG_METHOD_DHCP   "dhcp"
-#define NM_SETTING_IP4_CONFIG_METHOD_AUTOIP "autoip"
-#define NM_SETTING_IP4_CONFIG_METHOD_MANUAL "manual"
-#define NM_SETTING_IP4_CONFIG_METHOD_SHARED "shared"
+#define NM_SETTING_IP4_CONFIG_METHOD             "method"
+#define NM_SETTING_IP4_CONFIG_DNS                "dns"
+#define NM_SETTING_IP4_CONFIG_DNS_SEARCH         "dns-search"
+#define NM_SETTING_IP4_CONFIG_ADDRESSES          "addresses"
+#define NM_SETTING_IP4_CONFIG_ROUTES             "routes"
+#define NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES "ignore-auto-routes"
+#define NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS    "ignore-auto-dns"
+#define NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID     "dhcp-client-id"
+#define NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME      "dhcp-hostname"
+
+#define NM_SETTING_IP4_CONFIG_METHOD_AUTO       "auto"
+#define NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL "link-local"
+#define NM_SETTING_IP4_CONFIG_METHOD_MANUAL     "manual"
+#define NM_SETTING_IP4_CONFIG_METHOD_SHARED     "shared"
 
 typedef struct {
 	guint32 address;   /* network byte order */
@@ -74,14 +75,22 @@
 } NMSettingIP4Address;
 
 typedef struct {
+	guint32 address;   /* network byte order */
+	guint32 prefix;
+	guint32 next_hop;   /* network byte order */
+	guint32 metric;    /* lower metric == more preferred */
+} NMSettingIP4Route;
+
+typedef struct {
 	NMSetting parent;
 
 	char *method;
 	GArray *dns;        /* array of guint32; elements in network byte order */
 	GSList *dns_search; /* list of strings */
 	GSList *addresses;  /* array of NMSettingIP4Address */
-	GSList *routes;     /* array of NMSettingIP4Address */
-	gboolean ignore_dhcp_dns;
+	GSList *routes;     /* array of NMSettingIP4Route */
+	gboolean ignore_auto_routes;
+	gboolean ignore_auto_dns;
 	char *dhcp_client_id;
 	char *dhcp_hostname;
 } NMSettingIP4Config;

Modified: branches/modem-manager/libnm-util/nm-setting-vpn.c
==============================================================================
--- branches/modem-manager/libnm-util/nm-setting-vpn.c	(original)
+++ branches/modem-manager/libnm-util/nm-setting-vpn.c	Thu Aug  7 13:41:04 2008
@@ -70,7 +70,6 @@
 	PROP_0,
 	PROP_SERVICE_TYPE,
 	PROP_USER_NAME,
-	PROP_ROUTES,
 
 	LAST_PROP
 };
@@ -127,7 +126,6 @@
 
 	g_free (self->service_type);
 	g_free (self->user_name);
-	nm_utils_slist_free (self->routes, g_free);
 
 	G_OBJECT_CLASS (nm_setting_vpn_parent_class)->finalize (object);
 }
@@ -147,10 +145,6 @@
 		g_free (setting->user_name);
 		setting->user_name = g_value_dup_string (value);
 		break;
-	case PROP_ROUTES:
-		nm_utils_slist_free (setting->routes, g_free);
-		setting->routes = g_value_dup_boxed (value);
-		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 		break;
@@ -170,9 +164,6 @@
 	case PROP_USER_NAME:
 		g_value_set_string (value, setting->user_name);
 		break;
-	case PROP_ROUTES:
-		g_value_set_boxed (value, setting->routes);
-		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 		break;
@@ -207,12 +198,4 @@
 						  "User name",
 						  NULL,
 						  G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
-
-	g_object_class_install_property
-		(object_class, PROP_ROUTES,
-		 nm_param_spec_specialized (NM_SETTING_VPN_ROUTES,
-							   "Routes",
-							   "Routes",
-							   DBUS_TYPE_G_LIST_OF_STRING,
-							   G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
 }

Modified: branches/modem-manager/libnm-util/nm-setting-vpn.h
==============================================================================
--- branches/modem-manager/libnm-util/nm-setting-vpn.h	(original)
+++ branches/modem-manager/libnm-util/nm-setting-vpn.h	Thu Aug  7 13:41:04 2008
@@ -54,14 +54,12 @@
 
 #define NM_SETTING_VPN_SERVICE_TYPE "service-type"
 #define NM_SETTING_VPN_USER_NAME    "user-name"
-#define NM_SETTING_VPN_ROUTES       "routes"
 
 typedef struct {
 	NMSetting parent;
 
 	char *service_type;
 	char *user_name;
-	GSList *routes;
 } NMSettingVPN;
 
 typedef struct {

Modified: branches/modem-manager/libnm-util/nm-utils.c
==============================================================================
--- branches/modem-manager/libnm-util/nm-utils.c	(original)
+++ branches/modem-manager/libnm-util/nm-utils.c	Thu Aug  7 13:41:04 2008
@@ -859,6 +859,58 @@
 	g_value_take_boxed (value, addresses);
 }
 
+GSList *
+nm_utils_ip4_routes_from_gvalue (const GValue *value)
+{
+	GPtrArray *routes;
+	int i;
+	GSList *list = NULL;
+
+	routes = (GPtrArray *) g_value_get_boxed (value);
+	for (i = 0; routes && (i < routes->len); i++) {
+		GArray *array = (GArray *) g_ptr_array_index (routes, i);
+		NMSettingIP4Route *route;
+
+		if (array->len != 4) {
+			nm_warning ("Ignoring invalid IP4 route");
+			continue;
+		}
+		
+		route = g_malloc0 (sizeof (NMSettingIP4Route));
+		route->address = g_array_index (array, guint32, 0);
+		route->prefix = g_array_index (array, guint32, 1);
+		route->next_hop = g_array_index (array, guint32, 2);
+		route->metric = g_array_index (array, guint32, 3);
+		list = g_slist_prepend (list, route);
+	}
+
+	return g_slist_reverse (list);
+}
+
+void
+nm_utils_ip4_routes_to_gvalue (GSList *list, GValue *value)
+{
+	GPtrArray *routes;
+	GSList *iter;
+
+	routes = g_ptr_array_new ();
+
+	for (iter = list; iter; iter = iter->next) {
+		NMSettingIP4Route *route = (NMSettingIP4Route *) iter->data;
+		GArray *array;
+
+		array = g_array_sized_new (FALSE, TRUE, sizeof (guint32), 3);
+
+		g_array_append_val (array, route->address);
+		g_array_append_val (array, route->prefix);
+		g_array_append_val (array, route->next_hop);
+		g_array_append_val (array, route->metric);
+		g_ptr_array_add (routes, array);
+	}
+
+	g_value_take_boxed (value, routes);
+}
+
 /*
  * nm_utils_ip4_netmask_to_prefix
  *

Modified: branches/modem-manager/libnm-util/nm-utils.h
==============================================================================
--- branches/modem-manager/libnm-util/nm-utils.h	(original)
+++ branches/modem-manager/libnm-util/nm-utils.h	Thu Aug  7 13:41:04 2008
@@ -187,6 +187,9 @@
 GSList *nm_utils_ip4_addresses_from_gvalue (const GValue *value);
 void nm_utils_ip4_addresses_to_gvalue (GSList *list, GValue *value);
 
+GSList *nm_utils_ip4_routes_from_gvalue (const GValue *value);
+void nm_utils_ip4_routes_to_gvalue (GSList *list, GValue *value);
+
 guint32 nm_utils_ip4_netmask_to_prefix (guint32 ip4_netmask);
 guint32 nm_utils_ip4_prefix_to_netmask (guint32 ip4_prefix);
 

Modified: branches/modem-manager/src/NetworkManager.c
==============================================================================
--- branches/modem-manager/src/NetworkManager.c	(original)
+++ branches/modem-manager/src/NetworkManager.c	Thu Aug  7 13:41:04 2008
@@ -303,7 +303,7 @@
 		goto done;
 	}
 
-	manager = nm_manager_new ();
+	manager = nm_manager_get ();
 	if (manager == NULL) {
 		nm_error ("Failed to initialize the network manager.");
 		goto done;

Modified: branches/modem-manager/src/NetworkManagerPolicy.c
==============================================================================
--- branches/modem-manager/src/NetworkManagerPolicy.c	(original)
+++ branches/modem-manager/src/NetworkManagerPolicy.c	Thu Aug  7 13:41:04 2008
@@ -147,7 +147,7 @@
 
 		/* Never set the default route through an IPv4LL-addressed device */
 		s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
-		if (s_ip4 && !strcmp (s_ip4->method, NM_SETTING_IP4_CONFIG_METHOD_AUTOIP))
+		if (s_ip4 && !strcmp (s_ip4->method, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL))
 			continue;
 
 		/* Make sure at least one of this device's IP addresses has a gateway */

Modified: branches/modem-manager/src/NetworkManagerSystem.c
==============================================================================
--- branches/modem-manager/src/NetworkManagerSystem.c	(original)
+++ branches/modem-manager/src/NetworkManagerSystem.c	Thu Aug  7 13:41:04 2008
@@ -107,6 +107,7 @@
 						  guint32 ip4_dest,
 						  guint32 ip4_prefix,
 						  guint32 ip4_gateway,
+						  guint32 metric,
 						  int mss)
 {
 	struct nl_handle *nlh;
@@ -148,6 +149,10 @@
 		}
 	}
 
+	/* Metric */
+	if (metric)
+		rtnl_route_set_prio (route, metric);
+
 	/* Add the route */
 	err = rtnl_route_add (nlh, route, 0);
 	if (err == -ESRCH && ip4_gateway) {
@@ -284,14 +289,15 @@
 
 	sleep (1);
 
-	len = nm_ip4_config_get_num_static_routes (config);
+	len = nm_ip4_config_get_num_routes (config);
 	for (i = 0; i < len; i++) {
-		const NMSettingIP4Address *route = nm_ip4_config_get_static_route (config, i);
+		const NMSettingIP4Route *route = nm_ip4_config_get_route (config, i);
 
 		nm_system_device_set_ip4_route (iface, config, 
 								  route->address,
 								  route->prefix,
-								  route->gateway,
+								  route->next_hop,
+								  route->metric,
 								  nm_ip4_config_get_mss (config));
 	}
 
@@ -344,7 +350,7 @@
 			}
 
 			nm_system_device_set_ip4_route (nm_device_get_ip_iface (active_device),
-									  ad_config, vpn_gw, 32, ad_gw,
+									  ad_config, vpn_gw, 32, ad_gw, 0,
 									  nm_ip4_config_get_mss (config));
 		}
 	}
@@ -362,14 +368,15 @@
 		nm_system_device_set_mtu (iface, nm_ip4_config_get_mtu (config));
 
 	/* Set routes */
-	num = nm_ip4_config_get_num_static_routes (config);
+	num = nm_ip4_config_get_num_routes (config);
 	for (i = 0; i < num; i++) {
-		const NMSettingIP4Address *route = nm_ip4_config_get_static_route (config, i);
+		const NMSettingIP4Route *route = nm_ip4_config_get_route (config, i);
 
 		nm_system_device_set_ip4_route (iface, config,
 								  route->address,
 								  route->prefix,
-								  route->gateway,
+								  route->next_hop,
+								  route->metric,
 								  nm_ip4_config_get_mss (config));
 	}
 

Modified: branches/modem-manager/src/NetworkManagerUtils.c
==============================================================================
--- branches/modem-manager/src/NetworkManagerUtils.c	(original)
+++ branches/modem-manager/src/NetworkManagerUtils.c	Thu Aug  7 13:41:04 2008
@@ -278,11 +278,14 @@
 	if (!setting)
 		return; /* Defaults are just fine */
 
-	if (setting->ignore_dhcp_dns) {
+	if (setting->ignore_auto_dns) {
 		nm_ip4_config_reset_nameservers (ip4_config);
 		nm_ip4_config_reset_searches (ip4_config);
 	}
 
+	if (setting->ignore_auto_routes)
+		nm_ip4_config_reset_routes (ip4_config);
+
 	if (setting->dns) {
 		int i, j;
 
@@ -344,25 +347,27 @@
 			nm_ip4_config_add_address (ip4_config, setting_addr);
 	}
 
-	/* IPv4 static routes */
+	/* IPv4 routes */
 	for (iter = setting->routes; iter; iter = g_slist_next (iter)) {
-		NMSettingIP4Address *setting_route = (NMSettingIP4Address *) iter->data;
+		NMSettingIP4Route *setting_route = (NMSettingIP4Route *) iter->data;
 		guint32 i, num;
 
-		num = nm_ip4_config_get_num_static_routes (ip4_config);
+		num = nm_ip4_config_get_num_routes (ip4_config);
 		for (i = 0; i < num; i++) {
-			const NMSettingIP4Address *cfg_route;
+			const NMSettingIP4Route *cfg_route;
 
-			cfg_route = nm_ip4_config_get_static_route (ip4_config, i);
-			/* Dupe, override with user-specified address */
-			if (cfg_route->address == setting_route->address) {
-				nm_ip4_config_replace_static_route (ip4_config, i, setting_route);
+			cfg_route = nm_ip4_config_get_route (ip4_config, i);
+			/* Dupe, override with user-specified route */
+			if (   (cfg_route->address == setting_route->address)
+			    && (cfg_route->prefix == setting_route->prefix)
+			    && (cfg_route->next_hop == setting_route->next_hop)) {
+				nm_ip4_config_replace_route (ip4_config, i, setting_route);
 				break;
 			}
 		}
 
 		if (i == num)
-			nm_ip4_config_add_static_route (ip4_config, setting_route);
+			nm_ip4_config_add_route (ip4_config, setting_route);
 	}
 }
 

Modified: branches/modem-manager/src/dhcp-manager/nm-dhcp-manager.c
==============================================================================
--- branches/modem-manager/src/dhcp-manager/nm-dhcp-manager.c	(original)
+++ branches/modem-manager/src/dhcp-manager/nm-dhcp-manager.c	Thu Aug  7 13:41:04 2008
@@ -829,6 +829,7 @@
 			char **s;
 
 			for (s = searches; *s; s += 2) {
+				NMSettingIP4Route *route;
 				struct in_addr rt_addr;
 				struct in_addr rt_route;
 
@@ -843,13 +844,12 @@
 
 				// FIXME: ensure the IP addresse and route are sane
 
-				addr = g_malloc0 (sizeof (NMSettingIP4Address));
-				addr->address = (guint32) rt_addr.s_addr;
-				addr->prefix = 32; /* 255.255.255.255 */
-				addr->gateway = (guint32) rt_route.s_addr;
+				route = g_malloc0 (sizeof (NMSettingIP4Route));
+				route->address = (guint32) rt_addr.s_addr;
+				route->prefix = 32; /* 255.255.255.255 */
+				route->next_hop = (guint32) rt_route.s_addr;
 
-				nm_ip4_config_take_static_route (ip4_config, addr);
-				addr = NULL;
+				nm_ip4_config_take_route (ip4_config, route);
 				nm_info ("  static route %s gw %s", *s, *(s + 1));
 			}
 		} else {

Modified: branches/modem-manager/src/dnsmasq-manager/nm-dnsmasq-manager.c
==============================================================================
--- branches/modem-manager/src/dnsmasq-manager/nm-dnsmasq-manager.c	(original)
+++ branches/modem-manager/src/dnsmasq-manager/nm-dnsmasq-manager.c	Thu Aug  7 13:41:04 2008
@@ -255,6 +255,7 @@
 	nm_cmd_line_add_string (cmd, "--keep-in-foreground");
 	nm_cmd_line_add_string (cmd, "--bind-interfaces");
 	nm_cmd_line_add_string (cmd, "--no-poll");
+	nm_cmd_line_add_string (cmd, "--except-interface=lo");
 
 	s = g_string_new ("--listen-address=");
 	addr.s_addr = tmp->address;

Modified: branches/modem-manager/src/modem-manager/nm-modem-device.c
==============================================================================
--- branches/modem-manager/src/modem-manager/nm-modem-device.c	(original)
+++ branches/modem-manager/src/modem-manager/nm-modem-device.c	Thu Aug  7 13:41:04 2008
@@ -338,12 +338,9 @@
 	req = nm_device_get_act_request (device);
 	g_assert (req);
 
-	priv->ppp_manager = nm_ppp_manager_new ();
+	priv->ppp_manager = nm_ppp_manager_new (nm_device_get_iface (device));
 
-	if (nm_ppp_manager_start (priv->ppp_manager,
-						 nm_device_get_iface (device),
-						 req,
-						 &err)) {
+	if (nm_ppp_manager_start (priv->ppp_manager, req, &err)) {
 		g_signal_connect (priv->ppp_manager, "state-changed",
 					   G_CALLBACK (ppp_state_changed),
 					   device);

Modified: branches/modem-manager/src/modem-manager/nm-modem-manager.c
==============================================================================
--- branches/modem-manager/src/modem-manager/nm-modem-manager.c	(original)
+++ branches/modem-manager/src/modem-manager/nm-modem-manager.c	Thu Aug  7 13:41:04 2008
@@ -114,9 +114,9 @@
 {
 	NMModemManagerPrivate *priv = NM_MODEM_MANAGER_GET_PRIVATE (manager);
 	NMModemDevice *modem;
-	char *data_device;
-	char *driver;
-	uint modem_type;
+	char *data_device = NULL;
+	char *driver = NULL;
+	uint modem_type = MM_MODEM_TYPE_UNKNOWN;
 
 	if (g_hash_table_lookup (priv->modems, path)) {
 		nm_warning ("Modem with path %s already exists, ignoring", path);
@@ -127,6 +127,21 @@
 						  &data_device, &driver, &modem_type))
 		return;
 
+	if (modem_type == MM_MODEM_TYPE_UNKNOWN) {
+		nm_warning ("Modem with path %s has unknown type, ignoring", path);
+		return;
+	}
+
+	if (!driver || !strlen (driver)) {
+		nm_warning ("Modem with path %s has unknown driver, ignoring", path);
+		return;
+	}
+
+	if (!data_device || !strlen (data_device)) {
+		nm_warning ("Modem with path %s has unknown data device, ignoring", path);
+		return;
+	}
+
 	modem = nm_modem_device_new (path,
 						    data_device,
 						    driver,

Modified: branches/modem-manager/src/modem-manager/nm-modem-types.h
==============================================================================
--- branches/modem-manager/src/modem-manager/nm-modem-types.h	(original)
+++ branches/modem-manager/src/modem-manager/nm-modem-types.h	Thu Aug  7 13:41:04 2008
@@ -8,8 +8,9 @@
 #define MM_DBUS_INTERFACE       "org.freedesktop.ModemManager"
 #define MM_DBUS_INTERFACE_MODEM "org.freedesktop.ModemManager.Modem"
 
-#define MM_MODEM_TYPE_GSM  1
-#define MM_MODEM_TYPE_CDMA 2
+#define MM_MODEM_TYPE_UNKNOWN  0
+#define MM_MODEM_TYPE_GSM      1
+#define MM_MODEM_TYPE_CDMA     2
 
 #define MM_MODEM_ERROR_GENERAL        MM_DBUS_INTERFACE_MODEM ".GeneralError"
 #define MM_MODEM_ERROR_PIN_NEEDED     MM_DBUS_INTERFACE_MODEM ".PINNeeded"

Modified: branches/modem-manager/src/nm-activation-request.c
==============================================================================
--- branches/modem-manager/src/nm-activation-request.c	(original)
+++ branches/modem-manager/src/nm-activation-request.c	Thu Aug  7 13:41:04 2008
@@ -35,8 +35,6 @@
 
 #include "nm-manager.h" /* FIXME! */
 
-#define CONNECTION_GET_SECRETS_CALL_TAG "get-secrets-call"
-
 G_DEFINE_TYPE (NMActRequest, nm_act_request, G_TYPE_OBJECT)
 
 #define NM_ACT_REQUEST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_ACT_REQUEST, NMActRequestPrivate))
@@ -53,7 +51,11 @@
 
 
 typedef struct {
+	gboolean disposed;
+
 	NMConnection *connection;
+	DBusGProxyCall *secrets_call;
+
 	char *specific_object;
 	NMDevice *device;
 	gboolean user_requested;
@@ -168,32 +170,44 @@
 }
 
 static void
+cleanup_secrets_dbus_call (NMActRequest *self)
+{
+	NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (self);
+	DBusGProxy *proxy;
+
+	g_return_if_fail (priv->connection != NULL);
+	g_return_if_fail (NM_IS_CONNECTION (priv->connection));
+
+	proxy = g_object_get_data (G_OBJECT (priv->connection), NM_MANAGER_CONNECTION_SECRETS_PROXY_TAG);
+	g_assert (proxy);
+
+	if (priv->secrets_call) {
+		dbus_g_proxy_cancel_call (proxy, priv->secrets_call);
+		priv->secrets_call = NULL;
+	}
+}
+
+static void
 dispose (GObject *object)
 {
 	NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (object);
-	DBusGProxy *proxy;
-	DBusGProxyCall *call;
 
-	if (!priv->connection)
-		goto out;
+	if (priv->disposed) {
+		G_OBJECT_CLASS (nm_act_request_parent_class)->dispose (object);
+		return;
+	}
+	priv->disposed = TRUE;
+
+	g_assert (priv->connection);
 
 	g_signal_handlers_disconnect_by_func (G_OBJECT (priv->device),
 	                                      G_CALLBACK (device_state_changed),
 	                                      NM_ACT_REQUEST (object));
 
-	proxy = g_object_get_data (G_OBJECT (priv->connection),
-	                           NM_MANAGER_CONNECTION_SECRETS_PROXY_TAG);
-	call = g_object_get_data (G_OBJECT (priv->connection),
-	                          CONNECTION_GET_SECRETS_CALL_TAG);
-
-	if (proxy && call)
-		dbus_g_proxy_cancel_call (proxy, call);
+	cleanup_secrets_dbus_call (NM_ACT_REQUEST (object));
 
-	g_object_set_data (G_OBJECT (priv->connection),
-	                   CONNECTION_GET_SECRETS_CALL_TAG, NULL);
 	g_object_unref (priv->connection);
 
-out:
 	G_OBJECT_CLASS (nm_act_request_parent_class)->dispose (object);
 }
 
@@ -443,7 +457,9 @@
 	g_return_if_fail (info->setting_name);
 
 	priv = NM_ACT_REQUEST_GET_PRIVATE (info->req);
-	g_object_set_data (G_OBJECT (priv->connection), CONNECTION_GET_SECRETS_CALL_TAG, NULL);
+
+	g_return_if_fail (call == priv->secrets_call);
+	priv->secrets_call = NULL;
 
 	if (!dbus_g_proxy_end_call (proxy, call, &err,
 								DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, &settings,
@@ -498,40 +514,31 @@
 }
 
 gboolean
-nm_act_request_request_connection_secrets (NMActRequest *req,
+nm_act_request_request_connection_secrets (NMActRequest *self,
                                            const char *setting_name,
                                            gboolean request_new,
                                            RequestSecretsCaller caller,
                                            const char *hint1,
                                            const char *hint2)
 {
-	DBusGProxy *proxy;
-	DBusGProxyCall *call;
+	DBusGProxy *secrets_proxy;
 	GetSecretsInfo *info = NULL;
 	NMActRequestPrivate *priv = NULL;
 	GPtrArray *hints = NULL;
 
-	g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE);
+	g_return_val_if_fail (NM_IS_ACT_REQUEST (self), FALSE);
 	g_return_val_if_fail (setting_name != NULL, FALSE);
 
-	priv = NM_ACT_REQUEST_GET_PRIVATE (req);
-	proxy = g_object_get_data (G_OBJECT (priv->connection), NM_MANAGER_CONNECTION_SECRETS_PROXY_TAG);
-	if (!DBUS_IS_G_PROXY (proxy)) {
-		nm_warning ("Couldn't get dbus proxy for connection.");
-		goto error;
-	}
+	priv = NM_ACT_REQUEST_GET_PRIVATE (self);
+
+	cleanup_secrets_dbus_call (self);
 
 	info = g_malloc0 (sizeof (GetSecretsInfo));
-	if (!info) {
-		nm_warning ("Not enough memory to get secrets");
-		goto error;
-	}
+	g_return_val_if_fail (info != NULL, FALSE);
 
+	info->req = self;
+	info->caller = caller;
 	info->setting_name = g_strdup (setting_name);
-	if (!info->setting_name) {
-		nm_warning ("Not enough memory to get secrets");
-		goto error;
-	}
 
 	/* Empty for now */
 	hints = g_ptr_array_sized_new (2);
@@ -541,29 +548,30 @@
 	if (hint2)
 		g_ptr_array_add (hints, g_strdup (hint2));
 
-	info->req = req;
-	info->caller = caller;
-	call = dbus_g_proxy_begin_call_with_timeout (proxy, "GetSecrets",
-	                                             get_secrets_cb,
-	                                             info,
-	                                             free_get_secrets_info,
-	                                             G_MAXINT32,
-	                                             G_TYPE_STRING, setting_name,
-	                                             DBUS_TYPE_G_ARRAY_OF_STRING, hints,
-	                                             G_TYPE_BOOLEAN, request_new,
-	                                             G_TYPE_INVALID);
+	secrets_proxy = g_object_get_data (G_OBJECT (priv->connection), NM_MANAGER_CONNECTION_SECRETS_PROXY_TAG);
+	g_assert (secrets_proxy);
+
+	priv->secrets_call = dbus_g_proxy_begin_call_with_timeout (secrets_proxy, "GetSecrets",
+	                                                           get_secrets_cb,
+	                                                           info,
+	                                                           free_get_secrets_info,
+	                                                           G_MAXINT32,
+	                                                           G_TYPE_STRING, setting_name,
+	                                                           DBUS_TYPE_G_ARRAY_OF_STRING, hints,
+	                                                           G_TYPE_BOOLEAN, request_new,
+	                                                           G_TYPE_INVALID);
 	g_ptr_array_free (hints, TRUE);
-	if (!call) {
-		nm_warning ("Could not call GetSecrets");
+	if (!priv->secrets_call) {
+		nm_warning ("Could not call get secrets");
 		goto error;
 	}
 
-	g_object_set_data (G_OBJECT (priv->connection), CONNECTION_GET_SECRETS_CALL_TAG, call);
 	return TRUE;
 
 error:
 	if (info)
 		free_get_secrets_info (info);
+	cleanup_secrets_dbus_call (self);
 	return FALSE;
 }
 

Modified: branches/modem-manager/src/nm-device-ethernet.c
==============================================================================
--- branches/modem-manager/src/nm-device-ethernet.c	(original)
+++ branches/modem-manager/src/nm-device-ethernet.c	Thu Aug  7 13:41:04 2008
@@ -1178,11 +1178,8 @@
 	req = nm_device_get_act_request (NM_DEVICE (self));
 	g_assert (req);
 
-	priv->ppp_manager = nm_ppp_manager_new ();
-	if (nm_ppp_manager_start (priv->ppp_manager,
-						 nm_device_get_iface (NM_DEVICE (self)),
-						 req,
-						 &err)) {
+	priv->ppp_manager = nm_ppp_manager_new (nm_device_get_iface (NM_DEVICE (self)));
+	if (nm_ppp_manager_start (priv->ppp_manager, req, &err)) {
 		g_signal_connect (priv->ppp_manager, "state-changed",
 					   G_CALLBACK (ppp_state_changed),
 					   self);

Modified: branches/modem-manager/src/nm-device-wifi.c
==============================================================================
--- branches/modem-manager/src/nm-device-wifi.c	(original)
+++ branches/modem-manager/src/nm-device-wifi.c	Thu Aug  7 13:41:04 2008
@@ -2770,6 +2770,7 @@
 	NMConnection *          connection;
 	NMSettingConnection *	s_connection;
 	const char *			setting_name;
+	NMSettingWireless *     s_wireless;
 
 	g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
 
@@ -2787,33 +2788,31 @@
 	s_connection = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
 	g_assert (s_connection);
 
+	s_wireless = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS);
+	g_assert (s_wireless);
+
 	/* If we need secrets, get them */
 	setting_name = nm_connection_need_secrets (connection, NULL);
 	if (setting_name) {
-		NMActStageReturn auth_ret;
-
 		nm_info ("Activation (%s/wireless): access point '%s' has security,"
 		         " but secrets are required.",
 		         iface, s_connection->id);
 
-		auth_ret = handle_auth_or_fail (self, req, FALSE);
-		if (auth_ret == NM_ACT_STAGE_RETURN_FAILURE) {
+		ret = handle_auth_or_fail (self, req, FALSE);
+		if (ret == NM_ACT_STAGE_RETURN_FAILURE)
 			*reason = NM_DEVICE_STATE_REASON_NO_SECRETS;
-			goto out;
-		}
-	} else {
-		NMSettingWireless *s_wireless = (NMSettingWireless *) nm_connection_get_setting (connection, 
-																		 NM_TYPE_SETTING_WIRELESS);
+		goto out;
+	}
 
-		if (s_wireless->security) {
-			nm_info ("Activation (%s/wireless): connection '%s' has security"
-			         ", and secrets exist.  No new secrets needed.",
-			         iface, s_connection->id);
-		} else {
-			nm_info ("Activation (%s/wireless): connection '%s' requires no "
-			         "security.  No secrets needed.",
-			         iface, s_connection->id);
-		}
+	/* have secrets, or no secrets required */
+	if (s_wireless->security) {
+		nm_info ("Activation (%s/wireless): connection '%s' has security"
+		         ", and secrets exist.  No new secrets needed.",
+		         iface, s_connection->id);
+	} else {
+		nm_info ("Activation (%s/wireless): connection '%s' requires no "
+		         "security.  No secrets needed.",
+		         iface, s_connection->id);
 	}
 
 	config = build_supplicant_config (self, connection, ap);
@@ -3417,7 +3416,8 @@
 		return;
 
 	if (enabled) {
-		g_warn_if_fail (state == NM_DEVICE_STATE_UNAVAILABLE);
+		if (state != NM_DEVICE_STATE_UNAVAILABLE);
+			nm_warning ("not in expected unavailable state!");
 
 		if (!nm_device_hw_bring_up (NM_DEVICE (self), TRUE)) {
 			/* The device sucks, or HAL was lying to us about the killswitch state */

Modified: branches/modem-manager/src/nm-device.c
==============================================================================
--- branches/modem-manager/src/nm-device.c	(original)
+++ branches/modem-manager/src/nm-device.c	Thu Aug  7 13:41:04 2008
@@ -649,7 +649,7 @@
 
 	/* Ignore if the connection isn't an AutoIP connection */
 	s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
-	if (!s_ip4 || !s_ip4->method || strcmp (s_ip4->method, NM_SETTING_IP4_CONFIG_METHOD_AUTOIP))
+	if (!s_ip4 || !s_ip4->method || strcmp (s_ip4->method, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL))
 		return;
 
 	iface = nm_device_get_iface (self);
@@ -828,7 +828,7 @@
 													NM_TYPE_SETTING_IP4_CONFIG);
 
 	/* If we did not receive IP4 configuration information, default to DHCP */
-	if (!s_ip4 || !strcmp (s_ip4->method, NM_SETTING_IP4_CONFIG_METHOD_DHCP)) {
+	if (!s_ip4 || !strcmp (s_ip4->method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
 		NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
 		gboolean success;
 
@@ -850,7 +850,7 @@
 			*reason = NM_DEVICE_STATE_REASON_DHCP_START_FAILED;
 			ret = NM_ACT_STAGE_RETURN_FAILURE;
 		}
-	} else if (s_ip4 && !strcmp (s_ip4->method, NM_SETTING_IP4_CONFIG_METHOD_AUTOIP)) {
+	} else if (s_ip4 && !strcmp (s_ip4->method, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL)) {
 		GError *error = NULL;
 
 		/* Start avahi-autoipd */
@@ -1026,7 +1026,7 @@
 		g_assert (s_ip4);
 		g_assert (s_ip4->method);
 
-		if (!strcmp (s_ip4->method, NM_SETTING_IP4_CONFIG_METHOD_AUTOIP)) {
+		if (!strcmp (s_ip4->method, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL)) {
 			*config = aipd_get_ip4_config (self, reason);
 		} else if (!strcmp (s_ip4->method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
 			*config = nm_ip4_config_new ();

Modified: branches/modem-manager/src/nm-ip4-config.c
==============================================================================
--- branches/modem-manager/src/nm-ip4-config.c	(original)
+++ branches/modem-manager/src/nm-ip4-config.c	Thu Aug  7 13:41:04 2008
@@ -58,7 +58,7 @@
 	gchar *hostname;
 	gchar *nis_domain;
 	GArray *nis_servers;
-	GSList *static_routes;
+	GSList *routes;
 } NMIP4ConfigPrivate;
 
 
@@ -70,7 +70,7 @@
 	PROP_DOMAINS,
 	PROP_NIS_DOMAIN,
 	PROP_NIS_SERVERS,
-	PROP_STATIC_ROUTES,
+	PROP_ROUTES,
 
 	LAST_PROP
 };
@@ -133,13 +133,13 @@
 	for (i = 0; i < len; i++)
 		nm_ip4_config_add_nis_server (dst_config, nm_ip4_config_get_nis_server (src_config, i));
 
-	for (iter = src_priv->static_routes; iter; iter = g_slist_next (iter)) {
-		NMSettingIP4Address *src_addr = (NMSettingIP4Address *) iter->data;
-		NMSettingIP4Address *dst_addr;
-
-		dst_addr = g_malloc0 (sizeof (NMSettingIP4Address));
-		memcpy (dst_addr, src_addr, sizeof (NMSettingIP4Address));
-		nm_ip4_config_take_static_route (dst_config, dst_addr);
+	for (iter = src_priv->routes; iter; iter = g_slist_next (iter)) {
+		NMSettingIP4Route *src_route = (NMSettingIP4Route *) iter->data;
+		NMSettingIP4Route *dst_route;
+
+		dst_route = g_malloc0 (sizeof (NMSettingIP4Route));
+		memcpy (dst_route, src_route, sizeof (NMSettingIP4Route));
+		nm_ip4_config_take_route (dst_config, dst_route);
 	}
 
 	return dst_config;
@@ -310,38 +310,38 @@
 }
 
 void
-nm_ip4_config_take_static_route (NMIP4Config *config,
-						   NMSettingIP4Address *address)
+nm_ip4_config_take_route (NMIP4Config *config,
+						   NMSettingIP4Route *route)
 {
 	NMIP4ConfigPrivate *priv;
 
 	g_return_if_fail (NM_IS_IP4_CONFIG (config));
-	g_return_if_fail (address != NULL);
+	g_return_if_fail (route != NULL);
 
 	priv = NM_IP4_CONFIG_GET_PRIVATE (config);
-	priv->static_routes = g_slist_append (priv->static_routes, address);
+	priv->routes = g_slist_append (priv->routes, route);
 }
 
 void
-nm_ip4_config_add_static_route (NMIP4Config *config,
-						  NMSettingIP4Address *address)
+nm_ip4_config_add_route (NMIP4Config *config,
+						  NMSettingIP4Route *route)
 {
 	NMIP4ConfigPrivate *priv;
-	NMSettingIP4Address *copy;
+	NMSettingIP4Route *copy;
 
 	g_return_if_fail (NM_IS_IP4_CONFIG (config));
-	g_return_if_fail (address != NULL);
+	g_return_if_fail (route != NULL);
 
 	priv = NM_IP4_CONFIG_GET_PRIVATE (config);
-	copy = g_malloc0 (sizeof (NMSettingIP4Address));
-	memcpy (copy, address, sizeof (NMSettingIP4Address));
-	priv->static_routes = g_slist_append (priv->static_routes, copy);
+	copy = g_malloc0 (sizeof (NMSettingIP4Route));
+	memcpy (copy, route, sizeof (NMSettingIP4Route));
+	priv->routes = g_slist_append (priv->routes, copy);
 }
 
 void
-nm_ip4_config_replace_static_route (NMIP4Config *config,
+nm_ip4_config_replace_route (NMIP4Config *config,
 							 guint i,
-							 NMSettingIP4Address *new_address)
+							 NMSettingIP4Route *new_route)
 {
 	NMIP4ConfigPrivate *priv;
 	GSList *old;
@@ -349,28 +349,38 @@
 	g_return_if_fail (NM_IS_IP4_CONFIG (config));
 
 	priv = NM_IP4_CONFIG_GET_PRIVATE (config);
-	old = g_slist_nth (priv->static_routes, i);
+	old = g_slist_nth (priv->routes, i);
 	g_return_if_fail (old != NULL);
 
 	g_free (old->data);
-	old->data = new_address;
+	old->data = new_route;
 }
 
-const NMSettingIP4Address *
-nm_ip4_config_get_static_route (NMIP4Config *config, guint i)
+const NMSettingIP4Route *
+nm_ip4_config_get_route (NMIP4Config *config, guint i)
 {
 	g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
 
-	return (const NMSettingIP4Address *) g_slist_nth_data (NM_IP4_CONFIG_GET_PRIVATE (config)->static_routes, i);
+	return (const NMSettingIP4Route *) g_slist_nth_data (NM_IP4_CONFIG_GET_PRIVATE (config)->routes, i);
 }
 
-guint32 nm_ip4_config_get_num_static_routes (NMIP4Config *config)
+guint32 nm_ip4_config_get_num_routes (NMIP4Config *config)
 {
 	g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0);
 
-	return g_slist_length (NM_IP4_CONFIG_GET_PRIVATE (config)->static_routes);
+	return g_slist_length (NM_IP4_CONFIG_GET_PRIVATE (config)->routes);
 }
 
+void nm_ip4_config_reset_routes (NMIP4Config *config)
+{
+	NMIP4ConfigPrivate *priv;
+
+	g_return_if_fail (NM_IS_IP4_CONFIG (config));
+
+	priv = NM_IP4_CONFIG_GET_PRIVATE (config);
+	g_slist_foreach (priv->routes, (GFunc) g_free, NULL);
+	priv->routes = NULL;
+}
 
 void nm_ip4_config_add_domain (NMIP4Config *config, const char *domain)
 {
@@ -572,7 +582,7 @@
 	g_ptr_array_free (priv->domains, TRUE);
 	g_ptr_array_free (priv->searches, TRUE);
 	g_array_free (priv->nis_servers, TRUE);
-	nm_utils_slist_free (priv->static_routes, g_free);
+	nm_utils_slist_free (priv->routes, g_free);
 }
 
 static void
@@ -629,8 +639,8 @@
 	case PROP_NIS_SERVERS:
 		g_value_set_boxed (value, priv->nis_servers);
 		break;
-	case PROP_STATIC_ROUTES:
-		ip4_addresses_to_gvalue (priv->static_routes, value);
+	case PROP_ROUTES:
+		ip4_addresses_to_gvalue (priv->routes, value);
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -694,10 +704,10 @@
 							 G_PARAM_READABLE));
 
 	g_object_class_install_property
-		(object_class, PROP_STATIC_ROUTES,
-		 g_param_spec_boxed (NM_IP4_CONFIG_STATIC_ROUTES,
-						 "Static routes",
-						 "Static routes",
+		(object_class, PROP_ROUTES,
+		 g_param_spec_boxed (NM_IP4_CONFIG_ROUTES,
+						 "Routes",
+						 "Routes",
 						 DBUS_TYPE_G_ARRAY_OF_ARRAY_OF_UINT,
 						 G_PARAM_READABLE));
 

Modified: branches/modem-manager/src/nm-ip4-config.h
==============================================================================
--- branches/modem-manager/src/nm-ip4-config.h	(original)
+++ branches/modem-manager/src/nm-ip4-config.h	Thu Aug  7 13:41:04 2008
@@ -50,7 +50,7 @@
 #define NM_IP4_CONFIG_DOMAINS "domains"
 #define NM_IP4_CONFIG_NIS_DOMAIN "nis-domain"
 #define NM_IP4_CONFIG_NIS_SERVERS "nis-servers"
-#define NM_IP4_CONFIG_STATIC_ROUTES "static-routes"
+#define NM_IP4_CONFIG_ROUTES "routes"
 
 GType nm_ip4_config_get_type (void);
 
@@ -76,11 +76,12 @@
 guint32		nm_ip4_config_get_nis_server		(NMIP4Config *config, guint i);
 guint32		nm_ip4_config_get_num_nis_servers	(NMIP4Config *config);
 
-void			nm_ip4_config_take_static_route		(NMIP4Config *config, NMSettingIP4Address *address);
-void			nm_ip4_config_add_static_route		(NMIP4Config *config, NMSettingIP4Address *address);
-void			nm_ip4_config_replace_static_route		(NMIP4Config *config, guint32 i, NMSettingIP4Address *new_address);
-const NMSettingIP4Address *	nm_ip4_config_get_static_route		(NMIP4Config *config, guint32 i);
-guint32		nm_ip4_config_get_num_static_routes	(NMIP4Config *config);
+void			nm_ip4_config_take_route		(NMIP4Config *config, NMSettingIP4Route *route);
+void			nm_ip4_config_add_route			(NMIP4Config *config, NMSettingIP4Route *route);
+void			nm_ip4_config_replace_route		(NMIP4Config *config, guint32 i, NMSettingIP4Route *new_route);
+const NMSettingIP4Route *	nm_ip4_config_get_route		(NMIP4Config *config, guint32 i);
+guint32		nm_ip4_config_get_num_routes		(NMIP4Config *config);
+void            nm_ip4_config_reset_routes		(NMIP4Config *config);
 
 void			nm_ip4_config_set_hostname		(NMIP4Config *config, const char *hostname);
 const char * 	nm_ip4_config_get_hostname		(NMIP4Config *config);

Modified: branches/modem-manager/src/nm-manager.c
==============================================================================
--- branches/modem-manager/src/nm-manager.c	(original)
+++ branches/modem-manager/src/nm-manager.c	Thu Aug  7 13:41:04 2008
@@ -1405,49 +1405,54 @@
 }
 
 NMManager *
-nm_manager_new (void)
+nm_manager_get (void)
 {
-	GObject *object;
+	static NMManager *singleton = NULL;
 	NMManagerPrivate *priv;
 
-	object = g_object_new (NM_TYPE_MANAGER, NULL);
-	priv = NM_MANAGER_GET_PRIVATE (object);
+	if (singleton)
+		return g_object_ref (singleton);
+
+	singleton = (NMManager *) g_object_new (NM_TYPE_MANAGER, NULL);
+	g_assert (singleton);
+
+	priv = NM_MANAGER_GET_PRIVATE (singleton);
 
 	dbus_g_connection_register_g_object (nm_dbus_manager_get_connection (priv->dbus_mgr),
 	                                     NM_DBUS_PATH,
-	                                     object);
+	                                     G_OBJECT (singleton));
 
 	g_signal_connect (priv->dbus_mgr,
 	                  "name-owner-changed",
 	                  G_CALLBACK (nm_manager_name_owner_changed),
-	                  NM_MANAGER (object));
+	                  singleton);
 
-	g_idle_add ((GSourceFunc) initial_get_connections, NM_MANAGER (object));
+	g_idle_add ((GSourceFunc) initial_get_connections, singleton);
 
 	priv->hal_mgr = nm_hal_manager_new ();
-	priv->sync_devices_id = g_idle_add (deferred_sync_devices, object);
+	priv->sync_devices_id = g_idle_add (deferred_sync_devices, singleton);
 
 	g_signal_connect (priv->hal_mgr,
 	                  "udi-added",
 	                  G_CALLBACK (hal_manager_udi_added_cb),
-	                  NM_MANAGER (object));
+	                  singleton);
 
 	g_signal_connect (priv->hal_mgr,
 	                  "udi-removed",
 	                  G_CALLBACK (hal_manager_udi_removed_cb),
-	                  NM_MANAGER (object));
+	                  singleton);
 
 	g_signal_connect (priv->hal_mgr,
 	                  "rfkill-changed",
 	                  G_CALLBACK (hal_manager_rfkill_changed_cb),
-	                  NM_MANAGER (object));
+	                  singleton);
 
 	g_signal_connect (priv->hal_mgr,
 	                  "hal-reappeared",
 	                  G_CALLBACK (hal_manager_hal_reappeared_cb),
-	                  NM_MANAGER (object));
+	                  singleton);
 
-	return NM_MANAGER (object);
+	return singleton;
 }
 
 static void

Modified: branches/modem-manager/src/nm-manager.h
==============================================================================
--- branches/modem-manager/src/nm-manager.h	(original)
+++ branches/modem-manager/src/nm-manager.h	Thu Aug  7 13:41:04 2008
@@ -52,7 +52,7 @@
 
 GType nm_manager_get_type (void);
 
-NMManager *nm_manager_new (void);
+NMManager *nm_manager_get (void);
 
 /* Device handling */
 

Modified: branches/modem-manager/src/ppp-manager/nm-ppp-manager.c
==============================================================================
--- branches/modem-manager/src/ppp-manager/nm-ppp-manager.c	(original)
+++ branches/modem-manager/src/ppp-manager/nm-ppp-manager.c	Thu Aug  7 13:41:04 2008
@@ -19,6 +19,7 @@
 #endif
 #include <linux/if_ppp.h>
 
+#include "NetworkManager.h"
 #include "nm-ppp-manager.h"
 #include "nm-setting-connection.h"
 #include "nm-setting-ppp.h"
@@ -43,12 +44,15 @@
 #include "nm-ppp-manager-glue.h"
 
 #define NM_PPPD_PLUGIN PLUGINDIR "/nm-pppd-plugin.so"
-#define NM_PPP_WAIT_PPPD 10000 /* 10 seconds */
+#define NM_PPP_WAIT_PPPD 15000 /* 10 seconds */
 #define PPP_MANAGER_SECRET_TRIES "ppp-manager-secret-tries"
 
 typedef struct {
 	GPid pid;
 	NMDBusManager *dbus_manager;
+	char *dbus_path;
+
+	char *parent_iface;
 
 	NMActRequest *act_req;
 	DBusGMethodInvocation *pending_secrets_context;
@@ -57,7 +61,7 @@
 	guint32 ppp_timeout_handler;
 
 	/* Monitoring */
-	char *iface;
+	char *ip_iface;
 	int monitor_fd;
 	guint monitor_id;
 } NMPPPManagerPrivate;
@@ -76,6 +80,12 @@
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
+enum {
+	PROP_0,
+	PROP_PARENT_IFACE,
+	LAST_PROP
+};
+
 typedef enum {
 	NM_PPP_MANAGER_ERROR_UNKOWN
 } NMPPPManagerError;
@@ -104,9 +114,8 @@
 	GObject *object;
 	NMPPPManagerPrivate *priv;
 	DBusGConnection *connection;
-	DBusGProxy *proxy;
-	guint request_name_result;
-	GError *err = NULL;
+	static gboolean name_requested = FALSE;
+	static guint32 counter = 0;
 
 	object = G_OBJECT_CLASS (nm_ppp_manager_parent_class)->constructor (type,
 														   n_construct_params,
@@ -116,28 +125,48 @@
 
 	priv = NM_PPP_MANAGER_GET_PRIVATE (object);
 	priv->dbus_manager = nm_dbus_manager_get ();
+	if (!priv->dbus_manager) {
+		g_object_unref (object);
+		return NULL;
+	}
 	connection = nm_dbus_manager_get_connection (priv->dbus_manager);
 
-	proxy = dbus_g_proxy_new_for_name (connection,
-								"org.freedesktop.DBus",
-								"/org/freedesktop/DBus",
-								"org.freedesktop.DBus");
-
-	if (dbus_g_proxy_call (proxy, "RequestName", &err,
-					   G_TYPE_STRING, NM_DBUS_SERVICE_PPP,
-					   G_TYPE_UINT, 0,
-					   G_TYPE_INVALID,
-					   G_TYPE_UINT, &request_name_result,
-					   G_TYPE_INVALID))
-		dbus_g_connection_register_g_object (connection, NM_DBUS_PATH_PPP, object);
+	/* Only need to request bus name the first time */
+	if (!name_requested) {
+		DBusGProxy *proxy;
+		gboolean success;
+		guint request_name_result;
+		GError *err = NULL;
+
+		proxy = dbus_g_proxy_new_for_name (connection,
+									"org.freedesktop.DBus",
+									"/org/freedesktop/DBus",
+									"org.freedesktop.DBus");
+		success = dbus_g_proxy_call (proxy, "RequestName", &err,
+		                             G_TYPE_STRING, NM_DBUS_SERVICE_PPP,
+		                             G_TYPE_UINT, 0,
+		                             G_TYPE_INVALID,
+		                             G_TYPE_UINT, &request_name_result,
+		                             G_TYPE_INVALID);
+		g_object_unref (proxy);
+
+		if (!success) {
+			nm_warning ("Failed to acquire PPP manager service: %s", err->message);
+			g_object_unref (object);
+			return NULL;
+		}
+
+		name_requested = TRUE;
+	}
 
-	g_object_unref (proxy);
+	priv->dbus_path = g_strdup_printf (NM_DBUS_PATH "/PPP/%d", counter++);
+	dbus_g_connection_register_g_object (connection, priv->dbus_path, object);
 
 	return object;
 }
 
 static void
-finalize (GObject *object)
+dispose (GObject *object)
 {
 	NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (object);
 
@@ -146,21 +175,75 @@
 	g_object_unref (priv->act_req);
 	g_object_unref (priv->dbus_manager);
 
+	G_OBJECT_CLASS (nm_ppp_manager_parent_class)->dispose (object);
+}
+
+static void
+finalize (GObject *object)
+{
+	NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (object);
+
+	g_free (priv->ip_iface);
+	g_free (priv->parent_iface);
+
 	G_OBJECT_CLASS (nm_ppp_manager_parent_class)->finalize (object);
 }
 
 static void
+set_property (GObject *object, guint prop_id,
+		    const GValue *value, GParamSpec *pspec)
+{
+	NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (object);
+
+	switch (prop_id) {
+	case PROP_PARENT_IFACE:
+		if (priv->parent_iface)
+			g_free (priv->parent_iface);
+		priv->parent_iface = g_value_dup_string (value);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+get_property (GObject *object, guint prop_id,
+			  GValue *value, GParamSpec *pspec)
+{
+	NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (object);
+
+	switch (prop_id) {
+	case PROP_PARENT_IFACE:
+		g_value_set_string (value, priv->parent_iface);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+static void
 nm_ppp_manager_class_init (NMPPPManagerClass *manager_class)
 {
 	GObjectClass *object_class = G_OBJECT_CLASS (manager_class);
 
 	g_type_class_add_private (manager_class, sizeof (NMPPPManagerPrivate));
 
-	dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (manager_class),
-							   &dbus_glib_nm_ppp_manager_object_info);
-
 	object_class->constructor = constructor;
+	object_class->dispose = dispose;
 	object_class->finalize = finalize;
+	object_class->get_property = get_property;
+	object_class->set_property = set_property;
+
+	/* Properties */
+	g_object_class_install_property
+		(object_class, PROP_PARENT_IFACE,
+		 g_param_spec_string (NM_PPP_MANAGER_PARENT_IFACE,
+							"ParentIface",
+							"Parent interface",
+							NULL,
+							G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 
 	/* signals */
 	signals[STATE_CHANGED] =
@@ -193,12 +276,19 @@
 				    nm_marshal_VOID__UINT_UINT,
 				    G_TYPE_NONE, 2,
 				    G_TYPE_UINT, G_TYPE_UINT);
+
+	dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (manager_class),
+							   &dbus_glib_nm_ppp_manager_object_info);
 }
 
 NMPPPManager *
-nm_ppp_manager_new (void)
+nm_ppp_manager_new (const char *iface)
 {
-	return (NMPPPManager *) g_object_new (NM_TYPE_PPP_MANAGER, NULL);
+	g_return_val_if_fail (iface != NULL, NULL);
+
+	return (NMPPPManager *) g_object_new (NM_TYPE_PPP_MANAGER,
+	                                      NM_PPP_MANAGER_PARENT_IFACE, iface,
+	                                      NULL);
 }
 
 /*******************************************/
@@ -213,7 +303,7 @@
 	memset (&req, 0, sizeof (req));
 	req.stats_ptr = (caddr_t) &req.stats;
 
-	strncpy (req.ifr__name, priv->iface, sizeof (req.ifr__name));
+	strncpy (req.ifr__name, priv->ip_iface, sizeof (req.ifr__name));
 	if (!ioctl (priv->monitor_fd, SIOCGPPPSTATS, &req) < 0)
 		nm_warning ("Could not read ppp stats: %s", strerror (errno));
 	else
@@ -225,15 +315,14 @@
 }
 
 static void
-monitor_stats (NMPPPManager *manager, const char *iface)
+monitor_stats (NMPPPManager *manager)
 {
 	NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager);
 
 	priv->monitor_fd = socket (AF_INET, SOCK_DGRAM, 0);
-	if (priv->monitor_fd > 0) {
-		priv->iface = g_strdup (iface);
+	if (priv->monitor_fd > 0)
 		priv->monitor_id = g_timeout_add (5000, monitor_cb, manager);
-	} else
+	else
 		nm_warning ("Could not open pppd monitor: %s", strerror (errno));
 }
 
@@ -257,12 +346,10 @@
 	NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager);
 	NMConnection *connection;
 	NMSettingConnection *s_con;
-	NMSetting *setting;
 	const char *setting_name;
 	guint32 tries;
-	char *hint1 = NULL;
-
-	remove_timeout_handler (manager);
+	GPtrArray *hints = NULL;
+	const char *hint1 = NULL, *hint2 = NULL;
 
 	connection = nm_act_request_get_connection (priv->act_req);
 
@@ -271,54 +358,73 @@
 	g_assert (s_con->type);
 
 	nm_connection_clear_secrets (connection);
-	setting_name = nm_connection_need_secrets (connection, NULL);
-	if (setting_name) {
-		setting = nm_connection_get_setting_by_name (connection, setting_name);
-	} else {
-		/* Always ask for secrets unless the connection's type setting doesn't
-		 * even exist (which shouldn't happen).  Empty username and password are
-		 * valid, but we need to tell the pppd plugin that this is valid by
-		 * sending back blank secrets.
-		 */
+	setting_name = nm_connection_need_secrets (connection, &hints);
+	if (!setting_name) {
+		NMSetting *setting;
+
 		setting = nm_connection_get_setting_by_name (connection, s_con->type);
-		if (!setting) {
+		if (setting) {
+			const char *username = NULL;
+			const char *password = NULL;
+
+			/* FIXME: push this down to the settings and keep PPP manager generic */
+			if (NM_IS_SETTING_PPPOE (setting)) {
+				username = NM_SETTING_PPPOE (setting)->username;
+				password = NM_SETTING_PPPOE (setting)->password;
+			} else if (NM_IS_SETTING_GSM (setting)) {
+				username = NM_SETTING_GSM (setting)->username;
+				password = NM_SETTING_GSM (setting)->password;
+			} else if (NM_IS_SETTING_CDMA (setting)) {
+				username = NM_SETTING_CDMA (setting)->username;
+				password = NM_SETTING_CDMA (setting)->password;
+			}
+
+			/* If secrets are not required, send the existing username and password
+			 * back to the PPP plugin immediately.
+			 */
+			priv->pending_secrets_context = context;
+			nm_ppp_manager_update_secrets (manager,
+			                               NULL, /* FIXME: pass device name */
+			                               username ? username : "",
+			                               password ? password : "",
+			                               NULL);
+		} else {
 			GError *err = NULL;
 
 			g_set_error (&err, NM_PPP_MANAGER_ERROR, NM_PPP_MANAGER_ERROR_UNKOWN,
 					   "Missing type-specific setting; no secrets could be found.");
 			nm_warning ("%s", err->message);
 			dbus_g_method_return_error (context, err);
-			return;
 		}
-		setting_name = nm_setting_get_name (setting);
+		return;
 	}
 
-	/* FIXME: figure out some way of pushing this down to the settings
-	 * themselves and keeping the PPP Manager generic.
-	 */
-	if (NM_IS_SETTING_PPPOE (setting))
-		hint1 = NM_SETTING_PPPOE_PASSWORD;
-	else if (NM_IS_SETTING_GSM (setting))
-		hint1 = NM_SETTING_GSM_PASSWORD;
-	else if (NM_IS_SETTING_CDMA (setting))
-		hint1 = NM_SETTING_CDMA_PASSWORD;
+	/* Extract hints */
+	if (hints) {
+		if (hints->len > 0)
+			hint1 = g_ptr_array_index (hints, 0);
+		if (hints->len > 1)
+			hint2 = g_ptr_array_index (hints, 1);
+	}
 
 	tries = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (connection), PPP_MANAGER_SECRET_TRIES));
 	nm_act_request_request_connection_secrets (priv->act_req,
 	                                           setting_name,
-	                                           tries == 0 ? TRUE : FALSE,
+	                                           tries ? TRUE : FALSE,
 	                                           SECRETS_CALLER_PPP,
 	                                           hint1,
-	                                           NULL);
+	                                           hint2);
 	g_object_set_data (G_OBJECT (connection), PPP_MANAGER_SECRET_TRIES, GUINT_TO_POINTER (++tries));
 	priv->pending_secrets_context = context;
+
+	if (hints)
+		g_ptr_array_free (hints, TRUE);
 }
 
 static gboolean impl_ppp_manager_set_state (NMPPPManager *manager,
 								    guint32 state,
 								    GError **err)
 {
-	remove_timeout_handler (manager);
 	g_signal_emit (manager, signals[STATE_CHANGED], 0, state);
 
 	return TRUE;
@@ -329,10 +435,11 @@
 						   GHashTable *config_hash,
 						   GError **err)
 {
+	NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager);
+	NMConnection *connection;
 	NMIP4Config *config;
 	NMSettingIP4Address *addr;
 	GValue *val;
-	const char *iface;
 	int i;
 
 	nm_info ("PPP manager(IP Config Get) reply received.");
@@ -374,16 +481,21 @@
 	}
 
 	val = (GValue *) g_hash_table_lookup (config_hash, NM_PPP_IP4_CONFIG_INTERFACE);
-	if (val)
-		iface = g_value_get_string (val);
-	else {
+	if (!val || !G_VALUE_HOLDS_STRING (val)) {
 		nm_warning ("No interface");
 		goto out;
 	}
+	priv->ip_iface = g_value_dup_string (val);
 
-	g_signal_emit (manager, signals[IP4_CONFIG], 0, iface, config);
+	/* Got successful IP4 config; obviously the secrets worked */
+	connection = nm_act_request_get_connection (priv->act_req);
+	g_assert (connection);
+	g_object_set_data (G_OBJECT (connection), PPP_MANAGER_SECRET_TRIES, NULL);
+
+	/* Push the IP4 config up to the device */
+	g_signal_emit (manager, signals[IP4_CONFIG], 0, priv->ip_iface, config);
 
-	monitor_stats (manager, iface);
+	monitor_stats (manager);
 
  out:
 	g_object_unref (config);
@@ -582,11 +694,12 @@
 }
 
 static NMCmdLine *
-create_pppd_cmd_line (NMSettingPPP *setting, 
-				  NMSettingPPPOE *pppoe,
-				  const char *device,
-				  GError **err)
+create_pppd_cmd_line (NMPPPManager *self,
+                      NMSettingPPP *setting, 
+                      NMSettingPPPOE *pppoe,
+                      GError **err)
 {
+	NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (self);
 	const char *ppp_binary;
 	NMCmdLine *cmd;
 
@@ -610,7 +723,7 @@
 		nm_cmd_line_add_string (cmd, "plugin");
 		nm_cmd_line_add_string (cmd, "rp-pppoe.so");
 
-		dev_str = g_strdup_printf ("nic-%s", device);
+		dev_str = g_strdup_printf ("nic-%s", priv->parent_iface);
 		nm_cmd_line_add_string (cmd, dev_str);
 		g_free (dev_str);
 
@@ -622,7 +735,7 @@
 		nm_cmd_line_add_string (cmd, "user");
 		nm_cmd_line_add_string (cmd, pppoe->username);
 	} else {
-		nm_cmd_line_add_string (cmd, device);
+		nm_cmd_line_add_string (cmd, priv->parent_iface);
 		/* Don't send some random address as the local address */
 		nm_cmd_line_add_string (cmd, "noipdefault");
 	}
@@ -680,6 +793,9 @@
 		nm_cmd_line_add_int (cmd, setting->lcp_echo_interval);
 	}
 
+	nm_cmd_line_add_string (cmd, "ipparam");
+	nm_cmd_line_add_string (cmd, priv->dbus_path);
+
 	nm_cmd_line_add_string (cmd, "plugin");
 	nm_cmd_line_add_string (cmd, NM_PPPD_PLUGIN);
 
@@ -726,10 +842,7 @@
 }
 
 gboolean
-nm_ppp_manager_start (NMPPPManager *manager,
-				  const char *device,
-				  NMActRequest *req,
-				  GError **err)
+nm_ppp_manager_start (NMPPPManager *manager, NMActRequest *req, GError **err)
 {
 	NMPPPManagerPrivate *priv;
 	NMConnection *connection;
@@ -739,7 +852,6 @@
 	char *cmd_str;
 
 	g_return_val_if_fail (NM_IS_PPP_MANAGER (manager), FALSE);
-	g_return_val_if_fail (device != NULL, FALSE);
 	g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE);
 
 	connection = nm_act_request_get_connection (req);
@@ -750,7 +862,7 @@
 	if (pppoe_setting)
 		pppoe_fill_defaults (ppp_setting);
 
-	ppp_cmd = create_pppd_cmd_line (ppp_setting, pppoe_setting, device, err);
+	ppp_cmd = create_pppd_cmd_line (manager, ppp_setting, pppoe_setting, err);
 	if (!ppp_cmd)
 		return FALSE;
 
@@ -820,10 +932,7 @@
 		   the plugin would need to link against libnm-util just to parse this.
 		   So instead, let's just send what it needs */
 
-		/* FIXME: Do we have to strdup the values here? */
-		dbus_g_method_return (priv->pending_secrets_context,
-		                      g_strdup (username),
-		                      g_strdup (password));
+		dbus_g_method_return (priv->pending_secrets_context, username, password);
 	}
 	priv->pending_secrets_context = NULL;
 }
@@ -863,8 +972,6 @@
 		priv->monitor_fd = 0;
 	}
 
-	g_free (priv->iface);
-
 	if (priv->ppp_timeout_handler) {
 		g_source_remove (priv->ppp_timeout_handler);
 		priv->ppp_timeout_handler = 0;

Modified: branches/modem-manager/src/ppp-manager/nm-ppp-manager.h
==============================================================================
--- branches/modem-manager/src/ppp-manager/nm-ppp-manager.h	(original)
+++ branches/modem-manager/src/ppp-manager/nm-ppp-manager.h	Thu Aug  7 13:41:04 2008
@@ -19,6 +19,8 @@
 #define NM_IS_PPP_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_PPP_MANAGER))
 #define NM_PPP_MANAGER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_PPP_MANAGER, NMPPPManagerClass))
 
+#define NM_PPP_MANAGER_PARENT_IFACE "parent-iface"
+
 typedef struct {
 	GObject parent;
 } NMPPPManager;
@@ -34,12 +36,9 @@
 
 GType nm_ppp_manager_get_type (void);
 
-NMPPPManager *nm_ppp_manager_new (void);
+NMPPPManager *nm_ppp_manager_new (const char *iface);
 
-gboolean nm_ppp_manager_start (NMPPPManager *manager,
-						 const char *device,
-						 NMActRequest *req,
-						 GError **err);
+gboolean nm_ppp_manager_start (NMPPPManager *manager, NMActRequest *req, GError **err);
 
 void     nm_ppp_manager_update_secrets (NMPPPManager *manager,
                                         const char *device,

Modified: branches/modem-manager/src/ppp-manager/nm-pppd-plugin.c
==============================================================================
--- branches/modem-manager/src/ppp-manager/nm-pppd-plugin.c	(original)
+++ branches/modem-manager/src/ppp-manager/nm-pppd-plugin.c	Thu Aug  7 13:41:04 2008
@@ -91,9 +91,8 @@
 
 	if (ppp_status != NM_PPP_STATUS_UNKNOWN) {
 		dbus_g_proxy_call_no_reply (proxy, "SetState",
-							   G_TYPE_UINT, ppp_status,
-							   G_TYPE_INVALID,
-							   G_TYPE_INVALID);
+		                            G_TYPE_UINT, ppp_status, G_TYPE_INVALID,
+		                            G_TYPE_INVALID);
 	}
 }
 
@@ -133,16 +132,18 @@
 static void
 nm_ip_up (void *data, int arg)
 {
-	ipcp_options opts = ipcp_gotoptions[ifunit];
-	ipcp_options peer_opts = ipcp_hisoptions[ifunit];
+	ipcp_options opts = ipcp_gotoptions[0];
+	ipcp_options peer_opts = ipcp_hisoptions[0];
 	GHashTable *hash;
 	GArray *array;
 	GValue *val;
+	guint32 pppd_made_up_address = htonl (0x0a404040 + ifunit);
 
 	g_return_if_fail (DBUS_IS_G_PROXY (proxy));
 
 	if (!opts.ouraddr) {
-		g_warning ("Didn't receive an internal IP from pppd");
+		g_warning ("Didn't receive an internal IP from pppd!");
+		nm_phasechange (NULL, PHASE_DEAD);
 		return;
 	}
 
@@ -155,12 +156,20 @@
 	g_hash_table_insert (hash, NM_PPP_IP4_CONFIG_ADDRESS, 
 					 uint_to_gvalue (opts.ouraddr));
 
-	if (opts.hisaddr) {
+	/* Prefer the peer options remote address first, _unless_ pppd made the
+	 * address up, at which point prefer the local options remote address,
+	 * and if that's not right, use the made-up address as a last resort.
+	 */
+	if (peer_opts.hisaddr && (peer_opts.hisaddr != pppd_made_up_address)) {
 		g_hash_table_insert (hash, NM_PPP_IP4_CONFIG_GATEWAY, 
-						 uint_to_gvalue (opts.hisaddr));
-	} else if (peer_opts.hisaddr) {
+		                     uint_to_gvalue (peer_opts.hisaddr));
+	} else if (opts.hisaddr) {
 		g_hash_table_insert (hash, NM_PPP_IP4_CONFIG_GATEWAY, 
-						 uint_to_gvalue (peer_opts.hisaddr));
+		                     uint_to_gvalue (opts.hisaddr));
+	} else if (peer_opts.hisaddr == pppd_made_up_address) {
+		/* As a last resort, use the made-up address */
+		g_hash_table_insert (hash, NM_PPP_IP4_CONFIG_GATEWAY, 
+		                     uint_to_gvalue (peer_opts.hisaddr));
 	}
 
 	g_hash_table_insert (hash, NM_PPP_IP4_CONFIG_PREFIX, uint_to_gvalue (32));
@@ -289,10 +298,13 @@
 		return -1;
 	}
 
+	/* NM passes in the object path of the corresponding PPPManager
+	 * object as the 'ipparam' argument to pppd.
+	 */
 	proxy = dbus_g_proxy_new_for_name (bus,
-								NM_DBUS_SERVICE_PPP,
-								NM_DBUS_PATH_PPP,
-								NM_DBUS_INTERFACE_PPP);
+	                                   NM_DBUS_SERVICE_PPP,
+	                                   ipparam,
+	                                   NM_DBUS_INTERFACE_PPP);
 
 	dbus_g_connection_unref (bus);
 

Modified: branches/modem-manager/src/ppp-manager/nm-pppd-plugin.h
==============================================================================
--- branches/modem-manager/src/ppp-manager/nm-pppd-plugin.h	(original)
+++ branches/modem-manager/src/ppp-manager/nm-pppd-plugin.h	Thu Aug  7 13:41:04 2008
@@ -1,5 +1,4 @@
 #define NM_DBUS_SERVICE_PPP    "org.freedesktop.NetworkManager.PPP"
-#define NM_DBUS_PATH_PPP    "/org/freedesktop/NetworkManager/PPP"
 #define NM_DBUS_INTERFACE_PPP  "org.freedesktop.NetworkManager.PPP"
 
 #define NM_PPP_IP4_CONFIG_INTERFACE "interface"

Modified: branches/modem-manager/src/vpn-manager/nm-vpn-connection.c
==============================================================================
--- branches/modem-manager/src/vpn-manager/nm-vpn-connection.c	(original)
+++ branches/modem-manager/src/vpn-manager/nm-vpn-connection.c	Thu Aug  7 13:41:04 2008
@@ -48,8 +48,6 @@
 #include "nm-dbus-glib-types.h"
 #include "NetworkManagerUtils.h"
 
-#define CONNECTION_GET_SECRETS_CALL_TAG "get-secrets-call"
-
 #include "nm-vpn-connection-glue.h"
 
 G_DEFINE_TYPE (NMVPNConnection, nm_vpn_connection, G_TYPE_OBJECT)
@@ -58,6 +56,8 @@
 	gboolean disposed;
 
 	NMConnection *connection;
+	DBusGProxyCall *secrets_call;
+
 	NMActRequest *act_request;
 	NMDevice *parent_dev;
 	char *ac_path;
@@ -299,13 +299,15 @@
 		    ip_address_to_string (nm_ip4_config_get_ptp_address (config)));
 	nm_info ("Maximum Segment Size (MSS): %d", nm_ip4_config_get_mss (config));
 
-	num = nm_ip4_config_get_num_static_routes (config);
+	num = nm_ip4_config_get_num_routes (config);
 	for (i = 0; i < num; i++) {
-		addr = nm_ip4_config_get_static_route (config, i);
-		nm_info ("Static Route: %s/%d Gateway: %s",
-			    ip_address_to_string (addr->address),
-			    addr->prefix,
-			    ip_address_to_string (addr->gateway));
+		const NMSettingIP4Route *route;
+
+		route = nm_ip4_config_get_route (config, i);
+		nm_info ("Static Route: %s/%d   Next Hop: %s",
+			    ip_address_to_string (route->address),
+			    route->prefix,
+			    ip_address_to_string (route->next_hop));
 	}
 
 	num = nm_ip4_config_get_num_nameservers (config);
@@ -322,57 +324,6 @@
 }
 
 static void
-merge_vpn_routes (NMVPNConnection *connection, NMIP4Config *config)
-{
-	NMSettingVPN *setting;
-	GSList *iter;
-
-	setting = NM_SETTING_VPN (nm_connection_get_setting (NM_VPN_CONNECTION_GET_PRIVATE (connection)->connection,
-											   NM_TYPE_SETTING_VPN));
-
-	/* FIXME: Shouldn't the routes from user (NMSettingVPN) be inserted in the beginning
-	   instead of appending to the end?
-	*/
-
-	for (iter = setting->routes; iter; iter = iter->next) {
-		struct in_addr tmp;
-		char *p, *route;
-		long int prefix = 32;
-
-		route = g_strdup ((char *) iter->data);
-		p = strchr (route, '/');
-		if (!p || !(*(p + 1))) {
-			nm_warning ("Ignoring invalid route '%s'", route);
-			goto next;
-		}
-
-		errno = 0;
-		prefix = strtol (p + 1, NULL, 10);
-		if (errno || prefix <= 0 || prefix > 32) {
-			nm_warning ("Ignoring invalid route '%s'", route);
-			goto next;
-		}
-
-		/* don't pass the prefix to inet_pton() */
-		*p = '\0';
-		if (inet_pton (AF_INET, route, &tmp) > 0) {
-			NMSettingIP4Address *addr;
-
-			addr = g_new0 (NMSettingIP4Address, 1);
-			addr->address = tmp.s_addr;
-			addr->prefix = (guint32) prefix;
-			addr->gateway = 0;
-
-			nm_ip4_config_take_static_route (config, addr);
-		} else
-			nm_warning ("Ignoring invalid route '%s'", route);
-
-next:
-		g_free (route);
-	}
-}
-
-static void
 nm_vpn_connection_ip4_config_get (DBusGProxy *proxy,
 						    GHashTable *config_hash,
 						    gpointer user_data)
@@ -463,9 +414,9 @@
 		GSList *routes;
 		GSList *iter;
 
-		routes = nm_utils_ip4_addresses_from_gvalue (val);
+		routes = nm_utils_ip4_routes_from_gvalue (val);
 		for (iter = routes; iter; iter = iter->next)
-			nm_ip4_config_take_static_route (config, (NMSettingIP4Address *) iter->data);
+			nm_ip4_config_take_route (config, (NMSettingIP4Route *) iter->data);
 
 		g_slist_free (routes);
 	}
@@ -478,7 +429,6 @@
 	/* Merge in user overrides from the NMConnection's IPv4 setting */
 	s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting (priv->connection, NM_TYPE_SETTING_IP4_CONFIG));
 	nm_utils_merge_ip4_config (config, s_ip4);
-	merge_vpn_routes (connection, config);
 
 	if (nm_system_vpn_device_set_from_ip4_config (priv->parent_dev, priv->tundev, priv->ip4_config)) {
 		nm_info ("VPN connection '%s' (IP Config Get) complete.",
@@ -672,27 +622,21 @@
 /******************************************************************************/
 
 static void
-clear_need_auth (NMVPNConnection *vpn_connection)
+cleanup_secrets_dbus_call (NMVPNConnection *self)
 {
-	NMVPNConnectionPrivate *priv;
+	NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (self);
 	DBusGProxy *proxy;
-	DBusGProxyCall *call;
 
-	g_return_if_fail (vpn_connection != NULL);
-
-	priv = NM_VPN_CONNECTION_GET_PRIVATE (vpn_connection);
-	g_assert (priv->connection);
+	g_return_if_fail (priv->connection != NULL);
+	g_return_if_fail (NM_IS_CONNECTION (priv->connection));
 
 	proxy = g_object_get_data (G_OBJECT (priv->connection), NM_MANAGER_CONNECTION_SECRETS_PROXY_TAG);
-	if (!proxy || !DBUS_IS_G_PROXY (proxy))
-		return;
-
-	call = g_object_get_data (G_OBJECT (vpn_connection), CONNECTION_GET_SECRETS_CALL_TAG);
-	if (!call)
-		return;
+	g_assert (proxy);
 
-	dbus_g_proxy_cancel_call (proxy, call);
-	g_object_set_data (G_OBJECT (vpn_connection), CONNECTION_GET_SECRETS_CALL_TAG, NULL);
+	if (priv->secrets_call) {
+		dbus_g_proxy_cancel_call (proxy, priv->secrets_call);
+		priv->secrets_call = NULL;
+	}
 }
 
 typedef struct GetSecretsInfo {
@@ -737,7 +681,7 @@
 
 	priv = NM_VPN_CONNECTION_GET_PRIVATE (info->vpn_connection);
 
-	g_object_set_data (G_OBJECT (info->vpn_connection), CONNECTION_GET_SECRETS_CALL_TAG, NULL);
+	priv->secrets_call = NULL;
 
 	if (!dbus_g_proxy_end_call (proxy, call, &err,
 								DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, &settings,
@@ -770,7 +714,6 @@
 	NMVPNConnectionPrivate *priv;
 	DBusGProxy *secrets_proxy;
 	GetSecretsInfo *info = NULL;
-	DBusGProxyCall *call;
 	GPtrArray *hints;
 
 	g_return_val_if_fail (vpn_connection != NULL, FALSE);
@@ -780,48 +723,39 @@
 	priv = NM_VPN_CONNECTION_GET_PRIVATE (vpn_connection);
 	g_assert (priv->connection);
 
-	secrets_proxy = g_object_get_data (G_OBJECT (priv->connection),
-	                                   NM_MANAGER_CONNECTION_SECRETS_PROXY_TAG);
-	g_return_val_if_fail (secrets_proxy && DBUS_IS_G_PROXY (secrets_proxy), FALSE);
+	secrets_proxy = g_object_get_data (G_OBJECT (priv->connection), NM_MANAGER_CONNECTION_SECRETS_PROXY_TAG);
+	g_assert (secrets_proxy);
 
 	info = g_slice_new0 (GetSecretsInfo);
 	g_return_val_if_fail (info != NULL, FALSE);
 
 	info->setting_name = g_strdup (setting_name);
-	if (!info->setting_name) {
-		nm_warning ("Not enough memory to get secrets");
-		goto error;
-	}
-
 	info->vpn_connection = g_object_ref (vpn_connection);
 
 	/* Empty for now... */
 	hints = g_ptr_array_new ();
 
 	/* use ..._with_timeout to give the user time to enter secrets */
-	call = dbus_g_proxy_begin_call_with_timeout (secrets_proxy, "GetSecrets",
-	                                             get_secrets_cb,
-	                                             info,
-	                                             free_get_secrets_info,
-	                                             G_MAXINT32,
-	                                             G_TYPE_STRING, setting_name,
-	                                             DBUS_TYPE_G_ARRAY_OF_STRING, hints,
-	                                             G_TYPE_BOOLEAN, request_new,
-	                                             G_TYPE_INVALID);
+	priv->secrets_call = dbus_g_proxy_begin_call_with_timeout (secrets_proxy, "GetSecrets",
+	                                                           get_secrets_cb,
+	                                                           info,
+	                                                           free_get_secrets_info,
+	                                                           G_MAXINT32,
+	                                                           G_TYPE_STRING, setting_name,
+	                                                           DBUS_TYPE_G_ARRAY_OF_STRING, hints,
+	                                                           G_TYPE_BOOLEAN, request_new,
+	                                                           G_TYPE_INVALID);
 	g_ptr_array_free (hints, TRUE);
-	if (!call) {
+	if (!priv->secrets_call) {
 		nm_warning ("Could not call GetSecrets");
 		goto error;
 	}
-
-	g_object_set_data (G_OBJECT (vpn_connection),
-	                   CONNECTION_GET_SECRETS_CALL_TAG,
-	                   call);
 	return TRUE;
 
 error:
 	if (info)
 		free_get_secrets_info (info);
+	cleanup_secrets_dbus_call (vpn_connection);
 	return FALSE;
 }
 
@@ -833,9 +767,7 @@
 {
 	NMVPNConnection *vpn_connection = NM_VPN_CONNECTION (user_data);
 
-	g_object_set_data (G_OBJECT (vpn_connection),
-	                   CONNECTION_GET_SECRETS_CALL_TAG,
-	                   NULL);
+	cleanup_secrets_dbus_call (vpn_connection);
 
 	if (error) {
 		g_warning ("%s.%d: NeedSecrets failed: %s %s",
@@ -876,7 +808,7 @@
 {
 	NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
 
-	clear_need_auth (connection);
+	cleanup_secrets_dbus_call (connection);
 
 	switch (state) {
 	case NM_VPN_CONNECTION_STATE_NEED_AUTH:
@@ -962,6 +894,8 @@
 	}
 	priv->disposed = TRUE;
 
+	cleanup_secrets_dbus_call (NM_VPN_CONNECTION (object));
+
 	if (priv->parent_dev) {
 		if (priv->device_monitor)
 			g_signal_handler_disconnect (priv->parent_dev, priv->device_monitor);

Modified: branches/modem-manager/system-settings/plugins/ifcfg-fedora/common.h
==============================================================================
--- branches/modem-manager/system-settings/plugins/ifcfg-fedora/common.h	(original)
+++ branches/modem-manager/system-settings/plugins/ifcfg-fedora/common.h	Thu Aug  7 13:41:04 2008
@@ -28,6 +28,9 @@
 #define ORIG_TAG ".orig"
 #define REJ_TAG ".rej"
 
+#define IFCFG_PLUGIN_NAME "ifcfg-fedora"
+#define IFCFG_PLUGIN_INFO "(c) 2007 - 2008 Red Hat, Inc.  To report bugs please use the NetworkManager mailing list."
+
 #include <glib.h>
 
 GQuark ifcfg_plugin_error_quark (void);

Modified: branches/modem-manager/system-settings/plugins/ifcfg-fedora/plugin.c
==============================================================================
--- branches/modem-manager/system-settings/plugins/ifcfg-fedora/plugin.c	(original)
+++ branches/modem-manager/system-settings/plugins/ifcfg-fedora/plugin.c	Thu Aug  7 13:41:04 2008
@@ -45,9 +45,6 @@
 #include "nm-system-config-interface.h"
 #include "nm-ifcfg-connection.h"
 
-#define IFCFG_PLUGIN_NAME "ifcfg-fedora"
-#define IFCFG_PLUGIN_INFO "(c) 2007 - 2008 Red Hat, Inc.  To report bugs please use the NetworkManager mailing list."
-
 #define IFCFG_DIR SYSCONFDIR"/sysconfig/network-scripts/"
 
 static void system_config_interface_init (NMSystemConfigInterface *system_config_interface_class);

Modified: branches/modem-manager/system-settings/plugins/ifcfg-fedora/reader.c
==============================================================================
--- branches/modem-manager/system-settings/plugins/ifcfg-fedora/reader.c	(original)
+++ branches/modem-manager/system-settings/plugins/ifcfg-fedora/reader.c	Thu Aug  7 13:41:04 2008
@@ -51,6 +51,7 @@
 #include "shvar.h"
 
 #include "reader.h"
+#include "nm-system-config-interface.h"
 
 #define TYPE_ETHERNET "Ethernet"
 #define TYPE_WIRELESS "Wireless"
@@ -168,12 +169,12 @@
 
 	value = svGetValue (ifcfg, "BOOTPROTO");
 	if (value && (!g_ascii_strcasecmp (value, "bootp") || !g_ascii_strcasecmp (value, "dhcp")))
-		method = NM_SETTING_IP4_CONFIG_METHOD_DHCP;
+		method = NM_SETTING_IP4_CONFIG_METHOD_AUTO;
 
 	if (value && !g_ascii_strcasecmp (value, "autoip")) {
 		g_free (value);
 		s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
-		s_ip4->method = g_strdup (NM_SETTING_IP4_CONFIG_METHOD_AUTOIP);
+		s_ip4->method = g_strdup (NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL);
 		return NM_SETTING (s_ip4);
 	}
 
@@ -237,10 +238,10 @@
 	/* Yay, let's make an IP4 config */
 	s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
 	s_ip4->method = g_strdup (method);
-	s_ip4->ignore_dhcp_dns = !svTrueValue (ifcfg, "PEERDNS", 1);
+	s_ip4->ignore_auto_dns = !svTrueValue (ifcfg, "PEERDNS", 1);
 
 	/* DHCP hostname for 'send host-name' option */
-	if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_DHCP)) {
+	if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
 		value = svGetValue (ifcfg, "DHCP_HOSTNAME");
 		if (value && strlen (value))
 			s_ip4->dhcp_hostname = g_strdup (value);
@@ -604,6 +605,7 @@
 static NMSetting *
 make_wireless_setting (shvarFile *ifcfg,
                        NMSetting *security,
+                       gboolean unmanaged,
                        GError **error)
 {
 	NMSettingWireless *s_wireless;
@@ -611,6 +613,11 @@
 
 	s_wireless = NM_SETTING_WIRELESS (nm_setting_wireless_new ());
 
+	if (!read_mac_address (ifcfg, &s_wireless->mac_address, error)) {
+		g_object_unref (s_wireless);
+		return NULL;
+	}
+
 	value = svGetValue (ifcfg, "ESSID");
 	if (value) {
 		gsize len = strlen (value);
@@ -627,41 +634,41 @@
 		g_byte_array_append (s_wireless->ssid, (const guint8 *) value, len);
 		g_free (value);
 	} else {
-		g_set_error (error, ifcfg_plugin_error_quark (), 0, "Missing SSID");
-		goto error;
+		/* Only fail on lack of SSID if device is managed */
+		if (!unmanaged) {
+			g_set_error (error, ifcfg_plugin_error_quark (), 0, "Missing SSID");
+			goto error;
+		}
 	}
 
-	value = svGetValue (ifcfg, "MODE");
-	if (value) {
-		char *lcase;
+	if (!unmanaged) {
+		value = svGetValue (ifcfg, "MODE");
+		if (value) {
+			char *lcase;
 
-		lcase = g_ascii_strdown (value, -1);
-		g_free (value);
+			lcase = g_ascii_strdown (value, -1);
+			g_free (value);
 
-		if (!strcmp (lcase, "ad-hoc")) {
-			s_wireless->mode = g_strdup ("adhoc");
-		} else if (!strcmp (lcase, "managed")) {
-			s_wireless->mode = g_strdup ("infrastructure");
-		} else {
-			g_set_error (error, ifcfg_plugin_error_quark (), 0,
-			             "Invalid mode '%s' (not ad-hoc or managed)",
-			             lcase);
+			if (!strcmp (lcase, "ad-hoc")) {
+				s_wireless->mode = g_strdup ("adhoc");
+			} else if (!strcmp (lcase, "managed")) {
+				s_wireless->mode = g_strdup ("infrastructure");
+			} else {
+				g_set_error (error, ifcfg_plugin_error_quark (), 0,
+				             "Invalid mode '%s' (not ad-hoc or managed)",
+				             lcase);
+				g_free (lcase);
+				goto error;
+			}
 			g_free (lcase);
-			goto error;
 		}
-		g_free (lcase);
-	}
 
-	if (security)
-		s_wireless->security = g_strdup (NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
+		if (security)
+			s_wireless->security = g_strdup (NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
 
-	if (!read_mac_address (ifcfg, &s_wireless->mac_address, error)) {
-		g_object_unref (s_wireless);
-		s_wireless = NULL;
+		// FIXME: channel/freq, other L2 parameters like RTS
 	}
 
-	// FIXME: channel/freq, other L2 parameters like RTS
-
 	return NM_SETTING (s_wireless);
 
 error:
@@ -671,12 +678,15 @@
 }
 
 static NMConnection *
-wireless_connection_from_ifcfg (const char *file, shvarFile *ifcfg, GError **error)
+wireless_connection_from_ifcfg (const char *file,
+                                shvarFile *ifcfg,
+                                gboolean unmanaged,
+                                GError **error)
 {
 	NMConnection *connection = NULL;
 	NMSetting *con_setting = NULL;
 	NMSetting *wireless_setting = NULL;
-	NMSettingWireless *tmp;
+	NMSettingWireless *s_wireless;
 	NMSetting *security_setting = NULL;
 	char *printable_ssid = NULL;
 
@@ -694,49 +704,53 @@
 
 	/* Wireless security */
 	security_setting = make_wireless_security_setting (ifcfg, file, error);
-	if (*error)
-		goto error;
+	if (*error) {
+		g_object_unref (connection);
+		return NULL;
+	}
 	if (security_setting)
 		nm_connection_add_setting (connection, security_setting);
 
 	/* Wireless */
-	wireless_setting = make_wireless_setting (ifcfg, security_setting, error);
-	if (!wireless_setting)
-		goto error;
-
+	wireless_setting = make_wireless_setting (ifcfg, security_setting, unmanaged, error);
+	if (!wireless_setting) {
+		g_object_unref (connection);
+		return NULL;
+	}
 	nm_connection_add_setting (connection, wireless_setting);
 
-	tmp = NM_SETTING_WIRELESS (wireless_setting);
-	printable_ssid = nm_utils_ssid_to_utf8 ((const char *) tmp->ssid->data,
-	                                        (guint32) tmp->ssid->len);
+	s_wireless = (NMSettingWireless *) wireless_setting;
+	if (s_wireless && s_wireless->ssid) {
+		printable_ssid = nm_utils_ssid_to_utf8 ((const char *) s_wireless->ssid->data,
+		                                        (guint32) s_wireless->ssid->len);
+	} else
+		printable_ssid = g_strdup_printf ("unmanaged");
 
 	con_setting = make_connection_setting (file, ifcfg,
 	                                       NM_SETTING_WIRELESS_SETTING_NAME,
 	                                       printable_ssid);
+	g_free (printable_ssid);
 	if (!con_setting) {
 		g_set_error (error, ifcfg_plugin_error_quark (), 0,
 		             "Failed to create connection setting.");
-		goto error;
+		g_object_unref (connection);
+		return NULL;
 	}
 	nm_connection_add_setting (connection, con_setting);
 
-	if (!nm_connection_verify (connection, error))
-		goto error;
+	/* Don't verify if unmanaged since we may not have an SSID or whatever */
+	if (!unmanaged) {
+		if (!nm_connection_verify (connection, error)) {
+			g_object_unref (connection);
+			return NULL;
+		}
+	}
 
 	return connection;
-
-error:
-	g_free (printable_ssid);
-	g_object_unref (connection);
-	if (con_setting)
-		g_object_unref (con_setting);
-	if (wireless_setting)
-		g_object_unref (wireless_setting);
-	return NULL;
 }
 
 static NMSetting *
-make_wired_setting (shvarFile *ifcfg, GError **error)
+make_wired_setting (shvarFile *ifcfg, gboolean unmanaged, GError **error)
 {
 	NMSettingWired *s_wired;
 	char *value;
@@ -750,10 +764,8 @@
 			if (mtu >= 0 && mtu < 65536)
 				s_wired->mtu = mtu;
 		} else {
-			g_set_error (error, ifcfg_plugin_error_quark (), 0,
-			             "Invalid MTU '%s'", value);
-			g_object_unref (s_wired);
-			s_wired = NULL;
+			/* Shouldn't be fatal... */
+			PLUGIN_PRINT (IFCFG_PLUGIN_NAME, "    warning: invalid MTU '%s'", value);
 		}
 		g_free (value);
 	}
@@ -767,7 +779,10 @@
 }
 
 static NMConnection *
-wired_connection_from_ifcfg (const char *file, shvarFile *ifcfg, GError **error)
+wired_connection_from_ifcfg (const char *file,
+                             shvarFile *ifcfg,
+                             gboolean unmanaged,
+                             GError **error)
 {
 	NMConnection *connection = NULL;
 	NMSetting *con_setting = NULL;
@@ -787,28 +802,24 @@
 	if (!con_setting) {
 		g_set_error (error, ifcfg_plugin_error_quark (), 0,
 		             "Failed to create connection setting.");
-		goto error;
+		g_object_unref (connection);
+		return NULL;
 	}
 	nm_connection_add_setting (connection, con_setting);
 
-	wired_setting = make_wired_setting (ifcfg, error);
-	if (!wired_setting)
-		goto error;
-
+	wired_setting = make_wired_setting (ifcfg, unmanaged, error);
+	if (!wired_setting) {
+		g_object_unref (connection);
+		return NULL;
+	}
 	nm_connection_add_setting (connection, wired_setting);
 
-	if (!nm_connection_verify (connection, error))
-		goto error;
+	if (!nm_connection_verify (connection, error)) {
+		g_object_unref (connection);
+		return NULL;
+	}
 
 	return connection;
-
-error:
-	g_object_unref (connection);
-	if (con_setting)
-		g_object_unref (con_setting);
-	if (wired_setting)
-		g_object_unref (wired_setting);
-	return NULL;
 }
 
 static gboolean
@@ -933,9 +944,9 @@
 	}
 
 	if (!strcmp (type, TYPE_ETHERNET))
-		connection = wired_connection_from_ifcfg (filename, parsed, error);
+		connection = wired_connection_from_ifcfg (filename, parsed, *ignored, error);
 	else if (!strcmp (type, TYPE_WIRELESS))
-		connection = wireless_connection_from_ifcfg (filename, parsed, error);
+		connection = wireless_connection_from_ifcfg (filename, parsed, *ignored, error);
 	else {
 		g_set_error (error, ifcfg_plugin_error_quark (), 0,
 		             "Unknown connection type '%s'", type);
@@ -943,7 +954,8 @@
 
 	g_free (type);
 
-	if (!connection)
+	/* Don't bother reading the connection fully if it's unmanaged */
+	if (!connection || *ignored)
 		goto done;
 
 	s_ip4 = make_ip4_setting (parsed, error);

Modified: branches/modem-manager/system-settings/plugins/ifcfg-suse/parser.c
==============================================================================
--- branches/modem-manager/system-settings/plugins/ifcfg-suse/parser.c	(original)
+++ branches/modem-manager/system-settings/plugins/ifcfg-suse/parser.c	Thu Aug  7 13:41:04 2008
@@ -108,11 +108,11 @@
 	str = svGetValue (ifcfg, "BOOTPROTO");
 	if (str) {
 		if (!g_ascii_strcasecmp (str, "bootp") || !g_ascii_strcasecmp (str, "dhcp"))
-			s_ip4->method = g_strdup (NM_SETTING_IP4_CONFIG_METHOD_DHCP);
+			s_ip4->method = g_strdup (NM_SETTING_IP4_CONFIG_METHOD_AUTO);
 		else if (!g_ascii_strcasecmp (str, "static"))
 			s_ip4->method = g_strdup (NM_SETTING_IP4_CONFIG_METHOD_MANUAL);
 		else if (!g_ascii_strcasecmp (str, "autoip"))
-			s_ip4->method = g_strdup (NM_SETTING_IP4_CONFIG_METHOD_AUTOIP);
+			s_ip4->method = g_strdup (NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL);
 
 		g_free (str);
 	}

Modified: branches/modem-manager/system-settings/plugins/keyfile/reader.c
==============================================================================
--- branches/modem-manager/system-settings/plugins/keyfile/reader.c	(original)
+++ branches/modem-manager/system-settings/plugins/keyfile/reader.c	Thu Aug  7 13:41:04 2008
@@ -61,6 +61,22 @@
 	return TRUE;
 }
 
+static gboolean
+get_one_int (const char *str, guint32 max_val, const char *key_name, guint32 *out)
+{
+	long tmp;
+
+	errno = 0;
+	tmp = strtol (str, NULL, 10);
+	if (errno || (tmp < 0) || (tmp > max_val)) {
+		g_warning ("%s: ignoring invalid IPv4 %s item '%s'", __func__, key_name, str);
+		return FALSE;
+	}
+
+	*out = (guint32) tmp;
+	return TRUE;
+}
+
 static void
 free_one_address (gpointer data, gpointer user_data)
 {
@@ -69,8 +85,8 @@
 
 static GPtrArray *
 read_addresses (GKeyFile *file,
-			 const char *setting_name,
-			 const char *key)
+			    const char *setting_name,
+			    const char *key)
 {
 	GPtrArray *addresses;
 	int i = 0;
@@ -105,18 +121,14 @@
 			struct in_addr addr;
 
 			if (j == 1) {
-				/* prefix */
-				long tmp_prefix;
-				guint32 prefix;
+				guint32 prefix = 0;
 
-				errno = 0;
-				tmp_prefix = strtol (*iter, NULL, 10);
-				if (errno || (tmp_prefix < 0) || (tmp_prefix > 32)) {
-					g_warning ("%s: ignoring invalid IPv4 %s prefix '%s'", __func__, key_name, *iter);
+				/* prefix */
+				if (!get_one_int (*iter, 32, key_name, &prefix)) {
 					g_array_free (address, TRUE);
 					goto next;
 				}
-				prefix = (guint32) tmp_prefix;
+
 				g_array_append_val (address, prefix);
 			} else {
 				/* address and gateway */
@@ -148,32 +160,132 @@
 	return addresses;
 }
 
+static void
+free_one_route (gpointer data, gpointer user_data)
+{
+	g_array_free ((GArray *) data, TRUE);
+}
+
+static GPtrArray *
+read_routes (GKeyFile *file,
+			 const char *setting_name,
+			 const char *key)
+{
+	GPtrArray *routes;
+	int i = 0;
+
+	routes = g_ptr_array_sized_new (3);
+
+	/* Look for individual routes */
+	while (i++ < 1000) {
+		gchar **tmp, **iter;
+		char *key_name;
+		gsize length = 0;
+		int ret;
+		GArray *route;
+		int j;
+
+		key_name = g_strdup_printf ("%s%d", key, i);
+		tmp = g_key_file_get_string_list (file, setting_name, key_name, &length, NULL);
+		g_free (key_name);
+
+		if (!tmp || !length)
+			break; /* all done */
+
+		if (length != 4) {
+			g_warning ("%s: ignoring invalid IPv4 route item '%s'", __func__, key_name);
+			goto next;
+		}
+
+		/* convert the string array into IP addresses */
+		route = g_array_sized_new (FALSE, TRUE, sizeof (guint32), 4);
+		for (iter = tmp, j = 0; *iter; iter++, j++) {
+			struct in_addr addr;
+
+			if (j == 1) {
+				guint32 prefix = 0;
+
+				/* prefix */
+				if (!get_one_int (*iter, 32, key_name, &prefix)) {
+					g_array_free (route, TRUE);
+					goto next;
+				}
+
+				g_array_append_val (route, prefix);
+			} else if (j == 3) {
+				guint32 metric = 0;
+
+				/* prefix */
+				if (!get_one_int (*iter, G_MAXUINT32, key_name, &metric)) {
+					g_array_free (route, TRUE);
+					goto next;
+				}
+
+				g_array_append_val (route, metric);
+			} else {
+				/* address and next hop */
+				ret = inet_pton (AF_INET, *iter, &addr);
+				if (ret <= 0) {
+					g_warning ("%s: ignoring invalid IPv4 %s element '%s'", __func__, key_name, *iter);
+					g_array_free (route, TRUE);
+					goto next;
+				}
+				g_array_append_val (route, addr.s_addr);
+			}
+		}
+		g_ptr_array_add (routes, route);
+
+next:
+		g_strfreev (tmp);
+	}
+
+	if (routes->len < 1) {
+		g_ptr_array_free (routes, TRUE);
+		routes = NULL;
+	}
+
+	return routes;
+}
+
 static gboolean
 read_array_of_array_of_uint (GKeyFile *file,
                              NMSetting *setting,
                              const char *key)
 {
-	GPtrArray *addresses;
+	gboolean success = FALSE;
 
 	/* Only handle IPv4 addresses and routes for now */
-	if (   !NM_IS_SETTING_IP4_CONFIG (setting) ||
-		  (strcmp (key, NM_SETTING_IP4_CONFIG_ADDRESSES) &&
-		   strcmp (key, NM_SETTING_IP4_CONFIG_ROUTES)))
-	    return FALSE;
-
-	addresses = read_addresses (file, setting->name, key);
-
-	/* Work around for previous syntax */
-	if (!addresses && !strcmp (key, NM_SETTING_IP4_CONFIG_ADDRESSES))
-		addresses = read_addresses (file, setting->name, "address");
-
-	if (addresses) {
-		g_object_set (setting, key, addresses, NULL);
-		g_ptr_array_foreach (addresses, free_one_address, NULL);
-		g_ptr_array_free (addresses, TRUE);
+	if (!NM_IS_SETTING_IP4_CONFIG (setting))
+		return FALSE;
+
+	if (!strcmp (key, NM_SETTING_IP4_CONFIG_ADDRESSES)) {
+		GPtrArray *addresses;
+
+		addresses = read_addresses (file, setting->name, key);
+
+		/* Work around for previous syntax */
+		if (!addresses && !strcmp (key, NM_SETTING_IP4_CONFIG_ADDRESSES))
+			addresses = read_addresses (file, setting->name, "address");
+
+		if (addresses) {
+			g_object_set (setting, key, addresses, NULL);
+			g_ptr_array_foreach (addresses, free_one_address, NULL);
+			g_ptr_array_free (addresses, TRUE);
+		}
+		success = TRUE;
+	} else if (!strcmp (key, NM_SETTING_IP4_CONFIG_ROUTES)) {
+		GPtrArray *routes;
+
+		routes = read_routes (file, setting->name, key);
+		if (routes) {
+			g_object_set (setting, key, routes, NULL);
+			g_ptr_array_foreach (routes, free_one_route, NULL);
+			g_ptr_array_free (routes, TRUE);
+		}
+		success = TRUE;
 	}
 
-	return TRUE;
+	return success;
 }
 
 static void

Modified: branches/modem-manager/system-settings/plugins/keyfile/writer.c
==============================================================================
--- branches/modem-manager/system-settings/plugins/keyfile/writer.c	(original)
+++ branches/modem-manager/system-settings/plugins/keyfile/writer.c	Thu Aug  7 13:41:04 2008
@@ -62,6 +62,61 @@
 	return TRUE;
 }
 
+static void
+write_ip4_values (GKeyFile *file,
+                  const char *setting_name,
+                  const char *key,
+                  GPtrArray *array,
+                  guint32 tuple_len,
+                  guint32 addr1_pos,
+                  guint32 addr2_pos)
+{
+	char **list = NULL;
+	int i, j;
+
+	list = g_malloc (tuple_len);
+
+	for (i = 0, j = 0; i < array->len; i++, j++) {
+		GArray *tuple = g_ptr_array_index (array, i);
+		gboolean success = TRUE;
+		char *key_name;
+		int k;
+
+		memset (list, 0, tuple_len);
+
+		for (k = 0; k < tuple_len; k++) {
+			if (k == addr1_pos || k == addr2_pos) {
+				char buf[INET_ADDRSTRLEN + 1];
+				struct in_addr addr;
+
+				/* IP addresses */
+				addr.s_addr = g_array_index (tuple, guint32, k);
+				if (!inet_ntop (AF_INET, &addr, buf, sizeof (buf))) {
+					nm_warning ("%s: error converting IP4 address 0x%X",
+					            __func__, ntohl (addr.s_addr));
+					success = FALSE;
+					break;
+				} else {
+					list[k] = g_strdup (buf);
+				}
+			} else {
+				/* prefix, metric */
+				list[k] = g_strdup_printf ("%d", g_array_index (tuple, guint32, k));
+			}
+		}
+
+		if (success) {
+			key_name = g_strdup_printf ("%s%d", key, j + 1);
+			g_key_file_set_string_list (file, setting_name, key_name, (const char **) list, tuple_len);
+			g_free (key_name);
+		}
+
+		for (k = 0; k < tuple_len; k++)
+			g_free (list[k]);
+	}
+	g_free (list);
+}
+
 static gboolean
 write_array_of_array_of_uint (GKeyFile *file,
                               NMSetting *setting,
@@ -69,58 +124,19 @@
                               const GValue *value)
 {
 	GPtrArray *array;
-	int i, j;
 
 	/* Only handle IPv4 addresses and routes for now */
-	if (   !NM_IS_SETTING_IP4_CONFIG (setting) ||
-		  (strcmp (key, NM_SETTING_IP4_CONFIG_ADDRESSES) &&
-		   strcmp (key, NM_SETTING_IP4_CONFIG_ROUTES)))
-	    return FALSE;
+	if (!NM_IS_SETTING_IP4_CONFIG (setting))
+		return FALSE;
 
 	array = (GPtrArray *) g_value_get_boxed (value);
 	if (!array || !array->len)
 		return TRUE;
 
-	for (i = 0, j = 0; i < array->len; i++, j++) {
-		GArray *tuple = g_ptr_array_index (array, i);
-		char buf[INET_ADDRSTRLEN + 1];
-		struct in_addr addr;
-		char *list[3] = { NULL, NULL, NULL };
-		char *key_name;
-
-		/* Address */
-		addr.s_addr = g_array_index (tuple, guint32, 0);
-		if (!inet_ntop (AF_INET, &addr, buf, sizeof (buf))) {
-			nm_warning ("%s: error converting IP4 address 0x%X",
-			            __func__, ntohl (addr.s_addr));
-			list[0] = NULL;
-		} else {
-			list[0] = g_strdup (buf);
-		}
-
-		/* Prefix */
-		list[1] = g_strdup_printf ("%d", g_array_index (tuple, guint32, 1));
-
-		/* Gateway */
-		addr.s_addr = g_array_index (tuple, guint32, 2);
-		if (addr.s_addr) {
-			if (!inet_ntop (AF_INET, &addr, buf, sizeof (buf))) {
-				nm_warning ("%s: error converting IP4 address 0x%X",
-					        __func__, ntohl (addr.s_addr));
-				list[2] = NULL;
-			} else {
-				list[2] = g_strdup (buf);
-			}
-		}
-
-		key_name = g_strdup_printf ("%s%d", key, j + 1);
-		g_key_file_set_string_list (file, setting->name, key_name, (const char **) list, list[2] ? 3 : 2);
-		g_free (key_name);
-
-		g_free (list[0]);
-		g_free (list[1]);
-		g_free (list[2]);
-	}
+	if (!strcmp (key, NM_SETTING_IP4_CONFIG_ADDRESSES))
+		write_ip4_values (file, setting->name, key, array, 3, 0, 2);
+	else if (!strcmp (key, NM_SETTING_IP4_CONFIG_ROUTES))
+		write_ip4_values (file, setting->name, key, array, 4, 0, 2);
 
 	return TRUE;
 }

Modified: branches/modem-manager/vpn-daemons/openvpn/src/nm-openvpn-service-openvpn-helper.c
==============================================================================
--- branches/modem-manager/vpn-daemons/openvpn/src/nm-openvpn-service-openvpn-helper.c	(original)
+++ branches/modem-manager/vpn-daemons/openvpn/src/nm-openvpn-service-openvpn-helper.c	Thu Aug  7 13:41:04 2008
@@ -31,6 +31,7 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <string.h>
+#include <errno.h>
 #include <regex.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -197,7 +198,7 @@
 		struct in_addr network;
 		struct in_addr netmask;
 		struct in_addr gateway = { 0, };
-		guint32 prefix;
+		guint32 prefix, metric = 0;
 
 		snprintf (buf, BUFLEN, "route_network_%d", i);
 		tmp = getenv (buf);
@@ -218,16 +219,33 @@
 
 		snprintf (buf, BUFLEN, "route_gateway_%d", i);
 		tmp = getenv (buf);
-		if (!tmp || inet_pton (AF_INET, tmp, &gateway) <= 0) {
+		/* gateway can be missing */
+		if (tmp && (inet_pton (AF_INET, tmp, &gateway) <= 0)) {
 			nm_warning ("Ignoring invalid static route gateway '%s'", tmp ? tmp : "NULL");
 			continue;
 		}
 
-		array = g_array_sized_new (FALSE, TRUE, sizeof (guint32), 3);
+		snprintf (buf, BUFLEN, "route_metric_%d", i);
+		tmp = getenv (buf);
+		/* metric can be missing */
+		if (tmp && strlen (tmp)) {
+			long int tmp_metric;
+
+			errno = 0;
+			tmp_metric = strtol (tmp, NULL, 10);
+			if (errno || tmp_metric < 0 || tmp_metric > G_MAXUINT32) {
+				nm_warning ("Ignoring invalid static route metric '%s'", tmp);
+				continue;
+			}
+			metric = (guint32) tmp_metric;
+		}
+
+		array = g_array_sized_new (FALSE, TRUE, sizeof (guint32), 4);
 		g_array_append_val (array, network.s_addr);
 		prefix = nm_utils_ip4_netmask_to_prefix (netmask.s_addr);
 		g_array_append_val (array, prefix);
 		g_array_append_val (array, gateway.s_addr);
+		g_array_append_val (array, metric);
 		g_ptr_array_add (routes, array);
 	}
 

Modified: branches/modem-manager/vpn-daemons/vpnc/properties/nm-vpnc.c
==============================================================================
--- branches/modem-manager/vpn-daemons/vpnc/properties/nm-vpnc.c	(original)
+++ branches/modem-manager/vpn-daemons/vpnc/properties/nm-vpnc.c	Thu Aug  7 13:41:04 2008
@@ -547,39 +547,38 @@
 	substrs = g_strsplit (routelist, " ", 0);
 	for (i = 0; substrs[i] != NULL; i++) {
 		struct in_addr tmp;
-		char *p, *route;
+		char *p, *str_route;
 		long int prefix = 32;
 
-		route = g_strdup (substrs[i]);
-		p = strchr (route, '/');
+		str_route = g_strdup (substrs[i]);
+		p = strchr (str_route, '/');
 		if (!p || !(*(p + 1))) {
-			g_warning ("Ignoring invalid route '%s'", route);
+			g_warning ("Ignoring invalid route '%s'", str_route);
 			goto next;
 		}
 
 		errno = 0;
 		prefix = strtol (p + 1, NULL, 10);
 		if (errno || prefix <= 0 || prefix > 32) {
-			g_warning ("Ignoring invalid route '%s'", route);
+			g_warning ("Ignoring invalid route '%s'", str_route);
 			goto next;
 		}
 
 		/* don't pass the prefix to inet_pton() */
 		*p = '\0';
-		if (inet_pton (AF_INET, route, &tmp) > 0) {
-			NMSettingIP4Address *addr;
+		if (inet_pton (AF_INET, str_route, &tmp) > 0) {
+			NMSettingIP4Route *route;
 
-			addr = g_new0 (NMSettingIP4Address, 1);
-			addr->address = tmp.s_addr;
-			addr->prefix = (guint32) prefix;
-			addr->gateway = 0;
+			route = g_new0 (NMSettingIP4Route, 1);
+			route->address = tmp.s_addr;
+			route->prefix = (guint32) prefix;
 
-			routes = g_slist_append (routes, addr);
+			routes = g_slist_append (routes, route);
 		} else
-			g_warning ("Ignoring invalid route '%s'", route);
+			g_warning ("Ignoring invalid route '%s'", str_route);
 
 next:
-		g_free (route);
+		g_free (str_route);
 	}
 
 	g_strfreev (substrs);
@@ -788,16 +787,16 @@
 		GSList *iter;
 
 		for (iter = s_ip4->routes; iter; iter = g_slist_next (iter)) {
-			NMSettingIP4Address *addr = (NMSettingIP4Address *) iter->data;
+			NMSettingIP4Route *route = (NMSettingIP4Route *) iter->data;
 			char str_addr[INET_ADDRSTRLEN + 1];
 			struct in_addr num_addr;
 
 			if (routes->len)
 				g_string_append_c (routes, ' ');
 
-			num_addr.s_addr = addr->address;
+			num_addr.s_addr = route->address;
 			if (inet_ntop (AF_INET, &num_addr, &str_addr[0], INET_ADDRSTRLEN + 1))
-				g_string_append_printf (routes, "%s/%d", str_addr, addr->prefix);
+				g_string_append_printf (routes, "%s/%d", str_addr, route->prefix);
 		}
 	}
 

Modified: branches/modem-manager/vpn-daemons/vpnc/src/nm-vpnc-service-vpnc-helper.c
==============================================================================
--- branches/modem-manager/vpn-daemons/vpnc/src/nm-vpnc-service-vpnc-helper.c	(original)
+++ branches/modem-manager/vpn-daemons/vpnc/src/nm-vpnc-service-vpnc-helper.c	Thu Aug  7 13:41:04 2008
@@ -211,8 +211,8 @@
 		GArray *array;
 		char buf[BUFLEN];
 		struct in_addr network;
-		guint32 gateway = 0; /* no gateway */
-		guint32 prefix;
+		guint32 next_hop = 0; /* no next hop */
+		guint32 prefix, metric = 0;
 
 		snprintf (buf, BUFLEN, "CISCO_SPLIT_INC_%d_ADDR", i);
 		tmp = getenv (buf);
@@ -245,10 +245,11 @@
 			prefix = nm_utils_ip4_netmask_to_prefix (netmask.s_addr);
 		}
 
-		array = g_array_sized_new (FALSE, TRUE, sizeof (guint32), 3);
+		array = g_array_sized_new (FALSE, TRUE, sizeof (guint32), 4);
 		g_array_append_val (array, network.s_addr);
 		g_array_append_val (array, prefix);
-		g_array_append_val (array, gateway);
+		g_array_append_val (array, next_hop);
+		g_array_append_val (array, metric);
 		g_ptr_array_add (routes, array);
 	}
 

Modified: branches/modem-manager/vpn-daemons/vpnc/src/nm-vpnc-service.c
==============================================================================
--- branches/modem-manager/vpn-daemons/vpnc/src/nm-vpnc-service.c	(original)
+++ branches/modem-manager/vpn-daemons/vpnc/src/nm-vpnc-service.c	Thu Aug  7 13:41:04 2008
@@ -38,6 +38,8 @@
 	GType type;
 } ValidProperty;
 
+#define LEGACY_NAT_KEEPALIVE "NAT-Keepalive packet interval"
+
 static ValidProperty valid_properties[] = {
 	{ NM_VPNC_KEY_GATEWAY,               G_TYPE_STRING },
 	{ NM_VPNC_KEY_ID,                    G_TYPE_STRING },
@@ -53,6 +55,8 @@
 	{ NM_VPNC_KEY_DPD_IDLE_TIMEOUT,      G_TYPE_INT },
 	{ NM_VPNC_KEY_NAT_TRAVERSAL_MODE,    G_TYPE_STRING },
 	{ NM_VPNC_KEY_CISCO_UDP_ENCAPS_PORT, G_TYPE_INT },
+	/* Legacy options that are ignored */
+	{ LEGACY_NAT_KEEPALIVE,              G_TYPE_STRING },
 	{ NULL,                              G_TYPE_NONE }
 };
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]