В Tue, 1 Jul 2014 13:53:49 +0200
Valentin Dornauer <valen...@unimplemented.org> пишет:

> 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!
> 
> 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.
> 
> 
> I've included excerpts from the original commit message to further
> clarify the problem:
> 
>     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.
> 
>     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.
> 
> Original patch by Stefan Fritsch <frit...@genua.de>.
> 
> - Valentin
> 

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(). 

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to