grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* Randomized TCP client ports
@ 2016-11-23 21:04 Walter Huf
  2016-11-25 21:47 ` Daniel Kiper
  0 siblings, 1 reply; 3+ messages in thread
From: Walter Huf @ 2016-11-23 21:04 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 581 bytes --]

In the course of developing netboot menus, and rebooting my virtual machine
often, I am running into a problem where Grub is reusing the same TCP
client ports across reboots, and my server (because of TCP TIME_WAIT)
objects to this.

I have a small change to set the initial client port based on
grub_rtc_get_time_ms(), but I'm not sure if that functionality is available
on all supported platforms. I'd like to provide a general contribution that
works on all platforms.

Is there a general way to get a pseudo-random integer that is different on
each boot?

Thank you very much!

[-- Attachment #2: Type: text/html, Size: 683 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Randomized TCP client ports
  2016-11-23 21:04 Randomized TCP client ports Walter Huf
@ 2016-11-25 21:47 ` Daniel Kiper
  2016-11-26  6:41   ` Andrei Borzenkov
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Kiper @ 2016-11-25 21:47 UTC (permalink / raw)
  To: hufman, grub-devel; +Cc: dkiper

Hi Walter,

On Wed, Nov 23, 2016 at 01:04:20PM -0800, Walter Huf wrote:
> In the course of developing netboot menus, and rebooting my virtual machine
> often, I am running into a problem where Grub is reusing the same TCP
> client ports across reboots, and my server (because of TCP TIME_WAIT)
> objects to this.
>
> I have a small change to set the initial client port based on
> grub_rtc_get_time_ms(), but I'm not sure if that functionality is available
> on all supported platforms. I'd like to provide a general contribution that
> works on all platforms.
>
> Is there a general way to get a pseudo-random integer that is different on
> each boot?

I think that you should take a look, at least, at random module,
grub-core/lib/random.c, etc.

Have a nice weekend,

Daniel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Randomized TCP client ports
  2016-11-25 21:47 ` Daniel Kiper
@ 2016-11-26  6:41   ` Andrei Borzenkov
  0 siblings, 0 replies; 3+ messages in thread
From: Andrei Borzenkov @ 2016-11-26  6:41 UTC (permalink / raw)
  To: The development of GNU GRUB, hufman; +Cc: dkiper

26.11.2016 00:47, Daniel Kiper пишет:
> Hi Walter,
> 
> On Wed, Nov 23, 2016 at 01:04:20PM -0800, Walter Huf wrote:
>> In the course of developing netboot menus, and rebooting my virtual machine
>> often, I am running into a problem where Grub is reusing the same TCP
>> client ports across reboots, and my server (because of TCP TIME_WAIT)
>> objects to this.
>>
>> I have a small change to set the initial client port based on
>> grub_rtc_get_time_ms(), but I'm not sure if that functionality is available
>> on all supported platforms. I'd like to provide a general contribution that
>> works on all platforms.
>>

This function is not universally available; it is used as implementation
of grub_get_time_ms() which you probably should use instead, as it is
guaranteed to exist.

>> Is there a general way to get a pseudo-random integer that is different on
>> each boot?
> 
> I think that you should take a look, at least, at random module,
> grub-core/lib/random.c, etc.
> 

It relies on platform providing random value and so far it works for x86
with tsc and pmtimer only.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-26  6:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-23 21:04 Randomized TCP client ports Walter Huf
2016-11-25 21:47 ` Daniel Kiper
2016-11-26  6:41   ` Andrei Borzenkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).