Hi,

while reviewing Paolo's dnsproxy patches last week I noticed
that we were not caching DNS TCP packets at all. Fortunately the
issue has not caused any problems, we just have not cached
the TCP queries but always asked them from the upstream nameserver.
Following patches fixes this issue.

Patch #1 sets the MSG_NOSIGNAL flag when sending data. The
flag is only used in TCP and it makes the socket to return EPIPE
instead of raising SIGPIPE. The SIGPIPE caused aborts in
connman even if we were catching it.

Patch #2 and #3 save the packet into cache in TCP format. This way
we do not need to know if the cached packet was from UDP or TCP
query. When sending UDP DNS response, we just skip the first two
bytes in the cached message.

Patch #4 checks the cache for TCP packets properly (TCP offset is
correctly verified).

Patch #5 adds more debugging into code, this was usefull when
figuring out the problems in DNS caching.

Patch #6 checks various values from DNS packet using domain_header
struct instead of directly poking the message bytes.

Patch #7 checks the DNS cache before creating TCP connections to
upstream nameservers. This works now the same way as UDP caching.

Cheers,
Jukka


Jukka Rissanen (7):
  dnsproxy: Do not generate SIGPIPE
  dnsproxy: Save DNS packet in cache always in TCP format
  dnsproxy: Fix the negative caching of AAAA record
  dnsproxy: Check cache properly for TCP packets
  dnsproxy: Added more debugging prints
  dnsproxy: Use DNS header in checks
  dnsproxy: Check cache for TCP request before connecting to server

 src/dnsproxy.c |  179 ++++++++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 140 insertions(+), 39 deletions(-)

-- 
1.7.9.5

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

Reply via email to