[syslinux] [PATCH] efi: reuse UDP port with sendto

Gene Cumm gene.cumm at gmail.com
Thu Nov 28 18:49:28 PST 2013


On Thu, Nov 28, 2013 at 9:47 PM, Gene Cumm <gene.cumm at gmail.com> wrote:
> On Thu, Nov 28, 2013 at 9:34 PM, Celelibi <celelibi at gmail.com> wrote:
>> Without an assigned source port, Transmit function assign a random new
>> source port to the packet being sent. It thus have to be set before
>> calling Transmit if the source port have already been decided.
>> Conversly, we have to save the assigned port to reuse it later if
>> needed.
>>
>> Resolve bug #35.
>>
>> Signed-off-by: Celelibi <celelibi at gmail.com>
>> ---
>>  efi/udp.c | 18 ++++++++++++++++++
>>  1 file changed, 18 insertions(+)
>>
>> diff --git a/efi/udp.c b/efi/udp.c
>> index 59bb426..7271f1f 100644
>> --- a/efi/udp.c
>> +++ b/efi/udp.c
>> @@ -336,6 +336,9 @@ void core_udp_sendto(struct pxe_pvt_inode *socket, const void *data,
>>
>>      memset(&udata, 0, sizeof(udata));
>>
>> +    /* Re-use the existing local port number if any */
>> +    udata.StationPort = socket->net.efi.localport;
>> +
>
> As HPA noted, this shouldn't be saved here.  Commit 7ec052b on my
> branch efi-fixes (will be renamed to efi-fixes-for-mfleming once Jason
> gives more feedback).

To clarify, this code-quote reuses (needed) while the removed one
saves and should be in core_udp_open().  Perhaps a fallback-save in
here if the local port is somehow still NULL.

-- 
-Gene


More information about the Syslinux mailing list