aboutsummaryrefslogtreecommitdiff
path: root/net/relayd
diff options
context:
space:
mode:
authorJun Kuriyama <kuriyama@FreeBSD.org>2008-01-20 21:38:26 +0000
committerJun Kuriyama <kuriyama@FreeBSD.org>2008-01-20 21:38:26 +0000
commit304acfbef819ce1a154b526144a10cc3346a8f4f (patch)
tree2610e87b8112219eb5f34b75f44cbfc66f86289b /net/relayd
parentc0a00dff9a89b0d8075c456f340c0a6b4f44f330 (diff)
downloadports-304acfbef819ce1a154b526144a10cc3346a8f4f.tar.gz
ports-304acfbef819ce1a154b526144a10cc3346a8f4f.zip
Notes
Diffstat (limited to 'net/relayd')
-rw-r--r--net/relayd/Makefile62
-rw-r--r--net/relayd/distinfo3
-rw-r--r--net/relayd/files/patch-ctl-Makefile20
-rw-r--r--net/relayd/files/patch-ctl-parser.c21
-rw-r--r--net/relayd/files/patch-ctl-parser.h8
-rw-r--r--net/relayd/files/patch-ctl-relayctl.c19
-rw-r--r--net/relayd/files/patch-d-Makefile26
-rw-r--r--net/relayd/files/patch-d-carp.c44
-rw-r--r--net/relayd/files/patch-d-check_icmp.c11
-rw-r--r--net/relayd/files/patch-d-check_tcp.c47
-rw-r--r--net/relayd/files/patch-d-log.c11
-rw-r--r--net/relayd/files/patch-d-parse.y11
-rw-r--r--net/relayd/files/patch-d-pfe.c10
-rw-r--r--net/relayd/files/patch-d-pfe_filter.c45
-rw-r--r--net/relayd/files/patch-d-relay.c72
-rw-r--r--net/relayd/files/patch-d-relay_udp.c11
-rw-r--r--net/relayd/files/patch-d-relayd.820
-rw-r--r--net/relayd/files/patch-d-relayd.c29
-rw-r--r--net/relayd/files/patch-d-relayd.conf.533
-rw-r--r--net/relayd/files/patch-d-relayd.h27
-rw-r--r--net/relayd/files/relayd.in27
-rw-r--r--net/relayd/pkg-descr7
-rw-r--r--net/relayd/pkg-install36
-rw-r--r--net/relayd/pkg-plist3
24 files changed, 603 insertions, 0 deletions
diff --git a/net/relayd/Makefile b/net/relayd/Makefile
new file mode 100644
index 000000000000..d281d6b73d9c
--- /dev/null
+++ b/net/relayd/Makefile
@@ -0,0 +1,62 @@
+# New ports collection makefile for: relayd
+# Date created: 5 Jun 2007
+# Whom: Jun Kuriyama <kuriyama@FreeBSD.org>
+#
+# $FreeBSD$
+
+PORTNAME= relayd
+PORTVERSION= 4.2.20071221
+CATEGORIES= net
+MASTER_SITES= ${MASTER_SITE_LOCAL}
+MASTER_SITE_SUBDIR= kuriyama
+
+MAINTAINER= kuriyama@FreeBSD.org
+COMMENT= OpenBSD Relay Daemon
+
+LIB_DEPENDS= event:${PORTSDIR}/devel/libevent
+
+WRKSRC= ${WRKDIR}/tmp
+MAN5= relayd.conf.5
+MAN8= relayctl.8 relayd.8
+USE_RC_SUBR= relayd
+
+CFLAGS+= -I${PREFIX}/include
+
+WRKSRCC= ${WRKDIR}/tmp/relayctl
+WRKSRCD= ${WRKDIR}/tmp/relayd
+_MAKE= ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_ARGS}
+RUSER= _relayd
+RGROUP= _relayd
+
+post-extract:
+ ${MKDIR} ${WRKSRC}
+ ${MV} ${WRKDIR}/relayctl ${WRKSRC}/
+ ${MV} ${WRKDIR}/relayd ${WRKSRC}/
+
+pre-build:
+ ${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \
+ ${WRKSRCD}/relayd.h \
+ ${WRKSRCD}/relayd.conf.5 ${WRKSRCD}/relayd.8
+
+do-build:
+ (cd ${WRKSRCC}; ${_MAKE} ${ALL_TARGET})
+ (cd ${WRKSRCD}; ${_MAKE} ${ALL_TARGET})
+
+pre-su-install:
+ @${SETENV} PKG_PREFIX=${PREFIX} RUSER=${RUSER} RGROUP=${RGROUP} \
+ ${SH} ${PKGINSTALL} ${PORTNAME} PRE-INSTALL
+
+do-install:
+ (cd ${WRKSRCC}; ${_MAKE} ${INSTALL_TARGET} install-man)
+ (cd ${WRKSRCD}; ${_MAKE} ${INSTALL_TARGET} install-man)
+
+.include <bsd.port.pre.mk>
+
+.if ${OSVERSION} < 502106
+IGNORE= is of no use for you because your system is too old and doesn't have pf
+.endif
+.if (${OSVERSION} < 700049) && !defined(I_KNOW_WHAT_I_AM_DOING)
+IGNORE= needs a patched kernel to work correctly (http://www.openbsd.org/cgi-bin/cvsweb/src/sys/net/pf_table.c.diff?r1=1.67&r2=1.68)
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/net/relayd/distinfo b/net/relayd/distinfo
new file mode 100644
index 000000000000..714b2da38216
--- /dev/null
+++ b/net/relayd/distinfo
@@ -0,0 +1,3 @@
+MD5 (relayd-4.2.20071221.tar.gz) = 3e6060c3228f2427d4dc3f3740cd4b15
+SHA256 (relayd-4.2.20071221.tar.gz) = e92d777408e87e9c60d5a439affddc6c2ea005fcb116ced937f3ce977e9b3d0d
+SIZE (relayd-4.2.20071221.tar.gz) = 84150
diff --git a/net/relayd/files/patch-ctl-Makefile b/net/relayd/files/patch-ctl-Makefile
new file mode 100644
index 000000000000..686d1a5c1906
--- /dev/null
+++ b/net/relayd/files/patch-ctl-Makefile
@@ -0,0 +1,20 @@
+--- relayctl/Makefile.orig Tue Jan 9 09:45:32 2007
++++ relayctl/Makefile Wed Jun 6 18:58:57 2007
+@@ -8,9 +8,16 @@
+ MAN= relayctl.8
+
+ CFLAGS+= -Wall -Werror -I${.CURDIR} -I${.CURDIR}/../relayd
++CFLAGS+= -I${PREFIX}/include -D__dead=''
+ CFLAGS+= -Wstrict-prototypes -Wmissing-prototypes
+ CFLAGS+= -Wmissing-declarations
+ CFLAGS+= -Wshadow -Wpointer-arith -Wcast-qual
+-CFLAGS+= -Wsign-compare -Wbounded
++CFLAGS+= -Wsign-compare
++
++install:
++ $(INSTALL) -m 555 -g wheel -o root relayctl $(PREFIX)/sbin
++
++install-man:
++ $(INSTALL) -o root -g wheel -m 444 relayctl.8 $(PREFIX)/man/man8
+
+ .include <bsd.prog.mk>
diff --git a/net/relayd/files/patch-ctl-parser.c b/net/relayd/files/patch-ctl-parser.c
new file mode 100644
index 000000000000..f2162c9e9f05
--- /dev/null
+++ b/net/relayd/files/patch-ctl-parser.c
@@ -0,0 +1,21 @@
+--- relayctl/parser.c.orig Wed May 30 07:41:48 2007
++++ relayctl/parser.c Mon Jan 7 21:32:16 2008
+@@ -18,7 +18,7 @@
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+-#include <sys/types.h>
++#include <sys/param.h>
+ #include <sys/socket.h>
+ #include <sys/queue.h>
+ #include <netinet/in.h>
+@@ -118,6 +118,9 @@
+ };
+
+ static struct parse_result res;
++
++const struct token *match_token(const char *, const struct token []);
++void show_valid_args(const struct token []);
+
+ struct parse_result *
+ parse(int argc, char *argv[])
diff --git a/net/relayd/files/patch-ctl-parser.h b/net/relayd/files/patch-ctl-parser.h
new file mode 100644
index 000000000000..329b6c03dce5
--- /dev/null
+++ b/net/relayd/files/patch-ctl-parser.h
@@ -0,0 +1,8 @@
+--- relayctl/parser.h.orig Wed Jun 6 18:25:59 2007
++++ relayctl/parser.h Wed Jun 6 18:27:58 2007
+@@ -38,5 +38,3 @@
+ };
+
+ struct parse_result *parse(int, char *[]);
+-const struct token *match_token(const char *, const struct token []);
+-void show_valid_args(const struct token []);
diff --git a/net/relayd/files/patch-ctl-relayctl.c b/net/relayd/files/patch-ctl-relayctl.c
new file mode 100644
index 000000000000..7aa04fa8810a
--- /dev/null
+++ b/net/relayd/files/patch-ctl-relayctl.c
@@ -0,0 +1,19 @@
+--- relayctl/relayctl.c.orig Thu Feb 22 14:59:13 2007
++++ relayctl/relayctl.c Fri Jun 8 13:00:53 2007
+@@ -20,6 +20,7 @@
+ */
+
+ #include <sys/types.h>
++#include <sys/param.h>
+ #include <sys/socket.h>
+ #include <sys/queue.h>
+ #include <sys/un.h>
+@@ -286,7 +287,7 @@
+ imn = monitor_lookup(imsg->hdr.type);
+ printf("%s: imsg type %u len %u peerid %u pid %d\n", imn->name,
+ imsg->hdr.type, imsg->hdr.len, imsg->hdr.peerid, imsg->hdr.pid);
+- printf("\ttimestamp: %u, %s", now, ctime(&now));
++ printf("\ttimestamp: %lu, %s", (unsigned long)now, ctime(&now));
+ if (imn->type == -1)
+ done = 1;
+ if (imn->func != NULL)
diff --git a/net/relayd/files/patch-d-Makefile b/net/relayd/files/patch-d-Makefile
new file mode 100644
index 000000000000..a983bfebf003
--- /dev/null
+++ b/net/relayd/files/patch-d-Makefile
@@ -0,0 +1,26 @@
+--- relayd/Makefile.orig Tue Feb 27 04:35:43 2007
++++ relayd/Makefile Tue Jun 5 20:57:45 2007
+@@ -6,13 +6,20 @@
+ check_icmp.c check_tcp.c relay.c carp.c
+ MAN= relayd.8 relayd.conf.5
+
+-LDADD= -levent -lssl -lcrypto
++LDADD= -lmd -L${PREFIX}/lib -levent -lssl -lcrypto
+ DPADD= ${LIBEVENT} ${LIBSSL} ${LIBCRYPTO}
+-CFLAGS+= -Wall -I${.CURDIR}
++CFLAGS+= -Wall -I${.CURDIR} -I${PREFIX}/include -D__dead='' -DSHA1_DIGEST_LENGTH=SHA_DIGEST_LENGTH -DSHA1_DIGEST_STRING_LENGTH=SHA_DIGEST_LENGTH -DOPENSSL_NO_SHA -DOPENSSL_NO_MD5
+ CFLAGS+= -Wstrict-prototypes -Wmissing-prototypes
+ CFLAGS+= -Wmissing-declarations
+ CFLAGS+= -Wshadow -Wpointer-arith -Wcast-qual
+-CFLAGS+= -Wsign-compare -Wbounded
++CFLAGS+= -Wsign-compare
+ CLEANFILES+= y.tab.h
++
++install:
++ $(INSTALL) -m 555 -g wheel -o root relayd $(PREFIX)/sbin
++
++install-man:
++ $(INSTALL) -m 444 -g wheel -o root relayd.conf.5 $(PREFIX)/man/man5
++ $(INSTALL) -m 444 -g wheel -o root relayd.8 $(PREFIX)/man/man8
+
+ .include <bsd.prog.mk>
diff --git a/net/relayd/files/patch-d-carp.c b/net/relayd/files/patch-d-carp.c
new file mode 100644
index 000000000000..57cafacf3229
--- /dev/null
+++ b/net/relayd/files/patch-d-carp.c
@@ -0,0 +1,44 @@
+--- relayd/carp.c.orig 2007-12-08 02:17:00.000000000 +0900
++++ relayd/carp.c 2008-01-14 08:43:07.745281030 +0900
+@@ -19,6 +19,7 @@
+ #include <sys/param.h>
+ #include <sys/socket.h>
+ #include <sys/ioctl.h>
++#include <sys/queue.h>
+
+ #include <net/if.h>
+
+@@ -105,6 +106,7 @@
+ int
+ carp_demote_get(char *group)
+ {
++#if 0
+ int s;
+ struct ifgroupreq ifgr;
+
+@@ -131,6 +133,9 @@
+
+ close(s);
+ return ((int)ifgr.ifgr_attrib.ifg_carp_demoted);
++#else
++ return (-1);
++#endif
+ }
+
+ int
+@@ -188,6 +193,7 @@
+ int
+ carp_demote_ioctl(char *group, int demote)
+ {
++#if 0
+ int s, res;
+ struct ifgroupreq ifgr;
+
+@@ -214,4 +220,7 @@
+
+ close(s);
+ return (res);
++#else
++ return (-1);
++#endif
+ }
diff --git a/net/relayd/files/patch-d-check_icmp.c b/net/relayd/files/patch-d-check_icmp.c
new file mode 100644
index 000000000000..5fa746a3f234
--- /dev/null
+++ b/net/relayd/files/patch-d-check_icmp.c
@@ -0,0 +1,11 @@
+--- relayd/check_icmp.c.orig 2008-01-14 10:10:32.881133017 +0900
++++ relayd/check_icmp.c 2008-01-14 10:10:45.169385174 +0900
+@@ -16,7 +16,7 @@
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+-#include <sys/types.h>
++#include <sys/param.h>
+ #include <sys/queue.h>
+ #include <sys/socket.h>
+
diff --git a/net/relayd/files/patch-d-check_tcp.c b/net/relayd/files/patch-d-check_tcp.c
new file mode 100644
index 000000000000..44db31fc5190
--- /dev/null
+++ b/net/relayd/files/patch-d-check_tcp.c
@@ -0,0 +1,47 @@
+--- relayd/check_tcp.c.orig 2007-12-08 02:17:00.000000000 +0900
++++ relayd/check_tcp.c 2008-01-14 16:47:41.131892553 +0900
+@@ -31,7 +31,7 @@
+ #include <stdlib.h>
+ #include <errno.h>
+ #include <fnmatch.h>
+-#include <sha1.h>
++#include <sha.h>
+
+ #include <openssl/ssl.h>
+
+@@ -285,7 +285,7 @@
+ if (b == NULL)
+ fatal("out of memory");
+ *b = '\0';
+- if (fnmatch(cte->table->conf.exbuf, cte->buf->buf, 0) == 0) {
++ if (fnmatch(cte->table->conf.exbuf, (char *)cte->buf->buf, 0) == 0) {
+ cte->host->up = HOST_UP;
+ return (0);
+ }
+@@ -316,7 +316,7 @@
+ fatal("out of memory");
+ *b = '\0';
+
+- head = cte->buf->buf;
++ head = (char *)cte->buf->buf;
+ host = cte->host;
+ if (strncmp(head, "HTTP/1.1 ", strlen("HTTP/1.1 ")) &&
+ strncmp(head, "HTTP/1.0 ", strlen("HTTP/1.0 "))) {
+@@ -363,7 +363,7 @@
+ fatal("out of memory");
+ *b = '\0';
+
+- head = cte->buf->buf;
++ head = (char *)cte->buf->buf;
+ host = cte->host;
+ if ((head = strstr(head, "\r\n\r\n")) == NULL) {
+ log_debug("check_http_digest: %s failed "
+@@ -373,7 +373,7 @@
+ }
+ head += strlen("\r\n\r\n");
+
+- digeststr(cte->table->conf.digest_type, head, strlen(head), digest);
++ digeststr(cte->table->conf.digest_type, (u_int8_t*)head, strlen(head), digest);
+
+ if (strcmp(cte->table->conf.digest, digest)) {
+ log_warnx("check_http_digest: %s failed "
diff --git a/net/relayd/files/patch-d-log.c b/net/relayd/files/patch-d-log.c
new file mode 100644
index 000000000000..0811fecce71d
--- /dev/null
+++ b/net/relayd/files/patch-d-log.c
@@ -0,0 +1,11 @@
+--- relayd/log.c.orig 2008-01-14 09:59:27.825621568 +0900
++++ relayd/log.c 2008-01-14 09:59:36.888069516 +0900
+@@ -16,7 +16,7 @@
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+-#include <sys/types.h>
++#include <sys/param.h>
+ #include <sys/queue.h>
+ #include <sys/socket.h>
+ #include <sys/tree.h>
diff --git a/net/relayd/files/patch-d-parse.y b/net/relayd/files/patch-d-parse.y
new file mode 100644
index 000000000000..7bf00396a128
--- /dev/null
+++ b/net/relayd/files/patch-d-parse.y
@@ -0,0 +1,11 @@
+--- relayd/parse.y.orig Tue Jun 5 20:12:20 2007
++++ relayd/parse.y Tue Jun 5 20:12:51 2007
+@@ -1561,7 +1561,7 @@
+ hints.ai_family = PF_UNSPEC;
+ hints.ai_socktype = SOCK_DGRAM; /* DUMMY */
+ error = getaddrinfo(s, NULL, &hints, &res0);
+- if (error == EAI_AGAIN || error == EAI_NODATA || error == EAI_NONAME)
++ if (error == EAI_AGAIN || error == EAI_NONAME)
+ return (0);
+ if (error) {
+ log_warnx("host_dns: could not parse \"%s\": %s", s,
diff --git a/net/relayd/files/patch-d-pfe.c b/net/relayd/files/patch-d-pfe.c
new file mode 100644
index 000000000000..196f13933648
--- /dev/null
+++ b/net/relayd/files/patch-d-pfe.c
@@ -0,0 +1,10 @@
+--- relayd/pfe.c.orig 2008-01-14 10:06:37.013495830 +0900
++++ relayd/pfe.c 2008-01-14 10:06:47.508856711 +0900
+@@ -17,6 +17,7 @@
+ */
+
+ #include <sys/param.h>
++#include <sys/queue.h>
+ #include <sys/stat.h>
+ #include <sys/socket.h>
+ #include <sys/un.h>
diff --git a/net/relayd/files/patch-d-pfe_filter.c b/net/relayd/files/patch-d-pfe_filter.c
new file mode 100644
index 000000000000..fb2747b28b0e
--- /dev/null
+++ b/net/relayd/files/patch-d-pfe_filter.c
@@ -0,0 +1,45 @@
+--- relayd/pfe_filter.c.orig 2007-12-21 05:15:43.000000000 +0900
++++ relayd/pfe_filter.c 2008-01-20 15:31:28.856798863 +0900
+@@ -89,6 +89,7 @@
+ sizeof(tables[i].pfrt_name))
+ goto toolong;
+ tables[i].pfrt_flags |= PFR_TFLAG_PERSIST;
++ log_debug("init_tables: prepare anchor \"%s\" and table \"%s\"", tables[i].pfrt_anchor, tables[i].pfrt_name);
+ i++;
+ }
+ if (i != env->rdrcount)
+@@ -239,10 +240,15 @@
+ sizeof(io.pfrio_table.pfrt_name)) >=
+ sizeof(io.pfrio_table.pfrt_name))
+ goto toolong;
++ /* pfctl -Tflush */
+ if (ioctl(env->pf->dev, DIOCRCLRADDRS, &io) == -1)
+ fatal("flush_table: cannot flush table addresses");
++ /* pfctl -Tzero */
++#if 0
++ /* XXX: ioctl(DIOCRCLRTSTATS) requires io.pfrio_esize to be set as sizeof(struct pfr_table), but here doesn't set it. */
+ if (ioctl(env->pf->dev, DIOCRCLRTSTATS, &io) == -1)
+ fatal("flush_table: cannot flush table stats");
++#endif
+ log_debug("flush_table: flushed table %s", rdr->conf.name);
+ return;
+
+@@ -321,7 +327,9 @@
+ rio.rule.dst.addr.type = PF_ADDR_ADDRMASK;
+ rio.rule.dst.port_op = PF_OP_EQ;
+ rio.rule.dst.port[0] = address->port;
++#if 0
+ rio.rule.rtableid = -1; /* stay in the main routing table */
++#endif
+ rio.rule.action = PF_RDR;
+ if (strlen(rdr->conf.tag))
+ (void)strlcpy(rio.rule.tagname, rdr->conf.tag,
+@@ -362,7 +370,7 @@
+
+ if (ioctl(env->pf->dev, DIOCADDRULE, &rio) == -1)
+ fatal("cannot add rule");
+- log_debug("sync_ruleset: rule added");
++ log_debug("sync_ruleset: rule added into anchor \"%s\", table \"%s\"", rio.anchor, pio.addr.addr.v.tblname);
+ }
+ if (transaction_commit(env) == -1)
+ log_warn("sync_ruleset: add rules transaction failed");
diff --git a/net/relayd/files/patch-d-relay.c b/net/relayd/files/patch-d-relay.c
new file mode 100644
index 000000000000..c170b2736a3a
--- /dev/null
+++ b/net/relayd/files/patch-d-relay.c
@@ -0,0 +1,72 @@
+--- relayd/relay.c.orig 2007-12-09 05:36:36.000000000 +0900
++++ relayd/relay.c 2008-01-14 10:26:05.345356528 +0900
+@@ -16,7 +16,7 @@
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+-#include <sys/types.h>
++#include <sys/param.h>
+ #include <sys/queue.h>
+ #include <sys/time.h>
+ #include <sys/stat.h>
+@@ -675,6 +675,7 @@
+ &val, sizeof(val)) == -1)
+ goto bad;
+ }
++#if 0
+ if (proto->tcpflags & (TCPFLAG_SACK|TCPFLAG_NSACK)) {
+ if (proto->tcpflags & TCPFLAG_NSACK)
+ val = 0;
+@@ -684,6 +685,7 @@
+ &val, sizeof(val)) == -1)
+ goto bad;
+ }
++#endif
+
+ return (s);
+
+@@ -1000,7 +1002,7 @@
+ }
+ }
+ if (strstr(val, "$TIMEOUT") != NULL) {
+- snprintf(ibuf, sizeof(ibuf), "%lu", rlay->conf.timeout.tv_sec);
++ snprintf(ibuf, sizeof(ibuf), "%lu", (unsigned long)rlay->conf.timeout.tv_sec);
+ if (expand_string(buf, len, "$TIMEOUT", ibuf) != 0)
+ return (NULL);
+ }
+@@ -1565,7 +1567,7 @@
+ switch (type) {
+ case DIGEST_SHA1:
+ case DIGEST_MD5:
+- if ((md = digeststr(type, val, strlen(val), NULL)) == NULL) {
++ if ((md = digeststr(type, (u_int8_t*)val, strlen(val), NULL)) == NULL) {
+ relay_close_http(con, 500,
+ "failed to allocate digest", 0);
+ goto fail;
+@@ -2469,7 +2471,7 @@
+ goto err;
+
+ /* Set session context to the local relay name */
+- if (!SSL_CTX_set_session_id_context(ctx, rlay->conf.name,
++ if (!SSL_CTX_set_session_id_context(ctx, (unsigned char*)rlay->conf.name,
+ strlen(rlay->conf.name)))
+ goto err;
+
+@@ -2849,7 +2851,7 @@
+ if (fstat(fd, &st) != 0)
+ goto fail;
+ size = st.st_size;
+- if ((buf = (char *)calloc(1, size + 1)) == NULL)
++ if ((buf = (u_int8_t *)calloc(1, size + 1)) == NULL)
+ goto fail;
+ if (read(fd, buf, size) != size)
+ goto fail;
+@@ -2857,7 +2859,7 @@
+ close(fd);
+
+ *len = size + 1;
+- return (buf);
++ return (char *)(buf);
+
+ fail:
+ if (buf != NULL)
diff --git a/net/relayd/files/patch-d-relay_udp.c b/net/relayd/files/patch-d-relay_udp.c
new file mode 100644
index 000000000000..9b233242a145
--- /dev/null
+++ b/net/relayd/files/patch-d-relay_udp.c
@@ -0,0 +1,11 @@
+--- relayd/relay_udp.c.orig 2008-01-14 10:09:08.345280942 +0900
++++ relayd/relay_udp.c 2008-01-14 10:09:21.665469901 +0900
+@@ -16,7 +16,7 @@
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+-#include <sys/types.h>
++#include <sys/param.h>
+ #include <sys/queue.h>
+ #include <sys/time.h>
+ #include <sys/stat.h>
diff --git a/net/relayd/files/patch-d-relayd.8 b/net/relayd/files/patch-d-relayd.8
new file mode 100644
index 000000000000..c58d299a6c3a
--- /dev/null
+++ b/net/relayd/files/patch-d-relayd.8
@@ -0,0 +1,20 @@
+--- relayd/relayd.8.orig 2007-12-12 23:55:12.000000000 +0900
++++ relayd/relayd.8 2008-01-14 08:47:34.673073391 +0900
+@@ -116,7 +116,7 @@
+ .It Fl f Ar file
+ Specify an alternative configuration file.
+ The default is
+-.Pa /etc/relayd.conf .
++.Pa %%PREFIX%%/etc/relayd.conf .
+ .It Fl n
+ Configtest mode.
+ Only check the configuration file for validity.
+@@ -125,7 +125,7 @@
+ .El
+ .Sh FILES
+ .Bl -tag -width "/var/run/relayd.sockXX" -compact
+-.It /etc/relayd.conf
++.It %%PREFIX%%/etc/relayd.conf
+ Default configuration file.
+ .It /var/run/relayd.sock
+ Unix-domain socket used for communication with
diff --git a/net/relayd/files/patch-d-relayd.c b/net/relayd/files/patch-d-relayd.c
new file mode 100644
index 000000000000..19be09b14b3c
--- /dev/null
+++ b/net/relayd/files/patch-d-relayd.c
@@ -0,0 +1,29 @@
+--- relayd/relayd.c.orig 2008-01-14 10:00:21.487354557 +0900
++++ relayd/relayd.c 2008-01-14 16:44:45.705572691 +0900
+@@ -16,7 +16,7 @@
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+-#include <sys/types.h>
++#include <sys/param.h>
+ #include <sys/queue.h>
+ #include <sys/socket.h>
+ #include <sys/wait.h>
+@@ -36,7 +36,7 @@
+ #include <unistd.h>
+ #include <ctype.h>
+ #include <pwd.h>
+-#include <sha1.h>
++#include <sha.h>
+ #include <md5.h>
+
+ #include <openssl/ssl.h>
+@@ -943,7 +943,7 @@
+ {
+ switch (type) {
+ case DIGEST_SHA1:
+- return (SHA1Data(data, len, buf));
++ return (SHA1_Data(data, len, buf));
+ break;
+ case DIGEST_MD5:
+ return (MD5Data(data, len, buf));
diff --git a/net/relayd/files/patch-d-relayd.conf.5 b/net/relayd/files/patch-d-relayd.conf.5
new file mode 100644
index 000000000000..f1afc511f8d5
--- /dev/null
+++ b/net/relayd/files/patch-d-relayd.conf.5
@@ -0,0 +1,33 @@
+--- relayd/relayd.conf.5.orig 2007-12-12 23:55:12.000000000 +0900
++++ relayd/relayd.conf.5 2008-01-14 08:49:46.404074048 +0900
+@@ -101,20 +101,7 @@
+ Here are the settings that can be set globally:
+ .Pp
+ .Bl -tag -width Ds -compact
+-.It Ic demote Ar group
+-Enable the global
+-.Xr carp 4
+-demotion option, resetting the carp demotion counter for the
+-specified interface group to zero on startup and to 128 on shutdown of
+-the daemon.
+-For more information on interface groups,
+-see the
+-.Ic group
+-keyword in
+-.Xr ifconfig 8 .
+-.Pp
+-.It Xo
+-.Ic interval Ar number
++.It Ic interval Ar number
+ .Xc
+ Set the interval in seconds at which the hosts will be checked.
+ The default interval is 10 seconds.
+@@ -894,7 +881,7 @@
+ .El
+ .Sh FILES
+ .Bl -tag -width "/etc/ssl/private/address.keyXX" -compact
+-.It Pa /etc/relayd.conf
++.It Pa %%PREFIX%%/etc/relayd.conf
+ .Xr relayd 8
+ configuration file.
+ .Pp
diff --git a/net/relayd/files/patch-d-relayd.h b/net/relayd/files/patch-d-relayd.h
new file mode 100644
index 000000000000..ed7863fe17c1
--- /dev/null
+++ b/net/relayd/files/patch-d-relayd.h
@@ -0,0 +1,27 @@
+--- relayd/relayd.h.orig 2007-12-21 05:15:43.000000000 +0900
++++ relayd/relayd.h 2008-01-14 10:02:42.803752108 +0900
+@@ -20,7 +20,7 @@
+
+ #include <sys/tree.h>
+
+-#define CONF_FILE "/etc/relayd.conf"
++#define CONF_FILE "%%PREFIX%%/etc/relayd.conf"
+ #define RELAYD_SOCKET "/var/run/relayd.sock"
+ #define PF_SOCKET "/dev/pf"
+ #define RELAYD_USER "_relayd"
+@@ -56,6 +56,15 @@
+ #define PURGE_PROTOS 0x08
+ #define PURGE_EVERYTHING 0xff
+
++#define SIMPLEQ_HEAD STAILQ_HEAD
++#define SIMPLEQ_FIRST STAILQ_FIRST
++#define SIMPLEQ_REMOVE_HEAD STAILQ_REMOVE_HEAD
++#define SIMPLEQ_ENTRY STAILQ_ENTRY
++#define SIMPLEQ_INIT STAILQ_INIT
++#define SIMPLEQ_EMPTY STAILQ_EMPTY
++#define SIMPLEQ_NEXT STAILQ_NEXT
++#define SIMPLEQ_INSERT_TAIL STAILQ_INSERT_TAIL
++
+ /* buffer */
+ struct buf {
+ TAILQ_ENTRY(buf) entry;
diff --git a/net/relayd/files/relayd.in b/net/relayd/files/relayd.in
new file mode 100644
index 000000000000..b2c6f85ec28b
--- /dev/null
+++ b/net/relayd/files/relayd.in
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: relayd
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# relayd_enable (bool):
+#
+# relayd_flags:
+#
+
+. %%RC_SUBR%%
+
+name=relayd
+rcvar=${name}_enable
+
+load_rc_config $name
+
+: ${relayd_enable="NO"}
+: ${relayd_flags=""}
+
+command="%%PREFIX%%/sbin/relayd"
+command_args="${relayd_flags}"
+
+run_rc_command "$1"
diff --git a/net/relayd/pkg-descr b/net/relayd/pkg-descr
new file mode 100644
index 000000000000..83a1435a3713
--- /dev/null
+++ b/net/relayd/pkg-descr
@@ -0,0 +1,7 @@
+relayd is a daemon to relay and dynamically redirect incoming
+connections to a target host. Its main purposes are to run as a
+load-balancer, application layer gateway, or transparent proxy. The
+daemon is able to monitor groups of hosts for availability, which is
+determined by checking for a specific service common to a host group.
+
+WWW: http://spootnik.org/relayd/
diff --git a/net/relayd/pkg-install b/net/relayd/pkg-install
new file mode 100644
index 000000000000..51d59c7df480
--- /dev/null
+++ b/net/relayd/pkg-install
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# $FreeBSD$
+
+case $2 in
+PRE-INSTALL)
+ USER=${RUSER}
+ GROUP=${RGROUP}
+ UID=913
+ GID=913
+
+ if pw group show "${GROUP}" 2>/dev/null; then
+ echo "You already have a group \"${GROUP}\", so I will use it."
+ else
+ if pw groupadd ${GROUP} -g ${GID}; then
+ echo "Added group \"${GROUP}\"."
+ else
+ echo "Adding group \"${GROUP}\" failed..."
+ exit 1
+ fi
+ fi
+
+ if pw user show "${USER}" 2>/dev/null; then
+ echo "You already have a user \"${USER}\", so I will use it."
+ else
+ if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \
+ -d /var/empty -c "Relay Daemon" -s /usr/sbin/nologin
+ then
+ echo "Added user \"${USER}\"."
+ else
+ echo "Adding user \"${USER}\" failed..."
+ exit 1
+ fi
+ fi
+ ;;
+esac
diff --git a/net/relayd/pkg-plist b/net/relayd/pkg-plist
new file mode 100644
index 000000000000..3b7ff0926a3c
--- /dev/null
+++ b/net/relayd/pkg-plist
@@ -0,0 +1,3 @@
+sbin/relayctl
+sbin/relayd
+@unexec echo "Warning: If you will *NOT* use this package anymore, please remove the _relayd user manually."