1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
$NetBSD: patch-Modules_socketmodule.c,v 1.2 2022/01/20 13:07:50 jperkin Exp $
Support NetBSD's socketcan implementation
--- Modules/socketmodule.c.orig 2022-01-13 18:52:14.000000000 +0000
+++ Modules/socketmodule.c
@@ -2112,7 +2112,7 @@ getsockaddrarg(PySocketSockObject *s, Py
PyObject *interfaceName;
struct ifreq ifr;
Py_ssize_t len;
- struct sockaddr_can *addr = &addrbuf->can;
+ struct sockaddr_can *addr = (struct sockaddr_can *)addrbuf;
if (!PyTuple_Check(args)) {
PyErr_Format(PyExc_TypeError,
@@ -5440,7 +5440,7 @@ socket_sethostname(PyObject *self, PyObj
Py_buffer buf;
int res, flag = 0;
-#ifdef _AIX
+#if defined(_AIX) || (defined(__sun) && PKGSRC_OPSYS_VERSION < 051100)
/* issue #18259, not declared in any useful header file */
extern int sethostname(const char *, size_t);
#endif
@@ -7782,6 +7782,20 @@ PyInit__socket(void)
PyModule_AddIntMacro(m, J1939_FILTER_MAX);
#endif
+#ifdef HAVE_NETCAN_CAN_H
+ PyModule_AddIntMacro(m, CAN_EFF_FLAG);
+ PyModule_AddIntMacro(m, CAN_RTR_FLAG);
+ PyModule_AddIntMacro(m, CAN_ERR_FLAG);
+
+ PyModule_AddIntMacro(m, CAN_SFF_MASK);
+ PyModule_AddIntMacro(m, CAN_EFF_MASK);
+ PyModule_AddIntMacro(m, CAN_ERR_MASK);
+
+ PyModule_AddIntMacro(m, CAN_RAW_FILTER);
+ /* PyModule_AddIntMacro(m, CAN_RAW_ERR_FILTER); */
+ PyModule_AddIntMacro(m, CAN_RAW_LOOPBACK);
+ PyModule_AddIntMacro(m, CAN_RAW_RECV_OWN_MSGS);
+#endif
#ifdef SOL_RDS
PyModule_AddIntMacro(m, SOL_RDS);
#endif
|