From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1X2lwy-0002bu-GZ for mharc-grub-devel@gnu.org; Thu, 03 Jul 2014 14:41:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54884) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2lws-0002b7-6m for grub-devel@gnu.org; Thu, 03 Jul 2014 14:41:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X2lwm-0008Nd-UP for grub-devel@gnu.org; Thu, 03 Jul 2014 14:41:34 -0400 Received: from mail-la0-x22d.google.com ([2a00:1450:4010:c03::22d]:38018) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2lwm-0008NG-Ma for grub-devel@gnu.org; Thu, 03 Jul 2014 14:41:28 -0400 Received: by mail-la0-f45.google.com with SMTP id hr17so471415lab.4 for ; Thu, 03 Jul 2014 11:41:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type; bh=PA98/jX29aJyOZV1v1xsgVR4S1iuwBUnJN3DpEl6yf8=; b=JgZrwxqwl4Jz6T0izqgCUVgp2CBAQBRXXbRNiIUzO9vUXqXaRDGgFbIkhA4oYyDiRM Y4zVyw0gBlIwR7ZyJ0rEJ/SazjgNr2LiqkmWUHjKh24O8b6SVeJ2wXuT3tFmEsexxIFu dCiXcR9yU2J3bty1wzevqFOeOZOupKCKfFE5+TgSI27YtGLLQCkZKhDLO2lnpVlyDiQ1 CViIyk8e3/GJvGLLeU2nawx6xTacAkkg6Te34Sc37yodZEh5YvFsMDrZeVJFPaRS0PUQ AvFaw3lPaHz+4b1M5nium9iA/r+EorukQq8weN532OXuKbNa9nDlMfrrCsw48ZG3fMCY KUHg== X-Received: by 10.152.185.104 with SMTP id fb8mr2650966lac.64.1404412887482; Thu, 03 Jul 2014 11:41:27 -0700 (PDT) Received: from opensuse.site (ppp94-29-76-101.pppoe.spdop.ru. [94.29.76.101]) by mx.google.com with ESMTPSA id ar1sm36904526lbc.3.2014.07.03.11.41.25 for (version=SSLv3 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 03 Jul 2014 11:41:26 -0700 (PDT) Date: Thu, 3 Jul 2014 22:41:25 +0400 From: Andrey Borzenkov To: The development of GNU GRUB Subject: Re: [PATCH] Avoid reusing the same TCP port number Message-ID: <20140703224125.2e8962fa@opensuse.site> In-Reply-To: References: X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.22; x86_64-suse-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/1lTxx8.PYV1WLFqF2j0MY/s"; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::22d Cc: valentin@unimplemented.org, fritsch@genua.de 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, 03 Jul 2014 18:41:39 -0000 --Sig_/1lTxx8.PYV1WLFqF2j0MY/s Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: quoted-printable =F7 Tue, 1 Jul 2014 13:53:49 +0200 Valentin Dornauer =D0=C9=DB=C5=D4: > Hi! > Attached is another patch from our internal repository. I am not > certain that it will work under any circumstances and it has only > been tested on x86 hardware, so please use with care! >=20 > We had some very annoying issues with quick consecutive reboots, > as GRUB would reuse the same TCP port number without properly closing > the connection (especially when a boot fails). The remote host > (Apache web server) would then discard the new connection and booting > from HTTP would fail. >=20 >=20 > I've included excerpts from the original commit message to further > clarify the problem: >=20 > Even if a grub boot succeeds, the TCP connection for the last > HTTP request stays in state LAST_ACK for some reason. If the > next reboot happens before the web server discards that connection, > this will lead to the server not responding to the new SYN on > the same port number. >=20 > Make the initial port number depend on the RTC time. Increase > it by 80 for every second, wrapping around after 512 seconds. > The 80 is used because grub opens around 3 connections for every > file. Use & 511 instead of modulo because of linking problems. >=20 > Original patch by Stefan Fritsch . >=20 > - Valentin >=20 May be you can simply use grub_get_time_ms()? After all, we are not interested in exact time, just in some pseudo-random distribution. It should have less overhead than grub_get_datetime().=20 --Sig_/1lTxx8.PYV1WLFqF2j0MY/s Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iEYEARECAAYFAlO1o9UACgkQR6LMutpd94yUiQCfW58M545cv33vajr2SuFYkq6l w/EAnRGv4EwS9VshaDNEvIdRuM3QKMWL =q3K3 -----END PGP SIGNATURE----- --Sig_/1lTxx8.PYV1WLFqF2j0MY/s--