From 0111d4dbd708426875435a23ca2fcd00416b93dd Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 28 Aug 2012 11:37:27 -0500 Subject: [PATCH] modem: fix DNS configuration with static IP modems The MM API defines the GetIP4Config method return as (uuuu) which is [ IP, DNS1, DNS2, DNS3 ]. Unfortunately the for() loop in the static_stage3_done() function started at index 0, which is the IP address. This caused the IP address to be added to the DNS list. It should start at index 1 instead. --- src/modem-manager/nm-modem.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/modem-manager/nm-modem.c b/src/modem-manager/nm-modem.c index 8250015834..50ba53c1ad 100644 --- a/src/modem-manager/nm-modem.c +++ b/src/modem-manager/nm-modem.c @@ -322,9 +322,12 @@ static_stage3_done (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data) priv->call = NULL; + /* Returned value array is (uuuu): [IP, DNS1, DNS2, DNS3], all in + * network byte order. + */ if (dbus_g_proxy_end_call (proxy, call, &error, - G_TYPE_VALUE_ARRAY, &ret_array, - G_TYPE_INVALID)) { + G_TYPE_VALUE_ARRAY, &ret_array, + G_TYPE_INVALID)) { NMIP4Address *addr; int i; @@ -334,6 +337,7 @@ static_stage3_done (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data) nm_log_info (LOGD_MB, "(%s): IPv4 static configuration:", priv->iface); + /* IP address */ nm_ip4_address_set_address (addr, g_value_get_uint (g_value_array_get_nth (ret_array, 0))); nm_ip4_address_set_prefix (addr, 32); nm_ip4_config_take_address (config, addr); @@ -342,7 +346,8 @@ static_stage3_done (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data) ip_address_to_string (nm_ip4_address_get_address (addr)), nm_ip4_address_get_prefix (addr)); - for (i = 0; i < ret_array->n_values; i++) { + /* DNS servers */ + for (i = 1; i < ret_array->n_values; i++) { GValue *value = g_value_array_get_nth (ret_array, i); guint32 tmp = g_value_get_uint (value);