diff options
author | jsing <> | 2014-06-22 15:38:28 +0000 |
---|---|---|
committer | jsing <> | 2014-06-22 15:38:28 +0000 |
commit | f87f03b36bcc9dd1c7a9b37f8cdfc37bdae7b46b (patch) | |
tree | d208abb20aaa803f985f3c675f8968c4e7f227b7 | |
parent | 0e48583e384b473bddadeed479e2ac76911814bc (diff) | |
download | openbsd-f87f03b36bcc9dd1c7a9b37f8cdfc37bdae7b46b.tar.gz openbsd-f87f03b36bcc9dd1c7a9b37f8cdfc37bdae7b46b.tar.bz2 openbsd-f87f03b36bcc9dd1c7a9b37f8cdfc37bdae7b46b.zip |
Just use SOMAXCONN and IPPROTO_TCP, since we know we have them.
-rw-r--r-- | src/lib/libcrypto/bio/b_sock.c | 18 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/bio/b_sock.c | 18 |
2 files changed, 8 insertions, 28 deletions
diff --git a/src/lib/libcrypto/bio/b_sock.c b/src/lib/libcrypto/bio/b_sock.c index ddd2abb625..58d57db281 100644 --- a/src/lib/libcrypto/bio/b_sock.c +++ b/src/lib/libcrypto/bio/b_sock.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: b_sock.c,v 1.39 2014/06/22 14:41:10 jsing Exp $ */ | 1 | /* $OpenBSD: b_sock.c,v 1.40 2014/06/22 15:38:28 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -71,16 +71,6 @@ | |||
71 | 71 | ||
72 | #include "cryptlib.h" | 72 | #include "cryptlib.h" |
73 | 73 | ||
74 | #define SOCKET_PROTOCOL IPPROTO_TCP | ||
75 | |||
76 | #ifdef SO_MAXCONN | ||
77 | #define MAX_LISTEN SO_MAXCONN | ||
78 | #elif defined(SOMAXCONN) | ||
79 | #define MAX_LISTEN SOMAXCONN | ||
80 | #else | ||
81 | #define MAX_LISTEN 32 | ||
82 | #endif | ||
83 | |||
84 | static int get_ip(const char *str, unsigned char *ip); | 74 | static int get_ip(const char *str, unsigned char *ip); |
85 | 75 | ||
86 | int | 76 | int |
@@ -371,7 +361,7 @@ BIO_get_accept_socket(char *host, int bind_mode) | |||
371 | } | 361 | } |
372 | 362 | ||
373 | again: | 363 | again: |
374 | s = socket(server.sa.sa_family, SOCK_STREAM, SOCKET_PROTOCOL); | 364 | s = socket(server.sa.sa_family, SOCK_STREAM, IPPROTO_TCP); |
375 | if (s == -1) { | 365 | if (s == -1) { |
376 | SYSerr(SYS_F_SOCKET, errno); | 366 | SYSerr(SYS_F_SOCKET, errno); |
377 | ERR_asprintf_error_data("port='%s'", host); | 367 | ERR_asprintf_error_data("port='%s'", host); |
@@ -402,7 +392,7 @@ again: | |||
402 | } else | 392 | } else |
403 | goto err; | 393 | goto err; |
404 | } | 394 | } |
405 | cs = socket(client.sa.sa_family, SOCK_STREAM, SOCKET_PROTOCOL); | 395 | cs = socket(client.sa.sa_family, SOCK_STREAM, IPPROTO_TCP); |
406 | if (cs != -1) { | 396 | if (cs != -1) { |
407 | int ii; | 397 | int ii; |
408 | ii = connect(cs, &client.sa, addrlen); | 398 | ii = connect(cs, &client.sa, addrlen); |
@@ -422,7 +412,7 @@ again: | |||
422 | BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, BIO_R_UNABLE_TO_BIND_SOCKET); | 412 | BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, BIO_R_UNABLE_TO_BIND_SOCKET); |
423 | goto err; | 413 | goto err; |
424 | } | 414 | } |
425 | if (listen(s, MAX_LISTEN) == -1) { | 415 | if (listen(s, SOMAXCONN) == -1) { |
426 | SYSerr(SYS_F_BIND, errno); | 416 | SYSerr(SYS_F_BIND, errno); |
427 | ERR_asprintf_error_data("port='%s'", host); | 417 | ERR_asprintf_error_data("port='%s'", host); |
428 | BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, BIO_R_UNABLE_TO_LISTEN_SOCKET); | 418 | BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, BIO_R_UNABLE_TO_LISTEN_SOCKET); |
diff --git a/src/lib/libssl/src/crypto/bio/b_sock.c b/src/lib/libssl/src/crypto/bio/b_sock.c index ddd2abb625..58d57db281 100644 --- a/src/lib/libssl/src/crypto/bio/b_sock.c +++ b/src/lib/libssl/src/crypto/bio/b_sock.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: b_sock.c,v 1.39 2014/06/22 14:41:10 jsing Exp $ */ | 1 | /* $OpenBSD: b_sock.c,v 1.40 2014/06/22 15:38:28 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -71,16 +71,6 @@ | |||
71 | 71 | ||
72 | #include "cryptlib.h" | 72 | #include "cryptlib.h" |
73 | 73 | ||
74 | #define SOCKET_PROTOCOL IPPROTO_TCP | ||
75 | |||
76 | #ifdef SO_MAXCONN | ||
77 | #define MAX_LISTEN SO_MAXCONN | ||
78 | #elif defined(SOMAXCONN) | ||
79 | #define MAX_LISTEN SOMAXCONN | ||
80 | #else | ||
81 | #define MAX_LISTEN 32 | ||
82 | #endif | ||
83 | |||
84 | static int get_ip(const char *str, unsigned char *ip); | 74 | static int get_ip(const char *str, unsigned char *ip); |
85 | 75 | ||
86 | int | 76 | int |
@@ -371,7 +361,7 @@ BIO_get_accept_socket(char *host, int bind_mode) | |||
371 | } | 361 | } |
372 | 362 | ||
373 | again: | 363 | again: |
374 | s = socket(server.sa.sa_family, SOCK_STREAM, SOCKET_PROTOCOL); | 364 | s = socket(server.sa.sa_family, SOCK_STREAM, IPPROTO_TCP); |
375 | if (s == -1) { | 365 | if (s == -1) { |
376 | SYSerr(SYS_F_SOCKET, errno); | 366 | SYSerr(SYS_F_SOCKET, errno); |
377 | ERR_asprintf_error_data("port='%s'", host); | 367 | ERR_asprintf_error_data("port='%s'", host); |
@@ -402,7 +392,7 @@ again: | |||
402 | } else | 392 | } else |
403 | goto err; | 393 | goto err; |
404 | } | 394 | } |
405 | cs = socket(client.sa.sa_family, SOCK_STREAM, SOCKET_PROTOCOL); | 395 | cs = socket(client.sa.sa_family, SOCK_STREAM, IPPROTO_TCP); |
406 | if (cs != -1) { | 396 | if (cs != -1) { |
407 | int ii; | 397 | int ii; |
408 | ii = connect(cs, &client.sa, addrlen); | 398 | ii = connect(cs, &client.sa, addrlen); |
@@ -422,7 +412,7 @@ again: | |||
422 | BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, BIO_R_UNABLE_TO_BIND_SOCKET); | 412 | BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, BIO_R_UNABLE_TO_BIND_SOCKET); |
423 | goto err; | 413 | goto err; |
424 | } | 414 | } |
425 | if (listen(s, MAX_LISTEN) == -1) { | 415 | if (listen(s, SOMAXCONN) == -1) { |
426 | SYSerr(SYS_F_BIND, errno); | 416 | SYSerr(SYS_F_BIND, errno); |
427 | ERR_asprintf_error_data("port='%s'", host); | 417 | ERR_asprintf_error_data("port='%s'", host); |
428 | BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, BIO_R_UNABLE_TO_LISTEN_SOCKET); | 418 | BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, BIO_R_UNABLE_TO_LISTEN_SOCKET); |