bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] store local port after successful connection via network redirec


From: Piotr Grzybowski
Subject: [patch] store local port after successful connection via network redirections (/dev/{tcp,udp}/host/port)
Date: Wed, 23 Dec 2015 11:52:09 +0100

Hi.

 I have had a need to know the number of the client port after successful

exec 4<>/dev/tcp/${host}/${port}
[..]

 The attached patch stores the local, client port in the variable
LOCALPORT. Would you accept this new feature?
 We need it due to specific on-site security considerations.
 There is another benefit: after last discussion about tempfile this
would give another source of natural randomness along with $$ and $!.
Employing the kernel for generating the random sequence is the most
portable way to get pseudo random numbers, since most kernels
randomize pids and ports to some extent.
 The variable can go by any other name, and I am not sure about the
need for extra #ifdefs concerning ipv6 (I assumed that if we have
networking we also have ipv6, and in both cases struct
sockaddr_storage).

cheers,
pg

Attachment: 0001-store-local-port-in-network-redirections.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]