summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2007-01-08 16:52:59 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2007-01-08 16:52:59 +0000
commita46321eba2630d0d3d3bc2ac16ece3dd6507f8a8 (patch)
treeda7e7e67145ae6b9498ff64cd1ea098c33627063 /usr.sbin
parent40f355c442fea645d90f475ab659d79d5ef06efb (diff)
the timeout values are not allowed to exceed the global interval (i
figured this out while testing hostated against a stottering spamd where the send/expect timeout needs be > 10 seconds). also use another struct timeval to store the interval for easier handling in the code. ok Pierre-Yves Ritschard (pyr at spootnik dot org)
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/hostated/hce.c8
-rw-r--r--usr.sbin/hostated/hostated.h4
-rw-r--r--usr.sbin/hoststated/hce.c8
-rw-r--r--usr.sbin/hoststated/hoststated.h4
-rw-r--r--usr.sbin/relayd/hce.c8
-rw-r--r--usr.sbin/relayd/relayd.h4
6 files changed, 15 insertions, 21 deletions
diff --git a/usr.sbin/hostated/hce.c b/usr.sbin/hostated/hce.c
index 21cfe8a91aa..538783830d9 100644
--- a/usr.sbin/hostated/hce.c
+++ b/usr.sbin/hostated/hce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hce.c,v 1.5 2007/01/08 13:37:26 reyk Exp $ */
+/* $OpenBSD: hce.c,v 1.6 2007/01/08 16:52:58 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -139,8 +139,7 @@ hce(struct hostated *x_env, int pipe_parent2pfe[2], int pipe_parent2hce[2],
event_add(&ibuf_main->ev, NULL);
evtimer_set(&env->ev, hce_launch_checks, NULL);
- tv.tv_sec = env->interval;
- tv.tv_usec = 0;
+ bcopy(&env->interval, &tv, sizeof(tv));
evtimer_add(&env->ev, &tv);
hce_launch_checks(0, 0, NULL);
@@ -232,8 +231,7 @@ hce_notify_done(struct host *host, const char *msg)
TAILQ_FOREACH(host, &table->hosts, entry)
host->flags &= ~F_CHECK_DONE;
}
- tv.tv_sec = env->interval;
- tv.tv_usec = 0;
+ bcopy(&env->interval, &tv, sizeof(tv));
evtimer_add(&env->ev, &tv);
bzero(&st, sizeof(st));
}
diff --git a/usr.sbin/hostated/hostated.h b/usr.sbin/hostated/hostated.h
index 75ca9878c92..4fd86fb92ac 100644
--- a/usr.sbin/hostated/hostated.h
+++ b/usr.sbin/hostated/hostated.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: hostated.h,v 1.9 2007/01/08 13:37:26 reyk Exp $ */
+/* $OpenBSD: hostated.h,v 1.10 2007/01/08 16:52:58 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -228,11 +228,11 @@ enum {
struct hostated {
u_int8_t opts;
struct pfdata *pf;
- int interval;
int icmp_sock;
int icmp6_sock;
int tablecount;
int servicecount;
+ struct timeval interval;
struct timeval timeout;
struct table empty_table;
struct event ev;
diff --git a/usr.sbin/hoststated/hce.c b/usr.sbin/hoststated/hce.c
index 21cfe8a91aa..538783830d9 100644
--- a/usr.sbin/hoststated/hce.c
+++ b/usr.sbin/hoststated/hce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hce.c,v 1.5 2007/01/08 13:37:26 reyk Exp $ */
+/* $OpenBSD: hce.c,v 1.6 2007/01/08 16:52:58 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -139,8 +139,7 @@ hce(struct hostated *x_env, int pipe_parent2pfe[2], int pipe_parent2hce[2],
event_add(&ibuf_main->ev, NULL);
evtimer_set(&env->ev, hce_launch_checks, NULL);
- tv.tv_sec = env->interval;
- tv.tv_usec = 0;
+ bcopy(&env->interval, &tv, sizeof(tv));
evtimer_add(&env->ev, &tv);
hce_launch_checks(0, 0, NULL);
@@ -232,8 +231,7 @@ hce_notify_done(struct host *host, const char *msg)
TAILQ_FOREACH(host, &table->hosts, entry)
host->flags &= ~F_CHECK_DONE;
}
- tv.tv_sec = env->interval;
- tv.tv_usec = 0;
+ bcopy(&env->interval, &tv, sizeof(tv));
evtimer_add(&env->ev, &tv);
bzero(&st, sizeof(st));
}
diff --git a/usr.sbin/hoststated/hoststated.h b/usr.sbin/hoststated/hoststated.h
index f2555aa6270..9b56755c687 100644
--- a/usr.sbin/hoststated/hoststated.h
+++ b/usr.sbin/hoststated/hoststated.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: hoststated.h,v 1.9 2007/01/08 13:37:26 reyk Exp $ */
+/* $OpenBSD: hoststated.h,v 1.10 2007/01/08 16:52:58 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -228,11 +228,11 @@ enum {
struct hostated {
u_int8_t opts;
struct pfdata *pf;
- int interval;
int icmp_sock;
int icmp6_sock;
int tablecount;
int servicecount;
+ struct timeval interval;
struct timeval timeout;
struct table empty_table;
struct event ev;
diff --git a/usr.sbin/relayd/hce.c b/usr.sbin/relayd/hce.c
index 21cfe8a91aa..538783830d9 100644
--- a/usr.sbin/relayd/hce.c
+++ b/usr.sbin/relayd/hce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hce.c,v 1.5 2007/01/08 13:37:26 reyk Exp $ */
+/* $OpenBSD: hce.c,v 1.6 2007/01/08 16:52:58 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -139,8 +139,7 @@ hce(struct hostated *x_env, int pipe_parent2pfe[2], int pipe_parent2hce[2],
event_add(&ibuf_main->ev, NULL);
evtimer_set(&env->ev, hce_launch_checks, NULL);
- tv.tv_sec = env->interval;
- tv.tv_usec = 0;
+ bcopy(&env->interval, &tv, sizeof(tv));
evtimer_add(&env->ev, &tv);
hce_launch_checks(0, 0, NULL);
@@ -232,8 +231,7 @@ hce_notify_done(struct host *host, const char *msg)
TAILQ_FOREACH(host, &table->hosts, entry)
host->flags &= ~F_CHECK_DONE;
}
- tv.tv_sec = env->interval;
- tv.tv_usec = 0;
+ bcopy(&env->interval, &tv, sizeof(tv));
evtimer_add(&env->ev, &tv);
bzero(&st, sizeof(st));
}
diff --git a/usr.sbin/relayd/relayd.h b/usr.sbin/relayd/relayd.h
index f6dbe7bfc28..d0366ed0b1b 100644
--- a/usr.sbin/relayd/relayd.h
+++ b/usr.sbin/relayd/relayd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: relayd.h,v 1.9 2007/01/08 13:37:26 reyk Exp $ */
+/* $OpenBSD: relayd.h,v 1.10 2007/01/08 16:52:58 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -228,11 +228,11 @@ enum {
struct hostated {
u_int8_t opts;
struct pfdata *pf;
- int interval;
int icmp_sock;
int icmp6_sock;
int tablecount;
int servicecount;
+ struct timeval interval;
struct timeval timeout;
struct table empty_table;
struct event ev;