summaryrefslogtreecommitdiffstats
path: root/sysdep/unix
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-03-20 22:49:21 +0100
committerMartin Mares <mj@ucw.cz>2000-03-20 22:49:21 +0100
commit1cf716f0751ce1d146d6d5114cb36686844d4817 (patch)
tree140538230fe6fd9e04c8f3d53de0c7fcc7387563 /sysdep/unix
parent267a2c0ebd980c16c1cf01044b0ee44095f34b9e (diff)
downloadbird-1cf716f0751ce1d146d6d5114cb36686844d4817.tar
bird-1cf716f0751ce1d146d6d5114cb36686844d4817.zip
Handle EINPROGRESS properly.
Set IP_DONTROUTE sockopt only if sk->ttl == 1.
Diffstat (limited to 'sysdep/unix')
-rw-r--r--sysdep/unix/io.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c
index 824c7e2..69f3f06 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);