[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#815302: openntpd: FTBFS[kfreebsd]: no arc4random hooks defined

reassign 815302 src:openntpd
found 815302 openntpd/1:5.7p4-2
severity 815302 important
tags 815302 + patch
user debian-bsd@lists.debian.org
usertags 815302 + kfreebsd


(hope it's okay I reassign this bug as a FTBFS, instead of a removal)

Andreas Beckmann wrote:
> openntpd FTBFS on kfreebsd which is no longer a supported platform in
> the current release:
>   CC       libcompat_la-arc4random.lo
> In file included from arc4random.c:65:0:
> arc4random.h:25:2: error: #error "No arc4random hooks defined for this platform."

Upstream recently updated their arc4random.  It does support the FreeBSD
kernel and GNU libc;  we already have a working implementation of that
code packaged in libbsd.  The attached patch fixes this quite simply in

Thank you,
Steven Chamberlain
Subject: add support for GNU/kFreeBSD
From: Steven Chamberlain <steven@pyro.eu.org>
Date: Sun, 21 Feb 2016 02:05:49 +0000

--- a/compat/arc4random.h
+++ b/compat/arc4random.h
@@ -3,7 +3,7 @@
 #include <sys/param.h>
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD_kernel__)
 #include "arc4random_freebsd.h"
 #elif defined(__linux__)
--- a/configure.ac
+++ b/configure.ac
@@ -37,6 +37,11 @@
 		AC_DEFINE(YYSTYPE_IS_DECLARED,[], [Broken bison])
+	kfreebsd*)
+		HOST_OS=freebsd
+		AC_SUBST([PROG_LDADD], ['-lpthread'])
+		;;
 		AC_SUBST([PROG_LDADD], ['-lthr'])
--- a/compat/arc4random_freebsd.h
+++ b/compat/arc4random_freebsd.h
@@ -32,6 +32,11 @@
 #define _ARC4_LOCK()   pthread_mutex_lock(&arc4random_mtx)
 #define _ARC4_UNLOCK() pthread_mutex_unlock(&arc4random_mtx)
+#ifdef __GLIBC__
+extern void *__dso_handle;
+extern int __register_atfork(void (*)(void), void(*)(void), void (*)(void), void *);
+#define _ARC4_ATFORK(f) __register_atfork(NULL, NULL, (f), __dso_handle)
  * Unfortunately, pthread_atfork() is broken on FreeBSD (at least 9 and 10) if
  * a program does not link to -lthr. Callbacks registered with pthread_atfork()
@@ -39,6 +44,7 @@
  * wraparound.
 #define _ARC4_ATFORK(f) pthread_atfork(NULL, NULL, (f))
 static inline void

Attachment: signature.asc
Description: Digital signature

Reply to: