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)

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail
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 Wed, 23 Dec 2015 11:52:09 +0100
Lines 70
Approved bug-bash@gnu.org
Message-ID <mailman.435.1450867933.843.bug-bash@gnu.org> (permalink)
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type multipart/mixed; boundary=001a11c31f528c276a05278e8312
X-Trace usenet.stanford.edu 1450867933 17880 208.118.235.17 (23 Dec 2015 10:52:13 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash <bug-bash@gnu.org>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=JuE2nbPyEkgp8le3aljAvCwo7BKikFCJzdOCCkIdieE=; b=PqLCrb1YXwg4xdP79TQ+76yRChoxIME6J2ih0NVBlffjfju4zs9pboe4AC7kwfBfdP P5WAFeE6E5TVLDLaBX6nXQt0JfXmhvd63yEWVdz/kaFe2Cttoh0eymXfOEozZtFsFTQH +ul/+4+lsqHP1L4wdQ8XUDc67YhdSvSggyvlFbrE3iuHWjlLNIbUsglRoxsnmN9NBrSC UepOSDUWyPsbkqA00h2PNTJwwJ+gvWkb2OZHlt8K7bnMYb95B1luUXhfq2dX9Pnk7z4V T/QA2o4Tj0zRn5jdoN/FwTD1T1OGkwzX7egow/Inm0/JQfgt7CSJVaaJolP6rMe5RM89 kqmA==
X-Received by 10.112.161.131 with SMTP id xs3mr10441996lbb.0.1450867929383; Wed, 23 Dec 2015 02:52:09 -0800 (PST)
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From 2a00:1450:4010:c04::22d
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.14
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:12096

Show key headers only | 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