From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1aYL2s-0002NW-Ig for mharc-grub-devel@gnu.org; Tue, 23 Feb 2016 17:03:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36554) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYL2p-0002LU-Mk for grub-devel@gnu.org; Tue, 23 Feb 2016 17:03:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aYL2m-0005sg-Fp for grub-devel@gnu.org; Tue, 23 Feb 2016 17:02:59 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:46787) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYL2m-0005sX-7v for grub-devel@gnu.org; Tue, 23 Feb 2016 17:02:56 -0500 Received: from pps.filterd (m0044008.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.15.0.59/8.15.0.59) with SMTP id u1NLx9ER024433; Tue, 23 Feb 2016 14:02:53 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=subject : to : references : cc : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=facebook; bh=pvb/6cyqComjh9CBagatvm8NeRHdGiyeAX8BOyJdGYY=; b=fZ4TdKcf3vGwEX9vWiJ5o2rGiFKHph/SI+CXbYz3ZHLrIaAbow1zqVq9h6727xs58PvK GFPAFzx7fOztpyKmM7SRFnn0e/WUXRVqzB84Mp42jTbeVX2fWEruBWOLkisE8zwZwKzq OysaQmb67QMdQasTdc6tJpaI3qJxbkimRJM= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 218wxm0hvy-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Tue, 23 Feb 2016 14:02:53 -0800 Received: from localhost.localdomain (192.168.52.123) by mail.thefacebook.com (192.168.16.23) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 23 Feb 2016 14:02:48 -0800 Subject: Re: [PATCH 10/14] dns: poll card between each dns request To: Andrei Borzenkov , The development of GNU GRUB References: <1455139268-3241273-1-git-send-email-jbacik@fb.com> <1455139268-3241273-11-git-send-email-jbacik@fb.com> From: Josef Bacik Message-ID: <56CCD707.5090505@fb.com> Date: Tue, 23 Feb 2016 17:02:47 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.52.123] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-02-23_12:, , signatures=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 67.231.145.42 Cc: Kernel Team X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Feb 2016 22:03:00 -0000 On 02/15/2016 01:45 AM, Andrei Borzenkov wrote: > On Thu, Feb 11, 2016 at 12:21 AM, Josef Bacik wrote: >> If we have dns servers that we prefer to get AAAA records from we'll send a >> packet and immediately check data.naddresses to see if we got a response. If we >> didn't we'll then send a request for an A record, and _then_ we'll poll the >> card. So if the DNS server doesn't respond between us sending the packet and >> checking data.naddresses we'll send a request for the A record and then poll the >> card. Instead we need to make sure we poll after we issue each request to make >> sure we give the server enough time to respond to our initial request. >> >> Signed-off-by: Josef Bacik >> --- >> grub-core/net/dns.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/grub-core/net/dns.c b/grub-core/net/dns.c >> index 82a3307..86e609b 100644 >> --- a/grub-core/net/dns.c >> +++ b/grub-core/net/dns.c >> @@ -587,12 +587,12 @@ grub_net_dns_lookup (const char *name, >> grub_errno = GRUB_ERR_NONE; >> err = err2; >> } >> + grub_net_poll_cards (200, &data.stop); > > One consideration is that it will increase timeouts in case of > non-responsive servers, as now they are processed sequentially. > > But more importantly, this is still hit and miss - we rely on delivery > order which is non-deterministic. We really need to ask for all and > filter on receiving side. Two possible implementations are > > 1. Keep track of IPv4 and IPv6 answers separately; if non-preferred > answer is received, continue to wait for preferred one until timeout. > > 2. Queries for both A and AAAA in the same packet and filter out answers. > > The 2 looks better. It avoids extra timeouts (at least if we assume > that all DNS servers are equally authoritative) because as soon as we > get any response we can stop polling. > > This will also indirectly fix another reported issue as we now can > ignore any duplicate packet. > > Would you consider implementing it? Got this all implemented, started testing it and it just wasn't working, come to find out our dns server (also bind) doesn't support more than one question per packet. So instead I'm going to keep track of which type my DNS servers support and only do those questions. Updating the cache is kind of a pain in the ass, I'll probably make it so we just update in place the existing cache with the new answers. Thanks, Josef