Hi Arron,

On Tue, Sep 13, 2011 at 10:23:27PM -0400, Yu A Wang wrote:
> When we resolv hostname, we will append the domain name then we may
> get question section mismatch error. After we get the DNS reply
> we can remove the domain name again. This works well with one host
> with only a A record, it may failed when the reply with many cnames
> or additional records due to message compression error. But in a
> local network we only resolv hostname will not meet these issues.
The patch looks good, some comments though: 


> @@ -393,6 +394,7 @@ static int ns_resolv(struct server_data *server, struct 
> request_data *req,
>               if (err < 0)
>                       return -EIO;
>  
> +             req->append_domain = TRUE;
You don't need to set this flag for every domain on the domain list.
If the domain list is not empty and we are appending a domain, then you can
set this flag before entering the for loop.


> @@ -428,6 +430,21 @@ static int forward_dns_reply(unsigned char *reply, int 
> reply_len, int protocol)
>       req->numresp++;
>  
>       if (hdr->rcode == 0 || req->resp == NULL) {
> +             if (req->append_domain == TRUE) {
> +                     unsigned char *ptr;
> +                     uint8_t len;
> +                     unsigned int remove_len;
> +
> +                     ptr = reply + offset + sizeof(struct domain_hdr);
> +                     len = *ptr;
> +                     remove_len = strlen((const char *)ptr) - len - 1;
> +
> +                     memmove(ptr + len + 1, ptr + len + remove_len + 1,
> +                                     reply_len - (ptr - reply + remove_len));
> +
> +                     reply_len = reply_len - remove_len;
> +             }
Ok, so the dnsproxy code is already complicated enough, I would appreciate if
you could comment that code. Yes, you're basically removing everything but the
first string, and I'm fine with it, but please add some comments here.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to