From 284701640bf7ddcb1fa0869661ec622d6b7010ce Mon Sep 17 00:00:00 2001 From: Martin Panter Date: Mon, 11 Apr 2016 00:38:12 +0000 Subject: Issue #26685: Raise OSError if closing a socket fails --- Doc/library/socket.rst | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Doc/library/socket.rst') diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst index c09927cf34..cd6e3105b0 100644 --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -868,6 +868,10 @@ to sockets. it is recommended to :meth:`close` them explicitly, or to use a :keyword:`with` statement around them. + .. versionchanged:: 3.6 + :exc:`OSError` is now raised if an error occurs when the underlying + :c:func:`close` call is made. + .. note:: :meth:`close()` releases the resource associated with a connection but -- cgit v1.2.1 From 7cf8527b1cd148771bd4ac2581a429db0bb95b81 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Fri, 17 Jun 2016 12:52:18 -0700 Subject: Issue #26536: socket.ioctl now supports SIO_LOOPBACK_FAST_PATH. Patch by Daniel Stokes. --- Doc/library/socket.rst | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'Doc/library/socket.rst') diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst index 84286c9c19..c63c73aae1 100644 --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -329,12 +329,17 @@ Constants .. versionadded:: 3.3 -.. data:: SIO_* +.. data:: SIO_RCVALL + SIO_KEEPALIVE_VALS + SIO_LOOPBACK_FAST_PATH RCVALL_* Constants for Windows' WSAIoctl(). The constants are used as arguments to the :meth:`~socket.socket.ioctl` method of socket objects. + .. versionchanged:: 3.6 + ``SIO_LOOPBACK_FAST_PATH`` was added. + .. data:: TIPC_* @@ -996,6 +1001,12 @@ to sockets. On other platforms, the generic :func:`fcntl.fcntl` and :func:`fcntl.ioctl` functions may be used; they accept a socket object as their first argument. + Currently only the following control codes are supported: + ``SIO_RCVALL``, ``SIO_KEEPALIVE_VALS``, and ``SIO_LOOPBACK_FAST_PATH``. + + .. versionchanged:: 3.6 + ``SIO_LOOPBACK_FAST_PATH`` was added. + .. method:: socket.listen([backlog]) Enable a server to accept connections. If *backlog* is specified, it must -- cgit v1.2.1 From 4598391a5a9e9a231bbd0f401760e3058f5d1212 Mon Sep 17 00:00:00 2001 From: R David Murray Date: Tue, 23 Aug 2016 21:12:40 -0400 Subject: #26907: add some missing getsockopt constants. Patch by Christian Heimes, reviewed by Martin Panter. --- Doc/library/socket.rst | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Doc/library/socket.rst') diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst index d0a3c5edab..52c8f7f912 100644 --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -281,6 +281,10 @@ Constants in the Unix header files are defined; for a few symbols, default values are provided. + .. versionchanged:: 3.6 + ``SO_DOMAIN``, ``SO_PROTOCOL``, ``SO_PEERSEC``, ``SO_PASSSEC`` + were added. + .. data:: AF_CAN PF_CAN SOL_CAN_* -- cgit v1.2.1 From c4a3f724702fba76349034c07e43915d221fcf4d Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Mon, 5 Sep 2016 23:54:41 +0200 Subject: Issue #27744: Add AF_ALG (Linux Kernel crypto) to socket module. --- Doc/library/socket.rst | 55 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 6 deletions(-) (limited to 'Doc/library/socket.rst') diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst index 52c8f7f912..ec793ba16a 100644 --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -131,6 +131,22 @@ created. Socket addresses are represented as follows: string format. (ex. ``b'12:23:34:45:56:67'``) This protocol is not supported under FreeBSD. +- :const:`AF_ALG` is a Linux-only socket based interface to Kernel + cryptography. An algorithm socket is configured with a tuple of two to four + elements ``(type, name [, feat [, mask]])``, where: + + - *type* is the algorithm type as string, e.g. ``aead``, ``hash``, + ``skcipher`` or ``rng``. + + - *name* is the algorithm name and operation mode as string, e.g. + ``sha256``, ``hmac(sha256)``, ``cbc(aes)`` or ``drbg_nopr_ctr_aes256``. + + - *feat* and *mask* are unsigned 32bit integers. + + Availability Linux 2.6.38, some algorithm types require more recent Kernels. + + .. versionadded:: 3.6 + - Certain other address families (:const:`AF_PACKET`, :const:`AF_CAN`) support specific representations. @@ -350,6 +366,16 @@ Constants TIPC related constants, matching the ones exported by the C socket API. See the TIPC documentation for more information. +.. data:: AF_ALG + SOL_ALG + ALG_* + + Constants for Linux Kernel cryptography. + + Availability: Linux >= 2.6.38. + + .. versionadded:: 3.6 + .. data:: AF_LINK Availability: BSD, OSX. @@ -1294,6 +1320,15 @@ to sockets. an exception, the method now retries the system call instead of raising an :exc:`InterruptedError` exception (see :pep:`475` for the rationale). +.. method:: socket.sendmsg_afalg([msg], *, op[, iv[, assoclen[, flags]]]) + + Specialized version of :meth:`~socket.sendmsg` for :const:`AF_ALG` socket. + Set mode, IV, AEAD associated data length and flags for :const:`AF_ALG` socket. + + Availability: Linux >= 2.6.38 + + .. versionadded:: 3.6 + .. method:: socket.sendfile(file, offset=0, count=None) Send a file until EOF is reached by using high-performance @@ -1342,21 +1377,29 @@ to sockets. For further information, please consult the :ref:`notes on socket timeouts `. -.. method:: socket.setsockopt(level, optname, value) +.. method:: socket.setsockopt(level, optname, value: int) +.. method:: socket.setsockopt(level, optname, value: buffer) +.. method:: socket.setsockopt(level, optname, None, optlen: int) .. index:: module: struct Set the value of the given socket option (see the Unix manual page :manpage:`setsockopt(2)`). The needed symbolic constants are defined in the - :mod:`socket` module (:const:`SO_\*` etc.). The value can be an integer or - a :term:`bytes-like object` representing a buffer. In the latter case it is - up to the caller to - ensure that the bytestring contains the proper bits (see the optional built-in - module :mod:`struct` for a way to encode C structures as bytestrings). + :mod:`socket` module (:const:`SO_\*` etc.). The value can be an integer, + None or a :term:`bytes-like object` representing a buffer. In the later + case it is up to the caller to ensure that the bytestring contains the + proper bits (see the optional built-in module :mod:`struct` for a way to + encode C structures as bytestrings). When value is set to None, + optlen argument is required. It's equivalent to call setsockopt C + function with optval=NULL and optlen=optlen. + .. versionchanged:: 3.5 Writable :term:`bytes-like object` is now accepted. + .. versionchanged:: 3.6 + setsockopt(level, optname, None, optlen: int) form added. + .. method:: socket.shutdown(how) -- cgit v1.2.1 From eef0808012356b625e5a55dd635378b18f6c200c Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Tue, 6 Sep 2016 00:07:02 +0200 Subject: Issue #27744: correct comment and markup --- Doc/library/socket.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Doc/library/socket.rst') diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst index ec793ba16a..4a2cf11f8e 100644 --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -136,7 +136,7 @@ created. Socket addresses are represented as follows: elements ``(type, name [, feat [, mask]])``, where: - *type* is the algorithm type as string, e.g. ``aead``, ``hash``, - ``skcipher`` or ``rng``. + ``skcipher`` or ``rng``. - *name* is the algorithm name and operation mode as string, e.g. ``sha256``, ``hmac(sha256)``, ``cbc(aes)`` or ``drbg_nopr_ctr_aes256``. -- cgit v1.2.1 From 8bc96d38198140539ba2f1f2e3572f8987a5ae15 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 23 Jan 2017 12:30:00 +0100 Subject: Issue #26273: Document TCP_USER_TIMEOUT and TCP_CONGESTION --- Doc/library/socket.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Doc/library/socket.rst') diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst index c21cb7fd10..678e32ce57 100644 --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -300,8 +300,8 @@ Constants provided. .. versionchanged:: 3.6 - ``SO_DOMAIN``, ``SO_PROTOCOL``, ``SO_PEERSEC``, ``SO_PASSSEC`` - were added. + ``SO_DOMAIN``, ``SO_PROTOCOL``, ``SO_PEERSEC``, ``SO_PASSSEC``, + ``TCP_USER_TIMEOUT``, ``TCP_CONGESTION`` were added. .. data:: AF_CAN PF_CAN -- cgit v1.2.1