Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4)

Delta Between Two Patch Sets: Modules/socketmodule.c

Issue 27744: Add AF_ALG (Linux Kernel crypto) to socket module
Left Patch Set: Created 3 years, 6 months ago
Right Patch Set: Created 3 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« Lib/test/test_socket.py ('K') | « Lib/test/test_socket.py ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* Socket module */ 1 /* Socket module */
2 2
3 /* 3 /*
4 4
5 This module provides an interface to Berkeley socket IPC. 5 This module provides an interface to Berkeley socket IPC.
6 6
7 Limitations: 7 Limitations:
8 8
9 - Only AF_INET, AF_INET6 and AF_UNIX address families are supported in a 9 - Only AF_INET, AF_INET6 and AF_UNIX address families are supported in a
10 portable manner, though AF_PACKET, AF_NETLINK and AF_TIPC are supported 10 portable manner, though AF_PACKET, AF_NETLINK and AF_TIPC are supported
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 listen([n]) -- start listening for incoming connections\n\ 129 listen([n]) -- start listening for incoming connections\n\
130 recv(buflen[, flags]) -- receive data\n\ 130 recv(buflen[, flags]) -- receive data\n\
131 recv_into(buffer[, nbytes[, flags]]) -- receive data (into a buffer)\n\ 131 recv_into(buffer[, nbytes[, flags]]) -- receive data (into a buffer)\n\
132 recvfrom(buflen[, flags]) -- receive data and sender\'s address\n\ 132 recvfrom(buflen[, flags]) -- receive data and sender\'s address\n\
133 recvfrom_into(buffer[, nbytes, [, flags])\n\ 133 recvfrom_into(buffer[, nbytes, [, flags])\n\
134 -- receive data and sender\'s address (into a buffer)\n\ 134 -- receive data and sender\'s address (into a buffer)\n\
135 sendall(data[, flags]) -- send all data\n\ 135 sendall(data[, flags]) -- send all data\n\
136 send(data[, flags]) -- send data, may not send all of it\n\ 136 send(data[, flags]) -- send data, may not send all of it\n\
137 sendto(data[, flags], addr) -- send data to a given address\n\ 137 sendto(data[, flags], addr) -- send data to a given address\n\
138 setblocking(0 | 1) -- set or clear the blocking I/O flag\n\ 138 setblocking(0 | 1) -- set or clear the blocking I/O flag\n\
139 setsockopt(level, optname, value) -- set socket options\n\ 139 setsockopt(level, optname, value[, optlen]) -- set socket options\n\
140 settimeout(None | float) -- set or clear the timeout\n\ 140 settimeout(None | float) -- set or clear the timeout\n\
141 shutdown(how) -- shut down traffic in one or both directions\n\ 141 shutdown(how) -- shut down traffic in one or both directions\n\
142 if_nameindex() -- return all network interface indices and names\n\ 142 if_nameindex() -- return all network interface indices and names\n\
143 if_nametoindex(name) -- return the corresponding interface index\n\ 143 if_nametoindex(name) -- return the corresponding interface index\n\
144 if_indextoname(index) -- return the corresponding interface name\n\ 144 if_indextoname(index) -- return the corresponding interface name\n\
145 \n\ 145 \n\
146 [*] not available on all platforms!"); 146 [*] not available on all platforms!");
147 147
148 /* XXX This is a terrible mess of platform-dependent preprocessor hacks. 148 /* XXX This is a terrible mess of platform-dependent preprocessor hacks.
149 I hope some day someone can clean this up please... */ 149 I hope some day someone can clean this up please... */
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 #endif 287 #endif
288 288
289 #ifdef HAVE_SOCKADDR_ALG 289 #ifdef HAVE_SOCKADDR_ALG
290 #include <linux/if_alg.h> 290 #include <linux/if_alg.h>
291 #ifndef AF_ALG 291 #ifndef AF_ALG
292 #define AF_ALG 38 292 #define AF_ALG 38
293 #endif 293 #endif
294 #ifndef SOL_ALG 294 #ifndef SOL_ALG
295 #define SOL_ALG 279 295 #define SOL_ALG 279
296 #endif 296 #endif
297 #endif 297
298 /* Linux 3.19 */
299 #ifndef ALG_SET_AEAD_ASSOCLEN
300 #define ALG_SET_AEAD_ASSOCLEN 4
301 #endif
302 #ifndef ALG_SET_AEAD_AUTHSIZE
303 #define ALG_SET_AEAD_AUTHSIZE 5
304 #endif
305 /* Linux 4.8 */
306 #ifndef ALG_SET_PUBKEY
307 #define ALG_SET_PUBKEY 6
308 #endif
309
310 #ifndef ALG_OP_SIGN
311 #define ALG_OP_SIGN 2
312 #endif
313 #ifndef ALG_OP_VERIFY
314 #define ALG_OP_VERIFY 3
315 #endif
316
317 #endif /* HAVE_SOCKADDR_ALG */
298 318
299 /* Generic socket object definitions and includes */ 319 /* Generic socket object definitions and includes */
300 #define PySocket_BUILDING_SOCKET 320 #define PySocket_BUILDING_SOCKET
301 #include "socketmodule.h" 321 #include "socketmodule.h"
302 322
303 /* Addressing includes */ 323 /* Addressing includes */
304 324
305 #ifndef MS_WINDOWS 325 #ifndef MS_WINDOWS
306 326
307 /* Non-MS WINDOWS includes */ 327 /* Non-MS WINDOWS includes */
(...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after
1973 char *type; 1993 char *type;
1974 char *name; 1994 char *name;
1975 sa = (struct sockaddr_alg *)addr_ret; 1995 sa = (struct sockaddr_alg *)addr_ret;
1976 1996
1977 memset(sa, 0, sizeof(*sa)); 1997 memset(sa, 0, sizeof(*sa));
1978 sa->salg_family = AF_ALG; 1998 sa->salg_family = AF_ALG;
1979 1999
1980 if (!PyArg_ParseTuple(args, "ss|HH:getsockaddrarg", 2000 if (!PyArg_ParseTuple(args, "ss|HH:getsockaddrarg",
1981 &type, &name, &sa->salg_feat, &sa->salg_mask)) 2001 &type, &name, &sa->salg_feat, &sa->salg_mask))
1982 return 0; 2002 return 0;
2003 /* sockaddr_alg has fixed-sized char arrays for type and name */
1983 if (strlen(type) > sizeof(sa->salg_type)) { 2004 if (strlen(type) > sizeof(sa->salg_type)) {
1984 PyErr_SetString(PyExc_ValueError, "AF_ALG type too long."); 2005 PyErr_SetString(PyExc_ValueError, "AF_ALG type too long.");
1985 return 0; 2006 return 0;
1986 } 2007 }
1987 strncpy((char *)sa->salg_type, type, sizeof(sa->salg_type)); 2008 strncpy((char *)sa->salg_type, type, sizeof(sa->salg_type));
1988 if (strlen(name) > sizeof(sa->salg_name)) { 2009 if (strlen(name) > sizeof(sa->salg_name)) {
1989 PyErr_SetString(PyExc_ValueError, "AF_ALG name too long."); 2010 PyErr_SetString(PyExc_ValueError, "AF_ALG name too long.");
1990 return 0; 2011 return 0;
1991 } 2012 }
1992 strncpy((char *)sa->salg_name, name, sizeof(sa->salg_name)); 2013 strncpy((char *)sa->salg_name, name, sizeof(sa->salg_name));
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
2276 #if defined(HAVE_ACCEPT4) && defined(SOCK_CLOEXEC) 2297 #if defined(HAVE_ACCEPT4) && defined(SOCK_CLOEXEC)
2277 /* accept4() is available on Linux 2.6.28+ and glibc 2.10 */ 2298 /* accept4() is available on Linux 2.6.28+ and glibc 2.10 */
2278 static int accept4_works = -1; 2299 static int accept4_works = -1;
2279 #endif 2300 #endif
2280 2301
2281 static int 2302 static int
2282 sock_accept_impl(PySocketSockObject *s, void *data) 2303 sock_accept_impl(PySocketSockObject *s, void *data)
2283 { 2304 {
2284 struct sock_accept *ctx = data; 2305 struct sock_accept *ctx = data;
2285 struct sockaddr *addr = SAS2SA(ctx->addrbuf); 2306 struct sockaddr *addr = SAS2SA(ctx->addrbuf);
2286 socklen_t *addrlen = ctx->addrlen; 2307 socklen_t *paddrlen = ctx->addrlen;
2287 #ifdef HAVE_SOCKADDR_ALG 2308 #ifdef HAVE_SOCKADDR_ALG
2288 /* AF_ALG does not support accept() with addr and raises 2309 /* AF_ALG does not support accept() with addr and raises
2289 * ECONNABORTED instead. */ 2310 * ECONNABORTED instead. */
2290 if (s->sock_family == AF_ALG) { 2311 if (s->sock_family == AF_ALG) {
2291 addr = NULL; 2312 addr = NULL;
2292 addrlen = NULL; 2313 paddrlen = NULL;
2293 *ctx->addrlen = 0; 2314 *ctx->addrlen = 0;
2294 } 2315 }
2295 #endif 2316 #endif
2296 2317
2297 #if defined(HAVE_ACCEPT4) && defined(SOCK_CLOEXEC) 2318 #if defined(HAVE_ACCEPT4) && defined(SOCK_CLOEXEC)
2298 if (accept4_works != 0) { 2319 if (accept4_works != 0) {
2299 ctx->result = accept4(s->sock_fd, addr, addrlen, 2320 ctx->result = accept4(s->sock_fd, addr, paddrlen,
2300 SOCK_CLOEXEC); 2321 SOCK_CLOEXEC);
2301 if (ctx->result == INVALID_SOCKET && accept4_works == -1) { 2322 if (ctx->result == INVALID_SOCKET && accept4_works == -1) {
2302 /* On Linux older than 2.6.28, accept4() fails with ENOSYS */ 2323 /* On Linux older than 2.6.28, accept4() fails with ENOSYS */
2303 accept4_works = (errno != ENOSYS); 2324 accept4_works = (errno != ENOSYS);
2304 } 2325 }
2305 } 2326 }
2306 if (accept4_works == 0) 2327 if (accept4_works == 0)
2307 ctx->result = accept(s->sock_fd, addr, addrlen); 2328 ctx->result = accept(s->sock_fd, addr, paddrlen);
2308 #else 2329 #else
2309 ctx->result = accept(s->sock_fd, addr, addrlen); 2330 ctx->result = accept(s->sock_fd, addr, paddrlen);
2310 #endif 2331 #endif
2311 2332
2312 #ifdef MS_WINDOWS 2333 #ifdef MS_WINDOWS
2313 return (ctx->result != INVALID_SOCKET); 2334 return (ctx->result != INVALID_SOCKET);
2314 #else 2335 #else
2315 return (ctx->result >= 0); 2336 return (ctx->result >= 0);
2316 #endif 2337 #endif
2317 } 2338 }
2318 2339
2319 /* s._accept() -> (fd, address) */ 2340 /* s._accept() -> (fd, address) */
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
2501 } 2522 }
2502 2523
2503 PyDoc_STRVAR(gettimeout_doc, 2524 PyDoc_STRVAR(gettimeout_doc,
2504 "gettimeout() -> timeout\n\ 2525 "gettimeout() -> timeout\n\
2505 \n\ 2526 \n\
2506 Returns the timeout in seconds (float) associated with socket \n\ 2527 Returns the timeout in seconds (float) associated with socket \n\
2507 operations. A timeout of None indicates that timeouts on socket \n\ 2528 operations. A timeout of None indicates that timeouts on socket \n\
2508 operations are disabled."); 2529 operations are disabled.");
2509 2530
2510 /* s.setsockopt() method. 2531 /* s.setsockopt() method.
2511 With an integer third argument, sets an integer option. 2532 With an integer third argument, sets an integer optval with optlen=4.
2533 With None as third argument and an integer fourth argument, set
2534 optval=NULL with unsigned int as optlen.
2512 With a string third argument, sets an option from a buffer; 2535 With a string third argument, sets an option from a buffer;
2513 use optional built-in module 'struct' to encode the string. */ 2536 use optional built-in module 'struct' to encode the string.
2537 */
2514 2538
2515 static PyObject * 2539 static PyObject *
2516 sock_setsockopt(PySocketSockObject *s, PyObject *args) 2540 sock_setsockopt(PySocketSockObject *s, PyObject *args)
2517 { 2541 {
2518 int level; 2542 int level;
2519 int optname; 2543 int optname;
2520 int res; 2544 int res;
2521 Py_buffer optval; 2545 Py_buffer optval;
2522 int flag; 2546 int flag;
2523 socklen_t socklen; 2547 unsigned int optlen;
haypo 2016/09/01 23:10:30 Oh, thanks for fixing optlen type ;-)
2524 PyObject *none; 2548 PyObject *none;
2525 2549
2526 /* setsockopt(level, opt, flag) */ 2550 /* setsockopt(level, opt, flag) */
2527 if (PyArg_ParseTuple(args, "iii:setsockopt", 2551 if (PyArg_ParseTuple(args, "iii:setsockopt",
2528 &level, &optname, &flag)) { 2552 &level, &optname, &flag)) {
2529 res = setsockopt(s->sock_fd, level, optname, 2553 res = setsockopt(s->sock_fd, level, optname,
2530 (char*)&flag, sizeof flag); 2554 (char*)&flag, sizeof flag);
2531 goto done; 2555 goto done;
2532 } 2556 }
2533 2557
2534 PyErr_Clear(); 2558 PyErr_Clear();
2535 /* setsockopt(level, opt, (None, flag)) */ 2559 /* setsockopt(level, opt, (None, flag)) */
haypo 2016/09/01 23:10:30 The comment is still outdated, no?
2536 if (PyArg_ParseTuple(args, "ii(O!I):setsockopt", 2560 if (PyArg_ParseTuple(args, "iiO!I:setsockopt",
2537 &level, &optname, Py_TYPE(Py_None), &none, &socklen)) { 2561 &level, &optname, Py_TYPE(Py_None), &none, &optlen)) {
2562 assert(sizeof(socklen_t) >= sizeof(unsigned int));
2538 res = setsockopt(s->sock_fd, level, optname, 2563 res = setsockopt(s->sock_fd, level, optname,
2539 NULL, socklen); 2564 NULL, (socklen_t)optlen);
2540 goto done; 2565 goto done;
2541 } 2566 }
2542 2567
2543 PyErr_Clear(); 2568 PyErr_Clear();
2544 /* setsockopt(level, opt, buffer) */ 2569 /* setsockopt(level, opt, buffer) */
2545 if (!PyArg_ParseTuple(args, "iiy*:setsockopt", 2570 if (!PyArg_ParseTuple(args, "iiy*:setsockopt",
2546 &level, &optname, &optval)) 2571 &level, &optname, &optval))
2547 return NULL; 2572 return NULL;
2548 2573
2549 #ifdef MS_WINDOWS 2574 #ifdef MS_WINDOWS
(...skipping 13 matching lines...) Expand all
2563 2588
2564 done: 2589 done:
2565 if (res < 0) { 2590 if (res < 0) {
2566 return s->errorhandler(); 2591 return s->errorhandler();
2567 } 2592 }
2568 2593
2569 Py_RETURN_NONE; 2594 Py_RETURN_NONE;
2570 } 2595 }
2571 2596
2572 PyDoc_STRVAR(setsockopt_doc, 2597 PyDoc_STRVAR(setsockopt_doc,
2573 "setsockopt(level, option, value)\n\ 2598 "setsockopt(level, option, value: int)\n\
2599 setsockopt(level, option, value: buffer)\n\
2600 setsockopt(level, option, None, optlen: int)\n\
2574 \n\ 2601 \n\
2575 Set a socket option. See the Unix manual for level and option.\n\ 2602 Set a socket option. See the Unix manual for level and option.\n\
2576 The value argument can either be an integer, a string or a tuple\n\ 2603 The value argument can either be an integer, a string buffer, or \n\
2577 (None, integer). The last form calls setsockopt() with optval=NULL."); 2604 None, optlen.");
2578 2605
2579 2606
2580 /* s.getsockopt() method. 2607 /* s.getsockopt() method.
2581 With two arguments, retrieves an integer option. 2608 With two arguments, retrieves an integer option.
2582 With a third integer argument, retrieves a string buffer of that size; 2609 With a third integer argument, retrieves a string buffer of that size;
2583 use optional built-in module 'struct' to decode the string. */ 2610 use optional built-in module 'struct' to decode the string. */
2584 2611
2585 static PyObject * 2612 static PyObject *
2586 sock_getsockopt(PySocketSockObject *s, PyObject *args) 2613 sock_getsockopt(PySocketSockObject *s, PyObject *args)
2587 { 2614 {
(...skipping 4019 matching lines...) Expand 10 before | Expand all | Expand 10 after
6607 #ifdef NETLINK_ROUTE6 6634 #ifdef NETLINK_ROUTE6
6608 PyModule_AddIntMacro(m, NETLINK_ROUTE6); 6635 PyModule_AddIntMacro(m, NETLINK_ROUTE6);
6609 #endif 6636 #endif
6610 PyModule_AddIntMacro(m, NETLINK_IP6_FW); 6637 PyModule_AddIntMacro(m, NETLINK_IP6_FW);
6611 #ifdef NETLINK_DNRTMSG 6638 #ifdef NETLINK_DNRTMSG
6612 PyModule_AddIntMacro(m, NETLINK_DNRTMSG); 6639 PyModule_AddIntMacro(m, NETLINK_DNRTMSG);
6613 #endif 6640 #endif
6614 #ifdef NETLINK_TAPBASE 6641 #ifdef NETLINK_TAPBASE
6615 PyModule_AddIntMacro(m, NETLINK_TAPBASE); 6642 PyModule_AddIntMacro(m, NETLINK_TAPBASE);
6616 #endif 6643 #endif
6644 #ifdef NETLINK_CRYPTO
6645 PyModule_AddIntMacro(m, NETLINK_CRYPTO);
6646 #endif
6617 #endif /* AF_NETLINK */ 6647 #endif /* AF_NETLINK */
6618 #ifdef AF_ROUTE 6648 #ifdef AF_ROUTE
6619 /* Alias to emulate 4.4BSD */ 6649 /* Alias to emulate 4.4BSD */
6620 PyModule_AddIntMacro(m, AF_ROUTE); 6650 PyModule_AddIntMacro(m, AF_ROUTE);
6621 #endif 6651 #endif
6622 #ifdef AF_LINK 6652 #ifdef AF_LINK
6623 PyModule_AddIntMacro(m, AF_LINK); 6653 PyModule_AddIntMacro(m, AF_LINK);
6624 #endif 6654 #endif
6625 #ifdef AF_ASH 6655 #ifdef AF_ASH
6626 /* Ash */ 6656 /* Ash */
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
6767 PyModule_AddIntMacro(m, TIPC_TOP_SRV); 6797 PyModule_AddIntMacro(m, TIPC_TOP_SRV);
6768 #endif 6798 #endif
6769 6799
6770 #ifdef HAVE_SOCKADDR_ALG 6800 #ifdef HAVE_SOCKADDR_ALG
6771 /* Socket options */ 6801 /* Socket options */
6772 PyModule_AddIntMacro(m, ALG_SET_KEY); 6802 PyModule_AddIntMacro(m, ALG_SET_KEY);
6773 PyModule_AddIntMacro(m, ALG_SET_IV); 6803 PyModule_AddIntMacro(m, ALG_SET_IV);
6774 PyModule_AddIntMacro(m, ALG_SET_OP); 6804 PyModule_AddIntMacro(m, ALG_SET_OP);
6775 PyModule_AddIntMacro(m, ALG_SET_AEAD_ASSOCLEN); 6805 PyModule_AddIntMacro(m, ALG_SET_AEAD_ASSOCLEN);
6776 PyModule_AddIntMacro(m, ALG_SET_AEAD_AUTHSIZE); 6806 PyModule_AddIntMacro(m, ALG_SET_AEAD_AUTHSIZE);
6807 PyModule_AddIntMacro(m, ALG_SET_PUBKEY);
6777 6808
6778 /* Operations */ 6809 /* Operations */
6779 PyModule_AddIntMacro(m, ALG_OP_DECRYPT); 6810 PyModule_AddIntMacro(m, ALG_OP_DECRYPT);
6780 PyModule_AddIntMacro(m, ALG_OP_ENCRYPT); 6811 PyModule_AddIntMacro(m, ALG_OP_ENCRYPT);
6812 PyModule_AddIntMacro(m, ALG_OP_SIGN);
6813 PyModule_AddIntMacro(m, ALG_OP_VERIFY);
6781 #endif 6814 #endif
6782 6815
6783 /* Socket types */ 6816 /* Socket types */
6784 PyModule_AddIntMacro(m, SOCK_STREAM); 6817 PyModule_AddIntMacro(m, SOCK_STREAM);
6785 PyModule_AddIntMacro(m, SOCK_DGRAM); 6818 PyModule_AddIntMacro(m, SOCK_DGRAM);
6786 /* We have incomplete socket support. */ 6819 /* We have incomplete socket support. */
6787 #ifdef SOCK_RAW 6820 #ifdef SOCK_RAW
6788 /* SOCK_RAW is marked as optional in the POSIX specification */ 6821 /* SOCK_RAW is marked as optional in the POSIX specification */
6789 PyModule_AddIntMacro(m, SOCK_RAW); 6822 PyModule_AddIntMacro(m, SOCK_RAW);
6790 #endif 6823 #endif
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
6864 #endif 6897 #endif
6865 #ifdef SO_PASSCRED 6898 #ifdef SO_PASSCRED
6866 PyModule_AddIntMacro(m, SO_PASSCRED); 6899 PyModule_AddIntMacro(m, SO_PASSCRED);
6867 #endif 6900 #endif
6868 #ifdef SO_PEERCRED 6901 #ifdef SO_PEERCRED
6869 PyModule_AddIntMacro(m, SO_PEERCRED); 6902 PyModule_AddIntMacro(m, SO_PEERCRED);
6870 #endif 6903 #endif
6871 #ifdef LOCAL_PEERCRED 6904 #ifdef LOCAL_PEERCRED
6872 PyModule_AddIntMacro(m, LOCAL_PEERCRED); 6905 PyModule_AddIntMacro(m, LOCAL_PEERCRED);
6873 #endif 6906 #endif
6907 #ifdef SO_PASSSEC
6908 PyModule_AddIntMacro(m, SO_PASSSEC);
6909 #endif
6910 #ifdef SO_PEERSEC
6911 PyModule_AddIntMacro(m, SO_PEERSEC);
6912 #endif
6874 #ifdef SO_BINDTODEVICE 6913 #ifdef SO_BINDTODEVICE
6875 PyModule_AddIntMacro(m, SO_BINDTODEVICE); 6914 PyModule_AddIntMacro(m, SO_BINDTODEVICE);
6876 #endif 6915 #endif
6877 #ifdef SO_PRIORITY 6916 #ifdef SO_PRIORITY
6878 PyModule_AddIntMacro(m, SO_PRIORITY); 6917 PyModule_AddIntMacro(m, SO_PRIORITY);
6879 #endif 6918 #endif
6880 #ifdef SO_MARK 6919 #ifdef SO_MARK
6881 PyModule_AddIntMacro(m, SO_MARK); 6920 PyModule_AddIntMacro(m, SO_MARK);
6921 #endif
6922 #ifdef SO_DOMAIN
6923 PyModule_AddIntMacro(m, SO_DOMAIN);
6924 #endif
6925 #ifdef SO_PROTOCOL
6926 PyModule_AddIntMacro(m, SO_PROTOCOL);
6882 #endif 6927 #endif
6883 6928
6884 /* Maximum number of connections for "listen" */ 6929 /* Maximum number of connections for "listen" */
6885 #ifdef SOMAXCONN 6930 #ifdef SOMAXCONN
6886 PyModule_AddIntMacro(m, SOMAXCONN); 6931 PyModule_AddIntMacro(m, SOMAXCONN);
6887 #else 6932 #else
6888 PyModule_AddIntConstant(m, "SOMAXCONN", 5); /* Common value */ 6933 PyModule_AddIntConstant(m, "SOMAXCONN", 5); /* Common value */
6889 #endif 6934 #endif
6890 6935
6891 /* Ancilliary message types */ 6936 /* Ancillary message types */
6892 #ifdef SCM_RIGHTS 6937 #ifdef SCM_RIGHTS
6893 PyModule_AddIntMacro(m, SCM_RIGHTS); 6938 PyModule_AddIntMacro(m, SCM_RIGHTS);
6894 #endif 6939 #endif
6895 #ifdef SCM_CREDENTIALS 6940 #ifdef SCM_CREDENTIALS
6896 PyModule_AddIntMacro(m, SCM_CREDENTIALS); 6941 PyModule_AddIntMacro(m, SCM_CREDENTIALS);
6897 #endif 6942 #endif
6898 #ifdef SCM_CREDS 6943 #ifdef SCM_CREDS
6899 PyModule_AddIntMacro(m, SCM_CREDS); 6944 PyModule_AddIntMacro(m, SCM_CREDS);
6900 #endif 6945 #endif
6901 6946
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
7650 return NULL; 7695 return NULL;
7651 memcpy(&packed_addr, src, sizeof(packed_addr)); 7696 memcpy(&packed_addr, src, sizeof(packed_addr));
7652 return strncpy(dst, inet_ntoa(packed_addr), size); 7697 return strncpy(dst, inet_ntoa(packed_addr), size);
7653 } 7698 }
7654 /* Should set errno to EAFNOSUPPORT */ 7699 /* Should set errno to EAFNOSUPPORT */
7655 return NULL; 7700 return NULL;
7656 } 7701 }
7657 7702
7658 #endif 7703 #endif
7659 #endif 7704 #endif
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+