bpo-25780: Expose CAN_RAW_JOIN_FILTERS in the socket module (GH-19190)

Co-Authored-By: Stefan Tatschner <stefan@rumpelsepp.org>
This commit is contained in:
Zackery Spytz 2020-04-09 06:03:49 -06:00 committed by GitHub
parent b54a99d643
commit 97e0de04b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 66 additions and 0 deletions

View File

@ -408,6 +408,17 @@ Constants
.. versionadded:: 3.5 .. versionadded:: 3.5
.. data:: CAN_RAW_JOIN_FILTERS
Joins the applied CAN filters such that only CAN frames that match all
given CAN filters are passed to user space.
This constant is documented in the Linux documentation.
.. availability:: Linux >= 4.1.
.. versionadded:: 3.9
.. data:: CAN_ISOTP .. data:: CAN_ISOTP
CAN_ISOTP, in the CAN protocol family, is the ISO-TP (ISO 15765-2) protocol. CAN_ISOTP, in the CAN protocol family, is the ISO-TP (ISO 15765-2) protocol.

View File

@ -362,6 +362,13 @@ a non-blocking socket. (Contributed by Dong-hee Na in :issue:`39259`.)
:class:`~smtplib.LMTP` constructor now has an optional *timeout* parameter. :class:`~smtplib.LMTP` constructor now has an optional *timeout* parameter.
(Contributed by Dong-hee Na in :issue:`39329`.) (Contributed by Dong-hee Na in :issue:`39329`.)
socket
------
The :mod:`socket` module now exports the :data:`~socket.CAN_RAW_JOIN_FILTERS`
constant on Linux 4.1 and greater.
(Contributed by Stefan Tatschner and Zackery Spytz in :issue:`25780`.)
threading threading
--------- ---------

View File

@ -1682,6 +1682,7 @@ William Tanksley
Christian Tanzer Christian Tanzer
Steven Taschuk Steven Taschuk
Batuhan Taskaya Batuhan Taskaya
Stefan Tatschner
Amy Taylor Amy Taylor
Julian Taylor Julian Taylor
Monty Taylor Monty Taylor

View File

@ -0,0 +1 @@
Expose :data:`~socket.CAN_RAW_JOIN_FILTERS` in the :mod:`socket` module.

View File

@ -7702,6 +7702,9 @@ PyInit__socket(void)
#ifdef HAVE_LINUX_CAN_RAW_FD_FRAMES #ifdef HAVE_LINUX_CAN_RAW_FD_FRAMES
PyModule_AddIntMacro(m, CAN_RAW_FD_FRAMES); PyModule_AddIntMacro(m, CAN_RAW_FD_FRAMES);
#endif #endif
#ifdef HAVE_LINUX_CAN_RAW_JOIN_FILTERS
PyModule_AddIntMacro(m, CAN_RAW_JOIN_FILTERS);
#endif
#ifdef HAVE_LINUX_CAN_BCM_H #ifdef HAVE_LINUX_CAN_BCM_H
PyModule_AddIntMacro(m, CAN_BCM); PyModule_AddIntMacro(m, CAN_BCM);

30
configure vendored
View File

@ -11307,6 +11307,36 @@ $as_echo "no" >&6; }
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CAN_RAW_JOIN_FILTERS" >&5
$as_echo_n "checking for CAN_RAW_JOIN_FILTERS... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <linux/can/raw.h>
int
main ()
{
int can_raw_join_filters = CAN_RAW_JOIN_FILTERS;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
$as_echo "#define HAVE_LINUX_CAN_RAW_JOIN_FILTERS 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
# Check for --with-doc-strings # Check for --with-doc-strings
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-doc-strings" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-doc-strings" >&5
$as_echo_n "checking for --with-doc-strings... " >&6; } $as_echo_n "checking for --with-doc-strings... " >&6; }

View File

@ -3447,6 +3447,16 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ /* CAN_RAW_FD_FRAMES available check */
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
]) ])
AC_MSG_CHECKING(for CAN_RAW_JOIN_FILTERS)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <linux/can/raw.h>]],
[[int can_raw_join_filters = CAN_RAW_JOIN_FILTERS;]])],[
AC_DEFINE(HAVE_LINUX_CAN_RAW_JOIN_FILTERS, 1, [Define if compiling using Linux 4.1 or later.])
AC_MSG_RESULT(yes)
],[
AC_MSG_RESULT(no)
])
# Check for --with-doc-strings # Check for --with-doc-strings
AC_MSG_CHECKING(for --with-doc-strings) AC_MSG_CHECKING(for --with-doc-strings)
AC_ARG_WITH(doc-strings, AC_ARG_WITH(doc-strings,

View File

@ -628,6 +628,9 @@
/* Define to 1 if you have the <linux/can/raw.h> header file. */ /* Define to 1 if you have the <linux/can/raw.h> header file. */
#undef HAVE_LINUX_CAN_RAW_H #undef HAVE_LINUX_CAN_RAW_H
/* Define if compiling using Linux 4.1 or later. */
#undef HAVE_LINUX_CAN_RAW_JOIN_FILTERS
/* Define to 1 if you have the <linux/memfd.h> header file. */ /* Define to 1 if you have the <linux/memfd.h> header file. */
#undef HAVE_LINUX_MEMFD_H #undef HAVE_LINUX_MEMFD_H