summaryrefslogtreecommitdiff
path: root/src/dnsproxy.c
AgeCommit message (Collapse)AuthorFilesLines
2017-02-20Supported IPv6 DNS querysubmit/tizen/20170222.093648accepted/tizen/wearable/20170222.222326accepted/tizen/tv/20170222.222320accepted/tizen/mobile/20170222.222259accepted/tizen/ivi/20170222.222333accepted/tizen/common/20170222.124713Seonah Moon1-60/+0
connman dnsproxy has ignored AAAA record for IPv6. It makes fail to resolve DNS in IPv6 environment. Change-Id: I11e83560c522377b2f88c0dfea28df0fb66140a8 Signed-off-by: Seonah Moon <seonah1.moon@samsung.com>
2017-02-10WGID-149077: Fixed integer overflow issuesubmit/tizen/20170213.093416accepted/tizen/wearable/20170214.011127accepted/tizen/tv/20170214.011116accepted/tizen/mobile/20170214.011102accepted/tizen/ivi/20170214.011139accepted/tizen/common/20170214.173413Seonah Moon1-1/+3
Change-Id: Ie2d0939e43080aa2c7937f912d13ece6c39fdb9c Signed-off-by: Seonah Moon <seonah1.moon@samsung.com>
2016-06-17[SPIN] Apply system socket - onlycap supportsubmit/tizen/20160620.015850accepted/tizen/wearable/20160620.081549accepted/tizen/tv/20160620.081531accepted/tizen/mobile/20160620.081517accepted/tizen/ivi/20160620.081605accepted/tizen/common/20160620.163541Niraj Kumar Goit1-13/+36
Change-Id: Icc887f469e77eea24915c89efcf216aff466fa98 Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
2015-12-22Fix a svace 20384hyunuktak1-0/+1
Change-Id: I3bf09588ec0f1ee69bb1024a88ea912558d12ca7 Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
2015-10-06Sync with Tizen 2.4(1.29.36)submit/tizen/20151020.082803accepted/tizen/wearable/20151020.111030accepted/tizen/tv/20151020.111019accepted/tizen/mobile/20151020.111002taesub.kim1-2/+4
Change-Id: I02fc50820cccc66aed702a97a9928981e73b43cf Signed-off-by: Taesub Kim <taesub.kim@samsung.com>
2015-08-27dnsproxy: Fix crash on closing socketsubmit/tizen/20150902.062838accepted/tizen/wearable/20150902.101358accepted/tizen/tv/20150902.101343accepted/tizen/mobile/20150902.101338Saurav Babu1-4/+9
Change-Id: Ie99a531c8d9573ab2db41ed3ea9e2ecd3cce5284 Signed-off-by: Saurav Babu <saurav.babu@samsung.com>
2015-08-19Remove the smack_fsetlabel for system::use_internetsubmit/tizen/20150819.025736accepted/tizen/wearable/20150819.072331accepted/tizen/tv/20150819.072302accepted/tizen/mobile/20150819.072249hyunuktak1-7/+0
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com> Change-Id: Iae03c564dfba3b9fd35ca751856aecbfcc58d7fc
2015-08-07Base Code merged to SPIN 2.4submit/tizen/20150810.034432hyunuktak1-67/+89
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com> Change-Id: I84a42375b5c59739e4caca1f726699ea7647ef17
2015-07-15Add tizen extend code for dns proxysubmit/tizen/20150715.043627accepted/tizen/wearable/20150715.064106accepted/tizen/tv/20150715.064056accepted/tizen/mobile/20150715.064045hyunuktak1-2/+373
Change-Id: Ib54bbd745645a53c86bb69655529f809b6586621 Signed-off-by: Seonah Moon <seonah1.moon@samsung.com>
2014-10-29Imported Upstream version 1.26upstream/1.26Zhang zhengguang1-33/+91
2014-07-17Imported Upstream version 1.24upstream/1.24Zhang zhengguang1-231/+499
2013-04-30dnsproxy: Do not unref g_io_channel if we know it is nullJukka Rissanen1-4/+8
Currently tethering does not support IPv6 so its listener is not created and is null. This will cause following output connmand[18363]: src/dnsproxy.c:destroy_tcp_listener() index 31 (connmand:18363): GLib-CRITICAL **: g_io_channel_unref: assertion `channel != NULL' failed connmand[18363]: src/dnsproxy.c:destroy_udp_listener() index 31 (connmand:18363): GLib-CRITICAL **: g_io_channel_unref: assertion `channel != NULL' failed
2013-04-26dnsproxy: Conditional jump depends on uninitialized valueJukka Rissanen1-1/+1
This came from Daniel when running ConnMan using valgrind ==20635== Conditional jump or move depends on uninitialised value(s) ==20635== at 0x49ECF4: get_name (dnsproxy.c:867) ==20635== by 0x49F3F7: parse_response (dnsproxy.c:1096) ==20635== by 0x49FD40: cache_update (dnsproxy.c:1410) ==20635== by 0x4A0FF3: forward_dns_reply (dnsproxy.c:1803) ==20635== by 0x4A15D9: udp_server_event (dnsproxy.c:1912) ==20635== by 0x3331E47A54: g_main_context_dispatch (gmain.c:2715) ==20635== by 0x3331E47D87: g_main_context_iterate.isra.24 (gmain.c:3290) ==20635== by 0x3331E48181: g_main_loop_run (gmain.c:3484) ==20635== by 0x44B600: main (main.c:670)
2013-04-26dnsproxy: Return proper return code if listener_table is missingJukka Rissanen1-1/+1
The listener_table can be NULL if we have started connman with -r option. Because we return < 0 value to caller in this case, the caller, e.g. the tethering code, has a possibility to change its functionality, e.g. the tethering code can fall back to some other DNS servers.
2013-04-08dnsproxy: Fix cached message length correctlyJukka Rissanen1-1/+5
We must copy the response buffer before fixing the packet length. Otherwise the packet length will go wrong if the request contained EDNS0 data.
2013-04-05dnsproxy: Handle partial TCP messages from clientJukka Rissanen1-65/+410
We were not handling client sent partial TCP messages correctly. This meant that ConnMan would block if the client using TCP would not send full DNS request. When a new TCP client connects in tcp_listener_event(), a new TCP channel is created to handle a partial client message if all of the message is not already available. The partial TCP message is patched together in tcp_client_event(). When all of the TCP message has been received, the message is processed in read_tcp_data(). The client has to send the DNS request within two seconds before the connection is closed by ConnMan.
2013-04-05dnsproxy: Create cache if it is missing when doing lookupJukka Rissanen1-42/+56
2013-04-05dnsproxy: Fix memory leak when request timeoutsJukka Rissanen1-13/+13
2013-04-05dnsproxy: Avoid null pointer accessJukka Rissanen1-2/+2
2013-04-05dnsproxy: Do not add or remove ::1 serverJukka Rissanen1-0/+6
2013-04-05dnsproxy: Use ::1 when refreshing because of the address familyJukka Rissanen1-1/+1
2013-04-05dnsproxy: Add or remove ::1 to/from resolv.conf when necessaryJukka Rissanen1-9/+35
We add IPv6 loopback address to resolv.conf if we have created an IPv6 listening socket to port 53. Also remove ::1 from resolv.conf when deleting the proxy.
2013-04-05dnsproxy: Listen only on needed addressesJukka Rissanen1-91/+225
Do not bind to ANY address so that other DNS server applications can be used on the same host for interfaces that are not managed by ConnMan. This means that we only create DNS listeners on loopback and tethering interfaces.
2013-03-22dnsproxy: Make sure we are not accessing null hashJukka Rissanen1-0/+6
If dnsproxy is not in use, like when connman has been started with -r option, then the listener_table will be NULL which can cause crash in hash table lookup call.
2013-01-18dnsproxy: DNS response answer count was incorrectly setJukka Rissanen1-1/+1
We set the answer count in host byte order instead of network byte order when sending cached AAAA record. This problem is only seen in special case when an AAAA record is generated by us when there is IPv4 address in cache but no IPv6 address for the host.
2012-11-27dnsproxy: Fix hash table comparison function to avoid crashPatrik Flykt1-1/+1
2012-11-22core: Use interface index instead of interface namePatrik Flykt1-73/+87
Service and network code use only interface indexes. Convert the rest of the code using interface names to use interface indexes instead. The files affected are: include/resolver.h src/connman.h src/dnsproxy.c src/resolver.c src/rtnl.c src/service.c src/tethering.c As the network and service code used interface indexes, the interface name had to be looked up via a SIOCGIFNAME ioctl when needed. If a service was removed due to the interface and network being taken down, the lookup wouldn't work. This caused DNS servers to be left behind with broken sockets since removing the DNS servers was done using the interface name.
2012-11-19dnsproxy: Use TCP connections only for the intended requestPatrik Flykt1-0/+5
The DNS proxy code creates and uses a TCP connection only for a single request at a time. A TCP DNS proxy is added to the end of the server list, but should not be used for generic requests as the connection will be closed down after the response to the initial request. Any other requests sent over the connection will silently disappear. Add a check to ignore TCP DNS servers for generic lookups.
2012-11-19dnsproxy: Check the result of socket creation when resolvingPatrik Flykt1-2/+6
If the socket creation failed, continue with the next server.
2012-11-19dnsproxy: Check GIO channel for NULL before usePatrik Flykt1-3/+7
Check GIO channel for NULL before using it. Also shut down the GIO channel so that already pending input will not use the free'd structure.
2012-11-16dnsproxy: Close the UDP socket on error condition.Forest Bond1-106/+124
The socket is created again on the next request. Previously, an error condition only caused the event watch to be removed and then added again on the next request to avoid processing spurious error events. But in some network environments, the error condition is caused by an overly aggressive firewall that rejects our UDP packets and sends an ICMP error packet indicating an unreachable host and/or port. In some of these cases we can recover by using a different UDP source port for outgoing requests (i.e. by closing and re-opening the socket).
2012-10-25dnsproxy: Add reply host part length checkingPatrik Flykt1-5/+17
Check that the first part of the name is not of zero length before attempting to calculate the length of the domain part. Also ensure the domain lenght checking does not run outside of the receive buffer. Also add debug messages for ids and lengths in order to pinpoint any possible problems.
2012-10-03dnsproxy: Do not overwrite protocol and channel in server structJukka Rissanen1-5/+26
We copied too much data into addrinfo struct which corrupted the protocol and channel fields. Fixes BMC#25726
2012-09-26dnsproxy: Remove AI_PASSIVE for connected socketJukka Rissanen1-1/+1
The AI_PASSIVE is useless here because the server address is always known.
2012-09-26dnsproxy: Set recipient address when sending msg to DNS serverJukka Rissanen1-2/+12
There has been cases where send() is returning EINVAL even though there is a connected the socket. So use sendto() instead and supply the destination address when sending.
2012-07-15dnsproxy: Avoid multiple shadowing variablesMarcel Holtmann1-13/+12
2012-06-20dnsproxy: Check cache for TCP request before connecting to serverJukka Rissanen1-1/+31
It is not necessary to create TCP sockets to server if we have the answer already in the cache.
2012-06-20dnsproxy: Use DNS header in checksJukka Rissanen1-5/+7
We should use the DNS header struct when checking DNS protocol values instead of using pointer so that the TCP offset is properly taken care of.
2012-06-20dnsproxy: Add more debugging printsJukka Rissanen1-7/+17
2012-06-20dnsproxy: Check cache properly for TCP packetsJukka Rissanen1-4/+13
The DNS packet starts from offset 2 in TCP payload.
2012-06-20dnsproxy: Fix the negative caching of AAAA recordJukka Rissanen1-4/+13
Handle the TCP offset properly.
2012-06-20dnsproxy: Save DNS packet in cache always in TCP formatJukka Rissanen1-13/+57
The cached DNS packet will always contain two prefix bytes. For UDP we do not send these two extra bytes. This way we do not need to know if the cached message is from UDP or TCP query.
2012-06-20dnsproxy: Do not generate SIGPIPEJukka Rissanen1-6/+6
Instead of generating SIGPIPE, just return EPIPE error if TCP stream is broken. This way we cannot get aborted if we receive SIGPIPE (seen this happening).
2012-06-18dnsproxy: Fix flushing pending requestsPaulo Pizarro1-19/+15
2012-06-18dnsproxy: Release all the fields of the request after forward dns replyPaulo Pizarro1-5/+1
2012-06-18dnsproxy: Avoid duplication of domains in the TCP server domain listPaulo Pizarro1-15/+2
The domain list is created in the tcp_server_event function at connection time (G_IO_OUT event), so it is not necessary to create it here too.
2012-06-18dnsproxy: If no request was sent then the TCP server is destroyedPaulo Pizarro1-2/+17
2012-06-18dnsproxy: If the answer is in the cache, the TCP request is releasedPaulo Pizarro1-23/+28
2012-06-18dnsproxy: Only one copy of the relevant buffers will be made to a TCP requestPaulo Pizarro1-37/+38
This copy will be made after scanning the list of nameservers and only if at least one TCP server is created. Otherwise, it will be sent an error response to the request.
2012-06-11dnsproxy: Do not print too many info messagesJukka Rissanen1-6/+6
Convert connman_info() into DBG() in order to avoid excessive logging when debug prints are disabled.