aboutsummaryrefslogtreecommitdiff
path: root/net/relayd
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2011-09-07 12:14:40 +0000
committerMartin Matuska <mm@FreeBSD.org>2011-09-07 12:14:40 +0000
commitb6ec62db23f90c72ea574ac261a04a54e6e65aed (patch)
treee4a588953db05eb2b27185fd00338504f38a4f58 /net/relayd
parent4075117e52f42393cf6925f8659b00b174f4b526 (diff)
downloadports-b6ec62db23f90c72ea574ac261a04a54e6e65aed.tar.gz
ports-b6ec62db23f90c72ea574ac261a04a54e6e65aed.zip
Notes
Diffstat (limited to 'net/relayd')
-rw-r--r--net/relayd/Makefile15
-rw-r--r--net/relayd/distinfo4
-rw-r--r--net/relayd/files/Makefile.all5
-rw-r--r--net/relayd/files/Makefile.relayctl24
-rw-r--r--net/relayd/files/Makefile.relayd44
-rw-r--r--net/relayd/files/arc4random.c72
-rw-r--r--net/relayd/files/patch-bug-662420
-rw-r--r--net/relayd/files/patch-bug-662741
-rw-r--r--net/relayd/files/patch-relayctl-parser.c24
-rw-r--r--net/relayd/files/patch-relayctl-parser.h12
-rw-r--r--net/relayd/files/patch-relayctl-relayctl.817
-rw-r--r--net/relayd/files/patch-relayctl-relayctl.c83
-rw-r--r--net/relayd/files/patch-relayd-carp.c10
-rw-r--r--net/relayd/files/patch-relayd-check_tcp.c59
-rw-r--r--net/relayd/files/patch-relayd-config.c62
-rw-r--r--net/relayd/files/patch-relayd-hce.c35
-rw-r--r--net/relayd/files/patch-relayd-log.c14
-rw-r--r--net/relayd/files/patch-relayd-parse.y249
-rw-r--r--net/relayd/files/patch-relayd-pfe.c109
-rw-r--r--net/relayd/files/patch-relayd-pfe_filter.c284
-rw-r--r--net/relayd/files/patch-relayd-relay.c249
-rw-r--r--net/relayd/files/patch-relayd-relay_udp.c14
-rw-r--r--net/relayd/files/patch-relayd-relayd.820
-rw-r--r--net/relayd/files/patch-relayd-relayd.c181
-rw-r--r--net/relayd/files/patch-relayd-relayd.conf.5244
-rw-r--r--net/relayd/files/patch-relayd-relayd.h189
-rw-r--r--net/relayd/pkg-descr6
-rw-r--r--net/relayd/pkg-plist2
28 files changed, 14 insertions, 2074 deletions
diff --git a/net/relayd/Makefile b/net/relayd/Makefile
index 6ca0a4cdd4e8..09bc0a05a60e 100644
--- a/net/relayd/Makefile
+++ b/net/relayd/Makefile
@@ -5,10 +5,11 @@
# $FreeBSD$
PORTNAME= relayd
-PORTVERSION= 4.9.20110526
-PORTREVISION= 2
+PORTVERSION= 5.0.20110907
CATEGORIES= net
-MASTER_SITES= ${MASTER_SITE_LOCAL}
+MASTER_SITES= https://github.com/downloads/mmatuska/relayd/
+
+FETCH_ARGS= -pRr
MASTER_SITE_SUBDIR= mm
MAINTAINER= mm@FreeBSD.org
@@ -48,12 +49,6 @@ MAKE_ARGS+= LIBEVENT=-levent
BROKEN= does not build on FreeBSD 7.X
.endif
-post-extract:
- @${CP} ${FILESDIR}/Makefile.all ${WRKSRC}/Makefile
- @${CP} ${FILESDIR}/Makefile.relayctl ${WRKSRC}/relayctl/Makefile
- @${CP} ${FILESDIR}/Makefile.relayd ${WRKSRC}/relayd/Makefile
- @${CP} ${FILESDIR}/arc4random.c ${WRKSRC}/relayd
-
post-patch:
@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \
${WRKSRC}/relayd/relay.c \
@@ -64,5 +59,7 @@ post-patch:
post-install:
@${INSTALL_DATA} ${WRKSRC}/../etc/relayd.conf \
${PREFIX}/etc/relayd.conf.sample
+ @${CP} -n ${PREFIX}/etc/relayd.conf.sample \
+ ${PREFIX}/etc/relayd.conf
.include <bsd.port.post.mk>
diff --git a/net/relayd/distinfo b/net/relayd/distinfo
index dbcb17be2e5c..49f6b761fa58 100644
--- a/net/relayd/distinfo
+++ b/net/relayd/distinfo
@@ -1,2 +1,2 @@
-SHA256 (relayd-4.9.20110526.tar.bz2) = d9ce490b6bb2c82ed879b4e1c047977ffef49b530680c5816b05e1a04969411f
-SIZE (relayd-4.9.20110526.tar.bz2) = 85883
+SHA256 (relayd-5.0.20110907.tar.bz2) = bba3aa1e427031f74fa617616532b6c607b273d11278a06fad9e37aecb43f220
+SIZE (relayd-5.0.20110907.tar.bz2) = 86032
diff --git a/net/relayd/files/Makefile.all b/net/relayd/files/Makefile.all
deleted file mode 100644
index 3458f8dc487f..000000000000
--- a/net/relayd/files/Makefile.all
+++ /dev/null
@@ -1,5 +0,0 @@
-# $FreeBSD$
-
-SUBDIR= relayd relayctl
-
-.include <bsd.subdir.mk>
diff --git a/net/relayd/files/Makefile.relayctl b/net/relayd/files/Makefile.relayctl
deleted file mode 100644
index 627ed1fe53cc..000000000000
--- a/net/relayd/files/Makefile.relayctl
+++ /dev/null
@@ -1,24 +0,0 @@
-# $FreeBSD$
-
-PROG= relayctl
-
-.PATH: ${.CURDIR}/../../lib/libutil
-SRCS= imsg-buffer.c \
- imsg.c
-
-.PATH: ${.CURDIR}/../relayd
-SRCS+= log.c
-
-.PATH: ${.CURDIR}
-SRCS+= relayctl.c \
- parser.c
-
-MAN= relayctl.8
-
-CFLAGS+= -D__dead=''
-CFLAGS+= -I${.CURDIR} \
- -I${.CURDIR}/../../lib/libutil \
- -I${.CURDIR}/../relayd \
- -I${PREFIX}/include
-
-.include <bsd.prog.mk>
diff --git a/net/relayd/files/Makefile.relayd b/net/relayd/files/Makefile.relayd
deleted file mode 100644
index 58c7915913f1..000000000000
--- a/net/relayd/files/Makefile.relayd
+++ /dev/null
@@ -1,44 +0,0 @@
-# $FreeBSD$
-
-PROG= relayd
-
-MAN= relayd.8 \
- relayd.conf.5
-
-.PATH: ${.CURDIR}/../../lib/libutil
-SRCS= imsg-buffer.c \
- imsg.c
-
-.PATH: ${.CURDIR}
-SRCS+= parse.y \
- log.c \
- control.c \
- ssl.c \
- ssl_privsep.c \
- relayd.c \
- pfe.c \
- pfe_filter.c \
- hce.c \
- relay.c \
- relay_udp.c \
- check_icmp.c \
- check_tcp.c \
- check_script.c \
- name2id.c \
- arc4random.c \
- shuffle.c \
- proc.c \
- config.c
-
-CFLAGS+= -DSHA1_DIGEST_LENGTH=SHA_DIGEST_LENGTH \
- -DSHA1_DIGEST_STRING_LENGTH=SHA_DIGEST_LENGTH \
- -DOPENSSL_NO_SHA -DOPENSSL_NO_MD5 \
- -D__dead=''
-CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../../lib/libutil \
- -I${PREFIX}/include
-CLEANFILES+= y.tab.h
-
-LDADD= -lmd -L${PREFIX}/lib ${LIBEVENT} -lssl -lcrypto
-DPADD= ${LIBEVENT} ${LIBSSL} ${LIBCRYPTO}
-
-.include <bsd.prog.mk>
diff --git a/net/relayd/files/arc4random.c b/net/relayd/files/arc4random.c
deleted file mode 100644
index 08017bc22e73..000000000000
--- a/net/relayd/files/arc4random.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 1999,2000,2004 Damien Miller <djm@mindrot.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * $FreeBSD: /tmp/pcvs/ports/net/relayd/files/Attic/arc4random.c,v 1.1 2010-05-28 11:59:49 mm Exp $
- */
-
-#include <sys/param.h>
-
-#if __FreeBSD_version < 800041
-
-#include <sys/types.h>
-#include <limits.h>
-#include <stdlib.h>
-
-/*
- * Calculate a uniformly distributed random number less than upper_bound
- * avoiding "modulo bias".
- *
- * Uniformity is achieved by generating new random numbers until the one
- * returned is outside the range [0, 2**32 % upper_bound). This
- * guarantees the selected random number will be inside
- * [2**32 % upper_bound, 2**32) which maps back to [0, upper_bound)
- * after reduction modulo upper_bound.
- */
-u_int32_t
-arc4random_uniform(u_int32_t upper_bound)
-{
- u_int32_t r, min;
-
- if (upper_bound < 2)
- return 0;
-
-#if (ULONG_MAX > 0xffffffffUL)
- min = 0x100000000UL % upper_bound;
-#else
- /* Calculate (2**32 % upper_bound) avoiding 64-bit math */
- if (upper_bound > 0x80000000)
- min = 1 + ~upper_bound; /* 2**32 - upper_bound */
- else {
- /* (2**32 - (x * 2)) % x == 2**32 % x when x <= 2**31 */
- min = ((0xffffffff - (upper_bound * 2)) + 1) % upper_bound;
- }
-#endif
-
- /*
- * This could theoretically loop forever but each retry has
- * p > 0.5 (worst case, usually far better) of selecting a
- * number inside the range we need, so it should rarely need
- * to re-roll.
- */
- for (;;) {
- r = arc4random();
- if (r >= min)
- break;
- }
-
- return r % upper_bound;
-}
-
-#endif /* __FreeBSD_version */
diff --git a/net/relayd/files/patch-bug-6624 b/net/relayd/files/patch-bug-6624
deleted file mode 100644
index aa3b5e9f4f02..000000000000
--- a/net/relayd/files/patch-bug-6624
+++ /dev/null
@@ -1,20 +0,0 @@
---- relayd/check_tcp.c.orig Sat Jun 4 08:59:06 2011
-+++ relayd/check_tcp.c Sat Jun 4 09:07:17 2011
-@@ -77,6 +77,8 @@
- goto bad;
- }
-
-+ cte->s = s;
-+
- bzero(&lng, sizeof(lng));
- if (setsockopt(s, SOL_SOCKET, SO_LINGER, &lng, sizeof(lng)) == -1)
- goto bad;
-@@ -100,7 +102,6 @@
-
- cte->buf = NULL;
- cte->host->up = HOST_UP;
-- cte->s = s;
- event_del(&cte->ev);
- event_set(&cte->ev, s, EV_TIMEOUT|EV_WRITE, tcp_write, cte);
- event_add(&cte->ev, &tv);
-
diff --git a/net/relayd/files/patch-bug-6627 b/net/relayd/files/patch-bug-6627
deleted file mode 100644
index 045abdd30b31..000000000000
--- a/net/relayd/files/patch-bug-6627
+++ /dev/null
@@ -1,41 +0,0 @@
---- relayd/hce.c.orig Mon Jun 6 18:02:45 2011
-+++ relayd/hce.c Mon Jun 6 18:09:07 2011
-@@ -207,10 +207,27 @@
- struct timeval tv_now, tv_dur;
- u_long duration;
- u_int logopt;
-- struct host *h;
-+ struct host *h, *hostupd;
- int hostup;
- const char *msg;
-
-+ if ((hostupd = host_find(env, host->conf.id)) == NULL)
-+ fatalx("hce_notify_done: desynchronized");
-+
-+ if ((table = table_find(env, host->conf.tableid)) == NULL)
-+ fatalx("hce_notify_done: invalid table id");
-+
-+ if (hostupd->flags & F_DISABLE) {
-+ if (env->sc_opts & RELAYD_OPT_LOGUPDATE) {
-+ log_info("host %s, check %s%s (ignoring result, "
-+ "host disabled)",
-+ host->conf.name, table_check(table->conf.check),
-+ (table->conf.flags & F_SSL) ? " use ssl" : "");
-+ }
-+ host->flags |= (F_CHECK_SENT|F_CHECK_DONE);
-+ return;
-+ }
-+
- hostup = host->up;
- host->he = he;
-
-@@ -250,9 +267,6 @@
- duration = (tv_dur.tv_sec * 1000) + (tv_dur.tv_usec / 1000.0);
- else
- duration = 0;
--
-- if ((table = table_find(env, host->conf.tableid)) == NULL)
-- fatalx("hce_notify_done: invalid table id");
-
- if (env->sc_opts & logopt) {
- log_info("host %s, check %s%s (%lums), state %s -> %s, "
diff --git a/net/relayd/files/patch-relayctl-parser.c b/net/relayd/files/patch-relayctl-parser.c
deleted file mode 100644
index 7b6b132e3176..000000000000
--- a/net/relayd/files/patch-relayctl-parser.c
+++ /dev/null
@@ -1,24 +0,0 @@
---- relayctl/parser.c.orig 2011-05-19 10:56:49.000000000 +0200
-+++ relayctl/parser.c 2011-05-22 10:51:26.683383150 +0200
-@@ -18,7 +18,11 @@
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#ifdef __FreeBSD__
-+#include <sys/param.h>
-+#else
- #include <sys/types.h>
-+#endif
- #include <sys/socket.h>
- #include <sys/queue.h>
-
-@@ -87,7 +91,9 @@
- {KEYWORD, "hosts", SHOW_HOSTS, NULL},
- {KEYWORD, "redirects", SHOW_RDRS, NULL},
- {KEYWORD, "relays", SHOW_RELAYS, NULL},
-+#ifndef __FreeBSD__
- {KEYWORD, "routers", SHOW_ROUTERS, NULL},
-+#endif
- {KEYWORD, "sessions", SHOW_SESSIONS, NULL},
- {ENDTOKEN, "", NONE, NULL}
- };
diff --git a/net/relayd/files/patch-relayctl-parser.h b/net/relayd/files/patch-relayctl-parser.h
deleted file mode 100644
index 44ceeee3aeae..000000000000
--- a/net/relayd/files/patch-relayctl-parser.h
+++ /dev/null
@@ -1,12 +0,0 @@
---- relayctl/parser.h.orig 2011-05-22 10:56:33.769045780 +0200
-+++ relayctl/parser.h 2011-05-22 10:56:46.122442873 +0200
-@@ -23,7 +23,9 @@
- SHOW_RDRS,
- SHOW_RELAYS,
- SHOW_SESSIONS,
-+#ifndef __FreeBSD__
- SHOW_ROUTERS,
-+#endif
- RDR_DISABLE,
- RDR_ENABLE,
- TABLE_DISABLE,
diff --git a/net/relayd/files/patch-relayctl-relayctl.8 b/net/relayd/files/patch-relayctl-relayctl.8
deleted file mode 100644
index 0041d337ac17..000000000000
--- a/net/relayd/files/patch-relayctl-relayctl.8
+++ /dev/null
@@ -1,17 +0,0 @@
---- relayctl/relayctl.8.orig 2011-05-19 10:56:49.000000000 +0200
-+++ relayctl/relayctl.8 2011-05-22 10:43:42.420854658 +0200
-@@ -78,13 +78,10 @@
- Show detailed status of relays including the current and average
- access statistics.
- The statistics will be updated every minute.
--.It Cm show routers
--Show detailed status of routers including the configured network
--routes.
- .It Cm show sessions
- Dump the complete list of running relay sessions.
- .It Cm show summary
--Display a list of all relays, redirections, routers, tables, and hosts.
-+Display a list of all relays, redirections, tables, and hosts.
- .It Cm table disable Op Ar name | id
- Disable a table.
- Consider all hosts disabled.
diff --git a/net/relayd/files/patch-relayctl-relayctl.c b/net/relayd/files/patch-relayctl-relayctl.c
deleted file mode 100644
index 0259881fc47a..000000000000
--- a/net/relayd/files/patch-relayctl-relayctl.c
+++ /dev/null
@@ -1,83 +0,0 @@
---- relayctl/relayctl.c.orig 2011-05-20 11:43:53.000000000 +0200
-+++ relayctl/relayctl.c 2011-05-22 11:19:50.925707539 +0200
-@@ -20,6 +20,9 @@
- */
-
- #include <sys/types.h>
-+#ifdef __FreeBSD__
-+#include <sys/param.h>
-+#endif
- #include <sys/socket.h>
- #include <sys/queue.h>
- #include <sys/un.h>
-@@ -141,7 +144,9 @@
- case SHOW_HOSTS:
- case SHOW_RDRS:
- case SHOW_RELAYS:
-+#ifndef __FreeBSD__
- case SHOW_ROUTERS:
-+#endif
- imsg_compose(ibuf, IMSG_CTL_SHOW_SUM, 0, 0, -1, NULL, 0);
- printf("%-4s\t%-8s\t%-24s\t%-7s\tStatus\n",
- "Id", "Type", "Name", "Avlblty");
-@@ -222,7 +227,9 @@
- case SHOW_HOSTS:
- case SHOW_RDRS:
- case SHOW_RELAYS:
-+#ifndef __FreeBSD__
- case SHOW_ROUTERS:
-+#endif
- done = show_summary_msg(&imsg, res->action);
- break;
- case SHOW_SESSIONS:
-@@ -312,7 +319,11 @@
- 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);
-+#ifdef __FreeBSD__
-+ printf("\ttimestamp: %lu, %s", (unsigned long)now, ctime(&now));
-+#else
- printf("\ttimestamp: %u, %s", now, ctime(&now));
-+#endif
- if (imn->type == -1)
- done = 1;
- if (imn->func != NULL)
-@@ -328,8 +339,10 @@
- struct table *table;
- struct host *host;
- struct relay *rlay;
-+#ifndef __FreeBSD__
- struct router *rt;
- struct netroute *nr;
-+#endif
- struct ctl_stats stats[RELAY_MAXPROC];
- char name[MAXHOSTNAMELEN];
-
-@@ -394,6 +407,7 @@
- bcopy(imsg->data, &stats, sizeof(stats));
- print_statistics(stats);
- break;
-+#ifndef __FreeBSD__
- case IMSG_CTL_ROUTER:
- if (!(type == SHOW_SUM || type == SHOW_ROUTERS))
- break;
-@@ -416,6 +430,7 @@
- printf("\t%8s\troute: %s/%d\n",
- "", name, nr->nr_conf.prefixlen);
- break;
-+#endif
- case IMSG_CTL_END:
- return (1);
- default:
-@@ -557,7 +572,11 @@
- printf("\t%8s\ttotal: %llu sessions\n"
- "\t%8s\tlast: %u/%us %u/h %u/d sessions\n"
- "\t%8s\taverage: %u/%us %u/h %u/d sessions\n",
-+#ifdef __FreeBSD__
-+ "", (long long unsigned)crs.cnt,
-+#else
- "", crs.cnt,
-+#endif
- "", crs.last, crs.interval,
- crs.last_hour, crs.last_day,
- "", crs.avg, crs.interval,
diff --git a/net/relayd/files/patch-relayd-carp.c b/net/relayd/files/patch-relayd-carp.c
deleted file mode 100644
index ef02497845c2..000000000000
--- a/net/relayd/files/patch-relayd-carp.c
+++ /dev/null
@@ -1,10 +0,0 @@
---- relayd.orig/carp.c 2011-05-22 01:06:39.463154237 +0200
-+++ relayd/carp.c 2011-05-22 01:06:54.671017027 +0200
-@@ -19,6 +19,7 @@
- #include <sys/param.h>
- #include <sys/socket.h>
- #include <sys/ioctl.h>
-+#include <sys/queue.h>
-
- #include <net/if.h>
-
diff --git a/net/relayd/files/patch-relayd-check_tcp.c b/net/relayd/files/patch-relayd-check_tcp.c
deleted file mode 100644
index b62d45722981..000000000000
--- a/net/relayd/files/patch-relayd-check_tcp.c
+++ /dev/null
@@ -1,59 +0,0 @@
---- relayd.orig/check_tcp.c 2011-05-22 01:06:39.463154237 +0200
-+++ relayd/check_tcp.c 2011-05-22 01:06:54.673025092 +0200
-@@ -31,7 +31,7 @@
- #include <stdlib.h>
- #include <errno.h>
- #include <fnmatch.h>
--#include <sha1.h>
-+#include <sha.h>
-
- #include <openssl/ssl.h>
-
-@@ -287,7 +287,11 @@
- if (b == NULL)
- fatal("out of memory");
- *b = '\0';
-+#ifndef __FreeBSD__
- if (fnmatch(cte->table->conf.exbuf, cte->buf->buf, 0) == 0) {
-+#else
-+ if (fnmatch(cte->table->conf.exbuf, (char *)cte->buf->buf, 0) == 0) {
-+#endif
- cte->host->he = HCE_SEND_EXPECT_OK;
- cte->host->up = HOST_UP;
- return (0);
-@@ -320,7 +324,11 @@
- fatal("out of memory");
- *b = '\0';
-
-+#ifndef __FreeBSD__
- head = cte->buf->buf;
-+#else
-+ head = (char *)cte->buf->buf;
-+#endif
- host = cte->host;
- host->he = HCE_HTTP_CODE_ERROR;
-
-@@ -372,7 +380,11 @@
- fatal("out of memory");
- *b = '\0';
-
-+#ifndef __FreeBSD__
- head = cte->buf->buf;
-+#else
-+ head = (char *)cte->buf->buf;
-+#endif
- host = cte->host;
- host->he = HCE_HTTP_DIGEST_ERROR;
-
-@@ -384,7 +396,11 @@
- }
- head += strlen("\r\n\r\n");
-
-+#ifndef __FreeBSD__
- digeststr(cte->table->conf.digest_type, head, strlen(head), digest);
-+#else
-+ digeststr(cte->table->conf.digest_type, (u_int8_t*)head, strlen(head), digest);
-+#endif
-
- if (strcmp(cte->table->conf.digest, digest)) {
- log_warnx("%s: %s failed (wrong digest)",
diff --git a/net/relayd/files/patch-relayd-config.c b/net/relayd/files/patch-relayd-config.c
deleted file mode 100644
index fb723684012e..000000000000
--- a/net/relayd/files/patch-relayd-config.c
+++ /dev/null
@@ -1,62 +0,0 @@
---- relayd.orig/config.c 2011-05-22 01:06:39.463154237 +0200
-+++ relayd/config.c 2011-05-22 01:18:41.041076104 +0200
-@@ -118,6 +118,7 @@
- RB_INIT(&env->sc_proto_default.request_tree);
- RB_INIT(&env->sc_proto_default.response_tree);
- }
-+#ifndef __FreeBSD__
- if (what & CONFIG_RTS) {
- if ((env->sc_rts =
- calloc(1, sizeof(*env->sc_rts))) == NULL)
-@@ -130,7 +131,7 @@
- return (-1);
- TAILQ_INIT(env->sc_routes);
- }
--
-+#endif
- return (0);
- }
-
-@@ -143,8 +144,10 @@
- struct address *virt;
- struct protocol *proto;
- struct relay *rlay;
-+#ifndef __FreeBSD__
- struct netroute *nr;
- struct router *rt;
-+#endif
- u_int what;
-
- what = ps->ps_what[privsep_process] & reset;
-@@ -181,6 +184,7 @@
- }
- env->sc_protocount = 0;
- }
-+#ifndef __FreeBSD__
- if (what & CONFIG_RTS && env->sc_rts != NULL) {
- while ((rt = TAILQ_FIRST(env->sc_rts)) != NULL) {
- TAILQ_REMOVE(env->sc_rts, rt, rt_entry);
-@@ -203,6 +207,7 @@
- }
- env->sc_routecount = 0;
- }
-+#endif
- }
-
- int
-@@ -476,6 +481,7 @@
- return (0);
- }
-
-+#ifndef __FreeBSD__
- int
- config_setrt(struct relayd *env, struct router *rt)
- {
-@@ -570,6 +576,7 @@
-
- return (0);
- }
-+#endif
-
- int
- config_setproto(struct relayd *env, struct protocol *proto)
diff --git a/net/relayd/files/patch-relayd-hce.c b/net/relayd/files/patch-relayd-hce.c
deleted file mode 100644
index 385ea0eaf212..000000000000
--- a/net/relayd/files/patch-relayd-hce.c
+++ /dev/null
@@ -1,35 +0,0 @@
---- relayd.orig/hce.c 2011-05-22 01:06:39.461146172 +0200
-+++ relayd/hce.c 2011-05-22 01:08:01.230992828 +0200
-@@ -80,7 +80,9 @@
- /* Allow maximum available sockets for TCP checks */
- socket_rlimit(-1);
-
-+#ifndef __FreeBSD__
- snmp_init(env, PROC_PARENT);
-+#endif
- }
-
- void
-@@ -263,8 +265,10 @@
- print_availability(host->check_cnt, host->up_cnt));
- }
-
-+#ifndef __FreeBSD__
- if (host->last_up != host->up)
- snmp_hosttrap(env, table, host);
-+#endif
-
- host->last_up = host->up;
-
-@@ -350,9 +354,11 @@
- case IMSG_CFG_HOST:
- config_gethost(env, imsg);
- break;
-+#ifndef __FreeBSD__
- case IMSG_SNMPSOCK:
- snmp_getsock(env, imsg);
- break;
-+#endif
- case IMSG_CFG_DONE:
- config_getcfg(env, imsg);
- hce_setup_events();
diff --git a/net/relayd/files/patch-relayd-log.c b/net/relayd/files/patch-relayd-log.c
deleted file mode 100644
index 518d394c6dfe..000000000000
--- a/net/relayd/files/patch-relayd-log.c
+++ /dev/null
@@ -1,14 +0,0 @@
---- relayd.orig/log.c 2011-05-22 01:06:39.461146172 +0200
-+++ relayd/log.c 2011-05-22 01:06:54.680052759 +0200
-@@ -16,7 +16,11 @@
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#ifdef __FreeBSD__
-+#include <sys/param.h>
-+#else
- #include <sys/types.h>
-+#endif
- #include <sys/queue.h>
- #include <sys/socket.h>
- #include <sys/tree.h>
diff --git a/net/relayd/files/patch-relayd-parse.y b/net/relayd/files/patch-relayd-parse.y
deleted file mode 100644
index aef89333a2e2..000000000000
--- a/net/relayd/files/patch-relayd-parse.y
+++ /dev/null
@@ -1,249 +0,0 @@
---- relayd.orig/parse.y 2011-05-22 01:06:39.462150204 +0200
-+++ relayd/parse.y 2011-05-22 01:06:54.687080706 +0200
-@@ -35,7 +35,7 @@
- #include <netinet/in.h>
- #include <arpa/inet.h>
- #include <arpa/nameser.h>
--#include <net/route.h>
-+// FreeBSD #include <net/route.h>
-
- #include <ctype.h>
- #include <unistd.h>
-@@ -93,8 +93,10 @@
- objid_t last_host_id = 0;
- objid_t last_relay_id = 0;
- objid_t last_proto_id = 0;
-+/* FreeBSD exclude
- objid_t last_rt_id = 0;
- objid_t last_nr_id = 0;
-+*/
-
- static struct rdr *rdr = NULL;
- static struct table *table = NULL;
-@@ -103,7 +105,9 @@
- struct relaylist relays;
- static struct protocol *proto = NULL;
- static struct protonode node;
-+/* FreeBSD exclude
- static struct router *router = NULL;
-+*/
- static u_int16_t label = 0;
- static in_port_t tableport = 0;
- static int nodedirection;
-@@ -148,12 +152,20 @@
- %token CIPHERS CODE COOKIE DEMOTE DIGEST DISABLE ERROR EXPECT
- %token EXTERNAL FILENAME FILTER FORWARD FROM HASH HEADER HOST ICMP
- %token INCLUDE INET INET6 INTERFACE INTERVAL IP LABEL LISTEN
--%token LOADBALANCE LOG LOOKUP MARK MARKED MODE NAT NO DESTINATION
--%token NODELAY NOTHING ON PARENT PATH PORT PREFORK PRIORITY PROTO
-+// FreeBSD exclude %token LOADBALANCE LOG LOOKUP MARK MARKED MODE NAT NO DESTINATION
-+%token LOADBALANCE LOG LOOKUP MARK MARKED MODE NAT NO
-+// FreeBSD exclude %token NODELAY NOTHING ON PARENT PATH PORT PREFORK PRIORITY PROTO
-+%token NODELAY NOTHING ON PARENT PATH PORT PREFORK PROTO
- %token QUERYSTR REAL REDIRECT RELAY REMOVE REQUEST RESPONSE RETRY
- %token RETURN ROUNDROBIN ROUTE SACK SCRIPT SEND SESSION SOCKET SPLICE
-+/* FreeBSD exclude
- %token SSL STICKYADDR STYLE TABLE TAG TCP TIMEOUT TO ROUTER RTLABEL
- %token TRANSPARENT TRAP UPDATES URL VIRTUAL WITH TTL RTABLE MATCH
-+*/
-+// Start FreeBSD include
-+%token SSL STICKYADDR STYLE TABLE TAG TCP TIMEOUT TO
-+%token TRANSPARENT TRAP UPDATES URL VIRTUAL WITH TTL
-+// End FreeBSD include
- %token <v.string> STRING
- %token <v.number> NUMBER
- %type <v.string> hostname interface table
-@@ -179,7 +191,7 @@
- | grammar tabledef '\n'
- | grammar relay '\n'
- | grammar proto '\n'
-- | grammar router '\n'
-+// FreeBSD | grammar router '\n'
- | grammar error '\n' { file->errors++; }
- ;
-
-@@ -363,6 +375,7 @@
- }
- conf->sc_prefork_relay = $2;
- }
-+/* FreeBSD exclude
- | DEMOTE STRING {
- if (loadcfg)
- break;
-@@ -386,6 +399,7 @@
- break;
- conf->sc_flags |= F_TRAP;
- }
-+*/
- ;
-
- loglevel : UPDATES { $$ = RELAYD_OPT_LOGUPDATE; }
-@@ -658,6 +672,7 @@
- bcopy(&$2, &table->conf.timeout,
- sizeof(struct timeval));
- }
-+/* FreeBSD exclude
- | DEMOTE STRING {
- table->conf.flags |= F_DEMOTE;
- if (strlcpy(table->conf.demote_group, $2,
-@@ -675,6 +690,7 @@
- YYERROR;
- }
- }
-+*/
- | INTERVAL NUMBER {
- if ($2 < conf->sc_interval.tv_sec ||
- $2 % conf->sc_interval.tv_sec) {
-@@ -1261,6 +1277,8 @@
- rlay->rl_conf.name);
- YYERROR;
- }
-+ if ((rlay->rl_conf.flags & F_NATLOOK) == 0 &&
-+/* FreeBSD exclude
- if ((rlay->rl_conf.flags & (F_NATLOOK|F_DIVERT)) ==
- (F_NATLOOK|F_DIVERT)) {
- yyerror("relay %s with conflicting nat lookup "
-@@ -1268,6 +1286,7 @@
- YYERROR;
- }
- if ((rlay->rl_conf.flags & (F_NATLOOK|F_DIVERT)) == 0 &&
-+*/
- rlay->rl_conf.dstss.ss_family == AF_UNSPEC &&
- rlay->rl_conf.dsttable == EMPTY_ID) {
- yyerror("relay %s has no target, rdr, "
-@@ -1430,11 +1449,13 @@
- rlay->rl_conf.flags |= F_NATLOOK;
- rlay->rl_conf.dstretry = $3;
- }
-+/* FreeBSD exclude
- | DESTINATION retry {
- conf->sc_flags |= F_NEEDPF;
- rlay->rl_conf.flags |= F_DIVERT;
- rlay->rl_conf.dstretry = $2;
- }
-+*/
- | tablespec {
- if (rlay->rl_backuptable) {
- yyerror("only one backup table is allowed");
-@@ -1459,6 +1480,7 @@
- | HASH { $$ = RELAY_DSTMODE_HASH; }
- ;
-
-+/* FreeBSD exclude
- router : ROUTER STRING {
- struct router *rt = NULL;
-
-@@ -1594,7 +1616,7 @@
- | DISABLE { rlay->rl_conf.flags |= F_DISABLE; }
- | include
- ;
--
-+*/
- dstaf : /* empty */ {
- rlay->rl_conf.dstaf.ss_family = AF_UNSPEC;
- }
-@@ -1670,6 +1692,7 @@
- }
- hst->conf.parentid = $2;
- }
-+/* FreeBSD exclude
- | PRIORITY NUMBER {
- if (hst->conf.priority) {
- yyerror("priority already set");
-@@ -1681,6 +1704,7 @@
- }
- hst->conf.priority = $2;
- }
-+*/
- | IP TTL NUMBER {
- if (hst->conf.ttl) {
- yyerror("ttl value already set");
-@@ -1794,8 +1818,10 @@
- { "ciphers", CIPHERS },
- { "code", CODE },
- { "cookie", COOKIE },
-+/* FreeBSD exclude
- { "demote", DEMOTE },
- { "destination", DESTINATION },
-+*/
- { "digest", DIGEST },
- { "disable", DISABLE },
- { "error", ERROR },
-@@ -1833,7 +1859,7 @@
- { "path", PATH },
- { "port", PORT },
- { "prefork", PREFORK },
-- { "priority", PRIORITY },
-+// FreeBSD { "priority", PRIORITY },
- { "protocol", PROTO },
- { "query", QUERYSTR },
- { "real", REAL },
-@@ -1846,9 +1872,11 @@
- { "return", RETURN },
- { "roundrobin", ROUNDROBIN },
- { "route", ROUTE },
-+/* FreeBSD exclude
- { "router", ROUTER },
- { "rtable", RTABLE },
- { "rtlabel", RTLABEL },
-+*/
- { "sack", SACK },
- { "script", SCRIPT },
- { "send", SEND },
-@@ -1864,7 +1892,7 @@
- { "timeout", TIMEOUT },
- { "to", TO },
- { "transparent", TRANSPARENT },
-- { "trap", TRAP },
-+// FreeBSD { "trap", TRAP },
- { "ttl", TTL },
- { "updates", UPDATES },
- { "url", URL },
-@@ -2096,7 +2124,8 @@
- (isalnum(x) || (ispunct(x) && x != '(' && x != ')' && \
- x != '{' && x != '}' && x != '<' && x != '>' && \
- x != '!' && x != '=' && x != '#' && \
-- x != ',' && x != '/'))
-+ x != ','))
-+// FreeBSD exclude x != ',' && x != '/'))
-
- if (isalnum(c) || c == ':' || c == '_') {
- do {
-@@ -2240,13 +2269,14 @@
- loadcfg = 1;
- errors = 0;
- last_host_id = last_table_id = last_rdr_id = last_proto_id =
-- last_relay_id = last_rt_id = last_nr_id = 0;
-+// FreeBSD last_relay_id = last_rt_id = last_nr_id = 0;
-+ last_relay_id = 0;
-
- rdr = NULL;
- table = NULL;
- rlay = NULL;
- proto = NULL;
-- router = NULL;
-+// FreeBSD router = NULL;
-
- if ((file = pushfile(filename, 0)) == NULL)
- return (-1);
-@@ -2276,8 +2306,8 @@
- }
-
- if (TAILQ_EMPTY(conf->sc_rdrs) &&
-- TAILQ_EMPTY(conf->sc_relays) &&
-- TAILQ_EMPTY(conf->sc_rts)) {
-+ TAILQ_EMPTY(conf->sc_relays) /* FreeBSD exclude &&
-+ TAILQ_EMPTY(conf->sc_rts) */ ) {
- log_warnx("no actions, nothing to do");
- errors++;
- }
-@@ -2493,7 +2523,8 @@
- 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_NODATA || error == EAI_NONAME)
-+ if (error == EAI_AGAIN || error == EAI_NONAME)
- return (0);
- if (error) {
- log_warnx("%s: could not parse \"%s\": %s", __func__, s,
diff --git a/net/relayd/files/patch-relayd-pfe.c b/net/relayd/files/patch-relayd-pfe.c
deleted file mode 100644
index 2ccaccf556bd..000000000000
--- a/net/relayd/files/patch-relayd-pfe.c
+++ /dev/null
@@ -1,109 +0,0 @@
---- relayd.orig/pfe.c 2011-05-22 01:06:39.464157989 +0200
-+++ relayd/pfe.c 2011-05-22 01:09:30.589288807 +0200
-@@ -17,6 +17,9 @@
- */
-
- #include <sys/param.h>
-+#ifdef __FreeBSD__
-+#include <sys/queue.h>
-+#endif
- #include <sys/stat.h>
- #include <sys/socket.h>
- #include <sys/un.h>
-@@ -185,12 +188,14 @@
- case IMSG_CFG_VIRT:
- config_getvirt(env, imsg);
- break;
-+#ifndef __FreeBSD__
- case IMSG_CFG_ROUTER:
- config_getrt(env, imsg);
- break;
- case IMSG_CFG_ROUTE:
- config_getroute(env, imsg);
- break;
-+#endif
- case IMSG_CFG_PROTO:
- config_getproto(env, imsg);
- break;
-@@ -292,8 +297,10 @@
- struct rdr *rdr;
- struct host *host;
- struct relay *rlay;
-+#ifndef __FreeBSD__
- struct router *rt;
- struct netroute *nr;
-+#endif
-
- if (env->sc_rdrs == NULL)
- goto relays;
-@@ -324,7 +331,11 @@
- }
- relays:
- if (env->sc_relays == NULL)
-+#ifndef __FreeBSD__
- goto routers;
-+#else
-+ goto end;
-+#endif
- TAILQ_FOREACH(rlay, env->sc_relays, rl_entry) {
- rlay->rl_stats[env->sc_prefork_relay].id = EMPTY_ID;
- imsg_compose_event(&c->iev, IMSG_CTL_RELAY, 0, 0, -1,
-@@ -351,6 +362,7 @@
- 0, 0, -1, host, sizeof(*host));
- }
-
-+#ifndef __FreeBSD__
- routers:
- if (env->sc_rts == NULL)
- goto end;
-@@ -370,6 +382,7 @@
- imsg_compose_event(&c->iev, IMSG_CTL_HOST,
- 0, 0, -1, host, sizeof(*host));
- }
-+#endif
-
- end:
- imsg_compose_event(&c->iev, IMSG_CTL_END, 0, 0, -1, NULL, 0);
-@@ -622,8 +635,10 @@
- struct table *table;
- struct ctl_id id;
- struct imsg imsg;
-+#ifndef __FreeBSD__
- struct ctl_demote demote;
- struct router *rt;
-+#endif
-
- bzero(&id, sizeof(id));
- bzero(&imsg, sizeof(imsg));
-@@ -678,6 +693,7 @@
- }
- }
-
-+#ifndef __FreeBSD__
- TAILQ_FOREACH(rt, env->sc_rts, rt_entry) {
- rt->rt_conf.flags &= ~(F_BACKUP);
- rt->rt_conf.flags &= ~(F_DOWN);
-@@ -685,6 +701,7 @@
- if ((rt->rt_gwtable->conf.flags & F_CHANGED))
- sync_routes(env, rt);
- }
-+#endif
-
- TAILQ_FOREACH(table, env->sc_tables, entry) {
- if (table->conf.check == CHECK_NOCHECK)
-@@ -695,6 +712,7 @@
- */
- table->conf.flags &= ~(F_CHANGED);
-
-+#ifndef __FreeBSD__
- /*
- * handle demotion.
- */
-@@ -717,6 +735,7 @@
- sizeof(demote.group));
- proc_compose_imsg(env->sc_ps, PROC_PARENT, -1, IMSG_DEMOTE, -1,
- &demote, sizeof(demote));
-+#endif
- }
- }
-
diff --git a/net/relayd/files/patch-relayd-pfe_filter.c b/net/relayd/files/patch-relayd-pfe_filter.c
deleted file mode 100644
index 26c2483ae2d7..000000000000
--- a/net/relayd/files/patch-relayd-pfe_filter.c
+++ /dev/null
@@ -1,284 +0,0 @@
---- relayd/pfe_filter.c.orig 2011-05-19 10:56:49.000000000 +0200
-+++ relayd/pfe_filter.c 2011-05-22 10:32:36.639918375 +0200
-@@ -24,7 +24,10 @@
- #include <net/if.h>
- #include <net/pfvar.h>
- #include <netinet/in.h>
-+#ifndef __FreeBSD__
-+/* New pf */
- #include <netinet/tcp.h>
-+#endif
- #include <arpa/inet.h>
-
- #include <limits.h>
-@@ -43,8 +46,14 @@
- struct pfdata {
- int dev;
- struct pf_anchor *anchor;
-+#ifndef __FreeBSD__
- struct pfioc_trans pft;
- struct pfioc_trans_e pfte;
-+#else
-+ /* Old pf */
-+ struct pfioc_trans pft[PF_RULESET_MAX];
-+ struct pfioc_trans_e pfte[PF_RULESET_MAX];
-+#endif
- u_int8_t pfused;
- };
-
-@@ -103,6 +112,10 @@
- sizeof(tables[i].pfrt_name))
- goto toolong;
- tables[i].pfrt_flags |= PFR_TFLAG_PERSIST;
-+#ifdef __FreeBSD__
-+ log_debug("init_tables: prepare anchor \"%s\" and table \"%s\"",
-+ tables[i].pfrt_anchor, tables[i].pfrt_name);
-+#endif
- i++;
- }
- if (i != env->sc_rdrcount)
-@@ -286,12 +299,18 @@
- }
-
- psnk.psnk_af = host->conf.ss.ss_family;
-+#ifndef __FreeBSD__
- psnk.psnk_killed = 0;
-+#endif
-
- if (ioctl(env->sc_pf->dev,
- DIOCKILLSRCNODES, &psnk) == -1)
- fatal("kill_srcnodes: cannot kill src nodes");
-+#ifndef __FreeBSD__
- cnt += psnk.psnk_killed;
-+#else
-+ cnt += psnk.psnk_af;
-+#endif
- }
-
- return (cnt);
-@@ -335,6 +354,7 @@
- int
- transaction_init(struct relayd *env, const char *anchor)
- {
-+#ifndef __FreeBSD__
- env->sc_pf->pft.size = 1;
- env->sc_pf->pft.esize = sizeof(env->sc_pf->pfte);
- env->sc_pf->pft.array = &env->sc_pf->pfte;
-@@ -347,17 +367,45 @@
- if (ioctl(env->sc_pf->dev, DIOCXBEGIN,
- &env->sc_pf->pft) == -1)
- return (-1);
-+#else
-+ /* Old pf */
-+ int i;
-+
-+ for (i = 0; i < PF_RULESET_MAX; i++) {
-+ env->sc_pf->pft[i].size = 1;
-+ env->sc_pf->pft[i].esize = sizeof(env->sc_pf->pfte[i]);
-+ env->sc_pf->pft[i].array = &env->sc_pf->pfte[i];
-+
-+ bzero(&env->sc_pf->pfte[i], sizeof(env->sc_pf->pfte[i]));
-+ (void)strlcpy(env->sc_pf->pfte[i].anchor,
-+ anchor, PF_ANCHOR_NAME_SIZE);
-+ env->sc_pf->pfte[i].rs_num = i;
-
-+ if (ioctl(env->sc_pf->dev, DIOCXBEGIN,
-+ &env->sc_pf->pft[i]) == -1)
-+ return (-1);
-+ }
-+#endif
- return (0);
- }
-
- int
- transaction_commit(struct relayd *env)
- {
-+#ifndef __FreeBSD__
- if (ioctl(env->sc_pf->dev, DIOCXCOMMIT,
- &env->sc_pf->pft) == -1)
- return (-1);
--
-+#else
-+ /* Old pf */
-+ int i;
-+
-+ for (i = 0; i < PF_RULESET_MAX; i++) {
-+ if (ioctl(env->sc_pf->dev, DIOCXCOMMIT,
-+ &env->sc_pf->pft[i]) == -1)
-+ return (-1);
-+ }
-+#endif
- return (0);
- }
-
-@@ -365,10 +413,18 @@
- sync_ruleset(struct relayd *env, struct rdr *rdr, int enable)
- {
- struct pfioc_rule rio;
-+#ifdef __FreeBSD__
-+ /* Old pf */
-+ struct pfioc_pooladdr pio;
-+#endif
- struct sockaddr_in *sain;
- struct sockaddr_in6 *sain6;
- struct address *address;
- char anchor[PF_ANCHOR_NAME_SIZE];
-+#ifdef __FreeBSD__
-+ /* Old pf */
-+ int rs = 0;
-+#endif
- struct table *t = rdr->table;
-
- if ((env->sc_flags & F_NEEDPF) == 0)
-@@ -397,8 +453,14 @@
-
- TAILQ_FOREACH(address, &rdr->virts, entry) {
- memset(&rio, 0, sizeof(rio));
-+#ifdef __FreeBSD__
-+ /* Old pf */
-+ memset(&pio, 0, sizeof(pio));
-+#endif
- (void)strlcpy(rio.anchor, anchor, sizeof(rio.anchor));
-
-+#ifndef __FreeBSD__
-+ /* New pf */
- if (rdr->conf.flags & F_MATCH) {
- rio.rule.action = PF_MATCH;
- rio.rule.quick = 0;
-@@ -409,28 +471,61 @@
- rio.rule.direction = PF_IN;
- rio.rule.keep_state = PF_STATE_NORMAL;
-
-+#endif
- switch (t->conf.fwdmode) {
- case FWD_NORMAL:
-+#ifndef __FreeBSD__
- /* traditional redirection */
- if (address->ipproto == IPPROTO_TCP) {
- rio.rule.flags = TH_SYN;
- rio.rule.flagset = (TH_SYN|TH_ACK);
- }
-+#else
-+ /* Old pf */
-+ /* traditional redirection in the rdr-anchor */
-+ rs = PF_RULESET_RDR;
-+ rio.rule.action = PF_RDR;
-+#endif
- break;
- case FWD_ROUTE:
- /* re-route with pf for DSR (direct server return) */
-+#ifdef __FreeBSD__
-+ /* Old pf */
-+ rs = PF_RULESET_FILTER;
-+ rio.rule.action = PF_PASS;
-+#endif
- rio.rule.rt = PF_ROUTETO;
-+#ifdef __FreeBSD__
-+ /* Old pf */
-+ rio.rule.direction = PF_IN;
-+ rio.rule.quick = 1; /* force first match */
-+#endif
-
- /* Use sloppy state handling for half connections */
-+#ifdef __FreeBSD__
-+ /* Old pf */
-+ rio.rule.keep_state = PF_STATE_NORMAL;
-+#endif
-+#ifdef PFRULE_STATESLOPPY
- rio.rule.rule_flag = PFRULE_STATESLOPPY;
-+#endif
- break;
- default:
- fatalx("sync_ruleset: invalid forward mode");
- /* NOTREACHED */
- }
-
-+#ifndef __FreeBSD__
- rio.ticket = env->sc_pf->pfte.ticket;
-
-+#else
-+ /* Old pf */
-+ rio.ticket = env->sc_pf->pfte[rs].ticket;
-+ if (ioctl(env->sc_pf->dev, DIOCBEGINADDRS, &pio) == -1)
-+ fatal("sync_ruleset: cannot initialise address pool");
-+
-+ rio.pool_ticket = pio.ticket;
-+#endif
- rio.rule.af = address->ss.ss_family;
- rio.rule.proto = address->ipproto;
- rio.rule.src.addr.type = PF_ADDR_ADDRMASK;
-@@ -438,7 +533,9 @@
- rio.rule.dst.port_op = address->port.op;
- rio.rule.dst.port[0] = address->port.val[0];
- rio.rule.dst.port[1] = address->port.val[1];
-+#ifndef __FreeBSD__
- rio.rule.rtableid = -1; /* stay in the main routing table */
-+#endif
-
- if (rio.rule.proto == IPPROTO_TCP)
- rio.rule.timeout[PFTM_TCP_ESTABLISHED] =
-@@ -466,18 +563,36 @@
- memset(&rio.rule.dst.addr.v.a.mask.addr8, 0xff, 16);
- }
-
-+#ifndef __FreeBSD__
- rio.rule.nat.addr.type = PF_ADDR_NONE;
- rio.rule.rdr.addr.type = PF_ADDR_TABLE;
-+#else
-+ /* Old pf */
-+ pio.addr.addr.type = PF_ADDR_TABLE;
-+#endif
- if (strlen(t->conf.ifname))
-+#ifndef __FreeBSD__
- (void)strlcpy(rio.rule.rdr.ifname, t->conf.ifname,
- sizeof(rio.rule.rdr.ifname));
- if (strlcpy(rio.rule.rdr.addr.v.tblname, rdr->conf.name,
- sizeof(rio.rule.rdr.addr.v.tblname)) >=
- sizeof(rio.rule.rdr.addr.v.tblname))
- fatal("sync_ruleset: table name too long");
-+#else
-+ /* Old pf */
-+ (void)strlcpy(pio.addr.ifname, t->conf.ifname,
-+ sizeof(pio.addr.ifname));
-+ if (strlcpy(pio.addr.addr.v.tblname, rdr->conf.name,
-+ sizeof(pio.addr.addr.v.tblname)) >=
-+ sizeof(pio.addr.addr.v.tblname))
-+ fatal("sync_ruleset: table name too long");
-+ if (ioctl(env->sc_pf->dev, DIOCADDADDR, &pio) == -1)
-+ fatal("sync_ruleset: cannot add address to pool");
-+#endif
-
- if (address->port.op == PF_OP_EQ ||
- rdr->table->conf.flags & F_PORT) {
-+#ifndef __FreeBSD__
- rio.rule.rdr.proxy_port[0] =
- ntohs(rdr->table->conf.port);
- rio.rule.rdr.port_op = PF_OP_EQ;
-@@ -491,10 +606,27 @@
- sizeof(rio.rule.route));
- rio.rule.rdr.addr.type = PF_ADDR_NONE;
- }
-+#else
-+ /* Old pf */
-+ rio.rule.rpool.proxy_port[0] =
-+ ntohs(rdr->table->conf.port);
-+ rio.rule.rpool.port_op = PF_OP_EQ;
-+ }
-+ rio.rule.rpool.opts = PF_POOL_ROUNDROBIN;
-+ if (rdr->conf.flags & F_STICKY)
-+ rio.rule.rpool.opts |= PF_POOL_STICKYADDR;
-+#endif
-
- if (ioctl(env->sc_pf->dev, DIOCADDRULE, &rio) == -1)
- fatal("cannot add rule");
-+#ifndef __FreeBSD__
- log_debug("%s: rule added to anchor \"%s\"", __func__, anchor);
-+#else
-+ /* Old pf */
-+ log_debug("%s: rule added to %sanchor \"%s\"", __func__,
-+ rdr->table->conf.fwdmode == FWD_ROUTE ?
-+ "" : "rdr-", anchor);
-+#endif
- }
- if (transaction_commit(env) == -1)
- log_warn("%s: add rules transaction failed", __func__);
diff --git a/net/relayd/files/patch-relayd-relay.c b/net/relayd/files/patch-relayd-relay.c
deleted file mode 100644
index a395c33a6598..000000000000
--- a/net/relayd/files/patch-relayd-relay.c
+++ /dev/null
@@ -1,249 +0,0 @@
---- relayd/relay.c.orig 2011-05-20 11:43:53.000000000 +0200
-+++ relayd/relay.c 2011-05-22 10:41:40.085208004 +0200
-@@ -16,7 +16,11 @@
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#ifdef __FreeBSD__
-+#include <sys/param.h>
-+#else
- #include <sys/types.h>
-+#endif
- #include <sys/queue.h>
- #include <sys/time.h>
- #include <sys/stat.h>
-@@ -77,7 +81,9 @@
-
- void relay_write(struct bufferevent *, void *);
- void relay_read(struct bufferevent *, void *);
-+#ifndef __FreeBSD__
- int relay_splicelen(struct ctl_relay_event *);
-+#endif
- void relay_error(struct bufferevent *, short, void *);
- void relay_dump(struct ctl_relay_event *, const void *, size_t);
-
-@@ -494,6 +500,7 @@
- return (0);
- }
-
-+#ifndef __FreeBSD__
- in_port_t
- relay_socket_getport(struct sockaddr_storage *ss)
- {
-@@ -509,6 +516,7 @@
- /* NOTREACHED */
- return (0);
- }
-+#endif
-
- int
- relay_socket(struct sockaddr_storage *ss, in_port_t port,
-@@ -577,6 +585,7 @@
- &val, sizeof(val)) == -1)
- goto bad;
- }
-+#ifndef __FreeBSD__
- if (proto->tcpflags & (TCPFLAG_SACK|TCPFLAG_NSACK)) {
- if (proto->tcpflags & TCPFLAG_NSACK)
- val = 0;
-@@ -586,6 +595,7 @@
- &val, sizeof(val)) == -1)
- goto bad;
- }
-+#endif
-
- return (s);
-
-@@ -675,6 +685,7 @@
- }
- break;
- case RELAY_PROTO_TCP:
-+#ifndef __FreeBSD__
- if ((proto->tcpflags & TCPFLAG_NSPLICE) ||
- (rlay->rl_conf.flags & (F_SSL|F_SSLCLIENT)))
- break;
-@@ -692,6 +703,7 @@
- return;
- }
- con->se_out.splicelen = 0;
-+#endif
- break;
- default:
- fatalx("relay_input: unknown protocol");
-@@ -935,12 +947,20 @@
- }
- if (strstr(val, "$TIMEOUT") != NULL) {
- snprintf(ibuf, sizeof(ibuf), "%lu",
-+#ifdef __FreeBSD__
-+ (unsigned long)rlay->rl_conf.timeout.tv_sec);
-+#else
- rlay->rl_conf.timeout.tv_sec);
-+#endif
- if (expand_string(buf, len, "$TIMEOUT", ibuf) != 0)
- return (NULL);
- }
-
-+#ifndef __FreeBSD__
- return (buf);
-+#else
-+ return (char *)(buf);
-+#endif
- }
-
- int
-@@ -1552,7 +1572,11 @@
- switch (type) {
- case DIGEST_SHA1:
- case DIGEST_MD5:
-+#ifdef __FreeBSD__
-+ if ((md = digeststr(type, (u_int8_t*)val, strlen(val), NULL)) == NULL) {
-+#else
- if ((md = digeststr(type, val, strlen(val), NULL)) == NULL) {
-+#endif
- relay_close_http(con, 500,
- "failed to allocate digest", 0);
- goto fail;
-@@ -1841,6 +1865,7 @@
- }
- }
-
-+#ifndef __FreeBSD__
- int
- relay_splicelen(struct ctl_relay_event *cre)
- {
-@@ -1859,6 +1884,7 @@
- }
- return (0);
- }
-+#endif
-
- void
- relay_error(struct bufferevent *bev, short error, void *arg)
-@@ -1866,9 +1892,12 @@
- struct ctl_relay_event *cre = (struct ctl_relay_event *)arg;
- struct rsession *con = cre->con;
- struct evbuffer *dst;
-+#ifndef __FreeBSD__
- struct timeval tv, tv_now;
-+#endif
-
- if (error & EVBUFFER_TIMEOUT) {
-+#ifndef __FreeBSD__
- if (gettimeofday(&tv_now, NULL) == -1) {
- relay_close(con, strerror(errno));
- return;
-@@ -1882,6 +1911,9 @@
- relay_close(con, "buffer event timeout");
- else
- bufferevent_enable(cre->bev, EV_READ);
-+#else
-+ relay_close(con, "buffer event timeout");
-+#endif
- return;
- }
- if (error & (EVBUFFER_READ|EVBUFFER_WRITE|EVBUFFER_EOF)) {
-@@ -1934,8 +1966,10 @@
- con->se_out.dst = &con->se_in;
- con->se_in.con = con;
- con->se_out.con = con;
-+#ifndef __FreeBSD__
- con->se_in.splicelen = -1;
- con->se_out.splicelen = -1;
-+#endif
- con->se_relay = rlay;
- con->se_id = ++relay_conid;
- con->se_relayid = rlay->rl_conf.id;
-@@ -1981,6 +2015,7 @@
- return;
- }
-
-+#ifndef __FreeBSD__
- if (rlay->rl_conf.flags & F_DIVERT) {
- slen = sizeof(con->se_out.ss);
- if (getsockname(s, (struct sockaddr *)&con->se_out.ss,
-@@ -1996,12 +2031,19 @@
- con->se_out.port == rlay->rl_conf.port)
- con->se_out.ss.ss_family = AF_UNSPEC;
- } else if (rlay->rl_conf.flags & F_NATLOOK) {
-+#else
-+ if (rlay->rl_conf.flags & F_NATLOOK) {
-+#endif
- if ((cnl = (struct ctl_natlook *)
- calloc(1, sizeof(struct ctl_natlook))) == NULL) {
- relay_close(con, "failed to allocate nat lookup");
- return;
- }
-+#ifdef __FreeBSD__
-+ }
-
-+ if (rlay->rl_conf.flags & F_NATLOOK && cnl != NULL) {
-+#endif
- con->se_cnl = cnl;
- bzero(cnl, sizeof(*cnl));
- cnl->in = -1;
-@@ -2605,8 +2647,12 @@
- goto err;
-
- /* Set session context to the local relay name */
-- if (!SSL_CTX_set_session_id_context(ctx, rlay->rl_conf.name,
-- strlen(rlay->rl_conf.name)))
-+ if (!SSL_CTX_set_session_id_context(ctx,
-+#ifdef __FreeBSD__
-+ (unsigned char*)rlay->rl_conf.name, strlen(rlay->rl_conf.name)))
-+#else
-+ rlay->rl_conf.name, strlen(rlay->rl_conf.name)))
-+#endif
- goto err;
-
- return (ctx);
-@@ -2623,7 +2669,7 @@
- {
- struct relay *rlay = (struct relay *)con->se_relay;
- SSL *ssl;
-- const SSL_METHOD *method;
-+ SSL_METHOD *method;
- void (*cb)(int, short, void *);
- u_int flags = EV_TIMEOUT;
-
-@@ -3069,7 +3115,11 @@
- if (fstat(fd, &st) != 0)
- goto fail;
- size = st.st_size;
-+#ifndef __FreeBSD__
- if ((buf = (char *)calloc(1, size + 1)) == NULL)
-+#else
-+ if ((buf = (u_int8_t *)calloc(1, size + 1)) == NULL)
-+#endif
- goto fail;
- if (read(fd, buf, size) != size)
- goto fail;
-@@ -3077,7 +3127,11 @@
- close(fd);
-
- *len = size;
-+#ifndef __FreeBSD__
- return (buf);
-+#else
-+ return (char *)(buf);
-+#endif
-
- fail:
- if (buf != NULL)
-@@ -3107,7 +3161,7 @@
- return (-1);
-
- if (snprintf(certfile, sizeof(certfile),
-- "/etc/ssl/%s.crt", hbuf) == -1)
-+ "%%PREFIX%%/etc/ssl/%s.crt", hbuf) == -1)
- return (-1);
- if ((rlay->rl_ssl_cert = relay_load_file(certfile,
- &rlay->rl_conf.ssl_cert_len)) == NULL)
-@@ -3115,7 +3169,7 @@
- log_debug("%s: using certificate %s", __func__, certfile);
-
- if (snprintf(certfile, sizeof(certfile),
-- "/etc/ssl/private/%s.key", hbuf) == -1)
-+ "%%PREFIX%%/etc/ssl/private/%s.key", hbuf) == -1)
- return -1;
- if ((rlay->rl_ssl_key = relay_load_file(certfile,
- &rlay->rl_conf.ssl_key_len)) == NULL)
diff --git a/net/relayd/files/patch-relayd-relay_udp.c b/net/relayd/files/patch-relayd-relay_udp.c
deleted file mode 100644
index 6ac13dc49f45..000000000000
--- a/net/relayd/files/patch-relayd-relay_udp.c
+++ /dev/null
@@ -1,14 +0,0 @@
---- relayd.orig/relay_udp.c 2011-05-22 01:06:39.460142978 +0200
-+++ relayd/relay_udp.c 2011-05-22 01:06:54.703144104 +0200
-@@ -16,7 +16,11 @@
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#ifdef __FreeBSD__
-+#include <sys/param.h>
-+#else
- #include <sys/types.h>
-+#endif
- #include <sys/queue.h>
- #include <sys/time.h>
- #include <sys/stat.h>
diff --git a/net/relayd/files/patch-relayd-relayd.8 b/net/relayd/files/patch-relayd-relayd.8
deleted file mode 100644
index 9034641d8294..000000000000
--- a/net/relayd/files/patch-relayd-relayd.8
+++ /dev/null
@@ -1,20 +0,0 @@
---- relayd.orig/relayd.8 2011-05-22 01:06:39.464157989 +0200
-+++ relayd/relayd.8 2011-05-22 01:06:54.705151889 +0200
-@@ -114,7 +114,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.
-@@ -123,7 +123,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
- .Ux Ns -domain
diff --git a/net/relayd/files/patch-relayd-relayd.c b/net/relayd/files/patch-relayd-relayd.c
deleted file mode 100644
index 5a3e55dce18d..000000000000
--- a/net/relayd/files/patch-relayd-relayd.c
+++ /dev/null
@@ -1,181 +0,0 @@
---- relayd/relayd.c.orig 2011-05-19 10:56:49.000000000 +0200
-+++ relayd/relayd.c 2011-05-22 10:34:12.913164741 +0200
-@@ -17,7 +17,12 @@
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-+#ifdef __FreeBSD__
-+#include <sys/param.h>
-+#include <openssl/rand.h>
-+#else
- #include <sys/types.h>
-+#endif
- #include <sys/queue.h>
- #include <sys/socket.h>
- #include <sys/wait.h>
-@@ -39,7 +44,11 @@
- #include <unistd.h>
- #include <ctype.h>
- #include <pwd.h>
-+#ifdef __FreeBSD__
-+#include <sha.h>
-+#else
- #include <sha1.h>
-+#endif
- #include <md5.h>
-
- #include <openssl/ssl.h>
-@@ -150,6 +159,11 @@
- struct relayd *env;
- struct privsep *ps;
- const char *conffile = CONF_FILE;
-+#ifdef __FreeBSD__
-+#if __FreeBSD_version > 800040
-+ u_int32_t rnd[256];
-+#endif
-+#endif
-
- while ((c = getopt(argc, argv, "dD:nf:v")) != -1) {
- switch (c) {
-@@ -220,6 +234,16 @@
- else
- log_info("startup");
-
-+#ifdef __FreeBSD__
-+#if __FreeBSD_version > 800040
-+ arc4random_stir();
-+ arc4random_buf(rnd, sizeof(rnd));
-+ RAND_seed(rnd, sizeof(rnd));
-+#else
-+ RAND_load_file("/dev/random",2048);
-+#endif
-+#endif
-+
- ps->ps_instances[PROC_RELAY] = env->sc_prefork_relay;
- proc_init(ps, procs, nitems(procs));
-
-@@ -258,7 +282,9 @@
- if (parent_configure(env) == -1)
- fatalx("configuration failed");
-
-+#ifndef __FreeBSD__
- init_routes(env);
-+#endif
-
- event_dispatch();
-
-@@ -273,7 +299,9 @@
- {
- struct table *tb;
- struct rdr *rdr;
-+#ifndef __FreeBSD__
- struct router *rt;
-+#endif
- struct protocol *proto;
- struct relay *rlay;
- int id;
-@@ -284,8 +312,10 @@
- config_settable(env, tb);
- TAILQ_FOREACH(rdr, env->sc_rdrs, entry)
- config_setrdr(env, rdr);
-+#ifndef __FreeBSD__
- TAILQ_FOREACH(rt, env->sc_rts, rt_entry)
- config_setrt(env, rt);
-+#endif
- TAILQ_FOREACH(proto, env->sc_protos, entry)
- config_setproto(env, proto);
- TAILQ_FOREACH(rlay, env->sc_relays, rl_entry)
-@@ -359,9 +389,11 @@
-
- proc_kill(env->sc_ps);
- control_cleanup(&env->sc_ps->ps_csock);
-+#ifndef __FreeBSD__
- carp_demote_shutdown();
- if (env->sc_flags & F_DEMOTE)
- carp_demote_reset(env->sc_demote_group, 128);
-+#endif
-
- free(env->sc_ps);
- free(env);
-@@ -375,12 +407,15 @@
- parent_dispatch_pfe(int fd, struct privsep_proc *p, struct imsg *imsg)
- {
- struct relayd *env = p->p_env;
-+#ifndef __FreeBSD__
- struct ctl_demote demote;
- struct ctl_netroute crt;
-+#endif
- u_int v;
- char *str = NULL;
-
- switch (imsg->hdr.type) {
-+#ifndef __FreeBSD__
- case IMSG_DEMOTE:
- IMSG_SIZE_CHECK(imsg, &demote);
- memcpy(&demote, imsg->data, sizeof(demote));
-@@ -391,6 +426,7 @@
- memcpy(&crt, imsg->data, sizeof(crt));
- pfe_route(env, &crt);
- break;
-+#endif
- case IMSG_CTL_RESET:
- IMSG_SIZE_CHECK(imsg, &v);
- memcpy(&v, imsg->data, sizeof(v));
-@@ -432,9 +468,11 @@
- proc_compose_imsg(ps, PROC_HCE, -1, IMSG_SCRIPT,
- -1, &scr, sizeof(scr));
- break;
-+#ifndef __FreeBSD__
- case IMSG_SNMPSOCK:
- (void)snmp_setsock(env, p->p_id);
- break;
-+#endif
- case IMSG_CFG_DONE:
- if (env->sc_reload)
- env->sc_reload--;
-@@ -645,6 +683,7 @@
- return (NULL);
- }
-
-+#ifndef __FreeBSD__
- struct netroute *
- route_find(struct relayd *env, objid_t id)
- {
-@@ -666,6 +705,7 @@
- return (rt);
- return (NULL);
- }
-+#endif
-
- struct host *
- host_findbyname(struct relayd *env, const char *name)
-@@ -840,7 +880,11 @@
- {
- switch (type) {
- case DIGEST_SHA1:
-+#ifdef __FreeBSD__
-+ return (SHA1_Data(data, len, buf));
-+#else
- return (SHA1Data(data, len, buf));
-+#endif
- break;
- case DIGEST_MD5:
- return (MD5Data(data, len, buf));
-@@ -1077,9 +1121,17 @@
- bnd->bnd_proto == IPPROTO_TCP ? SOCK_STREAM : SOCK_DGRAM,
- bnd->bnd_proto)) == -1)
- goto fail;
-+#ifdef SO_BINDANY
- if (setsockopt(s, SOL_SOCKET, SO_BINDANY,
- &v, sizeof(v)) == -1)
- goto fail;
-+#else
-+#ifdef IP_BINDANY
-+ if (setsockopt(s, IPPROTO_IP, IP_BINDANY,
-+ &v, sizeof(v)) == -1)
-+ goto fail;
-+#endif
-+#endif
- if (bind(s, (struct sockaddr *)&bnd->bnd_ss,
- bnd->bnd_ss.ss_len) == -1)
- goto fail;
diff --git a/net/relayd/files/patch-relayd-relayd.conf.5 b/net/relayd/files/patch-relayd-relayd.conf.5
deleted file mode 100644
index f9382742f2e3..000000000000
--- a/net/relayd/files/patch-relayd-relayd.conf.5
+++ /dev/null
@@ -1,244 +0,0 @@
---- relayd/relayd.conf.5.orig 2011-05-05 12:20:24.000000000 +0200
-+++ relayd/relayd.conf.5 2011-05-22 12:52:42.026190316 +0200
-@@ -43,7 +43,7 @@
- in a similar fashion to
- .Xr pf 4
- tables.
--They are used for relay, redirection, and router target selection with
-+They are used for relay and redirection target selection with
- the described options and health checking on the host they contain.
- .It Sy Redirections
- Redirections are translated to
-@@ -55,9 +55,6 @@
- general purpose TCP proxying on layer 7.
- .It Sy Protocols
- Protocols are predefined protocol handlers and settings for relays.
--.It Sy Routers
--Routers are used to insert routes with health-checked gateways for
--(WAN) link balancing.
- .El
- .Pp
- Within the sections,
-@@ -86,7 +83,7 @@
- .Ic include
- keyword, for example:
- .Bd -literal -offset indent
--include "/etc/relayd.conf.local"
-+include "%%PREFIX%%/etc/relayd.conf.local"
- .Ed
- .Sh MACROS
- Macros can be defined that will later be expanded in context.
-@@ -111,17 +108,6 @@
- .Sh GLOBAL CONFIGURATION
- Here are the settings that can be set globally:
- .Bl -tag -width Ds
--.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 .
- .It Ic interval Ar number
- Set the interval in seconds at which the hosts will be checked.
- The default interval is 10 seconds.
-@@ -151,15 +137,6 @@
- .Xr relayd 8
- runs 5 relay processes by default and every process will handle
- all configured relays.
--.It Ic send trap
--Send an SNMP trap when the state of a host changes.
--.Xr relayd 8
--will try to connect to
--.Xr snmpd 8
--and request it send a trap to the registered trap receivers;
--see
--.Xr snmpd.conf 5
--for more information about the configuration.
- .It Ic timeout Ar number
- Set the global timeout in milliseconds for checks.
- This can be overridden by the timeout value in the table definitions.
-@@ -363,17 +340,6 @@
- .Pp
- The following general table options are available:
- .Bl -tag -width Ds
--.It Ic demote Ar group
--Enable the per-table
--.Xr carp 4
--demotion option.
--This will increment the carp demotion counter for the
--specified interface group if all hosts in the table are down.
--For more information on interface groups,
--see the
--.Ic group
--keyword in
--.Xr ifconfig 8 .
- .It Ic interval Ar number
- Override the global interval and specify one for this table.
- It must be a multiple of the global interval.
-@@ -605,7 +571,7 @@
- .Ic destination
- .Ar options ...
- .Xc
--When redirecting connections with a divert-to rule in
-+When redirecting connections with a rdr-to rule in
- .Xr pf.conf 5
- to a relay listening on localhost, this directive will
- look up the real destination address of the intended target host,
-@@ -613,14 +579,7 @@
- If an additional
- .Ic forward to
- directive to a specified address or table is present,
--it will be used as a backup if the lookup failed.
--.It Xo
--.Ic forward to
--.Ic nat lookup
--.Ar options ...
--.Xc
--Like the previous directive, but for redirections with rdr-to in
--.Xr pf.conf 5 .
-+it will be used as a backup if the NAT lookup failed.
- .It Xo
- .Ic listen on Ar address
- .Op Ic port Ar port
-@@ -639,9 +598,9 @@
- keyword is present, the relay will accept connections using the
- encrypted SSL protocol.
- The relay will look up a private key in
--.Pa /etc/ssl/private/address.key
-+.Pa %%PREFIX%%/etc/ssl/private/address.key
- and a public certificate in
--.Pa /etc/ssl/address.crt ,
-+.Pa %%PREFIX%%/etc/ssl/address.crt ,
- where
- .Ar address
- is the specified IP address of the relay to listen on.
-@@ -990,9 +949,6 @@
- This option enables CA verification in SSL client mode.
- The daemon will load the CA (Certificate Authority) certificates from
- the specified path to verify the server certificates.
--.Ox
--provides a default CA bundle in
--.Pa /etc/ssl/cert.pem .
- .It Ic ciphers Ar string
- Set the string defining the SSL cipher suite.
- If not specified, the default value
-@@ -1068,89 +1024,22 @@
- Set the socket-level buffer size for input and output for this
- connection.
- This will affect the TCP window size.
--.It Xo
--.Op Ic no
--.Ic splice
--.Xc
--Use socket splicing for zero-copy data transfer.
--This option is enabled by default.
- .El
- .El
--.Sh ROUTERS
--Routers represent routing table entries in the kernel forwarding
--database, see
--.Xr route 4 ,
--and a table of associated gateways.
--They are used to dynamically insert or remove routes with gateways
--based on their availability and health-check results.
--A router can include multiple network statements and a single forward
--statement with a table of one or more gateways.
--All entries in a single router directive must match the same address
--family, either IPv4 or IPv6.
--.Pp
--The kernel supports multipath routing when multiple gateways exist to
--the same destination address.
--The multipath routing behaviour can be changed globally using the
--.Xr sysctl 8
--variables
--.Va net.inet.ip.multipath
--and
--.Va net.inet6.ip6.multipath .
--With the default setting of 0,
--the first route selected will be used for subsequent packets to that
--destination regardless of source.
--Setting it to 1 will enable load balancing based on the packet source
--address across gateways; multiple routes with the same priority are
--used equally.
--The kernel will also check the link state of the related network
--interface and try a different route if it is not active.
--.Pp
--The configuration directives that are valid in the
--.Ic routers
--context are described below:
--.Bl -tag -width Ds
--.It Xo
--.Ic forward to
--.Aq Ar table
--.Ic port Ar number
--.Ar options ...
--.Xc
--Specify the table of target gateways to be used; see the
--.Sx TABLES
--section above for information about table options.
--This entry is mandatory and must be specified once.
--.It Xo
--.Ic route
--.Ar address Ns Li / Ns Ar prefix
--.Xc
--Specify the network address and prefix length of a route destination
--that is reachable via the active gateways.
--This entry must be specified at least once in a router directive.
--.It Ic rtable Ar id
--Add the routes to the kernel routing table with the specified
--.Ar id .
--.It Ic rtlabel Ar label
--Add the routes with the specified
--.Ar label
--to the kernel routing table.
--.El
- .Sh FILES
--.Bl -tag -width "/etc/ssl/private/address.keyXX" -compact
--.It Pa /etc/relayd.conf
-+.Bl -tag -width "%%PREFIX%%/etc/ssl/private/address.keyXX" -compact
-+.It Pa %%PREFIX%%/etc/relayd.conf
- .Xr relayd 8
- configuration file.
- .Pp
- .It Pa /etc/services
- Service name database.
- .Pp
--.It Pa /etc/ssl/address.crt
--.It Pa /etc/ssl/private/address.key
-+.It Pa %%PREFIX%%/etc/ssl/address.crt
-+.It Pa %%PREFIX%%/etc/ssl/private/address.key
- Location of the relay SSL server certificates, where
- .Ar address
- is the configured IP address of the relay.
--.It Pa /etc/ssl/cert.pem
--Default location of the CA bundle that can be used with
--.Xr relayd 8 .
- .El
- .Sh EXAMPLES
- This configuration file would create a redirection service
-@@ -1242,20 +1131,9 @@
- forward to shell.example.com port 22
- }
- .Ed
--.Pp
--The next simple router configuration example can be used to run
--redundant, health-checked WAN links:
--.Bd -literal -offset indent
--table \*(Ltgateways\*(Gt { $gw1 ip ttl 1, $gw2 ip ttl 1 }
--router "uplinks" {
-- route 0.0.0.0/0
-- forward to \*(Ltgateways\*(Gt check icmp
--}
--.Ed
- .Sh SEE ALSO
- .Xr relayctl 8 ,
- .Xr relayd 8 ,
--.Xr snmpd 8 ,
- .Xr ssl 8
- .Sh HISTORY
- The
diff --git a/net/relayd/files/patch-relayd-relayd.h b/net/relayd/files/patch-relayd-relayd.h
deleted file mode 100644
index efcdf9a93b64..000000000000
--- a/net/relayd/files/patch-relayd-relayd.h
+++ /dev/null
@@ -1,189 +0,0 @@
---- relayd/relayd.h.orig 2011-05-26 18:42:14.000000000 +0200
-+++ relayd/relayd.h 2011-05-26 18:44:44.868614096 +0200
-@@ -21,10 +21,18 @@
- #include <sys/tree.h>
-
- #include <sys/param.h> /* MAXHOSTNAMELEN */
-+#ifdef __FreeBSD__
-+#include <sys/queue.h>
-+#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
-+#endif
- #include <limits.h>
- #include <imsg.h>
-
-+#ifdef __FreeBSD__
-+#define CONF_FILE "%%PREFIX%%/etc/relayd.conf"
-+#else
- #define CONF_FILE "/etc/relayd.conf"
-+#endif
- #define RELAYD_SOCKET "/var/run/relayd.sock"
- #define PF_SOCKET "/dev/pf"
- #define RELAYD_USER "_relayd"
-@@ -63,7 +71,18 @@
- #define SMALL_READ_BUF_SIZE 1024
- #define ICMP_BUF_SIZE 64
-
-+#ifndef __FreeBSD__
- #define SNMP_RECONNECT_TIMEOUT { 3, 0 } /* sec, usec */
-+#else
-+#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
-+#endif
-
- #if DEBUG > 1
- #define DPRINTF log_debug
-@@ -626,6 +645,7 @@
- };
- #define RELAY_DSTMODE_DEFAULT RELAY_DSTMODE_ROUNDROBIN
-
-+#ifndef __FreeBSD__
- struct router;
- struct netroute_config {
- objid_t id;
-@@ -672,6 +692,7 @@
- struct netroute_config nr;
- struct router_config rt;
- };
-+#endif
-
- /* initially control.h */
- struct control_sock {
-@@ -757,12 +778,18 @@
- IMSG_HOST_STATUS, /* notifies from hce to pfe */
- IMSG_SYNC,
- IMSG_NATLOOK,
-+#ifndef __FreeBSD__
- IMSG_DEMOTE,
-+#endif
- IMSG_STATISTICS,
- IMSG_SCRIPT,
-+#ifndef __FreeBSD__
- IMSG_SNMPSOCK,
-+#endif
- IMSG_BINDANY,
-+#ifndef __FreeBSD__
- IMSG_RTMSG, /* from pfe to parent */
-+#endif
- IMSG_CFG_TABLE, /* configuration from parent */
- IMSG_CFG_HOST,
- IMSG_CFG_RDR,
-@@ -830,14 +857,18 @@
- u_int32_t sc_flags;
- const char *sc_conffile;
- struct pfdata *sc_pf;
-+#ifndef __FreeBSD__
- int sc_rtsock;
- int sc_rtseq;
-+#endif
- int sc_tablecount;
- int sc_rdrcount;
- int sc_protocount;
- int sc_relaycount;
-+#ifndef __FreeBSD__
- int sc_routercount;
- int sc_routecount;
-+#endif
- struct timeval sc_interval;
- struct timeval sc_timeout;
- struct table sc_empty_table;
-@@ -847,8 +878,10 @@
- struct rdrlist *sc_rdrs;
- struct protolist *sc_protos;
- struct relaylist *sc_relays;
-+#ifndef __FreeBSD__
- struct routerlist *sc_rts;
- struct netroutelist *sc_routes;
-+#endif
- u_int16_t sc_prefork_relay;
- char sc_demote_group[IFNAMSIZ];
- u_int16_t sc_id;
-@@ -856,10 +889,11 @@
- struct event sc_statev;
- struct timeval sc_statinterval;
-
-+#ifndef __FreeBSD__
- int sc_snmp;
- struct event sc_snmpto;
- struct event sc_snmpev;
--
-+#endif
- int sc_has_icmp;
- int sc_has_icmp6;
- struct ctl_icmp_event sc_icmp_send;
-@@ -927,10 +961,12 @@
- u_int64_t
- check_table(struct relayd *, struct rdr *, struct table *);
-
-+#ifndef __FreeBSD__
- /* pfe_route.c */
- void init_routes(struct relayd *);
- void sync_routes(struct relayd *, struct router *);
- int pfe_route(struct relayd *, struct ctl_netroute *);
-+#endif
-
- /* hce.c */
- pid_t hce(struct privsep *, struct privsep_proc *);
-@@ -947,8 +983,10 @@
- void relay_session(struct rsession *);
- int relay_from_table(struct rsession *);
- int relay_socket_af(struct sockaddr_storage *, in_port_t);
-+#ifndef __FreeBSD__
- in_port_t
- relay_socket_getport(struct sockaddr_storage *);
-+#endif
- int relay_cmp_af(struct sockaddr_storage *,
- struct sockaddr_storage *);
-
-@@ -990,8 +1028,10 @@
- struct host *host_find(struct relayd *, objid_t);
- struct table *table_find(struct relayd *, objid_t);
- struct rdr *rdr_find(struct relayd *, objid_t);
-+#ifndef __FreeBSD__
- struct netroute *route_find(struct relayd *, objid_t);
- struct router *router_find(struct relayd *, objid_t);
-+#endif
- struct host *host_findbyname(struct relayd *, const char *);
- struct table *table_findbyname(struct relayd *, const char *);
- struct table *table_findbyconf(struct relayd *, struct table *);
-@@ -1039,11 +1079,13 @@
- void pn_unref(u_int16_t);
- void pn_ref(u_int16_t);
-
-+#ifndef __FreeBSD__
- /* snmp.c */
- void snmp_init(struct relayd *, enum privsep_procid);
- int snmp_setsock(struct relayd *, enum privsep_procid);
- int snmp_getsock(struct relayd *, struct imsg *);
- void snmp_hosttrap(struct relayd *, struct table *, struct host *);
-+#endif
-
- /* shuffle.c */
- void shuffle_init(struct shuffle *);
-@@ -1096,9 +1138,11 @@
- int config_setrdr(struct relayd *, struct rdr *);
- int config_getrdr(struct relayd *, struct imsg *);
- int config_getvirt(struct relayd *, struct imsg *);
-+#ifndef __FreeBSD__
- int config_setrt(struct relayd *, struct router *);
- int config_getrt(struct relayd *, struct imsg *);
- int config_getroute(struct relayd *, struct imsg *);
-+#endif
- int config_setproto(struct relayd *env, struct protocol *);
- int config_getproto(struct relayd *, struct imsg *);
- int config_setprotonode(struct relayd *, enum privsep_procid,
-@@ -1106,3 +1150,9 @@
- int config_getprotonode(struct relayd *, struct imsg *);
- int config_setrelay(struct relayd *env, struct relay *);
- int config_getrelay(struct relayd *, struct imsg *);
-+
-+#ifdef __FreeBSD__
-+#if __FreeBSD_version < 800041
-+u_int32_t arc4random_uniform(u_int32_t upper_bound);
-+#endif
-+#endif
diff --git a/net/relayd/pkg-descr b/net/relayd/pkg-descr
index a356fd4f73a7..b0b1f39743b0 100644
--- a/net/relayd/pkg-descr
+++ b/net/relayd/pkg-descr
@@ -1,3 +1,5 @@
+This is the FreeBSD port of the OpenBSD relayd and relayctl.
+
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
@@ -13,4 +15,6 @@ carp
routers
snmp
-WWW: http://spootnik.org/relayd/
+The relayctl program controls the relayd(8) daemon.
+
+WWW: https://github.com/mmatuska/relayd
diff --git a/net/relayd/pkg-plist b/net/relayd/pkg-plist
index f7f0854929f4..d0cce47cf6c3 100644
--- a/net/relayd/pkg-plist
+++ b/net/relayd/pkg-plist
@@ -1,4 +1,4 @@
+@unexec if cmp -s %D/etc/relayd.conf %D/etc/relayd.conf.sample; then rm -f %D/etc/relayd.conf; fi
etc/relayd.conf.sample
sbin/relayctl
sbin/relayd
-@unexec echo "Warning: If you will *NOT* use this package anymore, please remove the _relayd user manually."