I haven't had chance to test this yet but thought I'd send it out in case anyone else is thinking of looking at it (no point two people having to merge the diffs).
It now handles v4 and v6 in the same daemon. For details about the change, see https://gitlab.labs.nic.cz/labs/bird/wikis/transition-notes-to-bird-2 Does anyone running it (on OpenBSD or elsewhere) have comments about 1.6 vs 2? Assuming that it still works ok, is there any point keeping both versions around? Index: Makefile =================================================================== RCS file: /cvs/ports/net/bird/Makefile,v retrieving revision 1.49 diff -u -p -r1.49 Makefile --- Makefile 11 Jan 2018 19:27:04 -0000 1.49 +++ Makefile 17 Jan 2018 00:48:20 -0000 @@ -3,9 +3,9 @@ COMMENT-main= BIRD internet routing daemon COMMENT-doc= BIRD internet routing daemon (documentation) -V= 1.6.3 -REVISION-main= 1 +V= 2.0.1 DISTNAME= bird-$V +PKGNAME-main= bird-$V DISTFILES= ${DISTNAME}${EXTRACT_SUFX} \ ${DISTNAME:S/-/-doc-/}${EXTRACT_SUFX} @@ -18,40 +18,27 @@ MAINTAINER= Stuart Henderson <sthen@open # GPLv2+ PERMIT_PACKAGE_CDROM= Yes -WANTLIB-main= c ncurses pthread readline +WANTLIB-main= c curses pthread readline ssh MULTI_PACKAGES= -main -doc FULLPKGNAME-doc= bird-doc-$V FULLPKGPATH-doc= net/bird,-doc -# IPv6 support must be built with separate flags, however the filenames -# do not conflict, so the two packages may be installed together. -FLAVORS= v6 -FLAVOR?= -SUBST_VARS+= SIX - -.if ${FLAVOR:Mv6} -FULLPKGNAME-main= bird-v6-$V -FULLPKGPATH-main= net/bird,-main,v6 -SIX= 6 -.else -PKGNAME-main= bird-$V -.endif - MASTER_SITES= ftp://bird.network.cz/pub/bird/ BUILD_DEPENDS= devel/m4 \ devel/bison +LIB_DEPENDS= security/libssh FAKE_FLAGS= sysconfdir=${TRUEPREFIX}/share/examples/bird USE_GMAKE= Yes +MAKE_FLAGS= VERBOSE=1 CONFIGURE_STYLE= gnu -CONFIGURE_ARGS+= --enable-pthreads - -.if ${FLAVOR:Mv6} -CONFIGURE_ARGS+= --enable-ipv6 -.endif +CFLAGS+= -I${LOCALBASE}/include +CONFIGURE_ENV= LDFLAGS="-L${LOCALBASE}/lib" +CONFIGURE_ARGS+= --enable-pthreads \ + --enable-ssh MODGNU_CONFIG_GUESS_DIRS= ${WRKSRC}/tools @@ -60,6 +47,6 @@ NO_TEST= Yes post-install: ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/bird ${INSTALL_DATA} ${WRKDIR}/bird-doc-$V/doc/* ${PREFIX}/share/doc/bird/ - ${INSTALL_DATA} ${WRKSRC}/doc/*.html ${PREFIX}/share/doc/bird/ + ${INSTALL_DATA} ${WRKSRC}/doc/bird.conf.example2 ${PREFIX}/share/examples/bird/ .include <bsd.port.mk> Index: distinfo =================================================================== RCS file: /cvs/ports/net/bird/distinfo,v retrieving revision 1.30 diff -u -p -r1.30 distinfo --- distinfo 23 Dec 2016 14:38:36 -0000 1.30 +++ distinfo 17 Jan 2018 00:48:20 -0000 @@ -1,4 +1,4 @@ -SHA256 (bird-1.6.3.tar.gz) = OcUc9Xw7qLWXiyplf/ovZH7H865kPpHPQu5csHDPfnw= -SHA256 (bird-doc-1.6.3.tar.gz) = 78jAKyzVwxwUCAPLIj1ihEZGvg7RdUd5z8GUR9q2XPc= -SIZE (bird-1.6.3.tar.gz) = 1337198 -SIZE (bird-doc-1.6.3.tar.gz) = 357386 +SHA256 (bird-2.0.1.tar.gz) = RqZgzg0sKIclx6q8SwsT+TeZqvNL33+2KQp+fzDFsnk= +SHA256 (bird-doc-2.0.1.tar.gz) = yOVthTXCZCQB3PfSslPhuY0ODCP8HLnYuWayH/OGOXA= +SIZE (bird-2.0.1.tar.gz) = 1006133 +SIZE (bird-doc-2.0.1.tar.gz) = 845307 Index: patches/patch-client_client_c =================================================================== RCS file: patches/patch-client_client_c diff -N patches/patch-client_client_c --- patches/patch-client_client_c 10 Sep 2016 13:03:42 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,11 +0,0 @@ -$OpenBSD: patch-client_client_c,v 1.1 2016/09/10 13:03:42 ajacoutot Exp $ ---- client/client.c.orig Sat Sep 10 11:48:54 2016 -+++ client/client.c Sat Sep 10 11:49:11 2016 -@@ -27,6 +27,7 @@ - #include <errno.h> - #include <sys/socket.h> - #include <sys/un.h> -+#include <sys/select.h> /* fd_set */ - #include <sys/types.h> - - #include "nest/bird.h" Index: patches/patch-sysdep_bsd_setkey_h =================================================================== RCS file: /cvs/ports/net/bird/patches/patch-sysdep_bsd_setkey_h,v retrieving revision 1.2 diff -u -p -r1.2 patch-sysdep_bsd_setkey_h --- patches/patch-sysdep_bsd_setkey_h 3 Mar 2017 00:05:38 -0000 1.2 +++ patches/patch-sysdep_bsd_setkey_h 17 Jan 2018 00:48:20 -0000 @@ -4,13 +4,13 @@ $OpenBSD: patch-sysdep_bsd_setkey_h,v 1. - uses hardcoded SPI (same for each direction); see comments ---- sysdep/bsd/setkey.h.orig Thu Dec 22 22:53:39 2016 -+++ sysdep/bsd/setkey.h Fri Mar 3 00:03:24 2017 +Index: sysdep/bsd/setkey.h +--- sysdep/bsd/setkey.h.orig ++++ sysdep/bsd/setkey.h @@ -8,12 +8,24 @@ #include <sys/types.h> #include <sys/socket.h> #include <net/pfkeyv2.h> -+ +#ifdef __OpenBSD__ +#include <netinet/ip_ipsp.h> +#else @@ -18,16 +18,17 @@ $OpenBSD: patch-sysdep_bsd_setkey_h,v 1. +#endif #include "nest/bird.h" - #include "lib/unix.h" + #include "sysdep/unix/unix.h" +#ifndef PFKEY_ALIGN8 -+#define PFKEY_ALIGN8(a) (1 + (((a) - 1) | (8 - 1))) ++#define PFKEY_ALIGN8(a) (1 + (((a) - 1) | (8 - 1))) +#endif +#ifndef PFKEY_UNIT64 -+#define PFKEY_UNIT64(a) ((a) >> 3) ++#define PFKEY_UNIT64(a) ((a) >> 3) +#endif + ++ /* * Open a socket for manage the IPsec SA/SP database entries */ @@ -39,7 +40,7 @@ $OpenBSD: patch-sysdep_bsd_setkey_h,v 1. msg->sadb_msg_type = SADB_DELETE; send(s, msg, len, 0); msg->sadb_msg_type = SADB_ADD; -@@ -71,7 +84,9 @@ setkey_md5(sockaddr *src, sockaddr *dst, char *passwd, +@@ -71,7 +84,9 @@ setkey_md5(sockaddr *src, sockaddr *dst, uint pxlen, c sizeof(struct sadb_msg) + sizeof(struct sadb_key) + PFKEY_ALIGN8(passwd_len) + sizeof(struct sadb_sa) + @@ -49,7 +50,7 @@ $OpenBSD: patch-sysdep_bsd_setkey_h,v 1. sizeof(struct sadb_address) + PFKEY_ALIGN8(src->sa.sa_len) + sizeof(struct sadb_address) + PFKEY_ALIGN8(dst->sa.sa_len); -@@ -90,6 +105,9 @@ setkey_md5(sockaddr *src, sockaddr *dst, char *passwd, +@@ -90,6 +105,9 @@ setkey_md5(sockaddr *src, sockaddr *dst, uint pxlen, c msg->sadb_msg_pid = getpid(); pos += len; @@ -59,7 +60,7 @@ $OpenBSD: patch-sysdep_bsd_setkey_h,v 1. /* Set authentication algorithm and password */ struct sadb_key *key = (void *) pos; len = sizeof(struct sadb_key) + PFKEY_ALIGN8(passwd_len); -@@ -98,31 +116,50 @@ setkey_md5(sockaddr *src, sockaddr *dst, char *passwd, +@@ -98,31 +116,43 @@ setkey_md5(sockaddr *src, sockaddr *dst, uint pxlen, c key->sadb_key_bits = passwd_len * 8; memcpy(pos + sizeof(struct sadb_key), passwd, passwd_len); pos += len; @@ -71,22 +72,16 @@ $OpenBSD: patch-sysdep_bsd_setkey_h,v 1. len = sizeof(struct sadb_sa); sa->sadb_sa_len = PFKEY_UNIT64(len); sa->sadb_sa_exttype = SADB_EXT_SA; +- sa->sadb_sa_spi = htonl((u32) TCP_SIG_SPI); +#ifdef __OpenBSD__ + sa->sadb_sa_auth = SADB_AALG_MD5HMAC; + sa->sadb_sa_state = SADB_SASTATE_MATURE; -+ -+ /* -+ * XXX Before adding the SA we should use SADB_GETSPI to reserve/fetch -+ * an SPI (call it with src/dest addresses). This spi should be stored -+ * and used for SADB_ADD/UPDATE and stored to use for later SADB_DELETE. -+ */ - sa->sadb_sa_spi = htonl((u32) TCP_SIG_SPI); +#else sa->sadb_sa_auth = SADB_X_AALG_TCP_MD5; - sa->sadb_sa_encrypt = SADB_EALG_NONE; sa->sadb_sa_flags = SADB_X_EXT_CYCSEQ; -+ sa->sadb_sa_spi = htonl((u32) TCP_SIG_SPI); +#endif ++ sa->sadb_sa_spi = htonl((u32) TCP_SIG_SPI); + sa->sadb_sa_encrypt = SADB_EALG_NONE; pos += len; @@ -106,38 +101,38 @@ $OpenBSD: patch-sysdep_bsd_setkey_h,v 1. saddr->sadb_address_exttype = SADB_EXT_ADDRESS_SRC; +#ifndef __OpenBSD__ saddr->sadb_address_proto = IPSEC_ULPROTO_ANY; - saddr->sadb_address_prefixlen = MAX_PREFIX_LENGTH; + saddr->sadb_address_prefixlen = pxlen; +#endif memcpy(pos + sizeof(struct sadb_address), &src->sa, src->sa.sa_len); pos += len; -@@ -131,8 +168,10 @@ setkey_md5(sockaddr *src, sockaddr *dst, char *passwd, +@@ -131,8 +161,10 @@ setkey_md5(sockaddr *src, sockaddr *dst, uint pxlen, c len = sizeof(struct sadb_address) + PFKEY_ALIGN8(dst->sa.sa_len); daddr->sadb_address_len = PFKEY_UNIT64(len); daddr->sadb_address_exttype = SADB_EXT_ADDRESS_DST; +#ifndef __OpenBSD__ daddr->sadb_address_proto = IPSEC_ULPROTO_ANY; - daddr->sadb_address_prefixlen = MAX_PREFIX_LENGTH; + daddr->sadb_address_prefixlen = pxlen; +#endif memcpy(pos + sizeof(struct sadb_address), &dst->sa, dst->sa.sa_len); pos += len; -@@ -160,11 +199,19 @@ sk_set_md5_in_sasp_db(sock *s, ip_addr local, ip_addr +@@ -162,11 +194,19 @@ sk_set_md5_in_sasp_db(sock *s, ip_addr local, ip_addr - if (setkey_md5(&src, &dst, passwd, SADB_ADD) < 0) + if (setkey_md5(&src, &dst, pxlen, passwd, SADB_ADD) < 0) ERR_MSG("Cannot add TCP-MD5 password into the IPsec SA/SP database"); -+#ifdef __OpenBSD__ -+ if (setkey_md5(&dst, &src, passwd, SADB_ADD) < 0) -+ ERR_MSG("Cannot add TCP-MD5 password into the IPsec SA/SP database #2"); ++#ifdef __OpenBSD__ /* needs both directions */ ++ if (setkey_md5(&dst, &src, pxlen, passwd, SADB_ADD) < 0) ++ ERR_MSG("Cannot add TCP-MD5 password into the IPsec SA/SP database"); +#endif } else { - if (setkey_md5(&src, &dst, NULL, SADB_DELETE) < 0) + if (setkey_md5(&src, &dst, pxlen, NULL, SADB_DELETE) < 0) ERR_MSG("Cannot delete TCP-MD5 password from the IPsec SA/SP database"); +#ifdef __OpenBSD__ -+ if (setkey_md5(&dst, &src, NULL, SADB_DELETE) < 0) -+ ERR_MSG("Cannot delete TCP-MD5 password from the IPsec SA/SP database #2"); ++ if (setkey_md5(&dst, &src, pxlen, NULL, SADB_DELETE) < 0) ++ ERR_MSG("Cannot delete TCP-MD5 password from the IPsec SA/SP database"); +#endif } return 0; Index: patches/patch-sysdep_bsd_sysio_h =================================================================== RCS file: /cvs/ports/net/bird/patches/patch-sysdep_bsd_sysio_h,v retrieving revision 1.2 diff -u -p -r1.2 patch-sysdep_bsd_sysio_h --- patches/patch-sysdep_bsd_sysio_h 18 Apr 2017 09:31:59 -0000 1.2 +++ patches/patch-sysdep_bsd_sysio_h 17 Jan 2018 00:48:20 -0000 @@ -1,12 +1,13 @@ $OpenBSD: patch-sysdep_bsd_sysio_h,v 1.2 2017/04/18 09:31:59 sthen Exp $ ---- sysdep/bsd/sysio.h.orig Thu Dec 22 22:53:39 2016 -+++ sysdep/bsd/sysio.h Thu Mar 2 23:47:06 2017 -@@ -198,7 +198,7 @@ sk_prepare_ip_header(sock *s, void *hdr, int dlen) +Index: sysdep/bsd/sysio.h +--- sysdep/bsd/sysio.h.orig ++++ sysdep/bsd/sysio.h +@@ -199,7 +199,7 @@ sk_prepare_ip_header(sock *s, void *hdr, int dlen) #define TCP_SIG_SPI 0x1000 #endif -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__OpenBSD__) #define USE_MD5SIG_SETKEY - #include "lib/setkey.h" + #include "sysdep/bsd/setkey.h" #endif Index: patches/patch-sysdep_unix_io_c =================================================================== RCS file: /cvs/ports/net/bird/patches/patch-sysdep_unix_io_c,v retrieving revision 1.6 diff -u -p -r1.6 patch-sysdep_unix_io_c --- patches/patch-sysdep_unix_io_c 23 Dec 2016 14:38:36 -0000 1.6 +++ patches/patch-sysdep_unix_io_c 17 Jan 2018 00:48:20 -0000 @@ -1,20 +1,12 @@ $OpenBSD: patch-sysdep_unix_io_c,v 1.6 2016/12/23 14:38:36 sthen Exp $ ---- sysdep/unix/io.c.orig Thu Dec 22 22:53:39 2016 -+++ sysdep/unix/io.c Fri Dec 23 14:36:35 2016 -@@ -264,7 +264,7 @@ tm_start(timer *t, unsigned after) - bird_clock_t when; - - if (t->randomize) -- after += random() % (t->randomize + 1); -+ after += arc4random_uniform(t->randomize + 1); - when = now + after; - if (t->expires == when) - return; -@@ -2061,7 +2061,6 @@ io_init(void) - init_times(); - update_times(); - boot_time = now; -- srandom((int) now_real); +Index: sysdep/unix/io.c +--- sysdep/unix/io.c.orig ++++ sysdep/unix/io.c +@@ -2143,7 +2143,6 @@ io_init(void) + // XXX init_times(); + // XXX update_times(); + boot_time = current_time(); +- srandom((uint) (current_real_time() TO_S)); } static int short_loops = 0; Index: patches/patch-tools_Makefile_in =================================================================== RCS file: patches/patch-tools_Makefile_in diff -N patches/patch-tools_Makefile_in --- patches/patch-tools_Makefile_in 6 May 2016 19:56:20 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,23 +0,0 @@ -$OpenBSD: patch-tools_Makefile_in,v 1.1 2016/05/06 19:56:20 sthen Exp $ ---- tools/Makefile.in.orig Fri Apr 29 10:13:23 2016 -+++ tools/Makefile.in Sun May 1 14:20:56 2016 -@@ -37,16 +37,13 @@ subdir: sysdep/paths.h .dir-stamp .dep-stamp - set -e ; for a in $(static-dirs) $(client-dirs) ; do $(MAKE) -C $$a -f $(srcdir_abs)/$$a/Makefile $@ ; done - - $(exedir)/bird: $(bird-dep) -- @echo LD $(LDFLAGS) -o $@ $^ $(LIBS) -- @$(CC) $(LDFLAGS) -o $@ $^ $(LIBS) -+ $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) - - $(exedir)/birdc: $(birdc-dep) -- @echo LD $(LDFLAGS) -o $@ $^ $(LIBS) $(CLIENT_LIBS) -- @$(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(CLIENT_LIBS) -+ $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(CLIENT_LIBS) - - $(exedir)/birdcl: $(birdcl-dep) -- @echo LD $(LDFLAGS) -o $@ $^ $(LIBS) -- @$(CC) $(LDFLAGS) -o $@ $^ $(LIBS) -+ $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) - - .dir-stamp: sysdep/paths.h - mkdir -p $(static-dirs) $(client-dirs) $(doc-dirs) Index: patches/patch-tools_Rules_in =================================================================== RCS file: patches/patch-tools_Rules_in diff -N patches/patch-tools_Rules_in --- patches/patch-tools_Rules_in 6 May 2016 19:56:20 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,20 +0,0 @@ -$OpenBSD: patch-tools_Rules_in,v 1.1 2016/05/06 19:56:20 sthen Exp $ ---- tools/Rules.in.orig Fri Apr 29 10:13:23 2016 -+++ tools/Rules.in Sun May 1 14:20:53 2016 -@@ -68,14 +68,12 @@ subdir: all.o - all.o: $(objs) - # $(LD) -r -o $@ $^ - # Changed to $(CC) because $(LD) has problems with crosscompiling -- @echo LD -r -o $@ $^ -- @$(CC) -nostdlib -r -o $@ $^ -+ $(CC) -nostdlib -r -o $@ $^ - - endif - - %.o: $(src-path)%.c -- @echo CC -o $@ -c $< -- @$(CC) $(CFLAGS) -o $@ -c $< -+ $(CC) $(CFLAGS) -o $@ -c $< - - ifndef source-dep - source-dep := $(source) Index: pkg/PLIST-doc =================================================================== RCS file: /cvs/ports/net/bird/pkg/PLIST-doc,v retrieving revision 1.2 diff -u -p -r1.2 PLIST-doc --- pkg/PLIST-doc 23 Dec 2016 14:38:36 -0000 1.2 +++ pkg/PLIST-doc 17 Jan 2018 00:48:20 -0000 @@ -1,20 +1,4 @@ @comment $OpenBSD: PLIST-doc,v 1.2 2016/12/23 14:38:36 sthen Exp $ share/doc/bird/ -share/doc/bird/bird-1.html -share/doc/bird/bird-2.html -share/doc/bird/bird-3.html -share/doc/bird/bird-4.html -share/doc/bird/bird-5.html -share/doc/bird/bird-6.html -share/doc/bird/bird-7.html -share/doc/bird/bird.html -share/doc/bird/prog-1.html -share/doc/bird/prog-2.html -share/doc/bird/prog-3.html -share/doc/bird/prog-4.html -share/doc/bird/prog-5.html -share/doc/bird/prog-6.html -share/doc/bird/prog-7.html -share/doc/bird/prog-8.html -share/doc/bird/prog.html -share/doc/bird/prog.ps +share/doc/bird/bird.pdf +share/doc/bird/prog.pdf Index: pkg/PLIST-main =================================================================== RCS file: /cvs/ports/net/bird/pkg/PLIST-main,v retrieving revision 1.3 diff -u -p -r1.3 PLIST-main --- pkg/PLIST-main 25 Nov 2013 14:58:32 -0000 1.3 +++ pkg/PLIST-main 17 Jan 2018 00:48:20 -0000 @@ -1,7 +1,11 @@ @comment $OpenBSD: PLIST-main,v 1.3 2013/11/25 14:58:32 sthen Exp $ -@bin sbin/bird${SIX} -@bin sbin/birdc${SIX} -@bin sbin/birdcl${SIX} -share/examples/bird/bird${SIX}.conf -@sample ${SYSCONFDIR}/bird${SIX}.conf -@rcscript ${RCDIR}/bird${SIX} +@pkgpath net/bird,-main,v6 +@conflict bird-v6-* +@bin sbin/bird +@bin sbin/birdc +@bin sbin/birdcl +share/examples/bird/ +share/examples/bird/bird.conf +@sample ${SYSCONFDIR}/bird.conf +share/examples/bird/bird.conf.example2 +@rcscript ${RCDIR}/bird Index: pkg/bird6.rc =================================================================== RCS file: pkg/bird6.rc diff -N pkg/bird6.rc --- pkg/bird6.rc 11 Jan 2018 19:27:04 -0000 1.6 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,13 +0,0 @@ -#!/bin/ksh -# -# $OpenBSD: bird6.rc,v 1.6 2018/01/11 19:27:04 rpe Exp $ - -daemon="${TRUEPREFIX}/sbin/bird6" - -. /etc/rc.d/rc.subr - -rc_stop() { - ${TRUEPREFIX}/sbin/birdc6 down -} - -rc_cmd $1