diff options
author | jsing <> | 2014-06-24 17:30:00 +0000 |
---|---|---|
committer | jsing <> | 2014-06-24 17:30:00 +0000 |
commit | d4f132e9609745e345c90835ab2d403f8629ba03 (patch) | |
tree | e469eaab8eb6c18b8ef6da06079024661eda4cd1 /src | |
parent | 9ea00e1103855200b63d98afaedfa948a22f90df (diff) | |
download | openbsd-d4f132e9609745e345c90835ab2d403f8629ba03.tar.gz openbsd-d4f132e9609745e345c90835ab2d403f8629ba03.tar.bz2 openbsd-d4f132e9609745e345c90835ab2d403f8629ba03.zip |
Actually make BIO_set_tcp_ndelay() work - TCP_NODELAY will not magically
appear by itself.
ok beck@ miod@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/bio/b_sock.c | 19 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/bio/b_sock.c | 19 |
2 files changed, 6 insertions, 32 deletions
diff --git a/src/lib/libcrypto/bio/b_sock.c b/src/lib/libcrypto/bio/b_sock.c index ec28ba2e82..62d545a129 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.41 2014/06/22 16:47:08 jsing Exp $ */ | 1 | /* $OpenBSD: b_sock.c,v 1.42 2014/06/24 17:30:00 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 | * |
@@ -60,6 +60,7 @@ | |||
60 | #include <sys/socket.h> | 60 | #include <sys/socket.h> |
61 | 61 | ||
62 | #include <netinet/in.h> | 62 | #include <netinet/in.h> |
63 | #include <netinet/tcp.h> | ||
63 | 64 | ||
64 | #include <errno.h> | 65 | #include <errno.h> |
65 | #include <netdb.h> | 66 | #include <netdb.h> |
@@ -509,21 +510,7 @@ end: | |||
509 | int | 510 | int |
510 | BIO_set_tcp_ndelay(int s, int on) | 511 | BIO_set_tcp_ndelay(int s, int on) |
511 | { | 512 | { |
512 | int ret = 0; | 513 | return (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)) == 0); |
513 | #if defined(TCP_NODELAY) && (defined(IPPROTO_TCP) || defined(SOL_TCP)) | ||
514 | int opt; | ||
515 | |||
516 | #ifdef SOL_TCP | ||
517 | opt = SOL_TCP; | ||
518 | #else | ||
519 | #ifdef IPPROTO_TCP | ||
520 | opt = IPPROTO_TCP; | ||
521 | #endif | ||
522 | #endif | ||
523 | |||
524 | ret = setsockopt(s, opt, TCP_NODELAY, (char *)&on, sizeof(on)); | ||
525 | #endif | ||
526 | return (ret == 0); | ||
527 | } | 514 | } |
528 | 515 | ||
529 | int | 516 | int |
diff --git a/src/lib/libssl/src/crypto/bio/b_sock.c b/src/lib/libssl/src/crypto/bio/b_sock.c index ec28ba2e82..62d545a129 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.41 2014/06/22 16:47:08 jsing Exp $ */ | 1 | /* $OpenBSD: b_sock.c,v 1.42 2014/06/24 17:30:00 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 | * |
@@ -60,6 +60,7 @@ | |||
60 | #include <sys/socket.h> | 60 | #include <sys/socket.h> |
61 | 61 | ||
62 | #include <netinet/in.h> | 62 | #include <netinet/in.h> |
63 | #include <netinet/tcp.h> | ||
63 | 64 | ||
64 | #include <errno.h> | 65 | #include <errno.h> |
65 | #include <netdb.h> | 66 | #include <netdb.h> |
@@ -509,21 +510,7 @@ end: | |||
509 | int | 510 | int |
510 | BIO_set_tcp_ndelay(int s, int on) | 511 | BIO_set_tcp_ndelay(int s, int on) |
511 | { | 512 | { |
512 | int ret = 0; | 513 | return (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)) == 0); |
513 | #if defined(TCP_NODELAY) && (defined(IPPROTO_TCP) || defined(SOL_TCP)) | ||
514 | int opt; | ||
515 | |||
516 | #ifdef SOL_TCP | ||
517 | opt = SOL_TCP; | ||
518 | #else | ||
519 | #ifdef IPPROTO_TCP | ||
520 | opt = IPPROTO_TCP; | ||
521 | #endif | ||
522 | #endif | ||
523 | |||
524 | ret = setsockopt(s, opt, TCP_NODELAY, (char *)&on, sizeof(on)); | ||
525 | #endif | ||
526 | return (ret == 0); | ||
527 | } | 514 | } |
528 | 515 | ||
529 | int | 516 | int |