Bug#810982: net-snmp: FTBFS on kfreebsd10
Package: net-snmp
Version: 5.7.3+dfsg-1
Severity: important
Tags: patch
Hi,
net-snmp FTBFS on kfreebsd10 for a few reasons.
Please could you:
$ quilt pop -a
* Fix a typo in 26_kfreebsd.patch
(replace it with the attached copy)
* Add 27_kfreebsd.patch:
- Add missing dependency of mibII/icmp on kfreebsd
- Add kfreebsd definitions not in GNU libc's icmp6.h
* Remove obsolete Fix-kfreebsd-builds-with-kernel-headers-10.patch
(apply attached rules.diff to debian/rules)
* Re-enable IPv6 on kfreebsd (Closes: #765846)
* Build with the libbsd overlay on kfreebsd, for nlist
$ quilt push -a
and then it should all be fine.
Thank you very much!
-- System Information:
Debian Release: stretch/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: kfreebsd-amd64 (x86_64)
Kernel: kFreeBSD 10.1-0-amd64
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Preliminary support for kfreebsd.
--- a/agent/mibgroup/hardware/cpu/cpu_sysctl.c
+++ b/agent/mibgroup/hardware/cpu/cpu_sysctl.c
@@ -12,7 +12,7 @@
#include <unistd.h>
#include <sys/types.h>
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#include <sys/resource.h>
#if !defined(CPUSTATES)
#include <sys/dkstat.h>
@@ -89,7 +89,7 @@
#elif defined(KERN_CPTIME) /* OpenBSD */
#define NETSNMP_KERN_CPU KERN_CPTIME
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#define NETSNMP_KERN_MCPU 1 /* Enable support for multi-cpu stats. Valid for FreeBSD >=6.4, >=7.1, >=8.0 and beyond */
#define NETSNMP_KERN_MCPU_TYPE NETSNMP_CPU_STATS
@@ -129,7 +129,7 @@
#define NETSNMP_VM_STATS_TYPE struct uvmexp
#endif /* VM_UVMEXP2 || VM_UVMEXP */
-#elif defined(__FreeBSD__) /* FreeBSD */
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) /* FreeBSD */
#define NETSNMP_VM_STATS VM_METER
#define NETSNMP_VM_STATS_TYPE struct vmmeter
#define NS_VM_INTR v_intr
@@ -169,10 +169,10 @@
*/
NETSNMP_CPU_STATS cpu_stats[CPUSTATES];
size_t cpu_size = sizeof(cpu_stats);
-#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+#if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) && !defined(__NetBSD__)
int cpu_mib[] = { CTL_KERN, NETSNMP_KERN_CPU };
#endif
-#ifdef __FreeBSD__
+#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__))
static int cp_times = -1;
#endif
#ifdef KERN_CPTIME2
@@ -189,7 +189,7 @@
size_t mem_size = sizeof(NETSNMP_VM_STATS_TYPE);
netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 0 );
-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
sysctlbyname("kern.cp_time", cpu_stats, &cpu_size, NULL, 0);
#else
sysctl(cpu_mib, 2, cpu_stats, &cpu_size, NULL, 0);
@@ -226,7 +226,7 @@
mcpu_size = cpu_num*sizeof(cpu_stats);
mcpu_stats = malloc(mcpu_size);
sysctlbyname("kern.cp_time", mcpu_stats, &mcpu_size, NULL, 0);
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
if (cp_times == -1) {
int ret = sysctlbyname("kern.cp_times", NULL, &mcpu_size, NULL, 0);
cp_times = ret == -1 ? 0 : 1;
--- debian/rules.orig 2015-04-28 12:58:23.000000000 +0100
+++ debian/rules 2016-01-14 13:54:08.497400988 +0000
@@ -23,8 +23,10 @@
DEB_DH_GENCONTROL_ARGS=-- -Vos-specific-dev="libsensors4-dev"
else
ifeq (kfreebsd,$(DEB_BUILD_ARCH_OS))
-IPV6 = --disable-ipv6
+IPV6 = --enable-ipv6
DEB_DH_GENCONTROL_ARGS=-- -Vos-specific-dev="libkvm-dev"
+CFLAGS += $(shell pkg-config --cflags libbsd-overlay)
+LDFLAGS += $(shell pkg-config --libs libbsd-overlay)
endif
endif
ifeq (hurd,$(DEB_BUILD_ARCH_OS))
--- a/agent/mibgroup/mibII/icmp.h
+++ b/agent/mibgroup/mibII/icmp.h
@@ -14,6 +14,7 @@
config_arch_require(freebsd8, mibII/kernel_sysctl)
config_arch_require(freebsd9, mibII/kernel_sysctl)
config_arch_require(freebsd10, mibII/kernel_sysctl)
+config_arch_require(kfreebsd, mibII/kernel_sysctl)
config_arch_require(netbsd, mibII/kernel_netbsd)
config_arch_require(netbsdelf, mibII/kernel_netbsd)
config_arch_require(openbsd4, mibII/kernel_sysctl)
--- a/agent/mibgroup/mibII/kernel_sysctl.c
+++ b/agent/mibgroup/mibII/kernel_sysctl.c
@@ -14,6 +14,12 @@
#include <netinet/icmp_var.h>
#include <netinet/icmp6.h>
+#ifdef __FreeBSD_kernel__
+/* definitions unavailable in GNU libc's icmp6.h */
+#define ICMP6_MAXTYPE 201
+#define ICMPV6CTL_STATS 1
+#endif
+
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
Reply to: