[network-manager-applet/ip6only] editor: support IPv6 DHCP-only configurations



commit a7d25cf04dd6de052bd22c9a54ffd961a1e7d8d7
Author: Dan Williams <dcbw redhat com>
Date:   Fri Apr 23 16:26:43 2010 -0700

    editor: support IPv6 DHCP-only configurations

 src/connection-editor/page-ip6.c |   29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/src/connection-editor/page-ip6.c b/src/connection-editor/page-ip6.c
index eeeb373..b0cc476 100644
--- a/src/connection-editor/page-ip6.c
+++ b/src/connection-editor/page-ip6.c
@@ -33,6 +33,8 @@
 
 #include <nm-setting-connection.h>
 #include <nm-setting-ip6-config.h>
+#include <nm-setting-wired.h>
+#include <nm-setting-wireless.h>
 #include <nm-setting-gsm.h>
 #include <nm-setting-cdma.h>
 #include <nm-setting-pppoe.h>
@@ -86,9 +88,10 @@ typedef struct {
 #define IP6_METHOD_IGNORE          0
 #define IP6_METHOD_AUTO            1
 #define IP6_METHOD_AUTO_ADDRESSES  2
-#define IP6_METHOD_MANUAL          3
-#define IP6_METHOD_LINK_LOCAL      4
-#define IP6_METHOD_SHARED          5
+#define IP6_METHOD_AUTO_DHCP_ONLY  3
+#define IP6_METHOD_MANUAL          4
+#define IP6_METHOD_LINK_LOCAL      5
+#define IP6_METHOD_SHARED          6
 
 static void
 ip6_private_init (CEPageIP6 *self, NMConnection *connection)
@@ -153,6 +156,17 @@ ip6_private_init (CEPageIP6 *self, NMConnection *connection)
 						METHOD_COL_ENABLED, TRUE,
 	                    -1);
 
+	/* DHCP only used on wifi and wired for now */
+	if (   priv->connection_type == NM_TYPE_SETTING_WIRED
+	    || priv->connection_type == NM_TYPE_SETTING_WIRELESS) {
+		gtk_list_store_append (priv->method_store, &iter);
+		gtk_list_store_set (priv->method_store, &iter,
+		                    METHOD_COL_NAME, _("Automatic, DHCP only"),
+		                    METHOD_COL_NUM, IP6_METHOD_AUTO_DHCP_ONLY,
+							METHOD_COL_ENABLED, TRUE,
+		                    -1);
+	}
+
 	/* Manual is pointless for Mobile Broadband */
 	if (   priv->connection_type != NM_TYPE_SETTING_GSM
 	    && priv->connection_type != NM_TYPE_SETTING_CDMA
@@ -225,6 +239,10 @@ method_changed (GtkComboBox *combo, gpointer user_data)
 		addr_enabled = FALSE;
 		dns_enabled = routes_enabled = TRUE;
 		break;
+	case IP6_METHOD_AUTO_DHCP_ONLY:
+		addr_enabled = FALSE;
+		routes_enabled = TRUE;
+		break;
 	case IP6_METHOD_MANUAL:
 		addr_enabled = dns_enabled = routes_enabled = TRUE;
 		break;
@@ -296,6 +314,8 @@ populate_ui (CEPageIP6 *self)
 	if (str_method) {
 		if (!strcmp (str_method, NM_SETTING_IP6_CONFIG_METHOD_AUTO))
 			method = IP6_METHOD_AUTO;
+		if (!strcmp (str_method, NM_SETTING_IP6_CONFIG_METHOD_DHCP))
+			method = IP6_METHOD_AUTO_DHCP_ONLY;
 		else if (!strcmp (str_method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL))
 			method = IP6_METHOD_LINK_LOCAL;
 		else if (!strcmp (str_method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL))
@@ -734,6 +754,9 @@ ui_to_setting (CEPageIP6 *self)
 	case IP6_METHOD_SHARED:
 		method = NM_SETTING_IP6_CONFIG_METHOD_SHARED;
 		break;
+	case IP6_METHOD_AUTO_DHCP_ONLY:
+		method = NM_SETTING_IP6_CONFIG_METHOD_DHCP;
+		break;
 	case IP6_METHOD_AUTO_ADDRESSES:
 		ignore_auto_dns = TRUE;
 		/* fall through */



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