summaryrefslogtreecommitdiff
path: root/usr.sbin/relayd/relay.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2010-11-16 15:31:02 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2010-11-16 15:31:02 +0000
commit8216150a6c43e6ca7b9ec06cf003e76359928f9d (patch)
treef366b98d04fcb7f971fb05984902b6fef06d8112 /usr.sbin/relayd/relay.c
parent1e15a85d6d204e715adcc53f3f7bcee745c288ea (diff)
Add support for enable/disable table when using relays instead of redirects.
From Patrik Lundin and Linus Widstromer. ok reyk@
Diffstat (limited to 'usr.sbin/relayd/relay.c')
-rw-r--r--usr.sbin/relayd/relay.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/usr.sbin/relayd/relay.c b/usr.sbin/relayd/relay.c
index c421e851ffc..e7ddef25742 100644
--- a/usr.sbin/relayd/relay.c
+++ b/usr.sbin/relayd/relay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relay.c,v 1.123 2010/10/12 14:52:21 dhill Exp $ */
+/* $OpenBSD: relay.c,v 1.124 2010/11/16 15:31:01 jsg Exp $ */
/*
* Copyright (c) 2006, 2007, 2008 Reyk Floeter <reyk@openbsd.org>
@@ -2492,6 +2492,22 @@ relay_dispatch_pfe(int fd, short event, void *ptr)
host->flags &= ~(F_DISABLE);
host->up = HOST_UNKNOWN;
break;
+ case IMSG_TABLE_DISABLE:
+ memcpy(&id, imsg.data, sizeof(id));
+ if ((table = table_find(env, id)) == NULL)
+ fatalx("relay_dispatch_pfe: desynchronized");
+ table->conf.flags |= F_DISABLE;
+ TAILQ_FOREACH(host, &table->hosts, entry)
+ host->up = HOST_UNKNOWN;
+ break;
+ case IMSG_TABLE_ENABLE:
+ memcpy(&id, imsg.data, sizeof(id));
+ if ((table = table_find(env, id)) == NULL)
+ fatalx("relay_dispatch_pfe: desynchronized");
+ table->conf.flags &= ~(F_DISABLE);
+ TAILQ_FOREACH(host, &table->hosts, entry)
+ host->up = HOST_UNKNOWN;
+ break;
case IMSG_HOST_STATUS:
if (imsg.hdr.len - IMSG_HEADER_SIZE != sizeof(st))
fatalx("relay_dispatch_pfe: invalid request");