From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1YqNJr-0004Ry-Ig for mharc-grub-devel@gnu.org; Thu, 07 May 2015 11:02:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51775) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqNJk-0004N0-UX for grub-devel@gnu.org; Thu, 07 May 2015 11:02:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YqNJe-0001tc-Vi for grub-devel@gnu.org; Thu, 07 May 2015 11:02:28 -0400 Received: from mail-wi0-x22c.google.com ([2a00:1450:400c:c05::22c]:38187) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqNJe-0001tY-Ol for grub-devel@gnu.org; Thu, 07 May 2015 11:02:22 -0400 Received: by wiun10 with SMTP id n10so63377761wiu.1 for ; Thu, 07 May 2015 08:02:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=3BwMJ9Uk/kLiXMeCaS5jGP5o3BWc3NyTeQi1W+P9TKc=; b=pbfxHELsnI8udKCHtxB7/49ZIzswKRxSBdPYcaOqId7OrkYuDsTllV2S6DawoKNeS7 mpmWa28F+lkNGf8mh8p3fq2WAHGKkAb4XpVtrnMdQfnAbiXfKNZBrxpjLVKcd+3mg+kD DpR+/cRAwpH/bIzX99Qrn1iT+fdl83ZJDVpCVIok01yHvn1O9J7tL0yIWVSQ1lF9gT4q /05yX1kmiwmr7qzYgP53RxuzinsywSct3uXlMdQsuSSjZYJ4yGIhTWdtJu4Nr8P1XM4D p7FH7cXgn2tSWCXb1x40q+1f3UXSZt9fxCRc9GG8cx5W/tP0H1MorILb/xwAcd8xiPq5 l2Dg== X-Received: by 10.194.241.194 with SMTP id wk2mr8536655wjc.58.1431010942090; Thu, 07 May 2015 08:02:22 -0700 (PDT) Received: from ?IPv6:2620:0:105f:fd00:863a:4bff:fe50:abc4? ([2620:0:105f:fd00:863a:4bff:fe50:abc4]) by mx.google.com with ESMTPSA id ng5sm4375789wic.24.2015.05.07.08.02.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 May 2015 08:02:21 -0700 (PDT) Message-ID: <554B7E7C.2030503@gmail.com> Date: Thu, 07 May 2015 17:02:20 +0200 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.6.0 MIME-Version: 1.0 To: The development of GNU GRUB Subject: Re: DNS endianness References: <20140922205325.132df618@opensuse.site> In-Reply-To: <20140922205325.132df618@opensuse.site> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="KOSA0q29gherUnjijr1NKAUxCDQA6pUjH" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::22c 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: Thu, 07 May 2015 15:02:34 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --KOSA0q29gherUnjijr1NKAUxCDQA6pUjH Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable It's purely code aesthetics but go ahead. Andrei Borzenkov wrote: > This does not sound right ... >=20 > static grub_err_t > recv_hook (grub_net_udp_socket_t sock __attribute__ ((unused)), > struct grub_net_buff *nb, > void *data_) > { > ... > head =3D (struct dns_header *) nb->data; > ... > for (i =3D 0; i < grub_cpu_to_be16 (head->qdcount); i++) > { >=20 > We sure want to convert *to* cpu, not *from* cpu here? Same in all > other places in this function. >=20 > Do I miss something obvious here? Or how about patch below? >=20 > diff --git a/grub-core/net/dns.c b/grub-core/net/dns.c > index 0b771fb..9d0c8fc 100644 > --- a/grub-core/net/dns.c > +++ b/grub-core/net/dns.c > @@ -262,7 +262,7 @@ recv_hook (grub_net_udp_socket_t sock __attribute__= ((unused)), > grub_netbuff_free (nb); > return GRUB_ERR_NONE; > } > - for (i =3D 0; i < grub_cpu_to_be16 (head->qdcount); i++) > + for (i =3D 0; i < grub_be_to_cpu16 (head->qdcount); i++) > { > if (ptr >=3D nb->tail) > { > @@ -277,7 +277,7 @@ recv_hook (grub_net_udp_socket_t sock __attribute__= ((unused)), > ptr +=3D 4; > } > *data->addresses =3D grub_malloc (sizeof ((*data->addresses)[0]) > - * grub_cpu_to_be16 (head->ancount)); > + * grub_be_to_cpu16 (head->ancount)); > if (!*data->addresses) > { > grub_errno =3D GRUB_ERR_NONE; > @@ -286,7 +286,7 @@ recv_hook (grub_net_udp_socket_t sock __attribute__= ((unused)), > } > reparse_ptr =3D ptr; > reparse: > - for (i =3D 0, ptr =3D reparse_ptr; i < grub_cpu_to_be16 (head->ancou= nt); i++) > + for (i =3D 0, ptr =3D reparse_ptr; i < grub_be_to_cpu16 (head->ancou= nt); i++) > { > int ignored =3D 0; > grub_uint8_t class; >=20 > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel >=20 --KOSA0q29gherUnjijr1NKAUxCDQA6pUjH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iF4EAREKAAYFAlVLfnwACgkQmBXlbbo5nOsI+QD6A4bfm5r5C3F8U/r7tkW6iFKS EdrwzS4jK70X+vgLGpkBAKnGEauzG7Po6jRL7D/t5lMgk9LC1U4xKQ1HeKwQ9cLv =FGLl -----END PGP SIGNATURE----- --KOSA0q29gherUnjijr1NKAUxCDQA6pUjH--