summaryrefslogtreecommitdiff
path: root/gweb/gresolv.c
AgeCommit message (Collapse)AuthorFilesLines
2021-01-04Imported Upstream connman version 1.38Niraj Kumar Goit1-2/+3
Change-Id: I9e650762f3b2b2a31945b66e044e67a77e3b4b12 Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
2019-09-18Imported Upstream version 1.37submit/tizen/20190920.082459Nishant Chaprana1-10/+6
Change-Id: Idb47c1ddbedc9f97181b8e9a5eeac04ddd832a2c Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
2019-07-04Imported Upstream version 1.37upstream/1.37Nishant Chaprana1-2/+6
Change-Id: Ib5957e7ee3a9315ee86a331189bc3e9e71751ee8 Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
2018-01-23Updated connman to version 1.35Seonah Moon1-8/+6
Change-Id: I13526fbf80296a79be15548fc226a308941ac9ec Signed-off-by: Taesub Kim <taesub.kim@samsung.com>
2018-01-08Imported Upstream version 1.35upstream/1.35Seonah Moon1-8/+6
Change-Id: I174854914d9fd06a813270b57d1f7bc2bac63c6a Signed-off-by: Seonah Moon <seonah1.moon@samsung.com>
2016-06-17[SPIN] Fix the connman bugs.Niraj Kumar Goit1-0/+8
- Fixed NTP service's DNS resolving failure in Hive project. - Do not turn "wlan0" interface down in cleanup_devices(). - Set resource limits "RLIMIT_NOFILE" for a process. - After appending a file, fflush and fsync all modified in-core data of the file. Change-Id: I2767b3302d6204d066fe2075027828ff209d0ee0 Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
2015-08-07Base Code merged to SPIN 2.4submit/tizen/20150810.034432hyunuktak1-0/+0
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com> Change-Id: I84a42375b5c59739e4caca1f726699ea7647ef17
2014-07-17Imported Upstream version 1.24upstream/1.24Zhang zhengguang1-54/+55
2013-02-18gresolv: Optimize the response parserTomasz Bursztyka1-5/+5
It will check first if the response belongs to a query, before interpreting any of its content (rcode, count...).
2013-02-18gresolv: Do not remove a query on failure if other results are pendingTomasz Bursztyka1-9/+19
Fixes BMC#25973 In the case one of the resolving failed, the query is removed and destroyed from the queue. So the responses of the requests sent to the other namerservers - which might be successful - will thus be lost since they cannot be matched anymore to their initial request.
2013-01-28gresolv: Destroy query at the relevant place when parsing the responseTomasz Bursztyka1-4/+2
parse_response() will eventually call sort_and_return_results() which in turn will call the result function. But the result function might cancel the gresolv. At that point all queries belonging to this gresolv are destroyed. Returning back to parse_response(), it calls again destroy_query() on an already destroyed one. Thus leading to a crash. Same issue with query_timeout() Reported by Daniel Wagner
2013-01-11gweb: Make sure to destroy the lookup before calling any result functionTomasz Bursztyka1-2/+4
Program received signal SIGSEGV, Segmentation fault. Backtrace: 0 0x00000000004219fe in _debug (resolv=0x75f9a0, file=0x497267 "gweb/gresolv.c", caller=0x497598 "destroy_lookup", format=0x497278 "lookup %p id %d ipv4 %p ipv6 %p") at gweb/gresolv.c:136 1 0x0000000000421ac5 in destroy_lookup (lookup=0x760e40) at gweb/gresolv.c:154 2 0x00000000004224ce in sort_and_return_results (lookup=0x760e40) at gweb/gresolv.c:520 3 0x0000000000422597 in query_timeout (user_data=0x760510) at gweb/gresolv.c:542 4 0x00007ffff7b1b26b in g_timeout_dispatch (source=0x760ea0, callback=<optimized out>, user_data=<optimized out>) at gmain.c:4095 5 0x00007ffff7b1a643 in g_main_dispatch (context=0x6f5110) at gmain.c:2784 6 g_main_context_dispatch (context=0x6f5110) at gmain.c:3288 7 0x00007ffff7b1a988 in g_main_context_iterate (dispatch=1, block=<optimized out>, context=0x6f5110, self=<optimized out>) at gmain.c:3359 8 g_main_context_iterate (context=0x6f5110, block=<optimized out>, dispatch=1, self=<optimized out>) at gmain.c:3296 9 0x00007ffff7b1ade5 in g_main_loop_run (loop=0x6f4fe0) at gmain.c:3553 10 0x0000000000442a5f in main (argc=1, argv=0x7fffffffdea8) at src/main.c:705 Reported by Daniel Wagner
2012-12-20gweb: Use glib memory functionsDaniel Wagner1-1/+1
Use for all memory allocation/dealocation operation the glib functions. This allows us to use g_mem_profile().
2012-11-13gweb: Check null before referenceDanny Jeongseok Seo1-2/+2
2012-10-19gresolv: Remove query from queue before destroying the queryJukka Rissanen1-1/+1
The order of actions is important here.
2012-10-19gresolv: Make sure we will not receive DNS data after closingJukka Rissanen1-1/+3
We must close the channel when freeing the resolver object, otherwise we might still receive data when the resolver has been freed already. Fixes BMC#25757
2012-10-19gresolv: Add more debug printsJukka Rissanen1-5/+31
2012-10-19gresolv: Make debug func print more useful informationJukka Rissanen1-3/+11
The file and function names are printed in debug prints.
2012-10-16gresolv: Remove the lookup for realJukka Rissanen1-1/+1
The call to g_resolv_cancel_lookup() will do nothing because we just removed the lookup from the queue. The fix is to remove the lookup directly and not call the cancel function.
2012-10-16gresolv: Remove all pending lookups when resolver is removedJukka Rissanen1-0/+4
Remove all lookups found in queue when GResolv object is removed.
2012-10-16gresolv: Avoid accessing already freed memoryJukka Rissanen1-3/+6
We must remove the lookup from lookup queue and query from query queue before calling user callback. The callback might unref the GResolv which in turn would remove the lookup/query what we are trying to access after the callback is returned. So it is enough to remove the lookup or query entry from queue before cb is called and then manually remove it after the callback has returned.
2012-10-12gresolv: Remove lookup from correct queueJukka Rissanen1-1/+1
The lookup must be removed from lookup queue and not from query queue when cancelling the lookup. Otherwise it is possible that we might access an already removed lookup that is still found in lookup queue. Fixes BMC#25728
2012-07-17gresolv: Use predefined mnemonics rather than magic numbersGrant Erickson1-6/+6
Use predefined mnemonics from arpa/nameserv.h for the return value from ns_msg_getflag rather than magic numbers.
2012-07-17gresolv: Do not update successful status with unsuccessful oneGrant Erickson1-3/+9
When performing a resolver lookup from timeserver or wpad, both perform queries with an unspecified address family. This means that both A and AAAA record queries are issued. In cases where a valid, successful A response comes back but where the AAAA query results in a timeout, do not smash the successful A status with the time out AAAA status; otherwise, the timeserver or wpad will appear to fail to them when, in fact, the A query was successful and more than satisfies its unspecified address family requirement. Partial fix for BMC#25486.
2012-07-17gresolve: Fix a typo in conditional check for returning resultsGrant Erickson1-1/+1
In both parse_response and query_timeout there exists logic that checks to ensure that both an A and AAAA lookups have either been responded to or timed out before processing and returning results to the caller. In query_timeout, there was a typo in the condition check such that it did not match those conditions tested in parse_response.
2012-06-26gweb: Use g_try_realloc instead of g_reallocJukka Rissanen1-1/+3
2012-04-29gweb: Update copyright informationMarcel Holtmann1-1/+1
2011-11-28gresolv: Bind socket to the right interfaceTomasz Bursztyka1-2/+22
2011-11-10gweb: Use gcc atomics instead glib's onesDaniel Wagner1-3/+3
g_atomic_int_exchange_and_add() has been removed from glib 2.30 and g_atomic_int_add() should be used. Though there are still quite a few distros out which do not ship a glib version with g_atomic_int_add(). Instead of maintaing a compatiblilty glib layer we just use the built-in functions for atomic memory access.
2011-10-25gweb: Add SOCK_CLOEXEC to socket()Daniel Wagner1-1/+2
Make sure all file descriptor are closed.
2011-09-12gresolv: Fix buffer sizeJukka Rissanen1-3/+5
Make buf just big enough and initialize it in order to get rid of valgrind error (accessing uninitialized memory).
2011-07-06gresolv: Queries address family scope restrictionTomasz Bursztyka1-8/+33
Adding the capability to restrict DNS queries to a specific address family through gresolv_set_address_family(). By default, AF_UNSPEC is applied.
2011-05-27gweb: Remove usage of unused variablesMarcel Holtmann1-2/+4
2011-03-17gresolv: Fix memory leakDaniel Wagner1-1/+3
Reported by: DJ Cozatt <ygdrasil@comcast.net>
2011-02-15gweb: Avoid forward declarations in resolver codeMarcel Holtmann1-341/+338
2011-02-15gweb: Some coding style cleanup on resolver codeMarcel Holtmann1-50/+74
2010-12-07gresolv: Destroy query after removing it from the resolv queueSamuel Ortiz1-2/+2
Fixes BMC#10958
2010-12-07gresolv: Remove ipv6 query from the resolv queueSamuel Ortiz1-1/+1
2010-12-02gresolv: Implement RFC3484 rule 9 (prefer longest matching prefix)David Woodhouse1-0/+35
2010-12-02gresolv: Add scope handling to RFC3484 sortDavid Woodhouse1-1/+55
2010-12-02gresolv: First partial implementation for RFC3484 sortingDavid Woodhouse1-1/+48
2010-12-02gresolv: Calculate precedence/label/etc required for RFC3484 sortingDavid Woodhouse1-1/+158
2010-12-02gresolv: Don't convert results to strings so earlyDavid Woodhouse1-94/+100
We're going to want results in sockaddr form for sorting, so let's put them directly into the array we'll want for the sort process, even though we haven't actually implemented sorting yet. We can ditch the support for arbitrary callbacks from the individual queries, too; there's no need for that. The callback to user code comes from the *lookup*, having combined the A and AAAA query results.
2010-12-01gresolv: Send A and AAAA queries, merge results for lookup callbackDavid Woodhouse1-36/+169
2010-12-01gresolv: Start handling AAAA results in queryDavid Woodhouse1-6/+12
2010-12-01gresolv: Fix handling of IPv6 nameserversDavid Woodhouse1-14/+43
If IPv6 nameservers were specified in /etc/resolv.conf, we would end up sending NS queries to 0.0.0.0 because we weren't parsing the __res_state structure correctly. We were assuming that all listed nameservers would be Legacy IP. Also fix connect_udp_channel() to generate the address correctly instead of just asssuming Legacy IP.
2010-12-01gresolv: Handle POLLERR on DNS UDP socketDavid Woodhouse1-2/+2
If we get an error on the UDP socket, we'll currently go into an endless loop eating CPU with poll() returning POLLERR and us ignoring it. This at least hooks things up so that our callback gets called, and we stop looping. But the callback's handling of POLLERR isn't correct. It should close the socket and open a new one. As it is, it's just going to try to use the same broken socket again for the next request. But at least with this patch it'll stop eating CPU.
2010-10-04Move GResolv source file sinto GWeb directoryMarcel Holtmann1-0/+515