From: Marcel Holtmann Date: Mon, 14 Dec 2009 02:28:53 +0000 (+0100) Subject: Handle additional DNS records when sending alternate request X-Git-Tag: 2.0_alpha~3079 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ad8fce0c1b11756e1fe04bf04ff205f18ff5dfad;p=framework%2Fconnectivity%2Fconnman.git Handle additional DNS records when sending alternate request The outbound queries that get qualified with the search domain need to handle additional records. Otherwise ENDS0 and other options might fail. --- diff --git a/plugins/dnsproxy.c b/plugins/dnsproxy.c index 9f1c265..8f28214 100644 --- a/plugins/dnsproxy.c +++ b/plugins/dnsproxy.c @@ -610,7 +610,11 @@ static gboolean listener_event(GIOChannel *channel, GIOCondition condition, if (data->domain != NULL) { unsigned char alt[1024]; struct domain_hdr *hdr = (void *) &alt; - int altlen; + int altlen, domlen; + + domlen = strlen(data->domain) + 1; + if (domlen < 5) + continue; alt[0] = req->altid & 0xff; alt[1] = req->altid >> 8; @@ -623,12 +627,12 @@ static gboolean listener_event(GIOChannel *channel, GIOCondition condition, 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 - domlen, + len - altlen + domlen); - err = send(sk, alt, altlen + 12 + 4, 0); + err = send(sk, alt, altlen + 4, 0); req->numserv++; }