[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Randomized TCP client ports
From: |
Andrei Borzenkov |
Subject: |
Re: Randomized TCP client ports |
Date: |
Sat, 26 Nov 2016 09:41:07 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
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.