diff options
| author | 2007-02-22 03:32:39 +0000 | |
|---|---|---|
| committer | 2007-02-22 03:32:39 +0000 | |
| commit | 2edd718bd68a9c827be137ebb51a319071210c69 (patch) | |
| tree | 8c1c5b888f71aa148d70db79b9527a623ad5e0be /usr.sbin/relayd/log.c | |
| parent | Expand description. (diff) | |
| download | wireguard-openbsd-2edd718bd68a9c827be137ebb51a319071210c69.tar.xz wireguard-openbsd-2edd718bd68a9c827be137ebb51a319071210c69.zip | |
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/relayd/log.c')
| -rw-r--r-- | usr.sbin/relayd/log.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/usr.sbin/relayd/log.c b/usr.sbin/relayd/log.c index 4fc3f35fb8c..0da3432ca88 100644 --- a/usr.sbin/relayd/log.c +++ b/usr.sbin/relayd/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); +} |
