summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMariatta <Mariatta@users.noreply.github.com>2017-03-17 03:59:36 (GMT)
committerGitHub <noreply@github.com>2017-03-17 03:59:36 (GMT)
commit7c2081122c2a6b8ea27c3111da7f19f7824fe18a (patch)
tree85809985ac32012ed8e1e61641a8337c11881063 /Modules
parent4ac01f0ff3e3c9c02f5cc8c55f2fbe4639808f5e (diff)
downloadcpython-7c2081122c2a6b8ea27c3111da7f19f7824fe18a.zip
cpython-7c2081122c2a6b8ea27c3111da7f19f7824fe18a.tar.gz
cpython-7c2081122c2a6b8ea27c3111da7f19f7824fe18a.tar.bz2
Add sockaddr_alg to sock_addr_t (GH-234) (GH-533)
(cherry picked from commit d37c068e695f8ec72b5c1b5a5a5ece2337fda768)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/socketmodule.c30
-rw-r--r--Modules/socketmodule.h34
2 files changed, 34 insertions, 30 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index f4edc06..f3654c9 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -288,36 +288,6 @@ http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/net/getaddrinfo.c.diff?r1=1.82&
#include <net/if.h>
#endif
-#ifdef HAVE_SOCKADDR_ALG
-#include <linux/if_alg.h>
-#ifndef AF_ALG
-#define AF_ALG 38
-#endif
-#ifndef SOL_ALG
-#define SOL_ALG 279
-#endif
-
-/* Linux 3.19 */
-#ifndef ALG_SET_AEAD_ASSOCLEN
-#define ALG_SET_AEAD_ASSOCLEN 4
-#endif
-#ifndef ALG_SET_AEAD_AUTHSIZE
-#define ALG_SET_AEAD_AUTHSIZE 5
-#endif
-/* Linux 4.8 */
-#ifndef ALG_SET_PUBKEY
-#define ALG_SET_PUBKEY 6
-#endif
-
-#ifndef ALG_OP_SIGN
-#define ALG_OP_SIGN 2
-#endif
-#ifndef ALG_OP_VERIFY
-#define ALG_OP_VERIFY 3
-#endif
-
-#endif /* HAVE_SOCKADDR_ALG */
-
/* Generic socket object definitions and includes */
#define PySocket_BUILDING_SOCKET
#include "socketmodule.h"
diff --git a/Modules/socketmodule.h b/Modules/socketmodule.h
index 3cce927..03f982b 100644
--- a/Modules/socketmodule.h
+++ b/Modules/socketmodule.h
@@ -98,6 +98,37 @@ typedef int socklen_t;
#include <sys/kern_control.h>
#endif
+#ifdef HAVE_SOCKADDR_ALG
+#include <linux/if_alg.h>
+#ifndef AF_ALG
+#define AF_ALG 38
+#endif
+#ifndef SOL_ALG
+#define SOL_ALG 279
+#endif
+
+/* Linux 3.19 */
+#ifndef ALG_SET_AEAD_ASSOCLEN
+#define ALG_SET_AEAD_ASSOCLEN 4
+#endif
+#ifndef ALG_SET_AEAD_AUTHSIZE
+#define ALG_SET_AEAD_AUTHSIZE 5
+#endif
+/* Linux 4.8 */
+#ifndef ALG_SET_PUBKEY
+#define ALG_SET_PUBKEY 6
+#endif
+
+#ifndef ALG_OP_SIGN
+#define ALG_OP_SIGN 2
+#endif
+#ifndef ALG_OP_VERIFY
+#define ALG_OP_VERIFY 3
+#endif
+
+#endif /* HAVE_SOCKADDR_ALG */
+
+
#ifndef Py__SOCKET_H
#define Py__SOCKET_H
#ifdef __cplusplus
@@ -159,6 +190,9 @@ typedef union sock_addr {
#ifdef HAVE_SYS_KERN_CONTROL_H
struct sockaddr_ctl ctl;
#endif
+#ifdef HAVE_SOCKADDR_ALG
+ struct sockaddr_alg alg;
+#endif
} sock_addr_t;
/* The object holding a socket. It holds some extra information,