summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/hoststated/hoststated.conf.510
-rw-r--r--usr.sbin/hoststated/hoststated.h3
-rw-r--r--usr.sbin/hoststated/relay.c12
-rw-r--r--usr.sbin/relayd/relay.c12
-rw-r--r--usr.sbin/relayd/relayd.conf.510
-rw-r--r--usr.sbin/relayd/relayd.h3
6 files changed, 44 insertions, 6 deletions
diff --git a/usr.sbin/hoststated/hoststated.conf.5 b/usr.sbin/hoststated/hoststated.conf.5
index e694fa48100..58720f97327 100644
--- a/usr.sbin/hoststated/hoststated.conf.5
+++ b/usr.sbin/hoststated/hoststated.conf.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: hoststated.conf.5,v 1.27 2007/02/25 09:04:59 jmc Exp $
+.\" $OpenBSD: hoststated.conf.5,v 1.28 2007/02/26 11:59:48 reyk Exp $
.\"
.\" Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org>
.\"
@@ -369,6 +369,14 @@ headers and GET variables; see the
.Sx PROTOCOLS
section below.
.El
+.Pp
+The optional host retry option will be used as a tolerance for failed
+host connections, the connection will be retried for
+.Ar number
+more times,
+see the
+.Sx TABLES
+section for details about host entries.
.It Ic nat lookup
When redirecting connections with an
.Ar rdr
diff --git a/usr.sbin/hoststated/hoststated.h b/usr.sbin/hoststated/hoststated.h
index 4f03c3247e1..bd3abbbe1c3 100644
--- a/usr.sbin/hoststated/hoststated.h
+++ b/usr.sbin/hoststated/hoststated.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: hoststated.h,v 1.31 2007/02/25 14:57:09 reyk Exp $ */
+/* $OpenBSD: hoststated.h,v 1.32 2007/02/26 11:59:48 reyk Exp $ */
/*
* Copyright (c) 2006, 2007 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -337,6 +337,7 @@ struct session {
struct timeval tv_start;
struct timeval tv_last;
int done;
+ int retry;
struct evbuffer *log;
void *relay;
struct ctl_natlook *cnl;
diff --git a/usr.sbin/hoststated/relay.c b/usr.sbin/hoststated/relay.c
index 94fe7cc317f..9bb2714fbb4 100644
--- a/usr.sbin/hoststated/relay.c
+++ b/usr.sbin/hoststated/relay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relay.c,v 1.6 2007/02/26 11:24:26 reyk Exp $ */
+/* $OpenBSD: relay.c,v 1.7 2007/02/26 11:59:48 reyk Exp $ */
/*
* Copyright (c) 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -1297,6 +1297,7 @@ relay_from_table(struct session *con)
fatalx("relay_from_table: no active hosts, desynchronized");
found:
+ con->retry = host->retry;
con->out.port = table->port;
bcopy(&host->ss, &con->out.ss, sizeof(con->out.ss));
@@ -1368,8 +1369,17 @@ relay_connect(struct session *con)
con->out.port = rlay->dstport;
}
+ retry:
if ((con->out.s = relay_socket_connect(&con->out.ss, con->out.port,
rlay->proto)) == -1) {
+ if (con->retry) {
+ con->retry--;
+ log_debug("relay_connect: session %d: "
+ "forward failed: %s, %s",
+ con->id, strerror(errno),
+ con->retry ? "next retry" : "last retry");
+ goto retry;
+ }
log_debug("relay_connect: session %d: forward failed: %s",
con->id, strerror(errno));
return (-1);
diff --git a/usr.sbin/relayd/relay.c b/usr.sbin/relayd/relay.c
index 94fe7cc317f..9bb2714fbb4 100644
--- a/usr.sbin/relayd/relay.c
+++ b/usr.sbin/relayd/relay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relay.c,v 1.6 2007/02/26 11:24:26 reyk Exp $ */
+/* $OpenBSD: relay.c,v 1.7 2007/02/26 11:59:48 reyk Exp $ */
/*
* Copyright (c) 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -1297,6 +1297,7 @@ relay_from_table(struct session *con)
fatalx("relay_from_table: no active hosts, desynchronized");
found:
+ con->retry = host->retry;
con->out.port = table->port;
bcopy(&host->ss, &con->out.ss, sizeof(con->out.ss));
@@ -1368,8 +1369,17 @@ relay_connect(struct session *con)
con->out.port = rlay->dstport;
}
+ retry:
if ((con->out.s = relay_socket_connect(&con->out.ss, con->out.port,
rlay->proto)) == -1) {
+ if (con->retry) {
+ con->retry--;
+ log_debug("relay_connect: session %d: "
+ "forward failed: %s, %s",
+ con->id, strerror(errno),
+ con->retry ? "next retry" : "last retry");
+ goto retry;
+ }
log_debug("relay_connect: session %d: forward failed: %s",
con->id, strerror(errno));
return (-1);
diff --git a/usr.sbin/relayd/relayd.conf.5 b/usr.sbin/relayd/relayd.conf.5
index 1ede18268b3..4b2fda7c381 100644
--- a/usr.sbin/relayd/relayd.conf.5
+++ b/usr.sbin/relayd/relayd.conf.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: relayd.conf.5,v 1.27 2007/02/25 09:04:59 jmc Exp $
+.\" $OpenBSD: relayd.conf.5,v 1.28 2007/02/26 11:59:48 reyk Exp $
.\"
.\" Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org>
.\"
@@ -369,6 +369,14 @@ headers and GET variables; see the
.Sx PROTOCOLS
section below.
.El
+.Pp
+The optional host retry option will be used as a tolerance for failed
+host connections, the connection will be retried for
+.Ar number
+more times,
+see the
+.Sx TABLES
+section for details about host entries.
.It Ic nat lookup
When redirecting connections with an
.Ar rdr
diff --git a/usr.sbin/relayd/relayd.h b/usr.sbin/relayd/relayd.h
index c9f30b15a7b..fa4017ab41f 100644
--- a/usr.sbin/relayd/relayd.h
+++ b/usr.sbin/relayd/relayd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: relayd.h,v 1.31 2007/02/25 14:57:09 reyk Exp $ */
+/* $OpenBSD: relayd.h,v 1.32 2007/02/26 11:59:48 reyk Exp $ */
/*
* Copyright (c) 2006, 2007 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -337,6 +337,7 @@ struct session {
struct timeval tv_start;
struct timeval tv_last;
int done;
+ int retry;
struct evbuffer *log;
void *relay;
struct ctl_natlook *cnl;