IPv4/DNS Settings for Dialup from gconf
- From: Markus Becker <mab comnets uni-bremen de>
- To: networkmanager-list gnome org
- Subject: IPv4/DNS Settings for Dialup from gconf
- Date: Thu, 8 May 2008 16:41:26 +0200 (CEST)
Hello Dan, Tambet,
as a follow-up on the 'weird' DNS address (10.11.12.13) issue, I added
some code that enables using the ipv4 settings (well currently only the
DNS addresses) from gconf. I would love to hear your opinion on this.
I also have a patch adding the ipv4 page to the connection-editor, which I
could provide, if you think this patch is OK.
BR,
Markus
Index: src/NetworkManagerUtils.c
===================================================================
--- src/NetworkManagerUtils.c (revision 3644)
+++ src/NetworkManagerUtils.c (working copy)
@@ -259,7 +259,7 @@
}
if (!found)
- nm_ip4_config_add_nameserver (ip4_config, ns);
+ nm_ip4_config_prepend_nameserver (ip4_config, ns);
}
}
Index: src/nm-device.c
===================================================================
--- src/nm-device.c (revision 3644)
+++ src/nm-device.c (working copy)
@@ -646,7 +646,6 @@
NMSettingIP4Config *s_ip4;
g_return_val_if_fail (config != NULL, NM_ACT_STAGE_RETURN_FAILURE);
- g_return_val_if_fail (*config == NULL, NM_ACT_STAGE_RETURN_FAILURE);
connection = nm_act_request_get_connection (nm_device_get_act_request (self));
g_assert (connection);
@@ -654,6 +653,7 @@
s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
if (nm_device_get_use_dhcp (self)) {
+ g_return_val_if_fail (*config == NULL, NM_ACT_STAGE_RETURN_FAILURE);
*config = nm_dhcp_manager_get_ip4_config (NM_DEVICE_GET_PRIVATE (self)->dhcp_manager,
nm_device_get_iface (self));
nm_utils_merge_ip4_config (*config, s_ip4);
@@ -663,8 +663,16 @@
if (!strcmp (s_ip4->method, NM_SETTING_IP4_CONFIG_METHOD_AUTOIP)) {
nm_device_new_ip4_autoip_config (self);
} else if (!strcmp (s_ip4->method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
+ g_return_val_if_fail (*config == NULL, NM_ACT_STAGE_RETURN_FAILURE);
*config = nm_ip4_config_new ();
nm_utils_merge_ip4_config (*config, s_ip4);
+ } else if ( s_ip4->dns != NULL ) {
+ nm_info ("real_act_stage4_get_ip4_config: %x %x !!!!",
+ g_array_index (s_ip4->dns, guint32, 0),
+ g_array_index (s_ip4->dns, guint32, 1)
+ );
+ nm_utils_merge_ip4_config (*config, s_ip4);
+ return NM_ACT_STAGE_RETURN_SUCCESS;
}
}
Index: src/nm-ip4-config.c
===================================================================
--- src/nm-ip4-config.c (revision 3644)
+++ src/nm-ip4-config.c (working copy)
@@ -216,6 +216,14 @@
NM_IP4_CONFIG_GET_PRIVATE (config)->ptp_address = ptp_addr;
}
+void nm_ip4_config_prepend_nameserver (NMIP4Config *config, guint32 nameserver)
+{
+ g_return_if_fail (NM_IS_IP4_CONFIG (config));
+
+ if (nameserver != 0)
+ g_array_prepend_val (NM_IP4_CONFIG_GET_PRIVATE (config)->nameservers, nameserver);
+}
+
void nm_ip4_config_add_nameserver (NMIP4Config *config, guint32 nameserver)
{
g_return_if_fail (NM_IS_IP4_CONFIG (config));
Index: src/nm-ip4-config.h
===================================================================
--- src/nm-ip4-config.h (revision 3644)
+++ src/nm-ip4-config.h (working copy)
@@ -67,6 +67,7 @@
guint32 nm_ip4_config_get_ptp_address (NMIP4Config *config);
void nm_ip4_config_set_ptp_address (NMIP4Config *config, guint32 ptp_addr);
+void nm_ip4_config_prepend_nameserver (NMIP4Config *config, guint32 nameserver);
void nm_ip4_config_add_nameserver (NMIP4Config *config, guint32 nameserver);
guint32 nm_ip4_config_get_nameserver (NMIP4Config *config, guint i);
guint32 nm_ip4_config_get_num_nameservers (NMIP4Config *config);
Index: src/ppp-manager/nm-ppp-manager.c
===================================================================
--- src/ppp-manager/nm-ppp-manager.c (revision 3644)
+++ src/ppp-manager/nm-ppp-manager.c (working copy)
@@ -11,6 +11,7 @@
#include "nm-setting-connection.h"
#include "nm-setting-ppp.h"
#include "nm-setting-pppoe.h"
+#include "nm-setting-ip4-config.h"
#include "nm-dbus-manager.h"
#include "nm-utils.h"
#include "nm-marshal.h"
@@ -278,8 +279,13 @@
if (val) {
GArray *dns = (GArray *) g_value_get_boxed (val);
- for (i = 0; i < dns->len; i++)
+ for (i = 0; i < dns->len; i++) {
+ if (g_array_index (dns, guint, i) == 0x0d0c0b0a ||
+ g_array_index (dns, guint, i) == 0x0e0c0b0a ) {
+ nm_warning ("!!! Bad DNS entry. I would rather set and use DNS IP addresses from gconf. !!!");
+ }
nm_ip4_config_add_nameserver (config, g_array_index (dns, guint, i));
+ }
}
val = (GValue *) g_hash_table_lookup (config_hash, NM_PPP_IP4_CONFIG_INTERFACE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]