On Sat, 2009-12-05 at 23:45 +0100, Marcel Holtmann wrote:
> Hi David,
> 
> > > nobody said that our DNS proxy supports TCP. We are doing UDP only.
> > 
> > Can you show me how to make the example lookup I demonstrated actually
> > work, without editing /etc/resolv.conf to point to a working nameserver?
> 
> problem here is that the DNS response you are receiving is too big for
> UDP DNS protocol. So it retries over TCP. And the proxy does not support
> TCP right now. So we have to add DNS over TCP support to the proxy.

We might yet conclude that, but for now it looks like EDNS0 support
might suffice:

diff --git a/src/resolver.c b/src/resolver.c
index 3c78d21..e87b23b 100644
--- a/src/resolver.c
+++ b/src/resolver.c
@@ -258,7 +258,8 @@ static int resolvfile_append(const char *interface, const 
char *domain,
        err = ftruncate(fd, 0);
 
        cmd = g_strdup_printf("# Generated by Connection Manager\n"
-                                               "nameserver %s\n", server);
+                             "options edns0\n"
+                             "nameserver %s\n", server);
 
        len = write(fd, cmd, strlen(cmd));
 


This stops it from fucking up the outbound queries when it qualifies
them with the search domain (you were assuming there were no additional
records _and_ that it was an IN A query, which was fairly broken even in
the absence of EDNS0).

--- plugins/dnsproxy.c~ 2009-12-09 08:04:13.000000000 +0000
+++ plugins/dnsproxy.c  2009-12-09 09:14:00.000000000 +0000
@@ -578,10 +578,10 @@ static gboolean listener_event(GIOChanne
                        if (altlen < 0)
                                continue;
 
-                       alt[altlen + 12] = 0x00;
-                       alt[altlen + 13] = 0x01;
-                       alt[altlen + 14] = 0x00;
-                       alt[altlen + 15] = 0x01;
+                       altlen += 12;
+                       
+                       memcpy(alt + altlen, buf + altlen - 
strlen(data->domain) - 1,
+                              len - altlen + strlen(data->domain) + 1);
 
                        err = send(sk, alt, altlen + 12 + 4, 0);
 

Next trick is to stop it from fucking up the responses...

-- 
dwmw2

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

Reply via email to