From: Peter Meerwald <[email protected]>

fix a crash because cache is NULL; this happens often, not always on the first 
name to resolve

initialization of the cache happens all over the place

cache_update() already has a create_cache() in a special-case path, but not in 
the main path

observed with 1.19; may have to do provisioning config

connmand[4347]: src/network.c:connman_network_unref_debug() 0xc97b0 name Wired 
ref 3 by src/network.c:462:check_dhcpv6()
connmand[4347]: src/ntp.c:send_timeout() send timeout (retries 1)
connmand[4347]: src/ntp.c:send_timeout() send timeout (retries 2)
connmand[4347]: src/ntp.c:send_timeout() send timeout (retries 3)
connmand[4347]: src/ntp.c:__connman_ntp_stop()
connmand[4347]: src/dnsproxy.c:udp_listener_event() Received 27 bytes (id 
0x76ea)
connmand[4347]: src/dnsproxy.c:parse_request() id 0x76ea qr 0 opcode 0 qdcount 
1 arcount 0
connmand[4347]: src/dnsproxy.c:parse_request() query google.at.
connmand[4347]: src/dnsproxy.c:resolv() server 192.168.233.10 enabled 1
connmand[4347]: src/dnsproxy.c:forward_dns_reply() Received 189 bytes (id 
0x2d11)
connmand[4347]: src/dnsproxy.c:forward_dns_reply() req 0xc81c0 dstid 0x2d11 
altid 0xf6ca rcode 0
connmand[4347]: src/dnsproxy.c:cache_update() offset 0 hdr 0xbe828b88 msg 
0xbe828b88 rcode 0
connmand[4347]: src/dnsproxy.c:parse_response() qr 1 qdcount 1
connmand[4347]: Aborting (signal 11) [/usr/sbin/connmand]
---
 src/dnsproxy.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/dnsproxy.c b/src/dnsproxy.c
index 65806ca..97b07aa 100644
--- a/src/dnsproxy.c
+++ b/src/dnsproxy.c
@@ -1468,7 +1468,11 @@ static int cache_update(struct server_data *srv, 
unsigned char *msg,
         * This is needed so that we can cache both A and AAAA
         * records for the same name.
         */
-       entry = g_hash_table_lookup(cache, question);
+       if (!cache) {
+               create_cache();
+               entry = NULL;
+       } else
+               entry = g_hash_table_lookup(cache, question);
        if (!entry) {
                entry = g_try_new(struct cache_entry, 1);
                if (!entry)
-- 
1.7.9.5

_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman

Reply via email to