summaryrefslogtreecommitdiff
path: root/usr.sbin/relayd/relayd.c
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2009-08-05 13:46:14 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2009-08-05 13:46:14 +0000
commit9cf9d3f9417b9bc23172dde9843df37ab87d07d5 (patch)
tree9eb54071ed19d16954c5972b3988a7ad8e635c6e /usr.sbin/relayd/relayd.c
parent584ad849718300e719b0c35389723c9c65349846 (diff)
prevent configuration of relays listening to a single addr:port tuple twice
Diffstat (limited to 'usr.sbin/relayd/relayd.c')
-rw-r--r--usr.sbin/relayd/relayd.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/usr.sbin/relayd/relayd.c b/usr.sbin/relayd/relayd.c
index eb33e59fe53..7d832ef4df8 100644
--- a/usr.sbin/relayd/relayd.c
+++ b/usr.sbin/relayd/relayd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relayd.c,v 1.89 2009/06/05 23:39:51 pyr Exp $ */
+/* $OpenBSD: relayd.c,v 1.90 2009/08/05 13:46:13 reyk Exp $ */
/*
* Copyright (c) 2007, 2008 Reyk Floeter <reyk@openbsd.org>
@@ -923,6 +923,18 @@ relay_findbyname(struct relayd *env, const char *name)
return (NULL);
}
+struct relay *
+relay_findbyaddr(struct relayd *env, struct relay_config *rc)
+{
+ struct relay *rlay;
+
+ TAILQ_FOREACH(rlay, env->sc_relays, rl_entry)
+ if (bcmp(&rlay->rl_conf.ss, &rc->ss, sizeof(rc->ss)) == 0 &&
+ rlay->rl_conf.port == rc->port)
+ return (rlay);
+ return (NULL);
+}
+
void
event_again(struct event *ev, int fd, short event,
void (*fn)(int, short, void *),