diff options
Diffstat (limited to 'meta/recipes-connectivity/connman/connman-gnome/0003-Fix-setting-IPv4-configuration.patch')
-rw-r--r-- | meta/recipes-connectivity/connman/connman-gnome/0003-Fix-setting-IPv4-configuration.patch | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/connman/connman-gnome/0003-Fix-setting-IPv4-configuration.patch b/meta/recipes-connectivity/connman/connman-gnome/0003-Fix-setting-IPv4-configuration.patch new file mode 100644 index 0000000000..a25ffd9cfa --- /dev/null +++ b/meta/recipes-connectivity/connman/connman-gnome/0003-Fix-setting-IPv4-configuration.patch | |||
@@ -0,0 +1,85 @@ | |||
1 | From 8594fb5e2fc347984457e2e46b175eb3cf57951f Mon Sep 17 00:00:00 2001 | ||
2 | Message-Id: <8594fb5e2fc347984457e2e46b175eb3cf57951f.1334369310.git.paul.eggleton@linux.intel.com> | ||
3 | In-Reply-To: <cover.1334369310.git.paul.eggleton@linux.intel.com> | ||
4 | References: <cover.1334369310.git.paul.eggleton@linux.intel.com> | ||
5 | From: Paul Eggleton <paul.eggleton@linux.intel.com> | ||
6 | Date: Sat, 14 Apr 2012 01:11:53 +0100 | ||
7 | Subject: [PATCH 3/6] Fix setting IPv4 configuration | ||
8 | |||
9 | Values in the hashtable for IPv4.Configuration need to be variants, not | ||
10 | strings, and don't pass address entries if the method is dhcp. | ||
11 | |||
12 | Upstream-Status: Submitted | ||
13 | |||
14 | Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> | ||
15 | --- | ||
16 | common/connman-client.c | 32 +++++++++++++++++++++++++------- | ||
17 | 1 files changed, 25 insertions(+), 7 deletions(-) | ||
18 | |||
19 | diff --git a/common/connman-client.c b/common/connman-client.c | ||
20 | index 9d755c4..e4441ad 100644 | ||
21 | --- a/common/connman-client.c | ||
22 | +++ b/common/connman-client.c | ||
23 | @@ -39,6 +39,11 @@ | ||
24 | #define CONNMAN_CLIENT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), \ | ||
25 | CONNMAN_TYPE_CLIENT, ConnmanClientPrivate)) | ||
26 | |||
27 | +#ifndef DBUS_TYPE_G_DICTIONARY | ||
28 | +#define DBUS_TYPE_G_DICTIONARY \ | ||
29 | + (dbus_g_type_get_map("GHashTable", G_TYPE_STRING, G_TYPE_VALUE)) | ||
30 | +#endif | ||
31 | + | ||
32 | typedef struct _ConnmanClientPrivate ConnmanClientPrivate; | ||
33 | |||
34 | struct _ConnmanClientPrivate { | ||
35 | @@ -248,6 +253,16 @@ GtkTreeModel *connman_client_get_device_model(ConnmanClient *client) | ||
36 | return model; | ||
37 | } | ||
38 | |||
39 | +void hash_table_value_string_insert( GHashTable *hash, gpointer key, const char *str ) | ||
40 | +{ | ||
41 | + GValue *itemvalue; | ||
42 | + | ||
43 | + itemvalue = g_slice_new0(GValue); | ||
44 | + g_value_init(itemvalue, G_TYPE_STRING); | ||
45 | + g_value_set_string(itemvalue, str); | ||
46 | + g_hash_table_insert(hash, key, itemvalue); | ||
47 | +} | ||
48 | + | ||
49 | gboolean connman_client_set_ipv4(ConnmanClient *client, const gchar *device, | ||
50 | struct ipv4_config *ipv4_config) | ||
51 | { | ||
52 | @@ -255,12 +270,7 @@ gboolean connman_client_set_ipv4(ConnmanClient *client, const gchar *device, | ||
53 | DBusGProxy *proxy; | ||
54 | GValue value = { 0 }; | ||
55 | gboolean ret; | ||
56 | - GHashTable *ipv4 = g_hash_table_new(g_str_hash, g_str_equal); | ||
57 | - | ||
58 | - g_hash_table_insert(ipv4, "Method", (gpointer)ipv4_config->method); | ||
59 | - g_hash_table_insert(ipv4, "Address", (gpointer)ipv4_config->address); | ||
60 | - g_hash_table_insert(ipv4, "Netmask", (gpointer)ipv4_config->netmask); | ||
61 | - g_hash_table_insert(ipv4, "Gateway", (gpointer)ipv4_config->gateway); | ||
62 | + GHashTable *ipv4 = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); | ||
63 | |||
64 | DBG("client %p", client); | ||
65 | |||
66 | @@ -270,7 +280,15 @@ gboolean connman_client_set_ipv4(ConnmanClient *client, const gchar *device, | ||
67 | proxy = connman_dbus_get_proxy(priv->store, device); | ||
68 | if (proxy == NULL) | ||
69 | return FALSE; | ||
70 | - g_value_init(&value, DBUS_TYPE_G_STRING_STRING_HASHTABLE); | ||
71 | + | ||
72 | + hash_table_value_string_insert(ipv4, "Method", ipv4_config->method); | ||
73 | + if( g_strcmp0(ipv4_config->method, "dhcp" ) != 0 ) { | ||
74 | + hash_table_value_string_insert(ipv4, "Address", ipv4_config->address); | ||
75 | + hash_table_value_string_insert(ipv4, "Netmask", ipv4_config->netmask); | ||
76 | + hash_table_value_string_insert(ipv4, "Gateway", ipv4_config->gateway); | ||
77 | + } | ||
78 | + | ||
79 | + g_value_init(&value, DBUS_TYPE_G_DICTIONARY); | ||
80 | g_value_set_boxed(&value, ipv4); | ||
81 | ret = connman_set_property(proxy, "IPv4.Configuration", &value, NULL); | ||
82 | |||
83 | -- | ||
84 | 1.7.5.4 | ||
85 | |||