[PATCH] ipconfig: Do not overwrite gateway address

2013-02-01 Thread Jukka Rissanen
If we have already received gateway address via newroute rtnl
message, then do not overwrite it when receiving newaddr message.

Fixes BMC#25931
---
 include/ipaddress.h |2 +-
 src/ipaddress.c |   16 ++--
 src/ipconfig.c  |4 ++--
 3 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/include/ipaddress.h b/include/ipaddress.h
index 9fff622..cc6848e 100644
--- a/include/ipaddress.h
+++ b/include/ipaddress.h
@@ -46,7 +46,7 @@ int connman_ipaddress_set_ipv6(struct connman_ipaddress 
*ipaddress,
 void connman_ipaddress_set_peer(struct connman_ipaddress *ipaddress,
const char *peer);
 void connman_ipaddress_clear(struct connman_ipaddress *ipaddress);
-void connman_ipaddress_copy(struct connman_ipaddress *ipaddress,
+void connman_ipaddress_copy_address(struct connman_ipaddress *ipaddress,
struct connman_ipaddress *source);
 
 #ifdef __cplusplus
diff --git a/src/ipaddress.c b/src/ipaddress.c
index e5af9a0..f66bb67 100644
--- a/src/ipaddress.c
+++ b/src/ipaddress.c
@@ -177,7 +177,12 @@ void connman_ipaddress_clear(struct connman_ipaddress 
*ipaddress)
ipaddress-gateway = NULL;
 }
 
-void connman_ipaddress_copy(struct connman_ipaddress *ipaddress,
+/*
+ * Note that this copy function only copies the actual address and
+ * prefixlen. If you need full copy of ipaddress struct, then you need
+ * to create a new function that does that.
+ */
+void connman_ipaddress_copy_address(struct connman_ipaddress *ipaddress,
struct connman_ipaddress *source)
 {
if (ipaddress == NULL || source == NULL)
@@ -188,13 +193,4 @@ void connman_ipaddress_copy(struct connman_ipaddress 
*ipaddress,
 
g_free(ipaddress-local);
ipaddress-local = g_strdup(source-local);
-
-   g_free(ipaddress-peer);
-   ipaddress-peer = g_strdup(source-peer);
-
-   g_free(ipaddress-broadcast);
-   ipaddress-broadcast = g_strdup(source-broadcast);
-
-   g_free(ipaddress-gateway);
-   ipaddress-gateway = g_strdup(source-gateway);
 }
diff --git a/src/ipconfig.c b/src/ipconfig.c
index b400894..9f67e67 100644
--- a/src/ipconfig.c
+++ b/src/ipconfig.c
@@ -663,11 +663,11 @@ void __connman_ipconfig_newaddr(int index, int family, 
const char *label,
__connman_ippool_newaddr(index, address, prefixlen);
 
if (ipdevice-config_ipv4 != NULL  family == AF_INET)
-   connman_ipaddress_copy(ipdevice-config_ipv4-system,
+   connman_ipaddress_copy_address(ipdevice-config_ipv4-system,
ipaddress);
 
else if (ipdevice-config_ipv6 != NULL  family == AF_INET6)
-   connman_ipaddress_copy(ipdevice-config_ipv6-system,
+   connman_ipaddress_copy_address(ipdevice-config_ipv6-system,
ipaddress);
else
return;
-- 
1.7.2.2

___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


DNS caching probably not working in dnsproxy.

2013-02-01 Thread Sameer Naik
Hi,

I am testing connman-1.10 and i get the following warnings when i try to
resolve a dns address.

 START OF LOG
connmand[2815]: src/dnsproxy.c:udp_listener_event() Received 32 bytes (id
0x090c)
connmand[2815]: src/dnsproxy.c:parse_request() id 0x090c qr 0 opcode 0
qdcount 1 arcount 0
connmand[2815]: src/dnsproxy.c:parse_request() query www.google.com.
connmand[2815]: src/dnsproxy.c:resolv() server 192.168.1.1 enabled 1

GLib-CRITICAL **: g_hash_table_lookup: assertion `hash_table != NULL' failed
connmand[2815]: src/dnsproxy.c:forward_dns_reply() Received 196 bytes (id
0x1629)
connmand[2815]: src/dnsproxy.c:forward_dns_reply() req 0x4daba8 dstid
0x1629 altid 0xe285 rcode 0
connmand[2815]: src/dnsproxy.c:cache_update() offset 0 hdr 0x7fa9fb68 msg
0x7fa9fb68 rcode 0
connmand[2815]: src/dnsproxy.c:parse_response() qr 1 qdcount 1

GLib-CRITICAL **: g_hash_table_lookup: assertion `hash_table != NULL' failed

GLib-CRITICAL **: g_hash_table_insert_internal: assertion `hash_table !=
NULL' failed
connmand[2815]: src/dnsproxy.c:cache_update() cache 5 new question
wwwgooglecom type 28 ttl 293 size 125 packet 62 dns len 62
connmand[2815]: src/dnsproxy.c:forward_dns_reply() proto 17 sent 196 bytes
to 9
connmand[2815]: src/dnsproxy.c:udp_listener_event() Received 32 bytes (id
0x9f96)
connmand[2815]: src/dnsproxy.c:parse_request() id 0x9f96 qr 0 opcode 0
qdcount 1 arcount 0
connmand[2815]: src/dnsproxy.c:parse_request() query www.google.com.
connmand[2815]: src/dnsproxy.c:resolv() server 192.168.1.1 enabled 1

GLib-CRITICAL **: g_hash_table_lookup: assertion `hash_table != NULL' failed
connmand[2815]: src/dnsproxy.c:forward_dns_reply() Received 248 bytes (id
0x6ebe)
connmand[2815]: src/dnsproxy.c:forward_dns_reply() req 0x4daba8 dstid
0x6ebe altid 0x5fc0 rcode 0
connmand[2815]: src/dnsproxy.c:cache_update() offset 0 hdr 0x7fa9fb68 msg
0x7fa9fb68 rcode 0
connmand[2815]: src/dnsproxy.c:parse_response() qr 1 qdcount 1

GLib-CRITICAL **: g_hash_table_lookup: assertion `hash_table != NULL' failed

GLib-CRITICAL **: g_hash_table_insert_internal: assertion `hash_table !=
NULL' failed
connmand[2815]: src/dnsproxy.c:cache_update() cache 6 new question
wwwgooglecom type 1 ttl 293 size 177 packet 114 dns len 114
connmand[2815]: src/dnsproxy.c:forward_dns_reply() proto 17 sent 248 bytes
to 9
 END OF LOG

It looks like there is some problem in DNS caching. Maybe the cache
GHashTable is not initialized.
Earlier i had glib assertion checks disabled due to which connman ended by
crashing.

Regards
~Sameer
___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


RE: Connman VPN: Do not replace default route

2013-02-01 Thread Yevhen Kyriukha
 Hi!

 How can I configure connman-vpn to leave my default route?
 I want that connman append VPN route so I can access my VPN network and
 have all other traffic go through default route.

You can use connman test script service-move-before to move the service
to the first one. The first service gets the default route.

I've tried 'service-move-before' but hadn't got any changes in routing table.
I have ethernet connection and I want to establish VPN connection.
After VPN connection is established, I run 'service-move-before
ethernet_service_path vpn_service_path' but 'route -n' command
gives me the same result as before executing 'service-move-before'
script.

Is there any option besides executing 'service-move-before' to tell
connman simply not to override default routes?
___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman