diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2007-02-22 03:32:41 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2007-02-22 03:32:41 +0000 |
commit | b8b5308cae709adc7b92263ac61594c76949364e (patch) | |
tree | 2bac390064e9007c688d03c0520127876862c33e /usr.sbin/hoststated/log.c | |
parent | 28be4aaf667d9ad44c93bdc68b15a111e28fe396 (diff) |
Add layer 7 functionality to hoststated used for layer 7
loadbalancing, SSL acceleration, general-purpose TCP relaying, and
transparent proxying.
see hoststated.conf(5) and my upcoming article on undeadly.org for
details.
ok to commit deraadt@ pyr@
Diffstat (limited to 'usr.sbin/hoststated/log.c')
-rw-r--r-- | usr.sbin/hoststated/log.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/usr.sbin/hoststated/log.c b/usr.sbin/hoststated/log.c index 4fc3f35fb8c..0da3432ca88 100644 --- a/usr.sbin/hoststated/log.c +++ b/usr.sbin/hoststated/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.3 2007/02/07 15:17:46 reyk Exp $ */ +/* $OpenBSD: log.c,v 1.4 2007/02/22 03:32:39 reyk Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -20,6 +20,7 @@ #include <sys/param.h> #include <sys/queue.h> #include <sys/socket.h> +#include <sys/tree.h> #include <netinet/in_systm.h> #include <netinet/in.h> @@ -199,3 +200,15 @@ table_check(enum table_check check) /* NOTREACHED */ return ("invalid"); } + +const char * +print_availability(u_long cnt, u_long up) +{ + static char buf[BUFSIZ]; + + if (cnt == 0) + return (""); + bzero(buf, sizeof(buf)); + snprintf(buf, sizeof(buf), "%.2f%%", (double)up / cnt * 100); + return (buf); +} |