Commit Graph

46 Commits

Author SHA1 Message Date
Luca Boccassi
da31917f4f Relicense from LGPL3 + exceptions to Mozilla Public License version 2.0
Relicense permission collected from all relevant authors as tallied at:
https://github.com/rlenferink/libzmq-relicense/blob/master/checklist.md
The relicense grants are collected under RELICENSE/ and will be moved
to the above repository in a later commit.

Fixes https://github.com/zeromq/libzmq/issues/2376
2023-06-05 20:31:47 +01:00
Dimitris Apostolou
6b8dd84a63
Fix typos 2022-02-11 00:45:06 +02:00
Andy Heroff
2998ff34aa
Problem: No direct support for setting socket priority (#4118)
* Problem: No direct support for setting socket priority

Solution: Add ZMQ_PRIORITY socket option, which sets the
SO_PRIORITY socket option on the underlying socket. This
socket option is not supported under Windows. Check option
and set socket option on creation of underlying socket.
2021-01-06 22:22:41 +00:00
Simon Giesecke
bd4c2d60ba Problem: zmq::listener_t::create_wildcard_address not reusable in ip.cpp
Solution: move to ip.hpp as zmq::create_ipc_wildcard_address
2019-12-06 19:11:50 +01:00
Andrei Tomashpolskiy
2aa87c94cc UDP engine aborts on networking-related errors from socket syscalls (2) #2862 (#3640)
* UDP engine aborts on networking-related errors from socket syscalls #2862
2019-08-25 15:55:42 +01:00
Andrei Tomashpolskiy
f48c86d077 UDP engine aborts on networking-related errors from socket syscalls #2862 (#3638)
* UDP engine aborts on networking-related errors from socket syscalls #2862

* Add relicense statement
2019-08-22 18:52:31 +01:00
Simon Giesecke
9cb1fca115 Problem: on a failure to setsockopt SO_BINDTODEVICE, libzmq asserts
Solution: return an error to the user instead
2019-02-07 09:39:02 -05:00
Simon Giesecke
3f4e64edc0 Problem: bind_to_device unnecessarily accepts a non-const string parameter
Solution: add const
2019-02-04 09:29:42 -05:00
Simon Giesecke
c581f43c97 Problem: parameter naming style inconsistent
Solution: define and apply parameter naming style: lower_case_
2018-05-26 09:34:44 +02:00
Simon Giesecke
44da0e7e42 Problem: code duplication in making sockets non-inheritable
Solution: extracted make_socket_noninheritable function
2018-05-23 11:23:33 +02:00
Simon Giesecke
e8e24030ea Problem: network initialization and shutdown functions not available for
reuse

Solution: extract into functions defined in ip.hpp

Problem: signaler_t::make_fdpair not reusable

Solution: move make_fdpair to ip.hpp

Problem: epoll worker with no fds cannot be stopped

Solution: use interruptible epoll_pwait call

Problem: insufficient unit tests for poller

Solution: add test cases
2018-02-13 18:38:17 +01:00
sigiesec
41f459e1dc Problem: formatting inconsistent
Solution: applied clang-format
2018-02-02 15:47:43 +01:00
Brian Russell
b963542e8f Add socket option BINDTODEVICE
Linux now supports Virtual Routing and Forwarding (VRF) as per:

https://www.kernel.org/doc/Documentation/networking/vrf.txt

In order for an application to bind or connect to a socket with an
address in a VRF, they need to first bind the socket to the VRF device:

    setsockopt(sd, SOL_SOCKET, SO_BINDTODEVICE, dev, strlen(dev)+1);

Note "dev" is the VRF device, eg. VRF "blue", rather than an interface
enslaved to the VRF.

Add a new socket option, ZMQ_BINDTODEVICE, to bind a socket to a device.
In general, if a socket is bound to a device, eg. an interface, only
packets received from that particular device are processed by the socket.

If device is a VRF device, then subsequent binds/connects to that socket
use addresses in the VRF routing table.
2017-07-31 15:31:47 +01:00
Luca Boccassi
31a3a06828 Problem: peer can close connection before SO_NOSIGPIPE is set
Solution: setsockopt returns EINVAL if the connection was closed by
the peer after the accept returned a valid socket. This is a valid
network error and should not cause an assert.
To handle this we have to extract the setsockopt from the stream
engine, as there's no clean way to return an error from the
constructor. Instead, try to set this option before creating the
engine in the callers, and return immediately as if the accept
had failed to avoid churn. Do the same for the connect calls by
setting the option in open_socket, so that the option for that
case is set even before connecting, so there's no possible race
condition.
Since this has to be done in 4 places (tcp/ipc listener, socks
connecter and open_socket) add an utility function in ip.cpp.
Fixes #1442
2017-01-04 17:34:33 +00:00
Constantin Rack
a539b0c6e8 Problem: copyright year is still 2015
Solution: update to 2016
2016-01-28 15:07:31 +01:00
Pieter Hintjens
8620c3e032 Problem: source file headers are somewhat confusing about LGPLv3
Of course people still "can" distributed the sources under the
LGPLv3. However we provide COPYING.LESSER with additional grants.

Solution: specify these grants in the header of each source file.
2015-06-02 22:33:55 +02:00
Pieter Hintjens
94d9a4ffdf Problem: copyright statements are out of date
Solution: update for 2015

Fixes #1320
2015-01-22 10:32:37 +01:00
Pieter Hintjens
b3b9e046ee Updated copyright statements for 2014 2014-01-02 12:00:57 +01:00
Brandon Carpenter
a018ef5e86 Add support for extending ZAP request address with IPC peer credentials.
Another take on LIBZMQ-568 to allow filtering IPC connections, this time
using ZAP.  This change is backward compatible.  If the
ZMQ_ZAP_IPC_CREDS option is set, the user, group, and process IDs of the
peer process are appended to the address (separated by colons) of a ZAP
request; otherwise, nothing changes.  See LIBZMQ-568 and zmq_setsockopt
documentation for more information.
2013-12-06 14:28:44 -08:00
Chris Laws
38bceca9ca Add ability to set and get DSCP socket option 2013-11-25 13:31:21 +10:30
Martin Hurton
7541debe6d Add get_peer_ip_address utility function
The functon returns string representation of peer's
IP address. We will need this to update ZAP implementation.
2013-07-18 10:41:31 +02:00
Pieter Hintjens
f0f16505e5 Removed corporate advertisements from source file headers
Copyrights had become ads for Sustrik's corporate sponsors, going against the original
agreement to share copyrights with the community (that agreement was: one line stating
iMatix copyright + one reference to AUTHORS file). The proliferation of corporate ads
is also unfair to the many individual authors. I've removed ALL corporate title from
the source files so the copyright statements can now be centralized in AUTHORS and
source files can be properly updated on an annual basis.
2013-03-12 13:24:57 +01:00
Ian Barber
eb14890d23 Revert "Revert "Merge branch 'master' of github.com:ianbarber/libzmq""
This reverts commit 029d3dfae2.
2012-06-12 14:43:18 +01:00
Ian Barber
029d3dfae2 Revert "Merge branch 'master' of github.com:ianbarber/libzmq"
This reverts commit 3345902979, reversing
changes made to 889b0e6f29.
2012-06-12 14:13:17 +01:00
Hiten P
db13fbf4a9 Consolidate TCP-specific common code into their own files.
The TCP keepalive tuning code has been moved into the newly added
files; this also allows future TCP-specific code to be added into
these files, without bloating the IP level code and establishes a
known file structure for other IP-based transports.

Remember: this is a no-op change, hence no API or functionality
was changed as part of this commit.
2012-06-08 18:18:52 +01:00
Sergey KHripchenko
0c3d917926 initial implementation of tuning TCP keep-alives for TCP socket
currently not fully cross-platform
work on linux
possibly work in *bsd
and could be enhanced to work on windows
2012-04-05 19:39:53 +04:00
Martin Sustrik
8e21d64c97 Copyright dates adjusted to reflect reality
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-01 18:06:11 +01:00
Martin Sustrik
ac7717b7b3 250bpm copyrights added
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-10-31 16:20:30 +01:00
Martin Sustrik
8b7ac4c2a9 Close file descriptors on exec (issue 218)
When exec is executed to start a different process image old
0MQ file descriptors could stay open, thus blocking TCP ports
and alike. This patch should solve the problem.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-09-02 15:34:12 +02:00
Martin Sustrik
b6ecb00d23 TCP address related functionality moved to tcp_address_t
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-08-18 17:40:42 +02:00
Martin Sustrik
b01a8e1751 IPC address related functionality refactored into ipc_address_t class
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-08-18 11:08:22 +02:00
Steven McCoy
57440b86e2 Add IPv6 support to tcp_listener
Signed-off-by: Steven McCoy <steven.mccoy@miru.hk>
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-08-15 08:56:00 +02:00
Steven McCoy
c27b9ac7de Update resolve_ip_interface and resolve_ip_hostname with ipv4only parameter.
Signed-off-by: Steven McCoy <steven.mccoy@miru.hk>
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-08-08 15:23:46 +02:00
Martin Sustrik
d5f3628ad0 Different connecters simplified
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-29 09:37:43 +02:00
Martin Sustrik
b45fec337a Tuning of TCP sockets is done at a single place
Instead of being spread throughout the codebase, the tuning
is done in tune_tcp_socket() function.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-28 15:13:04 +02:00
Brett Cameron
b00be2651c Different fixed to make OpenVMS port work.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-08 14:39:52 +01:00
Martin Sustrik
18b9ebea32 The copyrights in file headers updated.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-02 16:30:40 +01:00
Martin Sustrik
b358df9fff Name of "GNU Lesser Public License" corrected.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-30 15:08:28 +02:00
Martin Lucina
26b0aea24f Win32 build fixes 2010-03-03 17:01:08 +01:00
Martin Lucina
2a79a943de Add NetBSD support 2010-02-18 19:38:15 +01:00
Martin Sustrik
2634934999 IPv6 patch part 2/2 2010-01-23 08:19:30 +01:00
Martin Sustrik
34d65e22c5 Tero Marttila's Ipv6 patch - part I. 2010-01-22 13:13:52 +01:00
Martin Sustrik
2bb57ac57a ZMQII-39: Implement IPC transport 2010-01-15 14:11:39 +01:00
Martin Sustrik
4f6baf4dde Copyrights transferred from FastMQ to iMatix 2010-01-05 08:29:35 +01:00
Martin Sustrik
cc3755a16f renamed from zs to zmq 2009-08-03 11:30:13 +02:00
Martin Sustrik
4ed70a9302 initial commit 2009-07-29 12:07:54 +02:00