Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #12096

[patch] store local port after successful connection via network redirections (/dev/{tcp,udp}/host/port)

From Piotr Grzybowski <narsil.pl@gmail.com>
Newsgroups gnu.bash.bug
Subject [patch] store local port after successful connection via network redirections (/dev/{tcp,udp}/host/port)
Date 2015-12-23 11:52 +0100
Message-ID <mailman.435.1450867933.843.bug-bash@gnu.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

[patch] store local port after successful connection via network redirections (/dev/{tcp,udp}/host/port) Piotr Grzybowski <narsil.pl@gmail.com> - 2015-12-23 11:52 +0100

csiph-web