1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
$NetBSD: patch-an,v 1.2 2008/08/31 06:36:48 scottr Exp $
--- lib/guestInfo/guestInfoPosix.c.orig 2008-08-08 02:01:52.000000000 -0500
+++ lib/guestInfo/guestInfoPosix.c
@@ -38,10 +38,11 @@
#endif
#include <unistd.h>
#include <sys/types.h>
+#include <sys/param.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <errno.h>
-#if defined(__FreeBSD__) || defined(__APPLE__)
+#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__NetBSD__)
# include <sys/sysctl.h>
#endif
#ifndef NO_DNET
@@ -229,6 +230,7 @@ ReadInterfaceDetails(const struct intf_e
if (ip) {
GuestInfoAddSubnetMask(ip, entry->intf_addr.addr_bits);
}
+#if !defined(__NetBSD__) /* libdnet addr_ntoa() breaks with IPv6 on NetBSD */
} else if (entry->intf_alias_addrs[i].addr_type == ADDR_TYPE_IP6) {
memcpy(ipAddress,
addr_ntoa(&entry->intf_alias_addrs[i]),
@@ -236,6 +238,7 @@ ReadInterfaceDetails(const struct intf_e
GuestInfoAddIpAddress(nic,
ipAddress,
INFO_IP_ADDRESS_FAMILY_IPV6);
+#endif /* defined(__NetBSD__) */
}
}
}
@@ -697,6 +700,20 @@ GuestInfoGetOSName(unsigned int outBufFu
if (releaseLen != 0) {
Str_Strncat(osName, outBufLen, buf.release, releaseLen);
}
+ } else if (strstr(osNameFull, "NetBSD")) {
+ size_t nameLen = sizeof STR_OS_NETBSD - 1;
+ size_t releaseLen = 0;
+
+ /* NetBSD, as usual, just DTRT */
+ releaseLen = strlen(buf.release);
+
+ if (nameLen + releaseLen + 1 > outBufLen) {
+ Debug("GuestInfoGetOSName: Error: buffer too small\n");
+ return FALSE;
+ }
+
+ Str_Strcpy(osName, STR_OS_NETBSD, outBufLen);
+ Str_Strncat(osName, outBufLen, buf.release, releaseLen);
} else if (strstr(osNameFull, "SunOS")) {
size_t nameLen = sizeof STR_OS_SOLARIS - 1;
size_t releaseLen = 0;
@@ -766,7 +783,7 @@ int
GuestInfo_GetSystemBitness(void)
{
char buf[MAX_ARCH_NAME_LEN] = { 0 };
-#if defined(__FreeBSD__) || defined(__APPLE__)
+#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__NetBSD__)
int mib[2];
size_t len;
|