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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
Description: Fix setsockopt bugs
Author: Vladimir Olteanu <vladimir.olteanu@cs.pub.ro>
Applied-Upstream: https://github.com/larsbrinkhoff/httptunnel/commit/a578fb44f37c9ef8689d1030e19a69a73e914820
Forwarded: not-needed
--- a/tunnel.c
+++ b/tunnel.c
@@ -140,30 +140,25 @@
tunnel_in_setsockopts (int fd)
{
#ifdef SO_RCVLOWAT
- int tcp = get_proto_number ("tcp");
+ int i, n;
- if (tcp != -1)
- {
- int i, n;
-
- i = 1;
- if (setsockopt (fd,
- tcp,
- SO_RCVLOWAT,
- (void *)&i,
- sizeof i) == -1)
- {
- log_debug ("tunnel_in_setsockopts: non-fatal SO_RCVLOWAT error: %s",
- strerror (errno));
- }
- n = sizeof i;
- getsockopt (fd,
- tcp,
+ i = 1;
+ if (setsockopt (fd,
+ SOL_SOCKET,
SO_RCVLOWAT,
(void *)&i,
- &n);
- log_debug ("tunnel_out_setsockopts: SO_RCVLOWAT: %d", i);
+ sizeof i) == -1)
+ {
+ log_debug ("tunnel_in_setsockopts: non-fatal SO_RCVLOWAT error: %s",
+ strerror (errno));
}
+ n = sizeof i;
+ getsockopt (fd,
+ SOL_SOCKET,
+ SO_RCVLOWAT,
+ (void *)&i,
+ &n);
+ log_debug ("tunnel_out_setsockopts: SO_RCVLOWAT: %d", i);
#endif /* SO_RCVLOWAT */
return 0;
@@ -174,30 +169,26 @@
{
#ifdef SO_SNDLOWAT
{
- int tcp = get_proto_number ("tcp");
int i, n;
- if (tcp != -1)
- {
- i = 1;
- if (setsockopt (fd,
- tcp,
- SO_SNDLOWAT,
- (void *)&i,
- sizeof i) == -1)
- {
- log_debug ("tunnel_out_setsockopts: "
- "non-fatal SO_SNDLOWAT error: %s",
- strerror (errno));
- }
- n = sizeof i;
- getsockopt (fd,
- tcp,
+ i = 1;
+ if (setsockopt (fd,
+ SOL_SOCKET,
SO_SNDLOWAT,
(void *)&i,
- &n);
- log_debug ("tunnel_out_setsockopts: non-fatal SO_SNDLOWAT: %d", i);
+ sizeof i) == -1)
+ {
+ log_debug ("tunnel_out_setsockopts: "
+ "non-fatal SO_SNDLOWAT error: %s",
+ strerror (errno));
}
+ n = sizeof i;
+ getsockopt (fd,
+ SOL_SOCKET,
+ SO_SNDLOWAT,
+ (void *)&i,
+ &n);
+ log_debug ("tunnel_out_setsockopts: non-fatal SO_SNDLOWAT: %d", i);
}
#endif /* SO_SNDLOWAT */
|