diff options
author | Martin Mares <mj@ucw.cz> | 2000-03-20 21:49:21 +0000 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 2000-03-20 21:49:21 +0000 |
commit | 1cf716f0751ce1d146d6d5114cb36686844d4817 (patch) | |
tree | 140538230fe6fd9e04c8f3d53de0c7fcc7387563 /sysdep/unix/io.c | |
parent | 267a2c0ebd980c16c1cf01044b0ee44095f34b9e (diff) |
Handle EINPROGRESS properly.
Set IP_DONTROUTE sockopt only if sk->ttl == 1.
Diffstat (limited to 'sysdep/unix/io.c')
-rw-r--r-- | sysdep/unix/io.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c index 824c7e29..69f3f066 100644 --- a/sysdep/unix/io.c +++ b/sysdep/unix/io.c @@ -451,13 +451,10 @@ sk_setup(sock *s) #else if ((s->tos >= 0) && setsockopt(fd, SOL_IP, IP_TOS, &s->tos, sizeof(s->tos)) < 0) WARN("IP_TOS"); - if (s->ttl >= 0) - { - if (setsockopt(fd, SOL_IP, IP_TTL, &s->ttl, sizeof(s->ttl)) < 0) - ERR("IP_TTL"); - if (setsockopt(fd, SOL_SOCKET, SO_DONTROUTE, &one, sizeof(one)) < 0) - ERR("SO_DONTROUTE"); - } + if (s->ttl >= 0 && setsockopt(fd, SOL_IP, IP_TTL, &s->ttl, sizeof(s->ttl)) < 0) + ERR("IP_TTL"); + if (s->ttl == 1 && setsockopt(fd, SOL_SOCKET, SO_DONTROUTE, &one, sizeof(one)) < 0) + ERR("SO_DONTROUTE"); #endif /* FIXME: Set send/receive buffers? */ /* FIXME: Set keepalive for TCP connections? */ @@ -618,7 +615,7 @@ sk_open(sock *s) case SK_TCP_ACTIVE: if (connect(fd, (struct sockaddr *) &sa, sizeof(sa)) >= 0) sk_tcp_connected(s); - else if (errno != EINTR && errno != EAGAIN) + else if (errno != EINTR && errno != EAGAIN && errno != EINPROGRESS) ERR("connect"); break; case SK_TCP_PASSIVE: @@ -776,7 +773,7 @@ sk_read(sock *s) fill_in_sockaddr(&sa, s->daddr, s->dport); if (connect(s->fd, (struct sockaddr *) &sa, sizeof(sa)) >= 0) sk_tcp_connected(s); - else if (errno != EINTR && errno != EAGAIN) + else if (errno != EINTR && errno != EAGAIN && errno != EINPROGRESS) { log(L_ERR "connect: %m"); s->err_hook(s, errno); |