[zeromq-dev] An extension to CZMQ for ephemeral ports
murf at parsetree.com
Mon Aug 25 16:23:04 CEST 2014
On Mon, Aug 25, 2014 at 1:22 AM, Pieter Hintjens <ph at imatix.com> wrote:
> Nice, especially the randomization. Would you send this back to CZMQ
> as a pull request?
> On Mon, Aug 25, 2014 at 8:10 AM, Steve Murphy <murf at parsetree.com> wrote:
> > Hello---
> > I've got a fork of czmq wherein I added code to give developers
> > a little more control over "ephemeral" ports. (You know, where
> > port is specified as "*" in "tcp://22.214.171.124:*"
> > Normally, the * notation for a port means for the software to
> > pick the first free port in the range C000 to FFFF (49152 to 65535.
> > With this extension, you can now say:
> > tcp://*:*[50123-52123]
> > interpreted: bind to all interfaces; choose the first open port in
> > range between 50123 and 52123.
> > tcp://*:![40000-50000]
> > interpreted: bind to all interfaces; choose a random port between
> > 40-thousand
> > and 50-thousand.
> > This is done for both zsock and zsocket classes. Documentation updated.
> > Self-tests
> > added.
> > HUH? WHY did you do this? WHY the HECK would this be useful?
> > Short answers:
> > a. I'm a crazy guy doing crazy things.
> > b. Someday, maybe, maybe not, someone might have a cool, nifty
> > exploit against zeromq sockets. They might even know the best
> > to
> > look for sockets would be at the beginning of the range 49152 to
> > 64K. Why
> > make it easy for them to find your sockets?
> > c. Random port assignments (in this case, using the "!" instead of
> > might be a little faster than the "first free port" search,
> > especially
> > if you request lots of ephemeral ports. Unless the range
> > is very crowded, "!" will most likely find a free port on the
> > attempt.
> > I tested this code using some simple test sets.
> > Check it out! See: https://github.com/WyoMurf/czmq.git
> > murf
> > --
> > Steve Murphy
> > ParseTree Corporation
> > 57 Lane 17
> > Cody, WY 82414
> > ✉ murf at parsetree dot com
> > ☎ 307-899-5535
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
57 Lane 17
Cody, WY 82414
✉ murf at parsetree dot com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the zeromq-dev